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
@@ -220,3 +220,8 @@
while(slot_start != slot_num) //If we wrap around without finding any free slots, just give up.
return
/mob/living/silicon/robot/unEquip(obj/item/I)
if(I == module_active)
deselect_module(get_selected_module())
return ..()
@@ -37,6 +37,7 @@
if(!stacktypes || !stacktypes.len) return
var/stack_respawned = 0
for(var/T in stacktypes)
var/O = locate(T) in src.modules
var/obj/item/stack/S = O
@@ -46,9 +47,12 @@
S = new T(src)
src.modules += S
S.amount = 1
stack_respawned = 1
if(S && S.amount < stacktypes[T])
S.amount++
if(stack_respawned && istype(R) && R.hud_used)
R.hud_used.update_robot_modules_display()
/obj/item/weapon/robot_module/proc/rebuild()//Rebuilds the list so it's possible to add/remove items from the module
var/list/temp_list = modules