mirror of
https://github.com/APercy/airutils.git
synced 2025-03-15 08:01:22 +00:00
added adf specific methods
This commit is contained in:
parent
3770d2fb9e
commit
f7065a2766
3 changed files with 25 additions and 2 deletions
|
@ -153,6 +153,7 @@ end
|
|||
function airutils.logic(self)
|
||||
local velocity = self.object:get_velocity()
|
||||
local curr_pos = self.object:get_pos()
|
||||
self._curr_pos = curr_pos --shared
|
||||
|
||||
self._last_time_command = self._last_time_command + self.dtime
|
||||
|
||||
|
|
|
@ -43,6 +43,8 @@ function airutils.pilot_formspec(name)
|
|||
|
||||
if ent._have_copilot and name == ent.driver_name then extra_height = extra_height + 1.1 end
|
||||
|
||||
if ent._have_adf then extra_height = extra_height + 1.1 end
|
||||
|
||||
local yaw = "false"
|
||||
if ent._yaw_by_mouse then yaw = "true" end
|
||||
|
||||
|
@ -68,12 +70,17 @@ function airutils.pilot_formspec(name)
|
|||
basic_form = basic_form.."checkbox[1,"..ver_pos..";light;Landing Light;"..light.."]"
|
||||
ver_pos = ver_pos + 0.5
|
||||
end
|
||||
|
||||
|
||||
basic_form = basic_form.."checkbox[1,"..ver_pos..";yaw;Yaw by mouse;"..yaw.."]"
|
||||
ver_pos = ver_pos + 0.5
|
||||
|
||||
if ent._have_copilot and name == ent.driver_name then
|
||||
basic_form = basic_form.."button[1,"..ver_pos..";4,1;copilot_form;Co-pilot Manage]"
|
||||
basic_form = basic_form.."button[1,"..ver_pos..";4,1;copilot_form;Co-pilot Manager]"
|
||||
ver_pos = ver_pos + 1.1
|
||||
end
|
||||
|
||||
if ent._have_adf then
|
||||
basic_form = basic_form.."button[1,"..ver_pos..";4,1;adf_form;Adf Manager]"
|
||||
ver_pos = ver_pos + 1.1
|
||||
end
|
||||
|
||||
|
@ -334,6 +341,9 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
if fields.copilot_form then
|
||||
airutils.manage_copilot_formspec(name)
|
||||
end
|
||||
if fields.adf_form then
|
||||
airutils.adf_formspec(name)
|
||||
end
|
||||
end
|
||||
minetest.close_formspec(name, "lib_planes:pilot_main")
|
||||
end
|
||||
|
|
|
@ -850,3 +850,15 @@ function airutils.landing_lights_operate(self)
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
function airutils.get_adf_angle(self, pos)
|
||||
local adf = 0
|
||||
if self._adf == true then
|
||||
if airutils.getAngleFromPositions and self._adf_destiny then
|
||||
adf = airutils.getAngleFromPositions(pos, self._adf_destiny)
|
||||
adf = -(adf + math.deg(self._yaw))
|
||||
end
|
||||
end
|
||||
return adf
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue