From 3b6904d9ad410de214fe69ed21e74be2ea46b34a Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 29 Aug 2019 17:39:51 +0200 Subject: [PATCH] Fix some bed bugs --- mods/bed/init.lua | 18 ++++++++++-------- mods/bed/locale/bed.de.tr | 3 +++ mods/bed/locale/template.txt | 3 +++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/mods/bed/init.lua b/mods/bed/init.lua index 910b6a5..e917958 100644 --- a/mods/bed/init.lua +++ b/mods/bed/init.lua @@ -159,9 +159,11 @@ local function on_joinplayer(player) if bed.userdata[name].in_bed then minetest.after( 0.1, - function() - put_player_in_bed(player) - end) + function(player) + if player and player:is_player() then + put_player_in_bed(player) + end + end, player) end end @@ -222,12 +224,12 @@ local function on_globalstep(dtime) minetest.chat_send_all( minetest.colorize( "#0ff", - "*** " .. sleeping_players .. " of " .. player_count - .. " players slept, rise and shine!")) + "*** " .. S("Players have slept, rise and shine!"))) minetest.set_timeofday(0.23) delay_daytime = false + local players = minetest.get_connected_players() for _, player in ipairs(players) do if bed.userdata[player:get_player_name()].in_bed then bed.userdata[player:get_player_name()].slept = true @@ -241,7 +243,7 @@ local function on_globalstep(dtime) end end -minetest.after(0, on_load) +minetest.register_on_mods_loaded(on_load) minetest.register_on_shutdown(on_shutdown) @@ -382,8 +384,8 @@ crafting.register_craft( player_effects.register_effect( "inbed", { - title = "In bed", - description = "If you're in a bed", + title = S("In bed"), + description = S("You're in a bed"), duration = -1, physics = { speed = 0, diff --git a/mods/bed/locale/bed.de.tr b/mods/bed/locale/bed.de.tr index cefeea2..6ee33a8 100644 --- a/mods/bed/locale/bed.de.tr +++ b/mods/bed/locale/bed.de.tr @@ -2,3 +2,6 @@ Bed=Bett Bed Time=Schlafenszeit Craft a bed=Fertigen Sie ein Bett +Players have slept, rise and shine!=Spieler haben geschlafen, Raus aus den Federn! +In bed=Im Bett +You're in a bed=Sie sind in einem Bett diff --git a/mods/bed/locale/template.txt b/mods/bed/locale/template.txt index ac7d17b..d5e0a8a 100644 --- a/mods/bed/locale/template.txt +++ b/mods/bed/locale/template.txt @@ -2,3 +2,6 @@ Bed= Bed Time= Craft a bed= +Players have slept, rise and shine!= +In bed= +You're in a bed=