improved air rescue

This commit is contained in:
Alexsandro Percy 2024-02-17 18:47:24 -03:00
parent a405b75b51
commit 01ae153554
3 changed files with 17 additions and 3 deletions

View File

@ -389,7 +389,7 @@ minetest.register_entity('ap_airship:exit_interactor',{
minetest.register_entity('ap_airship:chair_interactor',{
initial_properties = {
physical = false,
collide_with_objects=false,
collide_with_objects=true,
collisionbox = {-0.3, 0, -0.3, 0.3, 1, 0.3},
pointable=true,
visual = "mesh",
@ -458,7 +458,7 @@ minetest.register_entity('ap_airship:ent_collider',{
minetest.register_entity('ap_airship:stand_base',{
initial_properties = {
physical = true,
collide_with_objects=true,
collide_with_objects=false,
collisionbox = {-2, -2, -2, 2, 0, 2},
pointable=false,
visual = "mesh",

View File

@ -29,11 +29,14 @@ function ap_airship.pilot_formspec(name)
if ent._at_control then take_control = "true" end
local anchor = "false"
if ent.anchored == true then anchor = "true" end
local rescue = "false"
if ent._rescue_plane == true then rescue = "true" end
basic_form = basic_form.."button[1,1.0;4,1;turn_on;Start/Stop engines]"
basic_form = basic_form.."button[1,3.0;4,1;inventory;Open inventory]"
--basic_form = basic_form.."button[1,4.0;4,1;manual;Show Manual Menu]"
basic_form = basic_form.."checkbox[1,4.4;rescue;Rescue external plane;"..rescue.."]"
basic_form = basic_form.."checkbox[1,5.6;take_control;Take the Control;"..take_control.."]"
basic_form = basic_form.."checkbox[1,6.2;anchor;Anchor away;"..anchor.."]"
@ -213,6 +216,17 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
if fields.manual then
ap_airship.manual_formspec(name)
end
if fields.rescue then
if fields.rescue == "true" then
ent._rescue_plane = true
minetest.chat_send_player(name,core.colorize('#00ff00', " >>> Rescue plane in flight is turned on."))
else
ent._rescue_plane = false
minetest.chat_send_player(name,core.colorize('#ff0000', " >>> Rescue plane in flight is turned off."))
end
end
if fields.take_control then
if fields.take_control == "true" then
if ent.driver_name == nil or ent.driver_name == "" then

View File

@ -491,7 +491,7 @@ end
function ap_airship.timed_anchor_entity(self, curr_pos, yaw, time, dtime)
local time = time or 0
if self._vehicle_custom_data.simple_external_attach_entity ~= nil then return end
if not self._timed_anchor_counter then self._timed_anchor_counter = time end
if not self._timed_anchor_counter then self._timed_anchor_counter = 0 end
self._timed_anchor_counter = self._timed_anchor_counter + dtime
if self._timed_anchor_counter < time then return nil, nil end --go out before the right time