Fixes stacks acting strange for cyborgs

Robot modules weren't handling qdel'd stacks properly, so now they
simply don't get qdel'd. They shouldn't get deleted often enough for
this to hurt performance.

Also, the module slot of a stack will now be deselected when it's used
up, and it will show up immediately when respawned while recharging.
This commit is contained in:
Krausus
2015-06-08 06:37:52 -04:00
parent b4dd04dd85
commit 075f89fcb0
3 changed files with 14 additions and 4 deletions
+5 -4
View File
@@ -142,11 +142,11 @@
new_item.amount = R.res_amount*multiplier
//new_item.add_to_stacks(usr)
src.amount-=R.req_amount*multiplier
if (src.amount<=0)
if (src.amount < 1) // Just in case a stack's amount ends up fractional somehow
var/oldsrc = src
src = null //dont kill proc after del()
usr.unEquip(oldsrc, 1)
del(oldsrc)
del(oldsrc) // Not qdel, because qdel'd stacks act strange for cyborgs
if (istype(O,/obj/item))
usr.put_in_hands(O)
O.add_fingerprint(usr)
@@ -165,10 +165,11 @@
if (amount < used)
return 0
amount -= used
if (amount <= 0)
if (amount < 1) // Just in case a stack's amount ends up fractional somehow
if(usr)
usr.unEquip(src, 1)
qdel(src)
spawn()
del(src) // Not qdel, because qdel'd stacks act strange for cyborgs
update_icon()
return 1