diff --git a/code/__DEFINES/machinery.dm b/code/__DEFINES/machinery.dm index 842f833347d..01a2ba0be67 100644 --- a/code/__DEFINES/machinery.dm +++ b/code/__DEFINES/machinery.dm @@ -201,3 +201,11 @@ GLOBAL_LIST_INIT(restricted_camera_networks, list(NETWORK_ERT,NETWORK_MERCENARY, #define INIT_MACHINERY_PROCESS_SELF 0x1 #define INIT_MACHINERY_PROCESS_COMPONENTS 0x2 #define INIT_MACHINERY_PROCESS_ALL 0x3 + +// Status Display Modes +#define STATUS_DISPLAY_BLANK 0 +#define STATUS_DISPLAY_TRANSFER_SHUTTLE_TIME 1 +#define STATUS_DISPLAY_MESSAGE 2 +#define STATUS_DISPLAY_ALERT 3 +#define STATUS_DISPLAY_TIME 4 +#define STATUS_DISPLAY_CUSTOM 99 diff --git a/code/__HELPERS/global_lists.dm b/code/__HELPERS/global_lists.dm index 3e8a2a2473c..15e9eb2a5c6 100644 --- a/code/__HELPERS/global_lists.dm +++ b/code/__HELPERS/global_lists.dm @@ -111,12 +111,15 @@ GLOBAL_LIST_INIT(headsetlist, list("Nothing", "Headset", "Bowman Headset", "Doub /// Primary Radio Slot loadout choices. GLOBAL_LIST_INIT(primary_radio_slot_choice, list("Left Ear", "Right Ear", "Wrist")) -// Used to track fauna spawners on the phoron deposit away site. +/// Used to track fauna spawners on the phoron deposit away site. GLOBAL_LIST_INIT(fauna_spawners, list()) /// List of spawn points associated with '/obj/effect/organized_fauna_spawner'. It will automatically assign the spawn points in the same Z level as spawner. GLOBAL_LIST_EMPTY(organized_spawn_points) +/// List of mob waypoints for fauna spawners. +GLOBAL_LIST_EMPTY(mob_waypoints) + /// Visual nets. GLOBAL_LIST_EMPTY_TYPED(visual_nets, /datum/visualnet) /// Camera visualnet. diff --git a/code/game/machinery/status_display.dm b/code/game/machinery/status_display.dm index 6f74ca24791..3fca3c4d24d 100644 --- a/code/game/machinery/status_display.dm +++ b/code/game/machinery/status_display.dm @@ -24,11 +24,8 @@ idle_power_usage = 10 obj_flags = OBJ_FLAG_MOVES_UNSUPPORTED var/hears_arrivals = FALSE - var/mode = 1 // 0 = Blank - // 1 = Shuttle timer - // 2 = Arbitrary message(s) - // 3 = alert picture - // 4 = Supply shuttle timer + var/mode = STATUS_DISPLAY_TRANSFER_SHUTTLE_TIME + var/last_mode = STATUS_DISPLAY_TRANSFER_SHUTTLE_TIME var/picture_state // icon_state of alert picture @@ -42,13 +39,6 @@ var/friendc = 0 // track if Friend Computer mode var/ignore_friendc = 0 - var/const/STATUS_DISPLAY_BLANK = 0 - var/const/STATUS_DISPLAY_TRANSFER_SHUTTLE_TIME = 1 - var/const/STATUS_DISPLAY_MESSAGE = 2 - var/const/STATUS_DISPLAY_ALERT = 3 - var/const/STATUS_DISPLAY_TIME = 4 - var/const/STATUS_DISPLAY_CUSTOM = 99 - /// Normal text color var/text_color = COLOR_DISPLAY_BLUE /// Color for headers, eg. "- ETA -" @@ -80,7 +70,19 @@ remove_display() update_lighting() return - update() + if((mode == STATUS_DISPLAY_TIME) && (message2 != worldtime2text())) + update() + +/obj/machinery/status_display/update_use_power(new_use_power) + var/should_update = (use_power != new_use_power && (use_power == POWER_USE_OFF || new_use_power == POWER_USE_OFF)) + . = ..() + if(should_update) + update() + +/obj/machinery/status_display/power_change() + . = ..() + if(.) + update() /obj/machinery/status_display/emp_act(severity) . = ..() @@ -362,5 +364,3 @@ #undef LINE2_X #undef LINE2_Y #undef STATUS_DISPLAY_FONT_DATUM - -#undef SCROLL_PADDING diff --git a/code/modules/effects/map_effects/mob_spawner.dm b/code/modules/effects/map_effects/mob_spawner.dm index 63ddf00f451..00c12a29603 100644 --- a/code/modules/effects/map_effects/mob_spawner.dm +++ b/code/modules/effects/map_effects/mob_spawner.dm @@ -24,15 +24,24 @@ /obj/effect/fauna_spawner/Initialize() . = ..() var/obj/effect/landmark/mob_waypoint/W = locate(/obj/effect/landmark/mob_waypoint) in world - RegisterSignal(GLOB, COMSIG_GLOB_MOB_DEATH, PROC_REF(mob_died)) + RegisterSignal(SSdcs, COMSIG_GLOB_MOB_DEATH, PROC_REF(mob_died)) if (W && W.z == src.z) waypoint = W if(!islist(GLOB.fauna_spawners)) GLOB.fauna_spawners = list() GLOB.fauna_spawners |= src + return INITIALIZE_HINT_LATELOAD + +/obj/effect/fauna_spawner/LateInitialize() + waypoint = LAZYACCESS(GLOB.mob_waypoints, z) + if(!istype(waypoint)) + qdel(src) /obj/effect/fauna_spawner/Destroy() UnregisterSignal(GLOB, COMSIG_GLOB_MOB_DEATH, PROC_REF(mob_died)) + for(var/mob/m in active_mobs) + UnregisterSignal(m, COMSIG_QDELETING) + active_mobs.Cut() if(islist(GLOB.fauna_spawners)) GLOB.fauna_spawners -= src return ..() @@ -71,7 +80,7 @@ if (!new_mob) return active_mobs += new_mob - RegisterSignal(new_mob, COMSIG_GLOB_MOB_DEATH, PROC_REF(mob_died)) + RegisterSignal(new_mob, COMSIG_QDELETING, PROC_REF(mob_died)) if (src.waypoint && istype(new_mob, /mob/living/simple_animal/hostile)) var/mob/living/simple_animal/hostile/H = new_mob H.target_waypoint = src.waypoint @@ -80,6 +89,8 @@ GLOB.move_manager.move_towards(H, src.waypoint.loc, move_speed, TRUE) /obj/effect/fauna_spawner/proc/mob_died(var/mob/living/mob_ref, gibbed) + SIGNAL_HANDLER + UnregisterSignal(mob_ref, COMSIG_QDELETING) for (var/i = length(active_mobs); i >= 1; i--) var/mob/living/M = active_mobs[i] if (!M || QDELETED(M) || M.stat == DEAD) @@ -171,7 +182,7 @@ var/mob/living/new_mob = new mob_type(T) active_mobs += new_mob - RegisterSignal(new_mob, COMSIG_GLOB_MOB_DEATH, PROC_REF(mob_died)) + RegisterSignal(new_mob, COMSIG_QDELETING, PROC_REF(mob_died)) if(src.waypoint && istype(new_mob, /mob/living/simple_animal/hostile)) var/mob/living/simple_animal/hostile/H = new_mob H.target_waypoint = src.waypoint @@ -206,3 +217,15 @@ /obj/effect/landmark/mob_waypoint name = "mob waypoint" + +/obj/effect/landmark/mob_waypoint/Initialize(mapload) + . = ..() + var/list/z_levels = GetConnectedZlevels(z) + for(var/i in z_levels) + LAZYADDASSOCLIST(GLOB.mob_waypoints, "[i]", src) + +/obj/effect/landmark/mob_waypoint/Destroy() + var/list/z_levels = GetConnectedZlevels(z) + for(var/i in z_levels) + LAZYREMOVEASSOC(GLOB.mob_waypoints, "[i]", src) + return ..() diff --git a/code/modules/projectiles/ammunition/ammo_pile.dm b/code/modules/projectiles/ammunition/ammo_pile.dm index 0a17eec9a39..48fec4c02e6 100644 --- a/code/modules/projectiles/ammunition/ammo_pile.dm +++ b/code/modules/projectiles/ammunition/ammo_pile.dm @@ -9,7 +9,7 @@ var/max_ammo = 5 /obj/item/ammo_pile/Destroy() - ammo.Cut() + QDEL_LIST(ammo) ammo_overlays.Cut() . = ..() diff --git a/code/modules/projectiles/guns/launcher/rocket.dm b/code/modules/projectiles/guns/launcher/rocket.dm index 1743699d964..fd2a31ced2a 100644 --- a/code/modules/projectiles/guns/launcher/rocket.dm +++ b/code/modules/projectiles/guns/launcher/rocket.dm @@ -19,6 +19,10 @@ var/max_rockets = 1 var/list/rockets = new/list() +/obj/item/gun/launcher/rocket/Destroy() + QDEL_LIST(rockets) + return ..() + /obj/item/gun/launcher/rocket/feedback_hints(mob/user, distance, is_adjacent) . += ..() if(is_adjacent) diff --git a/html/changelogs/johnwildkins-lag5.yml b/html/changelogs/johnwildkins-lag5.yml new file mode 100644 index 00000000000..80715f3e6a3 --- /dev/null +++ b/html/changelogs/johnwildkins-lag5.yml @@ -0,0 +1,14 @@ +# Your name. +author: JohnWildkins + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit. +# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog. +changes: + - refactor: "Improved garbage collection on ammo piles, rocket launchers, and mob spawners to reduce server lag spikes." + - refactor: "Refactored status displays so they don't create 50 overlays a second."