mirror of
https://github.com/APercy/airutils.git
synced 2025-03-21 18:41:21 +00:00
added plane ejection
This commit is contained in:
parent
c33b0c2a4b
commit
df4da519b3
2 changed files with 33 additions and 0 deletions
32
init.lua
32
init.lua
|
@ -508,3 +508,35 @@ minetest.register_chatcommand("transfer_ownership", {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_chatcommand("eject_from_plane", {
|
||||||
|
params = "",
|
||||||
|
description = "Ejects from a plane",
|
||||||
|
privs = {interact = true},
|
||||||
|
func = function(name, param)
|
||||||
|
local colorstring = core.colorize('#ff0000', " >>> you are not inside a plane")
|
||||||
|
local player = minetest.get_player_by_name(name)
|
||||||
|
local attached_to = player:get_attach()
|
||||||
|
|
||||||
|
if attached_to ~= nil then
|
||||||
|
local seat = attached_to:get_attach()
|
||||||
|
if seat ~= nil then
|
||||||
|
local entity = seat:get_luaentity()
|
||||||
|
if entity then
|
||||||
|
if entity.on_step == airutils.on_step then
|
||||||
|
if entity.driver_name == name then
|
||||||
|
airutils.dettachPlayer(entity, player)
|
||||||
|
elseif entity._passenger == name then
|
||||||
|
local passenger = minetest.get_player_by_name(entity._passenger)
|
||||||
|
airutils.dettach_pax(entity, passenger)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(name,colorstring)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(name,colorstring)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
|
@ -24,3 +24,4 @@ local function fetch_setting(name)
|
||||||
return settings and settings:get(sname) or minetest.settings:get(sname)
|
return settings and settings:get(sname) or minetest.settings:get(sname)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue