Skip to content

Commit

Permalink
Bunch of harddel fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkSuckerberg committed Oct 15, 2024
1 parent 29ff69e commit d326af2
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 30 deletions.
14 changes: 6 additions & 8 deletions code/datums/action.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 6 additions & 3 deletions code/datums/components/remote_materials.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions code/game/objects/items/implants/implant_misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions code/modules/atmospherics/machinery/airalarm.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..()
Expand Down
4 changes: 4 additions & 0 deletions code/modules/clothing/under/accessories.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions code/modules/power/singularity/emitter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
log_game("Emitter deleted at [AREACOORD(T)]")
investigate_log("<font color='red'>deleted</font> at [AREACOORD(T)]", INVESTIGATE_SINGULO)
QDEL_NULL(sparks)
QDEL_NULL(wires)
return ..()

/obj/machinery/power/emitter/update_icon_state()
Expand Down
4 changes: 4 additions & 0 deletions code/modules/projectiles/boxes_magazines/_box_magazine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
22 changes: 15 additions & 7 deletions code/modules/projectiles/gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -1011,15 +1011,24 @@
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()
. = ..()
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)
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions code/modules/surgery/organs/vocal_cords.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d326af2

Please sign in to comment.