[MIRROR] Silicon deletion cleanup (#846)

* Silicon deletion cleanup (#53680)

Law datums were referencing owner
Law datums were not being delled
Some MMI code was organized strangely

* Silicon deletion cleanup

Co-authored-by: TiviPlus <57223640+TiviPlus@users.noreply.github.com>
This commit is contained in:
SkyratBot
2020-09-17 06:11:37 +02:00
committed by GitHub
co-authored by TiviPlus
parent 74f36957dd
commit 303f712ae1
5 changed files with 33 additions and 37 deletions
+17 -23
View File
@@ -14,6 +14,23 @@
var/force_replace_ai_name = FALSE
var/overrides_aicore_laws = FALSE // Whether the laws on the MMI, if any, override possible pre-existing laws loaded on the AI core.
/obj/item/mmi/Initialize()
. = ..()
radio = new(src) //Spawns a radio inside the MMI.
radio.broadcasting = FALSE //researching radio mmis turned the robofabs into radios because this didnt start as 0.
laws.set_laws_config()
/obj/item/mmi/Destroy()
if(iscyborg(loc))
var/mob/living/silicon/robot/borg = loc
borg.mmi = null
mecha = null
QDEL_NULL(brainmob)
QDEL_NULL(brain)
QDEL_NULL(radio)
QDEL_NULL(laws)
return ..()
/obj/item/mmi/update_icon_state()
if(!brain)
icon_state = "mmi_off"
@@ -32,12 +49,6 @@
else if(brain)
. += "mmi_dead"
/obj/item/mmi/Initialize()
. = ..()
radio = new(src) //Spawns a radio inside the MMI.
radio.broadcasting = FALSE //researching radio mmis turned the robofabs into radios because this didnt start as 0.
laws.set_laws_config()
/obj/item/mmi/attackby(obj/item/O, mob/user, params)
user.changeNext_move(CLICK_CD_MELEE)
if(istype(O, /obj/item/organ/brain)) //Time to stick a brain in it --NEO
@@ -184,23 +195,6 @@
brainmob.emp_damage = min(brainmob.emp_damage + rand(0,10), 30)
brainmob.emote("alarm")
/obj/item/mmi/Destroy()
if(iscyborg(loc))
var/mob/living/silicon/robot/borg = loc
borg.mmi = null
if(brainmob)
qdel(brainmob)
brainmob = null
if(brain)
qdel(brain)
brain = null
if(mecha)
mecha = null
if(radio)
qdel(radio)
radio = null
return ..()
/obj/item/mmi/deconstruct(disassembled = TRUE)
if(brain)
eject_brain()
@@ -45,7 +45,7 @@
/mob/living/silicon/robot/proc/lawsync()
laws_sanity_check()
var/datum/ai_laws/master = connected_ai ? connected_ai.laws : null
var/datum/ai_laws/master = connected_ai?.laws
var/temp
if (master)
laws.devillaws.len = master.devillaws.len
+7 -6
View File
@@ -59,20 +59,21 @@
diag_hud_set_health()
add_sensors()
/mob/living/silicon/med_hud_set_health()
return //we use a different hud
/mob/living/silicon/med_hud_set_status()
return //we use a different hud
/mob/living/silicon/Destroy()
QDEL_NULL(radio)
QDEL_NULL(aicamera)
QDEL_NULL(builtInCamera)
QDEL_NULL(aiPDA)
QDEL_NULL(laws)
GLOB.silicon_mobs -= src
return ..()
/mob/living/silicon/med_hud_set_health()
return //we use a different hud
/mob/living/silicon/med_hud_set_status()
return //we use a different hud
/mob/living/silicon/contents_explosion(severity, target)
return