From 78bd353d05a0f702590f7d2c670f42a473011dea Mon Sep 17 00:00:00 2001 From: kaadmy Date: Wed, 4 Nov 2015 16:20:05 -0800 Subject: [PATCH] fixed ability to open multiple parachutes --- mods/parachute/init.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mods/parachute/init.lua b/mods/parachute/init.lua index 86c9635..9fc53c7 100644 --- a/mods/parachute/init.lua +++ b/mods/parachute/init.lua @@ -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