Merge pull request #6961 from Fox-McCloud/garbage-collect-stuffs

Garbage Collection and Code Cleanup
This commit is contained in:
Crazy Lemon
2017-04-01 22:58:52 -07:00
committed by GitHub
36 changed files with 231 additions and 164 deletions
+5
View File
@@ -8,6 +8,11 @@
var/mob/owner = null // Carp doesn't attack owner, set when using in hand
var/owned = 1 // Boolean, no owner to begin with
/obj/item/toy/carpplushie/dehy_carp/Destroy()
owner = null
return ..()
// Attack self
/obj/item/toy/carpplushie/dehy_carp/attack_self(mob/user as mob)
src.add_fingerprint(user) // Anyone can add their fingerprints to it with this
-87
View File
@@ -1,87 +0,0 @@
#define MODKIT_HELMET 1
#define MODKIT_SUIT 2
#define MODKIT_FULL 3
/obj/item/device/modkit
name = "hardsuit modification kit"
desc = "A kit containing all the needed tools and parts to modify a hardsuit for another user."
icon_state = "modkit"
var/parts = MODKIT_FULL
var/target_species = "Human"
var/list/permitted_types = list(
/obj/item/clothing/head/helmet/space/hardsuit,
/obj/item/clothing/suit/space/hardsuit
)
/obj/item/device/modkit/afterattack(obj/item/O, mob/user as mob, proximity)
if(!proximity)
return
if(!target_species)
return //it shouldn't be null, okay?
if(!parts)
to_chat(user, "<span class='warning'>This kit has no parts for this modification left.</span>")
user.unEquip(src)
qdel(src)
return
var/allowed = 0
for(var/permitted_type in permitted_types)
if(istype(O, permitted_type))
allowed = 1
var/obj/item/clothing/I = O
if(!istype(I) || !allowed)
to_chat(user, "<span class='notice'>[src] is unable to modify that.</span>")
return
var/excluding = ("exclude" in I.species_restricted)
var/in_list = (target_species in I.species_restricted)
if(excluding ^ in_list)
to_chat(user, "<span class='notice'>[I] is already modified.</span>")
return
if(!isturf(O.loc))
to_chat(user, "<span class='warning'>[O] must be safely placed on the ground for modification.</span>")
return
playsound(user.loc, O.usesound, 100, 1)
user.visible_message("\red [user] opens \the [src] and modifies \the [O].","\red You open \the [src] and modify \the [O].")
I.refit_for_species(target_species)
if(istype(I, /obj/item/clothing/head/helmet))
parts &= ~MODKIT_HELMET
if(istype(I, /obj/item/clothing/suit))
parts &= ~MODKIT_SUIT
if(!parts)
user.unEquip(src)
qdel(src)
/obj/item/device/modkit/examine(mob/user)
..(user)
to_chat(user, "It looks as though it modifies hardsuits to fit [target_species] users.")
/obj/item/device/modkit/tajaran
name = "Tajaran hardsuit modification kit"
desc = "A kit containing all the needed tools and parts to modify a hardsuit for another user. This one looks like it's meant for Tajaran."
target_species = "Tajaran"
/obj/item/device/modkit/unathi
name = "Unathi hardsuit modification kit"
desc = "A kit containing all the needed tools and parts to modify a hardsuit for another species. This one looks like it's meant for Unathi."
target_species = "Unathi"
/obj/item/device/modkit/skrell
name = "Skrell hardsuit modification kit"
desc = "A kit containing all the needed tools and parts to modify a hardsuit for another species. This one looks like it's meant for Skrell."
target_species = "Skrell"
/obj/item/device/modkit/vox
name = "Vox hardsuit modification kit"
desc = "A kit containing all the needed tools and parts to modify a hardsuit for another species. This one looks like it's meant for Vox."
target_species = "Vox"
+5 -2
View File
@@ -32,6 +32,9 @@
// Syndicate device disguised as a multitool; it will turn red when an AI camera is nearby.
/obj/item/device/multitool/Destroy()
buffer = null
return ..()
/obj/item/device/multitool/ai_detect
var/track_cooldown = 0
@@ -56,7 +59,7 @@
multitool_detect()
icon_state = "[initial(icon_state)][detect_state]"
track_cooldown = world.time + track_delay
/obj/item/device/multitool/ai_detect/proc/multitool_detect()
var/turf/our_turf = get_turf(src)
for(var/mob/living/silicon/ai/AI in ai_list)
@@ -76,7 +79,7 @@
if(get_dist(our_turf, detect_turf) < rangewarning)
detect_state = PROXIMITY_NEAR
break
/obj/item/device/multitool/ai_detect/admin
desc = "Used for pulsing wires to test which to cut. Not recommended by doctors. Has a strange tag that says 'Grief in Safety'" //What else should I say for a meme item?
track_delay = 5
@@ -27,6 +27,8 @@
/obj/item/device/powersink/Destroy()
processing_objects.Remove(src)
processing_power_items.Remove(src)
PN = null
attached = null
return ..()
/obj/item/device/powersink/attackby(var/obj/item/I, var/mob/user)
+1
View File
@@ -48,6 +48,7 @@ LIGHTERS ARE IN LIGHTERS.DM
/obj/item/clothing/mask/cigarette/Destroy()
if(reagents)
qdel(reagents)
reagents = null
processing_objects -= src
return ..()
@@ -18,10 +18,11 @@
..()
/obj/item/weapon/grenade/plastic/Destroy()
qdel(nadeassembly)
nadeassembly = null
if(nadeassembly)
qdel(nadeassembly)
nadeassembly = null
target = null
..()
return ..()
/obj/item/weapon/grenade/plastic/attackby(obj/item/I, mob/user, params)
if(!nadeassembly && istype(I, /obj/item/device/assembly_holder))
@@ -34,6 +34,7 @@
if(ptank)
qdel(ptank)
ptank = null
previousturf = null
return ..()
@@ -13,6 +13,10 @@
var/improvised = 0
var/garrote_time
/obj/item/weapon/twohanded/garrote/Destroy()
strangling = null
return ..()
/obj/item/weapon/twohanded/garrote/update_icon()
if(strangling) // If we're strangling someone we want our icon to stay wielded
icon_state = "garrot_unwrap"
@@ -26,6 +26,14 @@
payload_name += " " // formatting, ignore me
update_icon()
/obj/item/weapon/grenade/chem_grenade/Destroy()
if(nadeassembly)
qdel(nadeassembly)
nadeassembly = null
for(var/thing in beakers)
qdel(thing)
beakers.Cut()
return ..()
/obj/item/weapon/grenade/chem_grenade/examine(mob/user)
..(user)
@@ -13,6 +13,12 @@
var/list/signs = list()
var/max_signs = 20
/obj/item/weapon/holosign_creator/Destroy()
for(var/sign in signs)
qdel(sign)
signs.Cut()
return ..()
/obj/item/weapon/holosign_creator/afterattack(atom/target, mob/user, flag)
if(flag)
var/turf/T = get_turf(target)
+1
View File
@@ -18,6 +18,7 @@
var/mopspeed = 30
/obj/item/weapon/mop/New()
..()
create_reagents(mopcap)
janitorial_equipment += src
+8 -2
View File
@@ -201,11 +201,17 @@
stunforce = 5
hitcost = 3750
slot_flags = SLOT_BACK
var/obj/item/device/assembly/igniter/sparkler = 0
var/obj/item/device/assembly/igniter/sparkler = null
/obj/item/weapon/melee/baton/cattleprod/New()
..()
sparkler = new (src)
sparkler = new(src)
/obj/item/weapon/melee/baton/cattleprod/Destroy()
if(sparkler)
qdel(sparkler)
sparkler = null
return ..()
/obj/item/weapon/melee/baton/cattleprod/baton_stun()
if(sparkler.activate())