From d326af2ca7774e1a1d07e316351fa043e5eb67f8 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Tue, 15 Oct 2024 18:48:15 -0500 Subject: [PATCH] Bunch of harddel fixes --- code/datums/action.dm | 14 +++++------- code/datums/components/remote_materials.dm | 9 +++++--- .../objects/items/implants/implant_misc.dm | 4 ++++ .../atmospherics/machinery/airalarm.dm | 3 +-- code/modules/clothing/under/accessories.dm | 4 ++++ .../hostile/mining_mobs/gutlunch.dm | 22 ++++++++++--------- code/modules/power/singularity/emitter.dm | 1 + .../boxes_magazines/_box_magazine.dm | 4 ++++ code/modules/projectiles/gun.dm | 22 +++++++++++++------ code/modules/surgery/organs/vocal_cords.dm | 5 +++++ 10 files changed, 58 insertions(+), 30 deletions(-) diff --git a/code/datums/action.dm b/code/datums/action.dm index 9bc58c399dd4..69a1cb96cdd0 100644 --- a/code/datums/action.dm +++ b/code/datums/action.dm @@ -366,16 +366,14 @@ /datum/action/item_action/nano_picket_sign name = "Retext Nano Picket Sign" - var/obj/item/picket_sign/S - -/datum/action/item_action/nano_picket_sign/New(Target) - ..() - if(istype(Target, /obj/item/picket_sign)) - S = Target + var/obj/item/picket_sign/sign /datum/action/item_action/nano_picket_sign/Trigger() - if(istype(S)) - S.retext(owner) + if(!istype(target, /obj/item/picket_sign)) + return + + var/obj/item/picket_sign/sign = target + sign.retext(owner) /datum/action/item_action/adjust diff --git a/code/datums/components/remote_materials.dm b/code/datums/components/remote_materials.dm index 2f3aa79749b2..16c695fe9c06 100644 --- a/code/datums/components/remote_materials.dm +++ b/code/datums/components/remote_materials.dm @@ -39,6 +39,7 @@ handles linking back and forth. // specify explicitly in case the other component is deleted first var/atom/P = parent mat_container.retrieve_all(P.drop_location()) + mat_container = null return ..() /datum/component/remote_materials/proc/_MakeLocal() @@ -77,9 +78,11 @@ handles linking back and forth. /datum/component/remote_materials/proc/OnAttackBy(datum/source, obj/item/I, mob/user) SIGNAL_HANDLER - if (silo && istype(I, /obj/item/stack)) - if (silo.remote_attackby(parent, user, I)) - return COMPONENT_NO_AFTERATTACK + if (!silo || !istype(I, /obj/item/stack)) + return + + if (silo.remote_attackby(parent, user, I)) + return COMPONENT_NO_AFTERATTACK /datum/component/remote_materials/proc/OnMultitool(datum/source, mob/user, obj/item/I) SIGNAL_HANDLER diff --git a/code/game/objects/items/implants/implant_misc.dm b/code/game/objects/items/implants/implant_misc.dm index c4c832209bac..d8f871e1ecc4 100644 --- a/code/game/objects/items/implants/implant_misc.dm +++ b/code/game/objects/items/implants/implant_misc.dm @@ -110,6 +110,10 @@ radio.keyslot = new radio_key radio.recalculateChannels() +/obj/item/implant/radio/Destroy() + QDEL_NULL(radio) + return ..() + /obj/item/implant/radio/mining radio_key = /obj/item/encryptionkey diff --git a/code/modules/atmospherics/machinery/airalarm.dm b/code/modules/atmospherics/machinery/airalarm.dm index 236c7b040d99..a95e153c0e14 100644 --- a/code/modules/atmospherics/machinery/airalarm.dm +++ b/code/modules/atmospherics/machinery/airalarm.dm @@ -239,8 +239,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/airalarm, 27) /obj/machinery/airalarm/Destroy() SSradio.remove_object(src, frequency) - qdel(wires) - wires = null + QDEL_NULL(wires) var/area/ourarea = get_area(src) ourarea.atmosalert(FALSE, src) return ..() diff --git a/code/modules/clothing/under/accessories.dm b/code/modules/clothing/under/accessories.dm index 0d05c4e0cf7f..89cce9c24d64 100644 --- a/code/modules/clothing/under/accessories.dm +++ b/code/modules/clothing/under/accessories.dm @@ -444,6 +444,10 @@ chameleon_action.chameleon_name = "Accessory" chameleon_action.initialize_disguises() +/obj/item/clothing/accessory/holster/chameleon/Destroy() + QDEL_NULL(chameleon_action) + return ..() + /obj/item/clothing/accessory/holster/chameleon/emp_act(severity) . = ..() if(. & EMP_PROTECT_SELF) diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/gutlunch.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/gutlunch.dm index ee48ed624ee4..e7257c7d39c4 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/gutlunch.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/gutlunch.dm @@ -43,12 +43,16 @@ animal_species = /mob/living/simple_animal/hostile/asteroid/gutlunch childtype = list(/mob/living/simple_animal/hostile/asteroid/gutlunch/grublunch = 100) + var/mutable_appearance/gutlunch_full_overlay + wanted_objects = list(/obj/effect/decal/cleanable/xenoblood/xgibs, /obj/effect/decal/cleanable/blood/gibs/, /obj/item/organ, /obj/item/reagent_containers/food/snacks/meat/slab) /mob/living/simple_animal/hostile/asteroid/gutlunch/Initialize() . = ..() - if(wanted_objects.len) - AddComponent(/datum/component/udder, /obj/item/udder/gutlunch, CALLBACK(src, PROC_REF(regenerate_icons)), CALLBACK(src, PROC_REF(regenerate_icons))) + if(!length(wanted_objects)) + return + AddComponent(/datum/component/udder, /obj/item/udder/gutlunch, CALLBACK(src, TYPE_PROC_REF(/atom/movable, update_overlays)), CALLBACK(src, TYPE_PROC_REF(/atom/movable, update_overlays))) + gutlunch_full_overlay = mutable_appearance(icon, "gl_full") /mob/living/simple_animal/hostile/asteroid/gutlunch/CanAttack(atom/the_target) // Gutlunch-specific version of CanAttack to handle stupid stat_exclusive = true crap so we don't have to do it for literally every single simple_animal/hostile except the two that spawn in lavaland if(isturf(the_target) || !the_target || the_target.type == /atom/movable/lighting_object) // bail out on invalids @@ -72,14 +76,12 @@ return FALSE -/mob/living/simple_animal/hostile/asteroid/gutlunch/regenerate_icons(new_udder_volume, max_udder_volume) - cut_overlays() - var/static/gutlunch_full_overlay - if(isnull(gutlunch_full_overlay)) - gutlunch_full_overlay = iconstate2appearance(icon, "gl_full") - if(new_udder_volume == max_udder_volume) - add_overlay(gutlunch_full_overlay) - ..() +/mob/living/simple_animal/hostile/asteroid/gutlunch/update_overlays(new_udder_volume, max_udder_volume) + . = ..() + if(new_udder_volume != max_udder_volume) + return + + . += gutlunch_full_overlay //Male gutlunch. They're smaller and more colorful! /mob/living/simple_animal/hostile/asteroid/gutlunch/gubbuck diff --git a/code/modules/power/singularity/emitter.dm b/code/modules/power/singularity/emitter.dm index 73920780bef3..a6cd227550ec 100644 --- a/code/modules/power/singularity/emitter.dm +++ b/code/modules/power/singularity/emitter.dm @@ -119,6 +119,7 @@ log_game("Emitter deleted at [AREACOORD(T)]") investigate_log("deleted at [AREACOORD(T)]", INVESTIGATE_SINGULO) QDEL_NULL(sparks) + QDEL_NULL(wires) return ..() /obj/machinery/power/emitter/update_icon_state() diff --git a/code/modules/projectiles/boxes_magazines/_box_magazine.dm b/code/modules/projectiles/boxes_magazines/_box_magazine.dm index 57fb71d17f32..73a626721f4b 100644 --- a/code/modules/projectiles/boxes_magazines/_box_magazine.dm +++ b/code/modules/projectiles/boxes_magazines/_box_magazine.dm @@ -73,6 +73,10 @@ for(var/i = max(1, stored_ammo.len), i <= max_ammo, i++) stored_ammo += new round_check(src) +/obj/item/ammo_box/Destroy() + stored_ammo.Cut() + return ..() + ///gets a round from the magazine, if keep is TRUE the round will stay in the gun /obj/item/ammo_box/proc/get_round(keep = FALSE) if(!stored_ammo.len) diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index f848018a6115..fb2e90d1f518 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -262,8 +262,6 @@ */ ///The types of attachments allowed, a list of types. SUBTYPES OF AN ALLOWED TYPE ARE ALSO ALLOWED var/list/valid_attachments = list() - ///Reference to our attachment holder to prevent subtypes having to call GetComponent - var/datum/component/attachment_holder/attachment_holder ///Number of attachments that can fit on a given slot var/list/slot_available = ATTACHMENT_DEFAULT_SLOT_AVAILABLE ///Offsets for the slots on this gun. should be indexed by SLOT and then by X/Y @@ -339,7 +337,7 @@ /obj/item/gun/ComponentInitialize() . = ..() - attachment_holder = AddComponent(/datum/component/attachment_holder, slot_available, valid_attachments, slot_offsets, default_attachments) + AddComponent(/datum/component/attachment_holder, slot_available, valid_attachments, slot_offsets, default_attachments) AddComponent(/datum/component/two_handed) /// triggered on wield of two handed item @@ -384,6 +382,8 @@ QDEL_NULL(azoom) if(muzzle_flash) QDEL_NULL(muzzle_flash) + if(magazine) + QDEL_NULL(magazine) return ..() /obj/item/gun/handle_atom_del(atom/A) @@ -1011,6 +1011,10 @@ var/obj/item/gun/gun = null /datum/action/toggle_scope_zoom/Trigger() + if(!istype(target, /obj/item/gun) || !..()) + return + + var/obj/item/gun/gun = target gun.zoom(owner, owner.dir) /datum/action/toggle_scope_zoom/IsAvailable() @@ -1018,8 +1022,13 @@ if(!. && gun) gun.zoom(owner, owner.dir, FALSE) -/datum/action/toggle_scope_zoom/Remove(mob/living/L) - gun.zoom(L, L.dir, FALSE) +/datum/action/toggle_scope_zoom/Remove(mob/user) + if(!istype(target, /obj/item/gun)) + return ..() + + var/obj/item/gun/gun = target + gun.zoom(user, user.dir, FALSE) + ..() /obj/item/gun/proc/rotate(atom/thing, old_dir, new_dir) @@ -1056,8 +1065,7 @@ return if(zoomable) - azoom = new() - azoom.gun = src + azoom = new(src) /obj/item/gun/proc/build_firemodes() if(FIREMODE_FULLAUTO in gun_firemodes) diff --git a/code/modules/surgery/organs/vocal_cords.dm b/code/modules/surgery/organs/vocal_cords.dm index b86c5b8b86ce..ff1f9baea298 100644 --- a/code/modules/surgery/organs/vocal_cords.dm +++ b/code/modules/surgery/organs/vocal_cords.dm @@ -37,6 +37,11 @@ name = "Voice of God" var/obj/item/organ/vocal_cords/colossus/cords = null +/datum/action/item_action/organ_action/colossus/Destroy() + if(cords) + QDEL_NULL(cords) + return ..() + /datum/action/item_action/organ_action/colossus/New() ..() cords = target