mirror of
https://github.com/APercy/ap_airship.git
synced 2025-07-20 22:33:52 -04:00
changed attach method and added restriction to the form usage
This commit is contained in:
parent
088c82d784
commit
e57d36d299
2 changed files with 19 additions and 7 deletions
24
forms.lua
24
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue