From 7ecdd7e0b878261a557864cb8d76b2d5d808893c Mon Sep 17 00:00:00 2001 From: Atermonera Date: Sat, 9 May 2020 01:22:44 -0700 Subject: [PATCH] adds logging variable to enable shuttle log spam --- code/modules/shuttles/shuttle.dm | 27 ++++++++++++++-------- code/modules/shuttles/shuttle_autodock.dm | 2 +- code/modules/shuttles/shuttle_console.dm | 6 +++-- code/modules/shuttles/shuttle_emergency.dm | 4 ++-- code/modules/shuttles/shuttles_web.dm | 4 ++-- code/modules/shuttles/web_datums.dm | 2 +- 6 files changed, 28 insertions(+), 17 deletions(-) diff --git a/code/modules/shuttles/shuttle.dm b/code/modules/shuttles/shuttle.dm index 7e393c99d1..a062d2a3d3 100644 --- a/code/modules/shuttles/shuttle.dm +++ b/code/modules/shuttles/shuttle.dm @@ -30,6 +30,8 @@ var/tmp/depart_time = 0 //Similar to above, set when the shuttle leaves when long jumping. Used for progress bars. + var/debug_logging = FALSE // If set to true, the shuttle will start broadcasting its debug messages to admins + // Future Thoughts: Baystation put "docking" stuff in a subtype, leaving base type pure and free of docking stuff. Is this best? /datum/shuttle/New(_name, var/obj/effect/shuttle_landmark/initial_location) @@ -52,7 +54,8 @@ else current_location = SSshuttles.get_landmark(current_location) if(!istype(current_location)) - log_debug("UM whoops, no initial? [src]") + if(debug_logging) + log_shuttle("UM whoops, no initial? [src]") CRASH("Shuttle '[name]' could not find its starting location landmark [current_location].") if(src.name in SSshuttles.shuttles) @@ -239,14 +242,17 @@ // Returns TRUE if we actually moved, otherwise FALSE. /datum/shuttle/proc/attempt_move(var/obj/effect/shuttle_landmark/destination, var/interim = FALSE) if(current_location == destination) - log_shuttle("Shuttle [src] attempted to move to [destination] but is already there!") + if(debug_logging) + log_shuttle("Shuttle [src] attempted to move to [destination] but is already there!") return FALSE if(!destination.is_valid(src)) - log_shuttle("Shuttle [src] aborting attempt_move() because destination=[destination] is not valid") + if(debug_logging) + log_shuttle("Shuttle [src] aborting attempt_move() because destination=[destination] is not valid") return FALSE if(current_location.cannot_depart(src)) - log_shuttle("Shuttle [src] aborting attempt_move() because current_location=[current_location] refuses.") + if(debug_logging) + log_shuttle("Shuttle [src] aborting attempt_move() because current_location=[current_location] refuses.") return FALSE // Observer pattern pre-move @@ -254,19 +260,21 @@ GLOB.shuttle_pre_move_event.raise_event(src, old_location, destination) current_location.shuttle_departed(src) - log_shuttle("[src] moving to [destination]. Areas are [english_list(shuttle_area)]") + if(debug_logging) + log_shuttle("[src] moving to [destination]. Areas are [english_list(shuttle_area)]") var/list/translation = list() for(var/area/A in shuttle_area) - log_shuttle("Translating [A]") + if(debug_logging) + log_shuttle("Translating [A]") translation += get_turf_translation(get_turf(current_location), get_turf(destination), A.contents) // Actually do it! (This never fails) perform_shuttle_move(destination, translation) - + // Observer pattern post-move destination.shuttle_arrived(src) GLOB.shuttle_moved_event.raise_event(src, old_location, destination) - + return TRUE @@ -274,7 +282,8 @@ //A note to anyone overriding move in a subtype. perform_shuttle_move() must absolutely not, under any circumstances, fail to move the shuttle. //If you want to conditionally cancel shuttle launches, that logic must go in short_jump() or long_jump() /datum/shuttle/proc/perform_shuttle_move(var/obj/effect/shuttle_landmark/destination, var/list/turf_translation) - log_shuttle("perform_shuttle_move() current=[current_location] destination=[destination]") + if(debug_logging) + log_shuttle("perform_shuttle_move() current=[current_location] destination=[destination]") //to_world("move_shuttle() called for [name] leaving [origin] en route to [destination].") //to_world("area_coming_from: [origin]") diff --git a/code/modules/shuttles/shuttle_autodock.dm b/code/modules/shuttles/shuttle_autodock.dm index 4181af5b15..aa59856b50 100644 --- a/code/modules/shuttles/shuttle_autodock.dm +++ b/code/modules/shuttles/shuttle_autodock.dm @@ -65,7 +65,7 @@ current_dock_target = docking_controller_tag shuttle_docking_controller = SSshuttles.docking_registry[current_dock_target] if(current_dock_target && !shuttle_docking_controller) - to_world("warning: shuttle [src] can't find its controller with tag [current_dock_target]!") + log_shuttle("warning: shuttle [src] can't find its controller with tag [current_dock_target]!") // No toggle because this is an error message that needs to be seen /* Docking stuff */ diff --git a/code/modules/shuttles/shuttle_console.dm b/code/modules/shuttles/shuttle_console.dm index 6d277edec1..3e3655ca5a 100644 --- a/code/modules/shuttles/shuttle_console.dm +++ b/code/modules/shuttles/shuttle_console.dm @@ -64,11 +64,13 @@ var/cannot_depart = shuttle.current_location.cannot_depart(shuttle) if(cannot_depart) to_chat(user, "[cannot_depart]") - log_shuttle("Shuttle [shuttle] cannot depart [shuttle.current_location] because: [cannot_depart].") + if(shuttle.debug_logging) + log_shuttle("Shuttle [shuttle] cannot depart [shuttle.current_location] because: [cannot_depart].") return FALSE if(!shuttle.next_location.is_valid(shuttle)) to_chat(user, "Destination zone is invalid or obstructed.") - log_shuttle("Shuttle [shuttle] destination [shuttle.next_location] is invalid.") + if(shuttle.debug_logging) + log_shuttle("Shuttle [shuttle] destination [shuttle.next_location] is invalid.") return FALSE return TRUE diff --git a/code/modules/shuttles/shuttle_emergency.dm b/code/modules/shuttles/shuttle_emergency.dm index efb321e55c..6c584e1762 100644 --- a/code/modules/shuttles/shuttle_emergency.dm +++ b/code/modules/shuttles/shuttle_emergency.dm @@ -70,7 +70,7 @@ if (istype(user, /obj/machinery/computer/shuttle_control/emergency)) //if we were given a command by an emergency shuttle console if (emergency_shuttle.autopilot) emergency_shuttle.autopilot = 0 - to_chat(world, "Alert: The shuttle autopilot has been overridden. Launch sequence initiated!") + to_world("Alert: The shuttle autopilot has been overridden. Launch sequence initiated!") if(usr) log_admin("[key_name(usr)] has overridden the departure shuttle's autopilot and activated the launch sequence.") @@ -84,7 +84,7 @@ if (istype(user, /obj/machinery/computer/shuttle_control/emergency)) //if we were given a command by an emergency shuttle console if (emergency_shuttle.autopilot) emergency_shuttle.autopilot = 0 - to_chat(world, "Alert: The shuttle autopilot has been overridden. Bluespace drive engaged!") + to_world("Alert: The shuttle autopilot has been overridden. Bluespace drive engaged!") if(usr) log_admin("[key_name(usr)] has overridden the departure shuttle's autopilot and forced immediate launch.") diff --git a/code/modules/shuttles/shuttles_web.dm b/code/modules/shuttles/shuttles_web.dm index 0aebd2bf42..00d9344b00 100644 --- a/code/modules/shuttles/shuttles_web.dm +++ b/code/modules/shuttles/shuttles_web.dm @@ -181,7 +181,7 @@ my_doors[find_doors[A.id_tag]] = A find_doors -= A.id_tag for(var/lost in find_doors) - log_debug("[my_area] shuttle computer couldn't find [lost] door!") + log_shuttle("[my_area] shuttle computer couldn't find [lost] door!") if(my_sensors) var/list/find_sensors = my_sensors @@ -191,7 +191,7 @@ my_sensors[find_sensors[S.id_tag]] = S find_sensors -= S.id_tag for(var/lost in find_sensors) - log_debug("[my_area] shuttle computer couldn't find [lost] sensor!") + log_shuttle("[my_area] shuttle computer couldn't find [lost] sensor!") /obj/machinery/computer/shuttle_control/web/attackby(obj/I, mob/user) var/datum/shuttle/autodock/web_shuttle/shuttle = shuttle_controller.shuttles[shuttle_tag] diff --git a/code/modules/shuttles/web_datums.dm b/code/modules/shuttles/web_datums.dm index 3e2abf9443..bbba42dd58 100644 --- a/code/modules/shuttles/web_datums.dm +++ b/code/modules/shuttles/web_datums.dm @@ -72,7 +72,7 @@ /datum/shuttle_destination/New(var/new_master) my_landmark = SSshuttles.get_landmark(my_landmark) if(!my_landmark) - log_debug("Web shuttle destination '[name]' could not find its landmark '[my_landmark]'.") + log_debug("Web shuttle destination '[name]' could not find its landmark '[my_landmark]'.") // Important error message master = new_master /datum/shuttle_destination/Destroy()