Artur
2020-09-02 18:48:09 +03:00
parent debc300563
commit c79e9fbc0b
13 changed files with 56 additions and 51 deletions

View File

@@ -197,10 +197,9 @@
var/list/banned_edits = list(NAMEOF(src, entries_by_type), NAMEOF(src, entries), NAMEOF(src, directory)) var/list/banned_edits = list(NAMEOF(src, entries_by_type), NAMEOF(src, entries), NAMEOF(src, directory))
return !(var_name in banned_edits) && ..() return !(var_name in banned_edits) && ..()
/datum/controller/configuration/stat_entry() /datum/controller/configuration/stat_entry(msg)
if(!statclick) msg = "Edit"
statclick = new/obj/effect/statclick/debug(null, "Edit", src) return msg
stat("[name]:", statclick)
/// Your typical GET but returns a config. /// Your typical GET but returns a config.
/datum/controller/configuration/proc/GetEntryDatum(entry_type) /datum/controller/configuration/proc/GetEntryDatum(entry_type)

View File

@@ -16,4 +16,4 @@
/datum/controller/proc/Recover() /datum/controller/proc/Recover()
/datum/controller/proc/stat_entry() /datum/controller/proc/stat_entry(msg)

View File

@@ -95,8 +95,6 @@ GLOBAL_REAL(Failsafe, /datum/controller/failsafe)
/datum/controller/failsafe/proc/defcon_pretty() /datum/controller/failsafe/proc/defcon_pretty()
return defcon return defcon
/datum/controller/failsafe/stat_entry() /datum/controller/failsafe/stat_entry(msg)
if(!statclick) msg = "Defcon: [defcon_pretty()] (Interval: [Failsafe.processing_interval] | Iteration: [Failsafe.master_iteration])"
statclick = new/obj/effect/statclick/debug(null, "Initializing...", src) return msg
stat("Failsafe Controller:", statclick.update("Defcon: [defcon_pretty()] (Interval: [Failsafe.processing_interval] | Iteration: [Failsafe.master_iteration])"))

View File

@@ -24,11 +24,9 @@ GLOBAL_REAL(GLOB, /datum/controller/global_vars)
//fuck off kevinz //fuck off kevinz
return QDEL_HINT_IWILLGC return QDEL_HINT_IWILLGC
/datum/controller/global_vars/stat_entry() /datum/controller/global_vars/stat_entry(msg)
if(!statclick) msg = "Edit"
statclick = new/obj/effect/statclick/debug(null, "Initializing...", src) return msg
stat("Globals:", statclick.update("Edit"))
/datum/controller/global_vars/vv_edit_var(var_name, var_value) /datum/controller/global_vars/vv_edit_var(var_name, var_value)
if(gvars_datum_protected_varlist[var_name]) if(gvars_datum_protected_varlist[var_name])

View File

@@ -615,13 +615,10 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
skip_ticks = 1 skip_ticks = 1
/datum/controller/master/stat_entry() /datum/controller/master/stat_entry(msg)
if(!statclick) msg = "(TickRate:[Master.processing]) (Iteration:[Master.iteration]) (TickLimit: [round(Master.current_ticklimit, 0.1)])"
statclick = new/obj/effect/statclick/debug(null, "Initializing...", src) return msg
stat("Byond:", "(FPS:[world.fps]) (TickCount:[world.time/world.tick_lag]) (TickDrift:[round(Master.tickdrift,1)]([round((Master.tickdrift/(world.time/world.tick_lag))*100,0.1)]%)) (Internal Tick Usage: [round(MAPTICK_LAST_INTERNAL_TICK_USAGE,0.1)]%)")
stat("Master Controller:", statclick.update("(TickRate:[Master.processing]) (Iteration:[Master.iteration]) (TickLimit: [round(Master.current_ticklimit, 0.1)])"))
stat("Misc Subsystems", misc_statclick)
/datum/controller/master/StartLoadingMap() /datum/controller/master/StartLoadingMap()
//disallow more than one map to load at once, multithreading it will just cause race conditions //disallow more than one map to load at once, multithreading it will just cause race conditions

View File

@@ -12,7 +12,7 @@ SUBSYSTEM_DEF(profiler)
/datum/controller/subsystem/profiler/stat_entry(msg) /datum/controller/subsystem/profiler/stat_entry(msg)
msg += "F:[round(fetch_cost,1)]ms" msg += "F:[round(fetch_cost,1)]ms"
msg += "|W:[round(write_cost,1)]ms" msg += "|W:[round(write_cost,1)]ms"
..(msg) return msg
/datum/controller/subsystem/profiler/Initialize() /datum/controller/subsystem/profiler/Initialize()
if(CONFIG_GET(flag/auto_profile)) if(CONFIG_GET(flag/auto_profile))

View File

@@ -32,11 +32,11 @@ SUBSYSTEM_DEF(statpanels)
list("CPU:", world.cpu), list("CPU:", world.cpu),
list("Instances:", "[num2text(world.contents.len, 10)]"), list("Instances:", "[num2text(world.contents.len, 10)]"),
list("World Time:", "[world.time]"), list("World Time:", "[world.time]"),
list("Globals:", "Edit", "\ref[GLOB]"), list("Globals:", GLOB.stat_entry(), "\ref[GLOB]"),
list("[config]:", "Edit", "\ref[config]"), list("[config]:", config.stat_entry(), "\ref[config]"),
list("Byond:", "(FPS:[world.fps]) (TickCount:[world.time/world.tick_lag]) (TickDrift:[round(Master.tickdrift,1)]([round((Master.tickdrift/(world.time/world.tick_lag))*100,0.1)]%))"), list("Byond:", "(FPS:[world.fps]) (TickCount:[world.time/world.tick_lag]) (TickDrift:[round(Master.tickdrift,1)]([round((Master.tickdrift/(world.time/world.tick_lag))*100,0.1)]%)) (Internal Tick Usage: [round(MAPTICK_LAST_INTERNAL_TICK_USAGE,0.1)]%)"),
list("Master Controller:", Master ? "(TickRate:[Master.processing]) (Iteration:[Master.iteration])" : "ERROR", "\ref[Master]"), list("Master Controller:", Master.stat_entry(), "\ref[Master]"),
list("Failsafe Controller:", Failsafe ? "Defcon: [Failsafe.defcon_pretty()] (Interval: [Failsafe.processing_interval] | Iteration: [Failsafe.master_iteration])" : "ERROR", "\ref[Failsafe]"), list("Failsafe Controller:", Failsafe.stat_entry(), "\ref[Failsafe]"),
list("","") list("","")
) )
for(var/ss in Master.subsystems) for(var/ss in Master.subsystems)
@@ -94,6 +94,10 @@ SUBSYSTEM_DEF(statpanels)
if(!target_image.loc || target_image.loc.loc != target_mob.listed_turf || !target_image.override) if(!target_image.loc || target_image.loc.loc != target_mob.listed_turf || !target_image.override)
continue continue
overrides += target_image.loc overrides += target_image.loc
if(!(REF(target_mob.listed_turf) in cached_images))
target << browse_rsc(getFlatIcon(target_mob.listed_turf, no_anim = TRUE), "[REF(target_mob.listed_turf)].png")
cached_images += REF(target_mob.listed_turf)
turfitems[++turfitems.len] = list("[target_mob.listed_turf]", REF(target_mob.listed_turf), "[REF(target_mob.listed_turf)].png")
for(var/tc in target_mob.listed_turf) for(var/tc in target_mob.listed_turf)
var/atom/movable/turf_content = tc var/atom/movable/turf_content = tc
if(turf_content.mouse_opacity == MOUSE_OPACITY_TRANSPARENT) if(turf_content.mouse_opacity == MOUSE_OPACITY_TRANSPARENT)

View File

@@ -40,7 +40,7 @@
new_ai = select_active_ai(R) new_ai = select_active_ai(R)
R.notify_ai(DISCONNECT) R.notify_ai(DISCONNECT)
if(new_ai && (new_ai != R.connected_ai)) if(new_ai && (new_ai != R.connected_ai))
R.connected_ai = new_ai R.set_connected_ai(new_ai)
if(R.shell) if(R.shell)
R.undeploy() //If this borg is an AI shell, disconnect the controlling AI and assign ti to a new AI R.undeploy() //If this borg is an AI shell, disconnect the controlling AI and assign ti to a new AI
R.notify_ai(AI_SHELL) R.notify_ai(AI_SHELL)
@@ -69,7 +69,7 @@
R.notify_ai(DISCONNECT) R.notify_ai(DISCONNECT)
if(R.shell) if(R.shell)
R.undeploy() R.undeploy()
R.connected_ai = null R.set_connected_ai(null)
if(WIRE_LAWSYNC) // Cut the law wire, and the borg will no longer receive law updates from its AI. Repair and it will re-sync. if(WIRE_LAWSYNC) // Cut the law wire, and the borg will no longer receive law updates from its AI. Repair and it will re-sync.
if(mend) if(mend)
if(!R.emagged) if(!R.emagged)

