From f317a8943a4b737e06c2e314c6056bf2497afeaa Mon Sep 17 00:00:00 2001 From: Lars Mueller Date: Mon, 18 Nov 2024 15:19:44 +0100 Subject: [PATCH] kick --- game_api.txt | 1 + mods/beds/functions.lua | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/game_api.txt b/game_api.txt index cc50f453..c36cfe4b 100644 --- a/game_api.txt +++ b/game_api.txt @@ -47,6 +47,7 @@ Beds API * `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.kick(player)` Forces `player` 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.day_interval` Is a table with keys "start" and "finish". Allows you diff --git a/mods/beds/functions.lua b/mods/beds/functions.lua index cdae8274..823c3bd5 100644 --- a/mods/beds/functions.lua +++ b/mods/beds/functions.lua @@ -170,20 +170,20 @@ end -- Public functions -function beds.kick_player(player) +function beds.kick(player) lay_down(player, nil, nil, false) end function beds.kick_players() 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 core.register_globalstep(function() for name, bed_pos in pairs(beds.bed_position) do 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)