From 20ab3ee64d0024a5d2b7668babf914ac483c8e9e Mon Sep 17 00:00:00 2001 From: Fox McCloud Date: Thu, 11 May 2017 21:50:43 -0400 Subject: [PATCH] Makes Clothing Accessories, Clothing with Accessories, Blood, and Spiderlings GC (#7272) * Makes Clothing Accessories and Clothing with Accessories GC * and spiderlings, apparently * BLOOOD FINALLY GARBAGE COLLECTS!!!! --- .../game/objects/effects/decals/Cleanable/humans.dm | 11 ++++++----- code/game/objects/effects/spiders.dm | 5 +++-- code/modules/clothing/clothing.dm | 4 ++++ .../modules/clothing/under/accessories/accessory.dm | 13 ++++++++++--- code/modules/clothing/under/accessories/holster.dm | 4 ++++ code/modules/clothing/under/accessories/storage.dm | 4 ++++ 6 files changed, 31 insertions(+), 10 deletions(-) diff --git a/code/game/objects/effects/decals/Cleanable/humans.dm b/code/game/objects/effects/decals/Cleanable/humans.dm index ed322d99564..37063b8a90b 100644 --- a/code/game/objects/effects/decals/Cleanable/humans.dm +++ b/code/game/objects/effects/decals/Cleanable/humans.dm @@ -20,6 +20,7 @@ var/global/list/image/splatter_cache=list() var/basecolor="#A10808" // Color when wet. var/amount = 5 appearance_flags = NO_CLIENT_COLOR + var/dry_timer = 0 /obj/effect/decal/cleanable/blood/New() ..() @@ -41,8 +42,7 @@ var/global/list/image/splatter_cache=list() if(B.blood_DNA) blood_DNA |= B.blood_DNA.Copy() qdel(B) - spawn(DRYING_TIME * (amount+1)) - dry() + dry_timer = addtimer(src, "dry", DRYING_TIME * (amount+1)) /obj/effect/decal/cleanable/blood/Destroy() if(GAMEMODE_IS_CULT) @@ -51,7 +51,9 @@ var/global/list/image/splatter_cache=list() if(T && (is_station_level(T.z))) mode_ticker.bloody_floors -= T mode_ticker.blood_check() - .=..() + if(dry_timer) + deltimer(dry_timer) + return ..() /obj/effect/decal/cleanable/blood/update_icon() if(basecolor == "rainbow") basecolor = "#[pick(list("FF0000","FF7F00","FFFF00","00FF00","0000FF","4B0082","8F00FF"))]" @@ -137,8 +139,7 @@ var/global/list/image/splatter_cache=list() /obj/effect/decal/cleanable/blood/drip/New() ..() - spawn(1) - drips |= icon_state + drips |= icon_state /obj/effect/decal/cleanable/blood/writing icon_state = "tracks" diff --git a/code/game/objects/effects/spiders.dm b/code/game/objects/effects/spiders.dm index 0a9f49cd2d0..2265c166461 100644 --- a/code/game/objects/effects/spiders.dm +++ b/code/game/objects/effects/spiders.dm @@ -122,6 +122,7 @@ processing_objects.Add(src) /obj/structure/spider/spiderling/Destroy() + processing_objects.Remove(src) entry_vent = null return ..() @@ -234,7 +235,7 @@ icon_state = pick("cocoon1","cocoon2","cocoon3") /obj/structure/spider/cocoon/Destroy() - src.visible_message("\The [src] splits open.") + visible_message("[src] splits open.") for(var/atom/movable/A in contents) - A.loc = src.loc + A.forceMove(loc) return ..() diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index a9ada323869..914b3ed9209 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -587,6 +587,10 @@ BLIND // can't see anything var/rolled_down = 0 var/basecolor +/obj/item/clothing/under/Destroy() + QDEL_LIST(accessories) + return ..() + /obj/item/clothing/under/proc/can_attach_accessory(obj/item/clothing/accessory/A) if(istype(A)) .=1 diff --git a/code/modules/clothing/under/accessories/accessory.dm b/code/modules/clothing/under/accessories/accessory.dm index 4f844b8be78..81ffd08b176 100644 --- a/code/modules/clothing/under/accessories/accessory.dm +++ b/code/modules/clothing/under/accessories/accessory.dm @@ -15,6 +15,12 @@ ..() inv_overlay = image("icon" = 'icons/obj/clothing/ties_overlay.dmi', "icon_state" = "[item_color? "[item_color]" : "[icon_state]"]") +/obj/item/clothing/accessory/Destroy() + if(has_suit) + has_suit.accessories -= src + on_removed(null) + return ..() + //when user attached an accessory to S /obj/item/clothing/accessory/proc/on_attached(obj/item/clothing/under/S, mob/user as mob) if(!istype(S)) @@ -37,7 +43,7 @@ to_chat(user, "You attach [src] to [has_suit].") src.add_fingerprint(user) -/obj/item/clothing/accessory/proc/on_removed(mob/user as mob) +/obj/item/clothing/accessory/proc/on_removed(mob/user) if(!has_suit) return has_suit.overlays -= inv_overlay @@ -53,8 +59,9 @@ has_suit.armor[armor_type] -= armor[armor_type] has_suit = null - usr.put_in_hands(src) - src.add_fingerprint(user) + if(user) + user.put_in_hands(src) + add_fingerprint(user) /obj/item/clothing/accessory/attack(mob/living/carbon/human/H, mob/living/user) // This code lets you put accessories on other people by attacking their sprite with the accessory diff --git a/code/modules/clothing/under/accessories/holster.dm b/code/modules/clothing/under/accessories/holster.dm index ef106005bdc..cab12cba542 100644 --- a/code/modules/clothing/under/accessories/holster.dm +++ b/code/modules/clothing/under/accessories/holster.dm @@ -9,6 +9,10 @@ actions_types = list(/datum/action/item_action/accessory/holster) w_class = 3 // so it doesn't fit in pockets +/obj/item/clothing/accessory/holster/Destroy() + QDEL_NULL(holstered) + return ..() + //subtypes can override this to specify what can be holstered /obj/item/clothing/accessory/holster/proc/can_holster(obj/item/weapon/gun/W) if(!W.isHandgun()) diff --git a/code/modules/clothing/under/accessories/storage.dm b/code/modules/clothing/under/accessories/storage.dm index 72fbdbc9b92..fd335f43fb7 100644 --- a/code/modules/clothing/under/accessories/storage.dm +++ b/code/modules/clothing/under/accessories/storage.dm @@ -14,6 +14,10 @@ hold = new/obj/item/weapon/storage/internal(src) hold.storage_slots = slots +/obj/item/clothing/accessory/storage/Destroy() + QDEL_NULL(hold) + return ..() + /obj/item/clothing/accessory/storage/attack_hand(mob/user as mob) if(has_suit) //if we are part of a suit hold.open(user)