hud and formspec added
parent
ff4e662b94
commit
5cd9eb4f55
2
init.lua
2
init.lua
|
@ -28,6 +28,8 @@ dofile(minetest.get_modpath("trike") .. DIR_DELIM .. "trike_fuel_management.lua"
|
|||
dofile(minetest.get_modpath("trike") .. DIR_DELIM .. "trike_custom_physics.lua")
|
||||
dofile(minetest.get_modpath("trike") .. DIR_DELIM .. "trike_utilities.lua")
|
||||
dofile(minetest.get_modpath("trike") .. DIR_DELIM .. "trike_entities.lua")
|
||||
dofile(minetest.get_modpath("trike") .. DIR_DELIM .. "trike_hud.lua")
|
||||
dofile(minetest.get_modpath("trike") .. DIR_DELIM .. "trike_forms.lua")
|
||||
|
||||
--
|
||||
-- helpers and co.
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 35 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
|
@ -163,6 +163,7 @@ minetest.register_entity("trike:trike", {
|
|||
_longit_speed = 0,
|
||||
_lastrot = {x=0,y=0,z=0},
|
||||
_last_accell = {x=0,y=0,z=0},
|
||||
_show_hud = false,
|
||||
lastvelocity = nil,
|
||||
|
||||
get_staticdata = function(self) -- unloaded/unloads ... is now saved
|
||||
|
@ -380,15 +381,7 @@ minetest.register_entity("trike:trike", {
|
|||
end
|
||||
if can_access then
|
||||
if name == self.driver_name then
|
||||
-- eject passenger if the plane is on ground
|
||||
local touching_ground, liquid_below = trike.check_node_below(self.object)
|
||||
if self.isinliquid or touching_ground or liquid_below then --isn't flying?
|
||||
if self._passenger then
|
||||
local passenger = minetest.get_player_by_name(self._passenger)
|
||||
if passenger then trike.dettach_pax(self, passenger) end
|
||||
end
|
||||
end
|
||||
trike.dettachPlayer(self, clicker)
|
||||
trike.pilot_formspec(name)
|
||||
elseif not self.driver_name then
|
||||
local is_under_water = trike.check_is_under_water(self.object)
|
||||
if is_under_water then return end
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
dofile(minetest.get_modpath("trike") .. DIR_DELIM .. "trike_global_definitions.lua")
|
||||
|
||||
--------------
|
||||
-- Manual --
|
||||
--------------
|
||||
|
||||
function trike.getPlaneFromPlayer(player)
|
||||
local seat = player:get_attach()
|
||||
local plane = seat:get_attach()
|
||||
return plane
|
||||
end
|
||||
|
||||
function trike.pilot_formspec(name)
|
||||
local basic_form = table.concat({
|
||||
"formspec_version[3]",
|
||||
"size[6,4.5]",
|
||||
}, "")
|
||||
|
||||
basic_form = basic_form.."button[1,1.0;4,1;go_out;Go Offboard]"
|
||||
basic_form = basic_form.."button[1,2.5;4,1;hud;Show/Hide Gauges]"
|
||||
|
||||
minetest.show_formspec(name, "trike:pilot_main", basic_form)
|
||||
end
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname == "trike:pilot_main" then
|
||||
local name = player:get_player_name()
|
||||
local plane_obj = trike.getPlaneFromPlayer(player)
|
||||
local ent = plane_obj:get_luaentity()
|
||||
if fields.hud then
|
||||
if ent._show_hud == true then
|
||||
ent._show_hud = false
|
||||
else
|
||||
ent._show_hud = true
|
||||
end
|
||||
end
|
||||
if fields.go_out then
|
||||
-- eject passenger if the plane is on ground
|
||||
local touching_ground, liquid_below = trike.check_node_below(plane_obj)
|
||||
if ent.isinliquid or touching_ground or liquid_below then --isn't flying?
|
||||
if ent._passenger then
|
||||
local passenger = minetest.get_player_by_name(ent._passenger)
|
||||
if passenger then trike.dettach_pax(ent, passenger) end
|
||||
end
|
||||
end
|
||||
trike.dettachPlayer(ent, player)
|
||||
end
|
||||
minetest.close_formspec(name, "trike:pilot_main")
|
||||
end
|
||||
end)
|
|
@ -40,11 +40,6 @@ function trike.consumptionCalc(self, accel)
|
|||
local consumed_power = self._power_lever/700000
|
||||
--minetest.chat_send_all('consumed: '.. consumed_power)
|
||||
self._energy = self._energy - consumed_power;
|
||||
|
||||
local energy_indicator_angle = trike.get_gauge_angle(self._energy)
|
||||
if self.fuel_gauge:get_luaentity() then
|
||||
self.fuel_gauge:set_attach(self.object,'',TRIKE_GAUGE_FUEL_POSITION,{x=0,y=0,z=energy_indicator_angle})
|
||||
end
|
||||
end
|
||||
if self._energy <= 0 and self._engine_running and accel ~= nil then
|
||||
self._engine_running = false
|
||||
|
|
|
@ -0,0 +1,354 @@
|
|||
trike.hud_list = {}
|
||||
|
||||
function trike.animate_gauge(player, ids, prefix, x, y, angle)
|
||||
local angle_in_rad = math.rad(angle + 180)
|
||||
local dim = 10
|
||||
local pos_x = math.sin(angle_in_rad) * dim
|
||||
local pos_y = math.cos(angle_in_rad) * dim
|
||||
player:hud_change(ids[prefix .. "2"], "offset", {x = pos_x + x, y = pos_y + y})
|
||||
dim = 20
|
||||
pos_x = math.sin(angle_in_rad) * dim
|
||||
pos_y = math.cos(angle_in_rad) * dim
|
||||
player:hud_change(ids[prefix .. "3"], "offset", {x = pos_x + x, y = pos_y + y})
|
||||
dim = 30
|
||||
pos_x = math.sin(angle_in_rad) * dim
|
||||
pos_y = math.cos(angle_in_rad) * dim
|
||||
player:hud_change(ids[prefix .. "4"], "offset", {x = pos_x + x, y = pos_y + y})
|
||||
dim = 40
|
||||
pos_x = math.sin(angle_in_rad) * dim
|
||||
pos_y = math.cos(angle_in_rad) * dim
|
||||
player:hud_change(ids[prefix .. "5"], "offset", {x = pos_x + x, y = pos_y + y})
|
||||
dim = 50
|
||||
pos_x = math.sin(angle_in_rad) * dim
|
||||
pos_y = math.cos(angle_in_rad) * dim
|
||||
player:hud_change(ids[prefix .. "6"], "offset", {x = pos_x + x, y = pos_y + y})
|
||||
dim = 60
|
||||
pos_x = math.sin(angle_in_rad) * dim
|
||||
pos_y = math.cos(angle_in_rad) * dim
|
||||
player:hud_change(ids[prefix .. "7"], "offset", {x = pos_x + x, y = pos_y + y})
|
||||
end
|
||||
|
||||
function trike.update_hud(player, climb, speed, power, fuel)
|
||||
local player_name = player:get_player_name()
|
||||
|
||||
local screen_pos_y = -150
|
||||
local screen_pos_x = 10
|
||||
|
||||
local clb_gauge_x = screen_pos_x + 75
|
||||
local clb_gauge_y = screen_pos_y + 1
|
||||
local sp_gauge_x = screen_pos_x + 170
|
||||
local sp_gauge_y = clb_gauge_y
|
||||
|
||||
local pwr_gauge_x = screen_pos_x + 330
|
||||
local pwr_gauge_y = clb_gauge_y
|
||||
|
||||
local fu_gauge_x = screen_pos_x + 340
|
||||
local fu_gauge_y = clb_gauge_y
|
||||
|
||||
local ids = trike.hud_list[player_name]
|
||||
if ids then
|
||||
trike.animate_gauge(player, ids, "clb_pt_", clb_gauge_x, clb_gauge_y, climb)
|
||||
trike.animate_gauge(player, ids, "sp_pt_", sp_gauge_x, sp_gauge_y, speed)
|
||||
trike.animate_gauge(player, ids, "pwr_pt_", pwr_gauge_x, pwr_gauge_y, power)
|
||||
trike.animate_gauge(player, ids, "fu_pt_", fu_gauge_x, fu_gauge_y, fuel)
|
||||
else
|
||||
ids = {}
|
||||
|
||||
ids["title"] = player:hud_add({
|
||||
hud_elem_type = "text",
|
||||
position = {x = 0, y = 1},
|
||||
offset = {x = screen_pos_x +140, y = screen_pos_y -100},
|
||||
text = "Flight Information",
|
||||
alignment = 0,
|
||||
scale = { x = 100, y = 30},
|
||||
number = 0xFFFFFF,
|
||||
})
|
||||
|
||||
ids["bg"] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0, y = 1},
|
||||
offset = {x = screen_pos_x, y = screen_pos_y},
|
||||
text = "trike_hud_panel.png",
|
||||
scale = { x = 0.5, y = 0.5},
|
||||
alignment = { x = 1, y = 0 },
|
||||
})
|
||||
|
||||
ids["clb_pt_1"] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0, y = 1},
|
||||
offset = {x = clb_gauge_x, y = clb_gauge_y},
|
||||
text = "trike_ind_box.png",
|
||||
scale = { x = 6, y = 6},
|
||||
alignment = { x = 1, y = 0 },
|
||||
})
|
||||
|
||||
ids["clb_pt_2"] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0, y = 1},
|
||||
offset = {x = clb_gauge_x, y = clb_gauge_y},
|
||||
text = "trike_ind_box.png",
|
||||
scale = { x = 6, y = 6},
|
||||
alignment = { x = 1, y = 0 },
|
||||
})
|
||||
ids["clb_pt_3"] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0, y = 1},
|
||||
offset = {x = clb_gauge_x, y = clb_gauge_y},
|
||||
text = "trike_ind_box.png",
|
||||
scale = { x = 6, y = 6},
|
||||
alignment = { x = 1, y = 0 },
|
||||
})
|
||||
ids["clb_pt_4"] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0, y = 1},
|
||||
offset = {x = clb_gauge_x, y = clb_gauge_y},
|
||||
text = "trike_ind_box.png",
|
||||
scale = { x = 6, y = 6},
|
||||
alignment = { x = 1, y = 0 },
|
||||
})
|
||||
ids["clb_pt_5"] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0, y = 1},
|
||||
offset = {x = clb_gauge_x, y = clb_gauge_y},
|
||||
text = "trike_ind_box.png",
|
||||
scale = { x = 6, y = 6},
|
||||
alignment = { x = 1, y = 0 },
|
||||
})
|
||||
ids["clb_pt_6"] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0, y = 1},
|
||||
offset = {x = clb_gauge_x, y = clb_gauge_y},
|
||||
text = "trike_ind_box.png",
|
||||
scale = { x = 6, y = 6},
|
||||
alignment = { x = 1, y = 0 },
|
||||
})
|
||||
ids["clb_pt_7"] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0, y = 1},
|
||||
offset = {x = clb_gauge_x, y = clb_gauge_y},
|
||||
text = "trike_ind_box.png",
|
||||
scale = { x = 6, y = 6},
|
||||
alignment = { x = 1, y = 0 },
|
||||
})
|
||||
|
||||
ids["sp_pt_1"] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0, y = 1},
|
||||
offset = {x = sp_gauge_x, y = sp_gauge_y},
|
||||
text = "trike_ind_box.png",
|
||||
scale = { x = 6, y = 6},
|
||||
alignment = { x = 1, y = 0 },
|
||||
})
|
||||
ids["sp_pt_2"] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0, y = 1},
|
||||
offset = {x = sp_gauge_x, y = sp_gauge_y},
|
||||
text = "trike_ind_box.png",
|
||||
scale = { x = 6, y = 6},
|
||||
alignment = { x = 1, y = 0 },
|
||||
})
|
||||
ids["sp_pt_3"] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0, y = 1},
|
||||
offset = {x = sp_gauge_x, y = sp_gauge_y},
|
||||
text = "trike_ind_box.png",
|
||||
scale = { x = 6, y = 6},
|
||||
alignment = { x = 1, y = 0 },
|
||||
})
|
||||
ids["sp_pt_4"] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0, y = 1},
|
||||
offset = {x = sp_gauge_x, y = sp_gauge_y},
|
||||
text = "trike_ind_box.png",
|
||||
scale = { x = 6, y = 6},
|
||||
alignment = { x = 1, y = 0 },
|
||||
})
|
||||
ids["sp_pt_5"] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0, y = 1},
|
||||
offset = {x = sp_gauge_x, y = sp_gauge_y},
|
||||
text = "trike_ind_box.png",
|
||||
scale = { x = 6, y = 6},
|
||||
alignment = { x = 1, y = 0 },
|
||||
})
|
||||
ids["sp_pt_6"] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0, y = 1},
|
||||
offset = {x = sp_gauge_x, y = sp_gauge_y},
|
||||
text = "trike_ind_box.png",
|
||||
scale = { x = 6, y = 6},
|
||||
alignment = { x = 1, y = 0 },
|
||||
})
|
||||
ids["sp_pt_7"] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0, y = 1},
|
||||
offset = {x = sp_gauge_x, y = sp_gauge_y},
|
||||
text = "trike_ind_box.png",
|
||||
scale = { x = 6, y = 6},
|
||||
alignment = { x = 1, y = 0 },
|
||||
})
|
||||
|
||||
ids["pwr_pt_1"] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0, y = 1},
|
||||
offset = {x = pwr_gauge_x, y = pwr_gauge_y},
|
||||
text = "trike_ind_box.png",
|
||||
scale = { x = 6, y = 6},
|
||||
alignment = { x = 1, y = 0 },
|
||||
})
|
||||
|
||||
ids["pwr_pt_2"] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0, y = 1},
|
||||
offset = {x = pwr_gauge_x, y = pwr_gauge_y},
|
||||
text = "trike_ind_box.png",
|
||||
scale = { x = 6, y = 6},
|
||||
alignment = { x = 1, y = 0 },
|
||||
})
|
||||
ids["pwr_pt_3"] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0, y = 1},
|
||||
offset = {x = pwr_gauge_x, y = pwr_gauge_y},
|
||||
text = "trike_ind_box.png",
|
||||
scale = { x = 6, y = 6},
|
||||
alignment = { x = 1, y = 0 },
|
||||
})
|
||||
ids["pwr_pt_4"] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0, y = 1},
|
||||
offset = {x = pwr_gauge_x, y = pwr_gauge_y},
|
||||
text = "trike_ind_box.png",
|
||||
scale = { x = 6, y = 6},
|
||||
alignment = { x = 1, y = 0 },
|
||||
})
|
||||
ids["pwr_pt_5"] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0, y = 1},
|
||||
offset = {x = pwr_gauge_x, y = pwr_gauge_y},
|
||||
text = "trike_ind_box.png",
|
||||
scale = { x = 6, y = 6},
|
||||
alignment = { x = 1, y = 0 },
|
||||
})
|
||||
ids["pwr_pt_6"] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0, y = 1},
|
||||
offset = {x = pwr_gauge_x, y = pwr_gauge_y},
|
||||
text = "trike_ind_box.png",
|
||||
scale = { x = 6, y = 6},
|
||||
alignment = { x = 1, y = 0 },
|
||||
})
|
||||
ids["pwr_pt_7"] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0, y = 1},
|
||||
offset = {x = pwr_gauge_x, y = pwr_gauge_y},
|
||||
text = "trike_ind_box.png",
|
||||
scale = { x = 6, y = 6},
|
||||
alignment = { x = 1, y = 0 },
|
||||
})
|
||||
|
||||
ids["fu_pt_1"] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0, y = 1},
|
||||
offset = {x = fu_gauge_x, y = fu_gauge_y},
|
||||
text = "trike_ind_box.png",
|
||||
scale = { x = 6, y = 6},
|
||||
alignment = { x = 1, y = 0 },
|
||||
})
|
||||
|
||||
ids["fu_pt_2"] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0, y = 1},
|
||||
offset = {x = fu_gauge_x, y = fu_gauge_y},
|
||||
text = "trike_ind_box.png",
|
||||
scale = { x = 6, y = 6},
|
||||
alignment = { x = 1, y = 0 },
|
||||
})
|
||||
ids["fu_pt_3"] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0, y = 1},
|
||||
offset = {x = fu_gauge_x, y = fu_gauge_y},
|
||||
text = "trike_ind_box.png",
|
||||
scale = { x = 6, y = 6},
|
||||
alignment = { x = 1, y = 0 },
|
||||
})
|
||||
ids["fu_pt_4"] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0, y = 1},
|
||||
offset = {x = fu_gauge_x, y = fu_gauge_y},
|
||||
text = "trike_ind_box.png",
|
||||
scale = { x = 6, y = 6},
|
||||
alignment = { x = 1, y = 0 },
|
||||
})
|
||||
ids["fu_pt_5"] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0, y = 1},
|
||||
offset = {x = fu_gauge_x, y = fu_gauge_y},
|
||||
text = "trike_ind_box.png",
|
||||
scale = { x = 6, y = 6},
|
||||
alignment = { x = 1, y = 0 },
|
||||
})
|
||||
ids["fu_pt_6"] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0, y = 1},
|
||||
offset = {x = fu_gauge_x, y = fu_gauge_y},
|
||||
text = "trike_ind_box.png",
|
||||
scale = { x = 6, y = 6},
|
||||
alignment = { x = 1, y = 0 },
|
||||
})
|
||||
ids["fu_pt_7"] = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0, y = 1},
|
||||
offset = {x = fu_gauge_x, y = fu_gauge_y},
|
||||
text = "trike_ind_box.png",
|
||||
scale = { x = 6, y = 6},
|
||||
alignment = { x = 1, y = 0 },
|
||||
})
|
||||
|
||||
trike.hud_list[player_name] = ids
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function trike.remove_hud(player)
|
||||
if player then
|
||||
local player_name = player:get_player_name()
|
||||
--minetest.chat_send_all(player_name)
|
||||
local ids = trike.hud_list[player_name]
|
||||
if ids then
|
||||
--player:hud_remove(ids["altitude"])
|
||||
--player:hud_remove(ids["time"])
|
||||
player:hud_remove(ids["title"])
|
||||
player:hud_remove(ids["bg"])
|
||||
player:hud_remove(ids["clb_pt_7"])
|
||||
player:hud_remove(ids["clb_pt_6"])
|
||||
player:hud_remove(ids["clb_pt_5"])
|
||||
player:hud_remove(ids["clb_pt_4"])
|
||||
player:hud_remove(ids["clb_pt_3"])
|
||||
player:hud_remove(ids["clb_pt_2"])
|
||||
player:hud_remove(ids["clb_pt_1"])
|
||||
player:hud_remove(ids["sp_pt_7"])
|
||||
player:hud_remove(ids["sp_pt_6"])
|
||||
player:hud_remove(ids["sp_pt_5"])
|
||||
player:hud_remove(ids["sp_pt_4"])
|
||||
player:hud_remove(ids["sp_pt_3"])
|
||||
player:hud_remove(ids["sp_pt_2"])
|
||||
player:hud_remove(ids["sp_pt_1"])
|
||||
player:hud_remove(ids["pwr_pt_7"])
|
||||
player:hud_remove(ids["pwr_pt_6"])
|
||||
player:hud_remove(ids["pwr_pt_5"])
|
||||
player:hud_remove(ids["pwr_pt_4"])
|
||||
player:hud_remove(ids["pwr_pt_3"])
|
||||
player:hud_remove(ids["pwr_pt_2"])
|
||||
player:hud_remove(ids["pwr_pt_1"])
|
||||
player:hud_remove(ids["fu_pt_7"])
|
||||
player:hud_remove(ids["fu_pt_6"])
|
||||
player:hud_remove(ids["fu_pt_5"])
|
||||
player:hud_remove(ids["fu_pt_4"])
|
||||
player:hud_remove(ids["fu_pt_3"])
|
||||
player:hud_remove(ids["fu_pt_2"])
|
||||
player:hud_remove(ids["fu_pt_1"])
|
||||
end
|
||||
trike.hud_list[player_name] = nil
|
||||
end
|
||||
|
||||
end
|
|
@ -117,6 +117,7 @@ function trike.dettachPlayer(self, player)
|
|||
local name = self.driver_name
|
||||
trike.setText(self)
|
||||
|
||||
trike.remove_hud(player)
|
||||
self._engine_running = false
|
||||
|
||||
-- driver clicked the object => driver gets off the vehicle
|
||||
|
@ -130,10 +131,12 @@ function trike.dettachPlayer(self, player)
|
|||
self.engine:set_animation_frame_speed(0)
|
||||
|
||||
-- detach the player
|
||||
player:set_detach()
|
||||
player_api.player_attached[name] = nil
|
||||
player:set_eye_offset({x=0,y=0,z=0},{x=0,y=0,z=0})
|
||||
player_api.set_animation(player, "stand")
|
||||
if player then
|
||||
player:set_detach()
|
||||
player_api.player_attached[name] = nil
|
||||
player:set_eye_offset({x=0,y=0,z=0},{x=0,y=0,z=0})
|
||||
player_api.set_animation(player, "stand")
|
||||
end
|
||||
self.driver = nil
|
||||
--remove_physics_override(player, {speed=1,gravity=1,jump=1})
|
||||
end
|
||||
|
@ -459,6 +462,10 @@ function trike.flightstep(self)
|
|||
--adjust wing pitch (3d model)
|
||||
self.wing:set_attach(self.object,'',{x=0,y=29,z=0},{x=-self._angle_of_attack,y=0,z=0})
|
||||
|
||||
local indicated_speed = longit_speed
|
||||
if indicated_speed < 0 then indicated_speed = 0 end
|
||||
local speed_angle = trike.get_gauge_angle(indicated_speed, -45)
|
||||
|
||||
--adjust power indicator
|
||||
local power_indicator_angle = trike.get_gauge_angle(self._power_lever/10)
|
||||
self.power_gauge:set_attach(self.object,'',TRIKE_GAUGE_POWER_POSITION,{x=0,y=0,z=power_indicator_angle})
|
||||
|
@ -491,6 +498,19 @@ function trike.flightstep(self)
|
|||
local climb_angle = trike.get_gauge_angle(climb_rate)
|
||||
self.climb_gauge:set_attach(self.object,'',TRIKE_GAUGE_CLIMBER_POSITION,{x=0,y=0,z=climb_angle})
|
||||
|
||||
local energy_indicator_angle = trike.get_gauge_angle(self._energy)
|
||||
if self.fuel_gauge:get_luaentity() then
|
||||
self.fuel_gauge:set_attach(self.object,'',TRIKE_GAUGE_FUEL_POSITION,{x=0,y=0,z=energy_indicator_angle})
|
||||
end
|
||||
|
||||
if is_attached then
|
||||
if self._show_hud then
|
||||
trike.update_hud(player, climb_angle, speed_angle - 130, power_indicator_angle - 270, (energy_indicator_angle*-1)-90)
|
||||
else
|
||||
trike.remove_hud(player)
|
||||
end
|
||||
end
|
||||
|
||||
--saves last velocity for collision detection (abrupt stop)
|
||||
self.lastvelocity = self.object:get_velocity()
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue