Small fix, push to 1.1.1
parent
eba15ca982
commit
f841bad383
|
@ -12,3 +12,7 @@
|
||||||
- Allow players always to detach from bed (by donat-b)
|
- Allow players always to detach from bed (by donat-b)
|
||||||
- If more than 50% of players want sleep they can skip the night
|
- If more than 50% of players want sleep they can skip the night
|
||||||
- Don't show sleep dialog in singleplayer
|
- Don't show sleep dialog in singleplayer
|
||||||
|
|
||||||
|
1.1.1
|
||||||
|
-----
|
||||||
|
- Prevent possbile crash by trying to reposition leaving players
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
Minetest mod "Beds"
|
Minetest mod "Beds"
|
||||||
===================
|
===================
|
||||||
by BlockMen (c) 2014
|
by BlockMen (c) 2014-2015
|
||||||
|
|
||||||
Version: 1.1
|
Version: 1.1.1
|
||||||
|
|
||||||
About
|
About
|
||||||
~~~~~
|
~~~~~
|
||||||
|
@ -34,7 +34,7 @@ Notice: You can use any color of wood or wool, mixing different is also possible
|
||||||
|
|
||||||
License of source code, textures: WTFPL
|
License of source code, textures: WTFPL
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
(c) Copyright BlockMen (2014)
|
(c) Copyright BlockMen (2014-2015)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
8
init.lua
8
init.lua
|
@ -42,7 +42,7 @@ local function check_in_beds(players)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
local function lay_down(player, pos, bed_pos, state)
|
local function lay_down(player, pos, bed_pos, state, skip)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local hud_flags = player:hud_get_flags()
|
local hud_flags = player:hud_get_flags()
|
||||||
|
|
||||||
|
@ -57,6 +57,10 @@ local function lay_down(player, pos, bed_pos, state)
|
||||||
beds.player[name] = nil
|
beds.player[name] = nil
|
||||||
player_in_bed = player_in_bed - 1
|
player_in_bed = player_in_bed - 1
|
||||||
end
|
end
|
||||||
|
-- skip here to prevent sending player specific changes (used for leaving players)
|
||||||
|
if skip then
|
||||||
|
return
|
||||||
|
end
|
||||||
if p then
|
if p then
|
||||||
player:setpos(p)
|
player:setpos(p)
|
||||||
end
|
end
|
||||||
|
@ -182,7 +186,7 @@ end)
|
||||||
|
|
||||||
minetest.register_on_leaveplayer(function(player)
|
minetest.register_on_leaveplayer(function(player)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
lay_down(player, nil, nil, false)
|
lay_down(player, nil, nil, false, true)
|
||||||
beds.player[name] = nil
|
beds.player[name] = nil
|
||||||
if check_in_beds() then
|
if check_in_beds() then
|
||||||
minetest.after(2, function()
|
minetest.after(2, function()
|
||||||
|
|
|
@ -63,4 +63,4 @@ function beds.set_spawns()
|
||||||
beds.spawn[name] = p
|
beds.spawn[name] = p
|
||||||
end
|
end
|
||||||
beds.save_spawns()
|
beds.save_spawns()
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue