diff --git a/code/modules/mob/living/silicon/ai/decentralized/decentralized_os.dm b/code/modules/mob/living/silicon/ai/decentralized/decentralized_os.dm index 8fbd22d0cff4..42ba34b5257f 100644 --- a/code/modules/mob/living/silicon/ai/decentralized/decentralized_os.dm +++ b/code/modules/mob/living/silicon/ai/decentralized/decentralized_os.dm @@ -31,8 +31,8 @@ GLOBAL_DATUM_INIT(ai_os, /datum/ai_os, new) /datum/ai_os/proc/total_ram_assigned() var/total = 0 - for(var/N in ram_assigned) - total += ram_assigned[N] + for(var/mob/living/silicon/ai/AI in ram_assigned) + total += (ram_assigned[AI] - AI.dashboard.free_ram) return total /datum/ai_os/proc/update_hardware() @@ -67,13 +67,13 @@ GLOBAL_DATUM_INIT(ai_os, /datum/ai_os, new) var/needed_amount = total_assigned_ram - total_ram for(var/A in ram_assigned_copy) var/mob/living/silicon/ai/AI = A - if(ram_assigned_copy[AI] >= needed_amount) + if((ram_assigned_copy[AI] - AI.dashboard.free_ram) >= needed_amount) ram_assigned_copy[AI] -= needed_amount total_assigned_ram -= needed_amount affected_AIs |= AI break else if(ram_assigned_copy[AI]) - var/amount = ram_assigned_copy[AI] + var/amount = ram_assigned_copy[AI] - AI.dashboard.free_ram ram_assigned_copy[AI] -= amount affected_AIs |= AI needed_amount -= amount