Makes Stacks Garbage Collect

This commit is contained in:
Fox McCloud
2018-04-06 19:32:08 -04:00
parent 639c40d140
commit af7abe2679
4 changed files with 15 additions and 13 deletions
+2 -1
View File
@@ -5,7 +5,8 @@
icon = 'icons/obj/nanopaste.dmi'
icon_state = "tube"
origin_tech = "materials=2;engineering=3"
amount = 10
amount = 6
max_amount = 6
toolspeed = 1
/obj/item/stack/nanopaste/attack(mob/living/M as mob, mob/user as mob)
+8 -6
View File
@@ -26,8 +26,7 @@
/obj/item/stack/Destroy()
if(usr && usr.machine == src)
usr << browse(null, "window=stack")
..()
return QDEL_HINT_HARDDEL_NOW // because qdel'd stacks act strange for cyborgs
return ..()
/obj/item/stack/examine(mob/user)
if(..(user, 1))
@@ -195,15 +194,18 @@
interact(usr)
return
/obj/item/stack/proc/use(var/used)
/obj/item/stack/proc/use(used)
if(amount < used)
return 0
amount -= used
if(amount < 1) // Just in case a stack's amount ends up fractional somehow
if(isrobot(loc))
var/mob/living/silicon/robot/R = loc //Horrifying cyborg snowflake code that allows stacks to GC and cyborgs not to horrendously break
if(locate(src) in R.module.modules)
R.module.modules -= src
if(usr)
usr.unEquip(src, 1)
spawn()
qdel(src)
usr.unEquip(src, TRUE) // this has to be unEquip() over drop_item() or something similar because of cyborgs
qdel(src)
update_icon()
return 1
@@ -233,7 +233,7 @@
/mob/living/silicon/robot/unEquip(obj/item/I)
if(I == module_active)
deselect_module(get_selected_module())
uneq_active(I)
return ..()
/mob/living/silicon/robot/proc/update_module_icon()
@@ -54,7 +54,6 @@
var/obj/item/stack/S = O
if(!S)
modules -= null
S = new T(src)
modules += S
S.amount = 1
@@ -124,10 +123,10 @@
module_type = "Medical"
subsystems = list(/mob/living/silicon/proc/subsystem_crew_monitor)
stacktypes = list(
/obj/item/stack/medical/bruise_pack/advanced = 5,
/obj/item/stack/medical/ointment/advanced = 5,
/obj/item/stack/medical/splint = 5,
/obj/item/stack/nanopaste = 5
/obj/item/stack/medical/bruise_pack/advanced = 6,
/obj/item/stack/medical/ointment/advanced = 6,
/obj/item/stack/medical/splint = 6,
/obj/item/stack/nanopaste = 6
)
/obj/item/weapon/robot_module/medical/New()