mirror of
https://github.com/APercy/ap_airship.git
synced 2025-03-15 07:51:20 +00: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
|
@ -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",
|
||||
|
||||
|
|
14
forms.lua
14
forms.lua
|
@ -164,13 +164,25 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
end
|
||||
local ent = plane_obj:get_luaentity()
|
||||
if ent then
|
||||
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)
|
||||
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
|
||||
if formname == "ap_airship:pilot_main" then
|
||||
|
|
Loading…
Add table
Reference in a new issue