v0.14 Crane handing over bugfix

This commit is contained in:
Joachim Stolberg 2017-11-01 16:35:25 +01:00
parent 14591aba9c
commit 1ac183fbdf

@ -3,7 +3,7 @@
Tower Crane Mod Tower Crane Mod
=============== ===============
v0.13 by JoSt v0.14 by JoSt
Copyright (C) 2017 Joachim Stolberg Copyright (C) 2017 Joachim Stolberg
LGPLv2.1+ LGPLv2.1+
@ -23,6 +23,7 @@
2017-09-09 v0.11 further player bugfixes 2017-09-09 v0.11 further player bugfixes
2017-09-24 v0.12 Switched from entity hook model to real fly privs 2017-09-24 v0.12 Switched from entity hook model to real fly privs
2017-10-17 v0.13 Area protection bugfix 2017-10-17 v0.13 Area protection bugfix
2017-11-01 v0.14 Crane handing over bugfix
]]-- ]]--
@ -112,6 +113,7 @@ local function fly_privs(player, enable)
player:set_attribute("store_fast", minetest.serialize(privs["fast"])) player:set_attribute("store_fast", minetest.serialize(privs["fast"]))
player:set_attribute("store_fly", minetest.serialize(privs["fly"])) player:set_attribute("store_fly", minetest.serialize(privs["fly"]))
player:set_attribute("store_speed", minetest.serialize(physics.speed)) player:set_attribute("store_speed", minetest.serialize(physics.speed))
player:set_attribute("crane_active", "true")
privs["fly"] = true privs["fly"] = true
privs["fast"] = nil privs["fast"] = nil
physics.speed = 0.7 physics.speed = 0.7
@ -119,6 +121,7 @@ local function fly_privs(player, enable)
privs["fast"] = minetest.deserialize(player:get_attribute("store_fast")) privs["fast"] = minetest.deserialize(player:get_attribute("store_fast"))
privs["fly"] = minetest.deserialize(player:get_attribute("store_fly")) privs["fly"] = minetest.deserialize(player:get_attribute("store_fly"))
physics.speed = minetest.deserialize(player:get_attribute("store_speed")) physics.speed = minetest.deserialize(player:get_attribute("store_speed"))
player:set_attribute("crane_active", nil)
end end
player:set_physics_override(physics) player:set_physics_override(physics)
minetest.set_player_privs(player:get_player_name(), privs) minetest.set_player_privs(player:get_player_name(), privs)
@ -600,6 +603,10 @@ minetest.register_node("towercrane:mast_ctrl_off", {
if clicker:get_player_name() ~= meta:get_string("owner") then if clicker:get_player_name() ~= meta:get_string("owner") then
return return
end end
-- prevent handing over to the next crane
if clicker:get_attribute("crane_active") ~= nil then
return
end
-- swap to the other node -- swap to the other node
node.name = "towercrane:mast_ctrl_on" node.name = "towercrane:mast_ctrl_on"
minetest.swap_node(pos, node) minetest.swap_node(pos, node)