Skip to content

Commit

Permalink
Merge pull request #49 from inorton/dev/inb/sync-with-1.5.3-updates
Browse files Browse the repository at this point in the history
Merge in updates from 1.5.3
  • Loading branch information
Quantx authored Mar 18, 2024
2 parents d3c7867 + 78eaaa5 commit 84c65ff
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 23 deletions.
14 changes: 9 additions & 5 deletions ui_enhancer/source/scripts/screen_propulsion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ function render_docking_queue_info(x, y, this_vehicle)

local vehicle_count = update_get_map_vehicle_count()
local screen_team = update_get_screen_team_id()
local this_vehicle_id = this_vehicle:get_id()

g_flight_deck_state = 0

for i = 0, vehicle_count - 1, 1 do
Expand All @@ -235,18 +237,20 @@ function render_docking_queue_info(x, y, this_vehicle)
if vehicle:get_team() == screen_team and get_is_vehicle_air(def) then
local is_rotor = (def == e_game_object_type.chassis_air_rotor_light or def == e_game_object_type.chassis_air_rotor_heavy)
local dock_state = vehicle:get_dock_state()
local dock_parent_id = vehicle:get_dock_parent_id()
local attached_parent_id = vehicle:get_attached_parent_id()
local deck_state = g_flight_deck_states.none
local is_within_carrier_bounds = get_is_within_carrier_bounds(this_vehicle, vehicle)

if dock_state == e_vehicle_dock_state.undocking then
if dock_state == e_vehicle_dock_state.undocking and attached_parent_id == this_vehicle_id then
deck_state = g_flight_deck_states.launch
elseif dock_state == e_vehicle_dock_state.undock_holding then
elseif dock_state == e_vehicle_dock_state.undock_holding and attached_parent_id == this_vehicle_id then
deck_state = g_flight_deck_states.holding
elseif dock_state == e_vehicle_dock_state.docking then
elseif dock_state == e_vehicle_dock_state.docking and dock_parent_id == this_vehicle_id then
deck_state = g_flight_deck_states.landing
elseif dock_state == e_vehicle_dock_state.docking_taxi then
elseif dock_state == e_vehicle_dock_state.docking_taxi and dock_parent_id == this_vehicle_id then
deck_state = g_flight_deck_states.taxi
elseif dock_state == e_vehicle_dock_state.dock_queue then
elseif dock_state == e_vehicle_dock_state.dock_queue and dock_parent_id == this_vehicle_id then
deck_state = g_flight_deck_states.queued
end

Expand Down
61 changes: 43 additions & 18 deletions ui_enhancer/source/scripts/screen_vehicle_control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,7 @@ function update(screen_w, screen_h, ticks)
g_animation_time = g_animation_time + ticks

local screen_vehicle = update_get_screen_vehicle()
local screen_team = update_get_screen_team_id()
g_screen_vehicle_pos = screen_vehicle:get_position_xz()

if g_is_camera_pos_initialised == false and screen_vehicle:get() then
Expand Down Expand Up @@ -1150,7 +1151,7 @@ function update(screen_w, screen_h, ticks)
end
end

if island:get_team_control() == update_get_screen_team_id() then
if island:get_team_control() == screen_team then
local production_count = island:get_facility_production_queue_defense_count()

for j = 0, production_count - 1, 1 do
Expand Down Expand Up @@ -1193,7 +1194,7 @@ function update(screen_w, screen_h, ticks)
end
end

if vehicle_team == update_get_screen_team_id() then
if vehicle_team == screen_team and vehicle_definition_index ~= e_game_object_type.chassis_sea_barge then
local waypoint_count = vehicle:get_waypoint_count()

if g_drag.vehicle_id == 0 or g_drag.vehicle_id == vehicle:get_id() then
Expand Down Expand Up @@ -1310,15 +1311,15 @@ function update(screen_w, screen_h, ticks)

update_ui_text(screen_pos_x - 64, screen_pos_y - 9, island_name, 128, 1, island_color, 0)

if island:get_team_control() == update_get_screen_team_id() then
if island:get_team_control() == screen_team then
if is_placing_turret == false then
local production_count = island:get_facility_production_queue_defense_count()

for j = 0, production_count - 1, 1 do
local item_type, marker_index = island:get_facility_production_queue_defense_item(j)
local turret_spawn_xz = island:get_marker_position(marker_index)
local screen_pos_x, screen_pos_y = get_screen_from_world(turret_spawn_xz:x(), turret_spawn_xz:y(), g_camera_pos_x, g_camera_pos_y, g_camera_size, screen_w, screen_h)
local team_color = get_vehicle_team_color(update_get_screen_team_id())
local team_color = get_vehicle_team_color(screen_team)
local color = iff(j == 0, iff(g_blink_timer > 15, team_color, color_grey_dark), color_grey_dark)

if g_highlighted.island_id == island_id and g_highlighted.production_index == j then
Expand Down Expand Up @@ -1414,7 +1415,7 @@ function update(screen_w, screen_h, ticks)
local weapon_radius_vehicle = update_get_map_vehicle_by_id(g_drag.vehicle_id)

if weapon_radius_vehicle:get() then
if weapon_radius_vehicle:get_team() == update_get_screen_team_id() then
if weapon_radius_vehicle:get_team() == screen_team then
local weapon_range, weapon_range_col = get_vehicle_weapon_range(weapon_radius_vehicle)
local world_x, world_y = get_world_from_screen(g_cursor_pos_x, g_cursor_pos_y, g_camera_pos_x, g_camera_pos_y, g_camera_size, 256, 256)

