[MIRROR] Cyborg inventory runtime fix. (#813)

* Cyborg inventory runtime fix. (#53741)

Following the cyborg inventory refactor, code changed a bit.

Cyborg inventory screens are inited in the HUD, however AI Shells don't generate a HUD until an AI assumes direct control.

Damaging an AI shell before the AI created a HUD in it would cause runtimes as modules disabled and enabled.

To remedy this, we now initialize the core inventory slots on the robit Init() and then update them as necessary in the HUD code later on if an AI ever deigns to grace your shell with their exalted presence instead of asking for it and then never using it.

* Cyborg inventory runtime fix.

Co-authored-by: Timberpoes <silent_insomnia_pp@hotmail.co.uk>
This commit is contained in:
SkyratBot
2020-09-16 01:28:32 +01:00
committed by GitHub
co-authored by Timberpoes
parent ebaf0bf6b3
commit d87cbeeba3
2 changed files with 36 additions and 28 deletions
+10 -6
View File
@@ -114,6 +114,10 @@
robot_modules_background.layer = HUD_LAYER //Objects that appear on screen are on layer ABOVE_HUD_LAYER, UI should be just below it.
robot_modules_background.plane = HUD_PLANE
inv1 = new /obj/screen/robot/module1()
inv2 = new /obj/screen/robot/module2()
inv3 = new /obj/screen/robot/module3()
ident = rand(1, 999)
previous_health = health
@@ -188,12 +192,12 @@
if(T && istype(radio) && istype(radio.keyslot))
radio.keyslot.forceMove(T)
radio.keyslot = null
qdel(wires)
qdel(module)
qdel(eye_lights)
wires = null
module = null
eye_lights = null
QDEL_NULL(wires)
QDEL_NULL(module)
QDEL_NULL(eye_lights)
QDEL_NULL(inv1)
QDEL_NULL(inv2)
QDEL_NULL(inv3)
cell = null
return ..()