View File

@@ -100,7 +100,7 @@
// So he can't jump out the gate right away. // So he can't jump out the gate right away.
R.SetLockdown() R.SetLockdown()
if(masterAI) if(masterAI)
R.connected_ai = masterAI R.set_connected_ai(masterAI)
R.lawsync() R.lawsync()
R.lawupdate = 1 R.lawupdate = 1
addtimer(CALLBACK(src, .proc/unlock_new_robot, R), 50) addtimer(CALLBACK(src, .proc/unlock_new_robot, R), 50)

View File

@@ -281,12 +281,12 @@
O.custom_name = created_name O.custom_name = created_name
O.locked = panel_locked O.locked = panel_locked
if(!aisync) if(!aisync)
lawsync = 0 lawsync = FALSE
O.connected_ai = null O.set_connected_ai(null)
else else
O.notify_ai(NEW_BORG) O.notify_ai(NEW_BORG)
if(forced_ai) if(forced_ai)
O.connected_ai = forced_ai O.set_connected_ai(forced_ai)
if(!lawsync) if(!lawsync)
O.lawupdate = 0 O.lawupdate = 0
if(M.laws.id == DEFAULT_AI_LAWID) if(M.laws.id == DEFAULT_AI_LAWID)
@@ -337,10 +337,10 @@
if(!aisync) if(!aisync)
lawsync = FALSE lawsync = FALSE
O.connected_ai = null O.set_connected_ai(null)
else else
if(forced_ai) if(forced_ai)
O.connected_ai = forced_ai O.set_connected_ai(forced_ai)
O.notify_ai(AI_SHELL) O.notify_ai(AI_SHELL)
if(!lawsync) if(!lawsync)
O.lawupdate = FALSE O.lawupdate = FALSE

View File

@@ -199,7 +199,7 @@
borg.notify_ai(DISCONNECT) borg.notify_ai(DISCONNECT)
if(borg.shell) if(borg.shell)
borg.undeploy() borg.undeploy()
borg.connected_ai = newai borg.set_connected_ai(newai)
borg.notify_ai(TRUE) borg.notify_ai(TRUE)
message_admins("[key_name_admin(user)] slaved [ADMIN_LOOKUPFLW(borg)] to the AI [ADMIN_LOOKUPFLW(newai)].") message_admins("[key_name_admin(user)] slaved [ADMIN_LOOKUPFLW(borg)] to the AI [ADMIN_LOOKUPFLW(newai)].")
log_admin("[key_name(user)] slaved [key_name(borg)] to the AI [key_name(newai)].") log_admin("[key_name(user)] slaved [key_name(borg)] to the AI [key_name(newai)].")
@@ -207,7 +207,7 @@
borg.notify_ai(DISCONNECT) borg.notify_ai(DISCONNECT)
if(borg.shell) if(borg.shell)
borg.undeploy() borg.undeploy()
borg.connected_ai = null borg.set_connected_ai(null)
message_admins("[key_name_admin(user)] freed [ADMIN_LOOKUPFLW(borg)] from being slaved to an AI.") message_admins("[key_name_admin(user)] freed [ADMIN_LOOKUPFLW(borg)] from being slaved to an AI.")
log_admin("[key_name(user)] freed [key_name(borg)] from being slaved to an AI.") log_admin("[key_name(user)] freed [key_name(borg)] from being slaved to an AI.")
if (borg.lawupdate) if (borg.lawupdate)

View File

