From e57d36d29943a0bd961638dfda9479b55f7874dd Mon Sep 17 00:00:00 2001 From: Alexsandro Percy Date: Fri, 16 Feb 2024 22:28:15 -0300 Subject: [PATCH] changed attach method and added restriction to the form usage --- entities.lua | 2 +- forms.lua | 24 ++++++++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/entities.lua b/entities.lua index 446322d..8875a19 100755 --- a/entities.lua +++ b/entities.lua @@ -530,7 +530,7 @@ minetest.register_entity("ap_airship:airship", { _inv_id = "", _name_color = 0, _name_hor_aligment = 3.0, - _simple_attach_pos = {x=0,y=-25,z=-40}, + _simple_attach_pos = {x=0,y=-35,z=-70}, item = "ap_airship:airship", diff --git a/forms.lua b/forms.lua index 2e2eaa5..9f81940 100755 --- a/forms.lua +++ b/forms.lua @@ -164,12 +164,24 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) end local ent = plane_obj:get_luaentity() if ent then - if fields.attach then - airutils.simple_external_attach(ent, ent._simple_attach_pos, fields.entity, 22) - end - if fields.dettach then - airutils.dettach_entity(ent) - end + local can_bypass = minetest.check_player_privs(player, {protection_bypass=true}) + local is_shared = false + if name == ent.owner or can_bypass then is_shared = true end + for k, v in pairs(ent._shared_owners) do + if v == name then + is_shared = true + break + end + end + + if is_shared then + if fields.attach then + airutils.simple_external_attach(ent, ent._simple_attach_pos, fields.entity, 22, true) + end + if fields.dettach then + airutils.dettach_entity(ent) + end + end end minetest.close_formspec(name, "ap_airship:logo_main") end