From 8f3a1782325e936b29fa8dda469bc7cfa0177906 Mon Sep 17 00:00:00 2001 From: paulrpg Date: Thu, 12 Oct 2023 23:39:35 +0100 Subject: [PATCH] more robust fix for flyby timer issue --- .../shuttle/computers/dropship_computer.dm | 28 ++++----------- .../tgui/interfaces/DropshipFlightControl.tsx | 36 ------------------- 2 files changed, 7 insertions(+), 57 deletions(-) diff --git a/code/modules/shuttle/computers/dropship_computer.dm b/code/modules/shuttle/computers/dropship_computer.dm index 15b6a6ca6e87..fd727bd01d1c 100644 --- a/code/modules/shuttle/computers/dropship_computer.dm +++ b/code/modules/shuttle/computers/dropship_computer.dm @@ -8,9 +8,6 @@ exproof = TRUE needs_power = FALSE - // True if we are doing a flyby - var/is_set_flyby = FALSE - // Admin disabled var/disabled = FALSE @@ -54,15 +51,15 @@ /obj/structure/machinery/computer/shuttle/dropship/flight/enable() disabled = FALSE -/obj/structure/machinery/computer/shuttle/dropship/flight/proc/update_equipment(optimised=FALSE) +/obj/structure/machinery/computer/shuttle/dropship/flight/proc/update_equipment(optimised=FALSE, is_flyby=FALSE) var/obj/docking_port/mobile/marine_dropship/dropship = SSshuttle.getShuttle(shuttleId) if(!dropship) return // initial flight time - var/flight_duration = is_set_flyby ? DROPSHIP_TRANSIT_DURATION : DROPSHIP_TRANSIT_DURATION * GLOB.ship_alt + var/flight_duration = is_flyby ? DROPSHIP_TRANSIT_DURATION : DROPSHIP_TRANSIT_DURATION * GLOB.ship_alt if(optimised) - if(is_set_flyby) + if(is_flyby) flight_duration = DROPSHIP_TRANSIT_DURATION * 1.5 else flight_duration = DROPSHIP_TRANSIT_DURATION * SHUTTLE_OPTIMIZE_FACTOR_TRAVEL @@ -76,7 +73,7 @@ for(var/obj/structure/dropship_equipment/equipment as anything in dropship.equipments) // fuel enhancer if(istype(equipment, /obj/structure/dropship_equipment/fuel/fuel_enhancer)) - if(is_set_flyby) + if(is_flyby) flight_duration = flight_duration / SHUTTLE_FUEL_ENHANCE_FACTOR_TRAVEL else flight_duration = flight_duration * SHUTTLE_FUEL_ENHANCE_FACTOR_TRAVEL @@ -322,7 +319,6 @@ .["target_destination"] = shuttle.in_flyby? "Flyby" : shuttle.destination.name .["door_status"] = is_remote ? list() : shuttle.get_door_data() - .["flight_configuration"] = is_set_flyby ? "flyby" : "ferry" .["has_flyby_skill"] = skillcheck(user, SKILL_PILOT, SKILL_PILOT_EXPERT) .["destinations"] = list() @@ -375,12 +371,13 @@ // automatically apply optimisation if user is a pilot if(skillcheck(user, SKILL_PILOT, SKILL_PILOT_EXPERT)) is_optimised = TRUE - update_equipment(is_optimised) + var/dock_id = params["target"] if(dock_id == DROPSHIP_FLYBY_ID) if(!skillcheck(user, SKILL_PILOT, SKILL_PILOT_EXPERT)) to_chat(user, SPAN_WARNING("You don't have the skill to perform a flyby.")) return FALSE + update_equipment(is_optimised, TRUE) to_chat(user, SPAN_NOTICE("You begin the launch sequence for a flyby.")) link.log_ares_flight(user.name, "Launched Dropship [shuttle.name] on a flyby.") var/log = "[key_name(user)] launched the dropship [src.shuttleId] on flyby." @@ -389,6 +386,7 @@ shuttle.send_for_flyby() return TRUE + update_equipment(is_optimised, FALSE) var/list/local_data = ui_data(user) var/found = FALSE playsound(loc, get_sfx("terminal_button"), KEYBOARD_SOUND_VOLUME, 1) @@ -429,18 +427,6 @@ else playsound(loc, 'sound/machines/terminal_error.ogg', KEYBOARD_SOUND_VOLUME, 1) to_chat(user, SPAN_WARNING("Door controls have been overridden. Please call technical support.")) - if("set-ferry") - is_set_flyby = FALSE - link.log_ares_flight(user.name, "Set Dropship [shuttle.name] to transport runs.") - var/log = "[key_name(user)] set the dropship [src.shuttleId] into transport" - msg_admin_niche(log) - log_interact(user, msg = "[log]") - if("set-flyby") - is_set_flyby = TRUE - link.log_ares_flight(user.name, "Set Dropship [shuttle.name] to flyby runs.") - var/log = "[key_name(user)] set the dropship [src.shuttleId] into flyby." - msg_admin_niche(log) - log_interact(user, msg = "[log]") if("set-automate") var/almayer_lz = params["hangar_id"] var/ground_lz = params["ground_id"] diff --git a/tgui/packages/tgui/interfaces/DropshipFlightControl.tsx b/tgui/packages/tgui/interfaces/DropshipFlightControl.tsx index 289bb53d777a..eb221107522a 100644 --- a/tgui/packages/tgui/interfaces/DropshipFlightControl.tsx +++ b/tgui/packages/tgui/interfaces/DropshipFlightControl.tsx @@ -18,7 +18,6 @@ interface DropshipNavigationProps extends NavigationProps { door_status: Array; has_flight_optimisation?: 0 | 1; is_flight_optimised?: 0 | 1; - flight_configuration: 'flyby' | 'ferry'; can_fly_by?: 0 | 1; can_set_automated?: 0 | 1; primary_lz?: string; @@ -182,41 +181,6 @@ const DestinationSelector = (props: DestinationProps, context) => { ); }; -const FlybyControl = (props, context) => { - const { act, data } = useBackend(context); - return ( -
- {data.flight_configuration === 'flyby' && ( - - )} - {data.has_flyby_skill === 1 && data.flight_configuration === 'ferry' && ( - - )} - {data.has_flyby_skill === 1 && data.shuttle_mode === 'called' && ( - - )} - {data.has_flyby_skill === 1 && data.shuttle_mode === 'idle' && ( - - )} - - } - /> - ); -}; - export const TouchdownCooldown = (_, context) => { const { data } = useBackend(context); return (