APC-Rewrite AI fix.

Before:  AI's on new APC system would constantly add more and more power usage to the APC

After:   AI's no longer handle their power consumption, that has been pushed off to an /obj/machinery/ai_powersupply dummy object which will process the power usage.  This is much cleaner because machinery objects are already processed properly for the new system and keeps us from having to rewrite a bunch of AI code to bring the AI in line with how the new APC system works.

Conflicts:
	code/modules/mob/living/silicon/ai/ai.dm
This commit is contained in:
Ccomp5950
2014-03-13 22:57:59 -04:00
committed by ZomgPonies
parent f29440fced
commit 93d229004c
+35
View File
@@ -126,6 +126,10 @@ var/list/ai_list = list()
job = "AI"
spawn(5)
new /obj/machinery/ai_powersupply(src)
hud_list[HEALTH_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
hud_list[STATUS_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
hud_list[ID_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
@@ -145,6 +149,37 @@ var/list/ai_list = list()
..()
/*
The AI Power supply is a dummy object used for powering the AI since only machinery should be using power.
The alternative was to rewrite a bunch of AI code instead here we are.
*/
/obj/machinery/ai_powersupply
name="Power Supply"
active_power_usage=1000
use_power = 2
power_channel = EQUIP
var/mob/living/silicon/ai/powered_ai = null
invisibility = 100
/obj/machinery/ai_powersupply/New(var/mob/living/silicon/ai/ai=null)
powered_ai = ai
if(isnull(powered_ai))
Del()
loc = powered_ai.loc
use_power(1) // Just incase we need to wake up the power system.
..()
/obj/machinery/ai_powersupply/process()
if(!powered_ai || powered_ai.stat & DEAD)
Del()
if(!powered_ai.anchored)
loc = powered_ai.loc
use_power = 0
if(powered_ai.anchored)
use_power = 2
/mob/living/silicon/ai/verb/pick_icon()
set category = "AI Commands"
set name = "Set AI Core Display"