changed attach method and added restriction to the form usage

This commit is contained in:
Alexsandro Percy 2024-02-16 22:28:15 -03:00
parent 088c82d784
commit e57d36d299
2 changed files with 19 additions and 7 deletions

View File

@ -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",

View File

@ -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