1
0
mirror of https://github.com/minetest/minetest_game.git synced 2025-01-05 04:50:18 +01:00
This commit is contained in:
Lars Mueller 2024-11-18 15:19:44 +01:00
parent 49d874a4a1
commit f317a8943a
2 changed files with 4 additions and 3 deletions

View File

@ -47,6 +47,7 @@ Beds API
* `beds.can_dig(bed_pos)` Returns a boolean whether the bed at `bed_pos` may be dug * `beds.can_dig(bed_pos)` Returns a boolean whether the bed at `bed_pos` may be dug
* `beds.read_spawns() ` Returns a table containing players respawn positions * `beds.read_spawns() ` Returns a table containing players respawn positions
* `beds.kick(player)` Forces `player` to leave bed
* `beds.kick_players()` Forces all players to leave bed * `beds.kick_players()` Forces all players to leave bed
* `beds.skip_night()` Sets world time to morning and saves respawn position of all players currently sleeping * `beds.skip_night()` Sets world time to morning and saves respawn position of all players currently sleeping
* `beds.day_interval` Is a table with keys "start" and "finish". Allows you * `beds.day_interval` Is a table with keys "start" and "finish". Allows you

View File

@ -170,20 +170,20 @@ end
-- Public functions -- Public functions
function beds.kick_player(player) function beds.kick(player)
lay_down(player, nil, nil, false) lay_down(player, nil, nil, false)
end end
function beds.kick_players() function beds.kick_players()
for name in pairs(beds.player) do for name in pairs(beds.player) do
beds.kick_players(core.get_player_by_name(name)) beds.kick(core.get_player_by_name(name))
end end
end end
core.register_globalstep(function() core.register_globalstep(function()
for name, bed_pos in pairs(beds.bed_position) do for name, bed_pos in pairs(beds.bed_position) do
if not beds.is_bed_node[core.get_node(bed_pos).name] then if not beds.is_bed_node[core.get_node(bed_pos).name] then
beds.kick_player(core.get_player_by_name(name)) beds.kick(core.get_player_by_name(name))
end end
end end
end) end)