@@ -99,7 +99,7 @@
radio.keyslot = null radio.keyslot = null
//END CITADEL EDIT //END CITADEL EDIT
if(connected_ai) if(connected_ai)
connected_ai.connected_robots -= src set_connected_ai(null)
if(shell) if(shell)
GLOB.available_ai_shells -= src GLOB.available_ai_shells -= src
else else
@@ -560,11 +560,10 @@
gib() gib()
/mob/living/silicon/robot/proc/UnlinkSelf() /mob/living/silicon/robot/proc/UnlinkSelf()
if(src.connected_ai) set_connected_ai(null)
connected_ai.connected_robots -= src lawupdate = FALSE
src.connected_ai = null locked_down = FALSE
lawupdate = 0 scrambledcodes = TRUE
scrambledcodes = 1
//Disconnect it's camera so it's not so easily tracked. //Disconnect it's camera so it's not so easily tracked.
if(!QDELETED(builtInCamera)) if(!QDELETED(builtInCamera))
QDEL_NULL(builtInCamera) QDEL_NULL(builtInCamera)
@@ -586,10 +585,10 @@
W.attack_self(src) W.attack_self(src)
/mob/living/silicon/robot/proc/SetLockdown(state = 1) /mob/living/silicon/robot/proc/SetLockdown(state = TRUE)
// They stay locked down if their wire is cut. // They stay locked down if their wire is cut.
if(wires.is_cut(WIRE_LOCKDOWN)) if(wires.is_cut(WIRE_LOCKDOWN))
state = 1 state = TRUE
if(state) if(state)
throw_alert("locked", /obj/screen/alert/locked) throw_alert("locked", /obj/screen/alert/locked)
else else
@@ -991,7 +990,7 @@
builtInCamera.c_tag = real_name //update the camera name too builtInCamera.c_tag = real_name //update the camera name too
mainframe = AI mainframe = AI
deployed = TRUE deployed = TRUE
connected_ai = mainframe set_connected_ai(mainframe)
mainframe.connected_robots |= src mainframe.connected_robots |= src
lawupdate = TRUE lawupdate = TRUE
lawsync() lawsync()
@@ -1090,9 +1089,8 @@
. = ..(user) . = ..(user)
/mob/living/silicon/robot/proc/TryConnectToAI() /mob/living/silicon/robot/proc/TryConnectToAI()
connected_ai = select_active_ai_with_fewest_borgs() set_connected_ai(select_active_ai_with_fewest_borgs(z))
if(connected_ai) if(connected_ai)
connected_ai.connected_robots += src
lawsync() lawsync()
lawupdate = 1 lawupdate = 1
return TRUE return TRUE
@@ -1134,7 +1132,7 @@
/mob/living/silicon/robot/adjustStaminaLossBuffered(amount, updating_health = 1) /mob/living/silicon/robot/adjustStaminaLossBuffered(amount, updating_health = 1)
if(istype(cell)) if(istype(cell))
cell.charge -= amount*5 cell.charge -= amount * 5
/mob/living/silicon/robot/verb/viewmanifest() /mob/living/silicon/robot/verb/viewmanifest()
set category = "Robot Commands" set category = "Robot Commands"
@@ -1143,3 +1141,14 @@
if(usr.stat == DEAD) if(usr.stat == DEAD)
return //won't work if dead return //won't work if dead
ai_roster() ai_roster()
/mob/living/silicon/robot/proc/set_connected_ai(new_ai)
if(connected_ai == new_ai)
return
. = connected_ai
connected_ai = new_ai
if(.)
var/mob/living/silicon/ai/old_ai = .
old_ai.connected_robots -= src
if(connected_ai)
connected_ai.connected_robots |= src

View File

@@ -138,8 +138,8 @@
/mob/living/silicon/robot/proc/beep_boop_rogue_bot(mob/user) /mob/living/silicon/robot/proc/beep_boop_rogue_bot(mob/user)
SetEmagged(1) SetEmagged(1)
SetStun(60) //Borgs were getting into trouble because they would attack the emagger before the new laws were shown SetStun(60) //Borgs were getting into trouble because they would attack the emagger before the new laws were shown
lawupdate = 0 lawupdate = FALSE
connected_ai = null set_connected_ai(null)
message_admins("[ADMIN_LOOKUPFLW(user)] emagged cyborg [ADMIN_LOOKUPFLW(src)]. Laws overridden.") message_admins("[ADMIN_LOOKUPFLW(user)] emagged cyborg [ADMIN_LOOKUPFLW(src)]. Laws overridden.")
log_game("[key_name(user)] emagged cyborg [key_name(src)]. Laws overridden.") log_game("[key_name(user)] emagged cyborg [key_name(src)]. Laws overridden.")
var/time = time2text(world.realtime,"hh:mm:ss") var/time = time2text(world.realtime,"hh:mm:ss")