Shuttle unit test + bugfix (#13578)

This commit is contained in:
mikomyazaki
2022-04-20 21:15:27 +01:00
committed by GitHub
parent e59589ec8a
commit 692bef4a37
10 changed files with 77 additions and 5 deletions

View File

@@ -99,6 +99,14 @@
fuel_to_consume -= fuel_available
FT.remove_air_by_flag(XGM_GAS_FUEL, fuel_available)
/datum/shuttle/autodock/overmap/on_move_interim()
..()
for(var/obj/machinery/computer/shuttle_control/explore/E in shuttle_computers)
var/obj/effect/overmap/visitable/ship/S = E.linked
if(S)
S.halt()
S.unhalt()
/obj/structure/fuel_port
name = "fuel port"
desc = "The fuel input port of the shuttle. Holds one fuel tank. Use a crowbar to open and close it."
@@ -156,4 +164,4 @@
/obj/structure/fuel_port/hide()
return
#undef waypoint_sector
#undef waypoint_sector

View File

@@ -3,6 +3,17 @@
name = "general shuttle control console"
ui_template = "shuttle_control_console_exploration.tmpl"
/obj/machinery/computer/shuttle_control/explore/attempt_hook_up(obj/effect/overmap/visitable/ship/sector)
. = ..()
if(.)
LAZYSET(linked.consoles, src, TRUE)
/obj/machinery/computer/shuttle_control/explore/Destroy()
if(linked)
LAZYREMOVE(linked.consoles, src)
. = ..()
/obj/machinery/computer/shuttle_control/explore/get_ui_data(var/datum/shuttle/autodock/overmap/shuttle)
. = ..()
if(istype(shuttle))

View File

@@ -49,6 +49,9 @@ var/const/OVERMAP_SPEED_CONSTANT = (1 SECOND)
for(var/obj/machinery/computer/ship/S in SSmachinery.all_machines)
if(S.linked == src)
S.linked = null
for(var/obj/machinery/computer/shuttle_control/explore/C in SSmachinery.all_machines)
if(C.linked == src)
C.linked = null
for(var/obj/machinery/hologram/holopad/H as anything in SSmachinery.all_holopads)
if(H.linked == src)
H.linked = null
@@ -241,6 +244,8 @@ var/const/OVERMAP_SPEED_CONSTANT = (1 SECOND)
..()
for(var/obj/machinery/computer/ship/S in SSmachinery.all_machines)
S.attempt_hook_up(src)
for(var/obj/machinery/computer/shuttle_control/explore/C in SSmachinery.all_machines)
C.attempt_hook_up(src)
for(var/obj/machinery/hologram/holopad/H as anything in SSmachinery.all_holopads)
H.attempt_hook_up(src)
for(var/datum/ship_engine/E in ship_engines)

View File

@@ -126,6 +126,7 @@
arrive_time = world.time + travel_time*10
moving_status = SHUTTLE_INTRANSIT
if(attempt_move(interim))
on_move_interim()
var/fwooshed = 0
while (world.time < arrive_time)
if(!fwooshed && (arrive_time - world.time) < 100)
@@ -298,4 +299,7 @@
/datum/shuttle/proc/set_process_state(var/new_state)
process_state = new_state
for(var/obj/machinery/computer/shuttle_control/SC as anything in shuttle_computers)
SC.update_helmets(src)
SC.update_helmets(src)
/datum/shuttle/proc/on_move_interim()
return

View File

@@ -0,0 +1,36 @@
/datum/unit_test/shuttle_landmarks_shall_exist
name = "SHUTTLE: Defined shuttle landmarks shall exist."
/datum/unit_test/shuttle_landmarks_shall_exist/start_test()
var/failed = 0
for(var/A in subtypesof(/datum/shuttle/autodock))
var/datum/shuttle/autodock/shuttle = A
// Check start location and transition locations exist
var/found_current_location = FALSE
var/found_transition_location = FALSE
var/found_logging_home_location = FALSE
for(var/L in subtypesof(/obj/effect/shuttle_landmark))
var/obj/effect/shuttle_landmark/landmark = L
if(initial(landmark.landmark_tag) == initial(shuttle.current_location))
found_current_location = TRUE
if(initial(landmark.landmark_tag) == initial(shuttle.landmark_transition))
found_transition_location = TRUE
if(initial(landmark.landmark_tag) == initial(shuttle.logging_home_tag))
found_logging_home_location = TRUE
if(initial(shuttle.current_location) && !found_current_location)
log_unit_test("Failed to find 'current_location' landmark for [shuttle].")
failed++
if(initial(shuttle.landmark_transition) && !found_transition_location)
log_unit_test("Failed to find 'landmark_transition' landmark for [shuttle].")
failed++
if(initial(shuttle.logging_home_tag) && !found_logging_home_location)
log_unit_test("Failed to find 'logging_home_tag' landmark for [shuttle].")
failed++
if(failed)
fail("[failed] shuttle transition and start location landmarks were not found.")
else
pass("All shuttle transition and start location landmarks were found.")
return TRUE