[Ready] AI building fixes: Runtimes when adding AI law modules, Syndicate modules work during building again, Helpful messages for freeform modules. (#17935)

* Fixes rumtimes when adding AI law modules while building AI

* Syndicate AI modules now can be used during AI construction

Freeform modules now provide helpful messages if you try to use empty
module on the AI during construction

Co-authored-by: Kugamo <thekugamo@gmail.com>
This commit is contained in:
alex-gh
2022-06-14 13:31:18 +01:00
committed by GitHub
co-authored by Kugamo
parent 01a5869cce
commit 821b324e6a
2 changed files with 16 additions and 2 deletions
+15 -1
View File
@@ -6,7 +6,7 @@
icon_state = "0"
max_integrity = 500
var/state = 0
var/datum/ai_laws/laws = null
var/datum/ai_laws/laws = new /datum/ai_laws/crewsimov()
var/obj/item/circuitboard/aicore/circuit = null
var/obj/item/mmi/brain = null
@@ -63,16 +63,30 @@
if(istype(P, /obj/item/aiModule/freeform))
var/obj/item/aiModule/freeform/M = P
if(!M.newFreeFormLaw)
to_chat(usr, "No law detected on module, please create one.")
return
laws.add_inherent_law(M.newFreeFormLaw)
to_chat(usr, "<span class='notice'>Added a freeform law.</span>")
return
if(istype(P, /obj/item/aiModule/syndicate))
var/obj/item/aiModule/syndicate/M = P
if(!M.newFreeFormLaw)
to_chat(usr, "No law detected on module, please create one.")
return
laws.add_ion_law(M.newFreeFormLaw)
to_chat(usr, "<span class='notice'>Added a hacked law.</span>")
return
if(istype(P, /obj/item/aiModule))
var/obj/item/aiModule/M = P
if(!M.laws)
to_chat(usr, "<span class='warning'>This AI module can not be applied directly to AI cores.</span>")
return
laws = M.laws
to_chat(usr, "<span class='notice'>Added [M.laws.name] laws.</span>")
return
if(istype(P, /obj/item/mmi) && !brain)
var/obj/item/mmi/M = P
@@ -188,7 +188,7 @@ AI MODULES
/****************** New Freeform ******************/
/obj/item/aiModule/freeform // Slightly more dynamic freeform module -- TLE
name = "\improper Freeform AI module"
var/newFreeFormLaw = "freeform"
var/newFreeFormLaw = ""
var/lawpos = 15
desc = "A 'freeform' AI module: '<freeform>'"
origin_tech = "programming=4;materials=4"