qdel and Destroy() improvements, now done through objects/items/devices

This commit is contained in:
d3athrow
2014-03-05 20:28:17 -05:00
committed by ZomgPonies
parent 19d339c45d
commit 4f168d8caf
10 changed files with 64 additions and 13 deletions
+1
View File
@@ -321,6 +321,7 @@ var/global/list/PDA_Manifest = list()
layer = 2.44 //Just below unary stuff, which is at 2.45 and above pipes, which are at 2.4
var/_color = "red"
var/obj/structure/powerswitch/power_switch
var/obj/item/device/powersink/attached // holding this here for qdel
/obj/structure/cable/yellow
_color = "yellow"
+13 -3
View File
@@ -41,14 +41,24 @@
var/obj/item/device/uplink/hidden/hidden_uplink = null // All items can have an uplink hidden inside, just remember to add the triggers.
/obj/item/Destroy()
if(istype(src.loc, /mob/living))
var/mob/living/H = src.loc
H.u_equip(src) // items at the very least get unequipped from their mob before being deleted
if(istype(src.loc, /mob))
var/mob/H = src.loc
H.drop_from_inventory(src) // items at the very least get unequipped from their mob before being deleted
if(istype(src.loc, /obj/item/assembly))
var/obj/item/assembly/A = src.loc
if(A.part1 == src)
A.part1 = null
else if(A.part2 == src)
A.part2 = null
master = null
if(reagents && istype(reagents))
reagents.my_atom = null
reagents.delete()
if(hasvar(src, "holder"))
src:holder = null
if(hasvar(src, "my_atom"))
src:my_atom = null
..()
/obj/item/device
@@ -1144,6 +1144,8 @@ var/global/list/obj/item/device/pda/PDAs = list()
PDAs -= src
if (src.id)
src.id.loc = get_turf(src.loc)
if(src.pai)
src.pai.loc = get_turf(src.loc)
..()
/obj/item/device/pda/clown/Crossed(AM as mob|obj) //Clown PDA is slippery.
+8 -1
View File
@@ -48,7 +48,10 @@
spawn(5)
if(radio_controller)
radio_controller.add_object(src, control_freq, filter = RADIO_SECBOT)
Destroy()
if(radio_controller)
radio_controller.remove_object(src, control_freq)
..()
// receive radio signals
// can detect bot status signals
// create/populate list as they are recvd
@@ -118,6 +121,10 @@
spawn(10)
post_signal(beacon_freq, "findbeacon", "delivery", s_filter = RADIO_NAVBEACONS)
Destroy()
if(radio_controller)
radio_controller.remove_object(src, control_freq)
radio_controller.remove_object(src, beacon_freq)
// receive radio signals
// can detect bot status signals
// and beacon locations
+8 -4
View File
@@ -120,7 +120,11 @@
overlays += image('icons/obj/aicards.dmi', "aicard-on")
attack_self(U)
/obj/item/device/aicard/ex_act(severity)
switch(severity)
if(1.0)
del(src)
if(2.0)
if(prob(50)) del(src)
if(3.0)
if(prob(25)) del(src)
+10 -2
View File
@@ -31,6 +31,7 @@
user << "No exposed cable here to attach to."
return
else
attached.attached = src
anchored = 1
mode = 1
user << "You attach the device to the cable."
@@ -47,6 +48,8 @@
anchored = 0
mode = 0
user << "You detach the device from the cable."
attached.attached = null
attached = null
for(var/mob/M in viewers(user))
if(M == user) continue
M << "[user] detaches the power sink from the cable."
@@ -57,7 +60,12 @@
else
..()
Destroy()
SetLuminosity(0)
processing_objects.Remove(src)
attached.attached = null
attached = null
..()
attack_paw()
return
@@ -117,4 +125,4 @@
if(power_drained >= max_power)
processing_objects.Remove(src)
explosion(src.loc, 3,6,9,12)
del(src)
qdel(src)
@@ -816,4 +816,10 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use
return
/obj/item/device/radio/off
listening = 0
listening = 0
/obj/item/device/radio/Destroy()
if(isrobot(src.loc))
var/mob/living/silicon/robot/R = src.loc
R.radio = null
..()
@@ -20,6 +20,11 @@ REAGENT SCANNER
m_amt = 150
origin_tech = "magnets=1;engineering=1"
/obj/item/device/t_scanner/Destroy()
if(on)
processing_objects.Remove(src)
..()
/obj/item/device/t_scanner/attack_self(mob/user)
on = !on
@@ -41,7 +41,7 @@
user << "<span class='notice'>The device is secured.</span>"
return
if(attached_device)
user << "<span class='warning'>There is already an device attached to the valve, remove it first.</span>"
user << "<span class='warning'>There is already a device attached to the valve, remove it first.</span>"
return
user.remove_from_mob(item)
attached_device = A
+9 -1
View File
@@ -90,6 +90,14 @@
if(powernet)
powernet.cut_cable(src) // update the powernets
cable_list -= src
if(istype(attached))
attached.SetLuminosity(0)
attached.icon_state = "powersink0"
attached.mode = 0
processing_objects.Remove(attached)
attached.anchored = 0
attached.attached = null
attached = null
..() // then go ahead and delete the cable
/obj/structure/cable/hide(var/i)
@@ -623,4 +631,4 @@ obj/structure/cable/proc/cableColor(var/colorC)
else
user << "Nothing to fix!"
else
return ..()
return ..()