diff --git a/code/game/machinery/computer/message.dm b/code/game/machinery/computer/message.dm index 465bd187912..6bab0b713d4 100644 --- a/code/game/machinery/computer/message.dm +++ b/code/game/machinery/computer/message.dm @@ -45,6 +45,7 @@ RegisterSignal(linkedServer, COMSIG_PARENT_QDELETING, .proc/unlink_server) /obj/machinery/computer/message_monitor/proc/unlink_server() + SIGNAL_HANDLER linkedServer = null /obj/machinery/computer/message_monitor/Destroy() diff --git a/code/modules/arcade/mob_hunt/mob_avatar.dm b/code/modules/arcade/mob_hunt/mob_avatar.dm index 5411d686b51..19f792af763 100644 --- a/code/modules/arcade/mob_hunt/mob_avatar.dm +++ b/code/modules/arcade/mob_hunt/mob_avatar.dm @@ -16,6 +16,7 @@ if(!new_info) return INITIALIZE_HINT_QDEL mob_info = new_info + RegisterSignal(mob_info, COMSIG_PARENT_QDELETING, .proc/delete_wrapper) update_self() forceMove(mob_info.spawn_point) if(!mob_info.is_trap) @@ -24,11 +25,15 @@ /obj/effect/nanomob/Destroy() SSmob_hunt.trap_spawns -= src SSmob_hunt.normal_spawns -= src + mob_info = null // Can't delete this since multiple players can get the exact same /datum/mob_hunt. (This should be refactored) clients_encountered.Cut() - QDEL_NULL(mob_info) - qdel(avatar) + QDEL_NULL(avatar) return ..() +/obj/effect/nanomob/proc/delete_wrapper() + SIGNAL_HANDLER + qdel(src) + /obj/effect/nanomob/proc/update_self() if(!mob_info) return diff --git a/code/modules/mob/living/simple_animal/hostile/bat.dm b/code/modules/mob/living/simple_animal/hostile/bat.dm index 1cc904f1017..9e5ae1e2ec1 100644 --- a/code/modules/mob/living/simple_animal/hostile/bat.dm +++ b/code/modules/mob/living/simple_animal/hostile/bat.dm @@ -33,27 +33,16 @@ // break_stuff_probability = 2 faction = list("scarybat") - var/mob/living/owner gold_core_spawnable = HOSTILE_SPAWN -/mob/living/simple_animal/hostile/scarybat/New(loc, mob/living/L as mob) - ..() +/mob/living/simple_animal/hostile/scarybat/Initialize(mapload, mob/living/L) + . = ..() if(istype(L)) - owner = L + faction += "\ref[L]" /mob/living/simple_animal/hostile/scarybat/Process_Spacemove(check_drift = 0) return ..() //No drifting in space for space carp! //original comments do not steal -/mob/living/simple_animal/hostile/scarybat/Found(atom/A)//This is here as a potential override to pick a specific target if available - if(istype(A) && A == owner) - return 0 - return ..() - -/mob/living/simple_animal/hostile/scarybat/CanAttack(atom/the_target)//This is here as a potential override to pick a specific target if available - if(istype(the_target) && the_target == owner) - return 0 - return ..() - /mob/living/simple_animal/hostile/scarybat/AttackingTarget() . =..() var/mob/living/L = . diff --git a/code/modules/pda/mob_hunt_game_app.dm b/code/modules/pda/mob_hunt_game_app.dm index 50b5350651a..8b5f081ee97 100644 --- a/code/modules/pda/mob_hunt_game_app.dm +++ b/code/modules/pda/mob_hunt_game_app.dm @@ -79,13 +79,14 @@ return scan_nearby() -/datum/data/pda/app/mob_hunter_game/proc/register_capture(datum/mob_hunt/captured, wild = 0) +/datum/data/pda/app/mob_hunter_game/proc/register_capture(datum/mob_hunt/captured, wild = FALSE) if(!captured) - return 0 - my_collection.Add(captured) + return FALSE + my_collection += captured + RegisterSignal(captured, COMSIG_PARENT_QDELETING, .proc/remove_mob) if(wild) wild_captures++ - return 1 + return TRUE /datum/data/pda/app/mob_hunter_game/update_ui(mob/user, list/data) if(!SSmob_hunt || !(src in SSmob_hunt.connected_clients)) @@ -143,12 +144,27 @@ card.forceMove(get_turf(pda)) remove_mob() -/datum/data/pda/app/mob_hunter_game/proc/remove_mob() - if(!my_collection.len) +/** + * Removes a Nanomob from the [my_collection] list. + * + * The Nanomob that is currently selected in the app ([current_index]) will be removed from the list unless a `mob_override` argument is given, in which case that will be removed instead. + * + * Arguments: + * * mob_override - A specific Nanomob to remove from the list. (Optional) + */ +/datum/data/pda/app/mob_hunter_game/proc/remove_mob(datum/mob_hunt/mob_override = null) + SIGNAL_HANDLER + var/collection_length = length(my_collection) + if(!collection_length) return - my_collection.Remove(my_collection[current_index]) - if(current_index > my_collection.len) - current_index = my_collection.len + + if(mob_override) + my_collection -= mob_override + else + my_collection -= my_collection[current_index] + + if(current_index > collection_length) + current_index = collection_length /datum/data/pda/app/mob_hunter_game/proc/set_trap() if(!my_collection.len || !pda || !hacked) diff --git a/code/modules/research/rdmachines.dm b/code/modules/research/rdmachines.dm index ee15317f928..3fba5e8093a 100644 --- a/code/modules/research/rdmachines.dm +++ b/code/modules/research/rdmachines.dm @@ -32,12 +32,9 @@ wires["Black"] = 0 wires["White"] = 0 var/list/w = list("Red","Blue","Green","Yellow","Black","White") - hack_wire = pick(w) - w -= hack_wire - shock_wire = pick(w) - w -= shock_wire - disable_wire = pick(w) - w -= disable_wire + hack_wire = pick_n_take(w) + shock_wire = pick_n_take(w) + disable_wire = pick_n_take(w) /obj/machinery/r_n_d/Destroy() if(loaded_item)