beds: allow setting spawn point during daytime#3235
beds: allow setting spawn point during daytime#3235GP-commits wants to merge 4 commits intoluanti-org:masterfrom
Conversation
|
Hi, the workflows are awaiting approval. Could you please approve them so checks can run? |
|
Seems like if i will spam clicking on bed at the day, it will write in the chat: I think you should add check for already set spawnpoint. |
|
Good catch, thanks! I’ll add a check to prevent repeated spawn setting. |
mods/beds/functions.lua
Outdated
|
|
||
| minetest.chat_send_player(name, S("You can only sleep at night.")) | ||
| return | ||
| end |
There was a problem hiding this comment.
Please indent the entire new code block so that it makes sense again.
mods/beds/functions.lua
Outdated
| if not current_spawn or vector.distance(current_spawn, pos) > 0.1 then | ||
| beds.set_spawns(player, pos) | ||
| minetest.chat_send_player(name, S("Spawn point set.")) | ||
| end |
There was a problem hiding this comment.
How about else instead? Have the first click set the spawn point and the 2nd to notify the player that it's yet not time to sleep.
FYI, running the checks locally is straight-forward. Install |
| end | ||
| end | ||
| beds.save_spawns() | ||
| function beds.set_spawns(player, bed_pos) |
There was a problem hiding this comment.
is this a documented API function? if so, won't this break compatibility?
There was a problem hiding this comment.
Same thought here. It's not documented, thus no compat break.
Lines 41 to 57 in 95991f8
Summary
Allow players to set their spawn point by right-clicking a bed during daytime.
Changes
Motivation
Improves convenience without affecting existing mechanics.
Closes #3151