local Screen_grp_h = -1
local Meter_h = -1
local Meter_width, Meter_height
function msn_tank_hud_init()
Screen_grp_h = vint_object_find( "screen_grp" )
Meter_h = vint_object_find( "tank_mask" )
Meter_width, Meter_height = element_get_actual_size(Meter_h)
vint_set_mouse_cursor("ui_cursor_target")
vint_dataitem_add_subscription("msn_tank_hud_data", "update", "msn_tank_hud_set_meter")
end
function msn_tank_hud_set_meter(di_h)
local meter_value = vint_dataitem_get(di_h)
if meter_value == nil or meter_value < 0 then
meter_value = 0
end
local new_meter_width = Meter_width * meter_value
if meter_value ~= 1 then --if 1 then set it to full
local incriment = Meter_width/16
for i = 0, Meter_width, incriment do
if new_meter_width >= i and new_meter_width < (i + incriment) then
new_meter_width = i
end
end
end
element_set_actual_size(Meter_h, new_meter_width, Meter_height)
end
function msn_tank_hud_cleanup()
vint_set_mouse_cursor("")
end