Expand All @@ -1425,9 +1426,21 @@ function update(screen_w, screen_h, ticks)
local def = weapon_radius_vehicle:get_definition_index()

if def == e_game_object_type.chassis_sea_ship_light or def == e_game_object_type.chassis_sea_ship_heavy then
local team_carrier = screen_vehicle
local vehicle_pos_xz = team_carrier:get_position_xz()
render_weapon_radius(vehicle_pos_xz:x(), vehicle_pos_xz:y(), 500, color8(0, 255, 128, 8))
local vehicle_count = update_get_map_vehicle_count()

for i = 0, vehicle_count - 1, 1 do
local vehicle = update_get_map_vehicle_by_index(i)

if vehicle:get() then
local vehicle_definition_index = vehicle:get_definition_index()

if vehicle:get_definition_index() == e_game_object_type.chassis_carrier and vehicle:get_team() == screen_team then
local vehicle_pos_xz = vehicle:get_position_xz()

render_weapon_radius(vehicle_pos_xz:x(), vehicle_pos_xz:y(), 500, color8(0, 255, 128, 8))
end
end
end
end
end
end
Expand All @@ -1438,7 +1451,7 @@ function update(screen_w, screen_h, ticks)
local def = weapon_radius_vehicle:get_definition_index()

if def ~= e_game_object_type.chassis_carrier then
if weapon_radius_vehicle:get_team() == update_get_screen_team_id() or weapon_radius_vehicle:get_is_observation_weapon_revealed() then
if weapon_radius_vehicle:get_team() == screen_team or weapon_radius_vehicle:get_is_observation_weapon_revealed() then
local weapon_range, weapon_range_col = get_vehicle_weapon_range(weapon_radius_vehicle)
local vehicle_pos_xz = weapon_radius_vehicle:get_position_xz()

Expand All @@ -1447,11 +1460,23 @@ function update(screen_w, screen_h, ticks)
end
end

if weapon_radius_vehicle:get_team() == update_get_screen_team_id() then
if weapon_radius_vehicle:get_team() == screen_team then
if def == e_game_object_type.chassis_sea_ship_light or def == e_game_object_type.chassis_sea_ship_heavy then
local team_carrier = screen_vehicle
local vehicle_pos_xz = team_carrier:get_position_xz()
render_weapon_radius(vehicle_pos_xz:x(), vehicle_pos_xz:y(), 500, color8(0, 255, 128, 8))
local vehicle_count = update_get_map_vehicle_count()

for i = 0, vehicle_count - 1, 1 do
local vehicle = update_get_map_vehicle_by_index(i)

if vehicle:get() then
local vehicle_definition_index = vehicle:get_definition_index()

if vehicle:get_definition_index() == e_game_object_type.chassis_carrier and vehicle:get_team() == screen_team then
local vehicle_pos_xz = vehicle:get_position_xz()

render_weapon_radius(vehicle_pos_xz:x(), vehicle_pos_xz:y(), 500, color8(0, 255, 128, 8))
end
end
end
end
end
end
Expand Down Expand Up @@ -1548,7 +1573,7 @@ function update(screen_w, screen_h, ticks)
show_waypoints = g_is_carrier_waypoint
end

if vehicle_team == update_get_screen_team_id() and show_waypoints then
if vehicle_team == screen_team and show_waypoints then
local waypoint_color = g_color_waypoint

if g_highlighted.vehicle_id == vehicle:get_id() and g_highlighted.waypoint_id == 0 then
Expand Down Expand Up @@ -1874,7 +1899,7 @@ function update(screen_w, screen_h, ticks)
cy = cy + 2
end

if vehicle_team == update_get_screen_team_id() and vehicle_definition_index ~= e_game_object_type.chassis_land_robot_dog then
if vehicle_team == screen_team and vehicle_definition_index ~= e_game_object_type.chassis_land_robot_dog then
cx = screen_pos_x - 4

local is_visible_by_enemy = vehicle:get_is_visible_by_enemy()
Expand Down Expand Up @@ -1916,7 +1941,7 @@ function update(screen_w, screen_h, ticks)
end
end

if vehicle_team == update_get_screen_team_id() then
if vehicle_team == screen_team then
if vehicle:get_controlling_peer_id() ~= 0 then
update_ui_image(screen_pos_x - icon_offset, screen_pos_y - icon_offset, atlas_icons.map_icon_vehicle_control, element_color, 0)
end
Expand Down Expand Up @@ -2180,7 +2205,7 @@ function update(screen_w, screen_h, ticks)
render_tooltip(10, 10, screen_w - 20, screen_h - 20, g_cursor_pos_x, g_cursor_pos_y, text_w + 18, 17, 10, function(w, h)
update_ui_image(4, 4, atlas_icons.column_team_control, update_get_team_color(highlighted_island:get_team_control()), 0)

if highlighted_island:get_team_control() == update_get_screen_team_id() then
if highlighted_island:get_team_control() == screen_team then
update_ui_text(14, 4, text, w, 0, color_white, 0)
else
update_ui_text(14, 4, text, w, 0, color_grey_dark, 0)
Expand Down Expand Up @@ -3255,4 +3280,4 @@ function get_is_vehicle_waypoint_available(vehicle)
end

return true
end
end

0 comments on commit 84c65ff

Please sign in to comment.