Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down