diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 154a7f047f3..8fd90aa5719 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -94,7 +94,7 @@ var/list/ai_list = list() /mob/living/silicon/ai/proc/ai_camera_list, /mob/living/silicon/ai/proc/ai_network_change, \ /mob/living/silicon/ai/proc/ai_statuschange, /mob/living/silicon/ai/proc/ai_hologram_change, \ /mob/living/silicon/ai/proc/toggle_camera_light) - + if(!safety)//Only used by AIize() to successfully spawn an AI. if (!B)//If there is no player/brain inside. @@ -116,6 +116,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") @@ -135,6 +139,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" diff --git a/code/modules/mob/living/silicon/ai/life.dm b/code/modules/mob/living/silicon/ai/life.dm index 37f0fdd1f8b..c2b6e6e189c 100644 --- a/code/modules/mob/living/silicon/ai/life.dm +++ b/code/modules/mob/living/silicon/ai/life.dm @@ -58,10 +58,20 @@ src.see_in_dark = 8 src.see_invisible = SEE_INVISIBLE_LEVEL_TWO + + //Congratulations! You've found a way for AI's to run without using power! + //Todo: Without snowflaking up master_controller procs find a way to make AI use_power but only when APC's clear the area usage the tick prior + // since mobs are in master_controller before machinery. We also have to do it in a manner where we don't reset the entire area's need to update + // the power usage. + // + // We can probably create a new machine that resides inside of the AI contents that uses power using the idle_usage of 1000 and nothing else and + // be fine. +/* var/area/home = get_area(src) if(!home) return//something to do with malf fucking things up I guess. <-- aisat is gone. is this still necessary? ~Carn if(home.powered(EQUIP)) home.use_power(1000, EQUIP) +*/ if (src:aiRestorePowerRoutine==2) src << "Alert cancelled. Power has been restored without our assistance." @@ -168,4 +178,4 @@ if(fire_res_on_core) health = 100 - getOxyLoss() - getToxLoss() - getBruteLoss() else - health = 100 - getOxyLoss() - getToxLoss() - getFireLoss() - getBruteLoss() \ No newline at end of file + health = 100 - getOxyLoss() - getToxLoss() - getFireLoss() - getBruteLoss()