From cc85cee9ee49f952c9404e298f986abcfc03d7e3 Mon Sep 17 00:00:00 2001 From: SabreML <57483089+SabreML@users.noreply.github.com> Date: Sat, 28 Aug 2021 21:06:19 +0100 Subject: [PATCH] Nanomob --- code/modules/arcade/mob_hunt/mob_avatar.dm | 19 +++++++++---------- code/modules/pda/mob_hunt_game_app.dm | 6 ++++++ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/code/modules/arcade/mob_hunt/mob_avatar.dm b/code/modules/arcade/mob_hunt/mob_avatar.dm index 7f7f53d3199..9ce8de159af 100644 --- a/code/modules/arcade/mob_hunt/mob_avatar.dm +++ b/code/modules/arcade/mob_hunt/mob_avatar.dm @@ -12,17 +12,22 @@ var/list/clients_encountered = list() //tracks who has already interacted with us, so they can't attempt a second capture var/image/avatar -/obj/effect/nanomob/New(loc, datum/mob_hunt/new_info) - ..() +/obj/effect/nanomob/Initialize(mapload, datum/mob_hunt/new_info) + . = ..() if(!new_info) - qdel(src) - return + return INITIALIZE_HINT_QDEL mob_info = new_info update_self() forceMove(mob_info.spawn_point) if(!mob_info.is_trap) addtimer(CALLBACK(src, .proc/despawn), mob_info.lifetime) +/obj/effect/nanomob/Destroy() + if(SSmob_hunt) + SSmob_hunt.trap_spawns -= src + SSmob_hunt.normal_spawns -= src + return ..() + /obj/effect/nanomob/proc/update_self() if(!mob_info) return @@ -132,12 +137,6 @@ icon_state = "placeholder" var/obj/machinery/computer/mob_battle_terminal/my_terminal -/obj/effect/nanomob/battle/New(loc, datum/mob_hunt/new_info) - . = ..() - if(new_info) - mob_info = new_info - update_self() - /obj/effect/nanomob/battle/update_self() if(!mob_info) name = "Nano-Mob Battle Avatar" diff --git a/code/modules/pda/mob_hunt_game_app.dm b/code/modules/pda/mob_hunt_game_app.dm index 5db744c37ef..18c235cbeae 100644 --- a/code/modules/pda/mob_hunt_game_app.dm +++ b/code/modules/pda/mob_hunt_game_app.dm @@ -28,6 +28,12 @@ disconnect("Program Terminated") STOP_PROCESSING(SSobj, pda) +/datum/data/pda/app/mob_hunter_game/Destroy() + STOP_PROCESSING(SSobj, pda) + if(SSmob_hunt) + SSmob_hunt.connected_clients -= src + return ..() + /datum/data/pda/app/mob_hunter_game/proc/scan_nearby() if(!SSmob_hunt || !connected) return