fixed ability to open multiple parachutes

This commit is contained in:
kaadmy 2015-11-04 16:20:05 -08:00
parent 85eaa54f5b
commit 78bd353d05

View File

@ -25,6 +25,10 @@ minetest.register_craftitem(
local on = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z})
if default.player_attached[player:get_player_name()] then
return
end
if on.name == "air" then
-- Spawn parachute
pos.y = pos.y + 3
@ -39,6 +43,8 @@ minetest.register_craftitem(
ent = ent:get_luaentity()
ent.attached = player
default.player_attached[player:get_player_name()] = true
itemstack:take_item()
return itemstack
else
@ -100,6 +106,8 @@ minetest.register_entity(
local pos = self.object:getpos()
local under = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z})
if under.name ~= "air" then
default.player_attached[self.attached:get_player_name()] = false
self.object:set_detach()
self.object:remove()
end