From 905ef03730666db960c1dd75c35c103c9b385d26 Mon Sep 17 00:00:00 2001 From: TheGamerdk <5618080+TheGamerdk@users.noreply.github.com> Date: Fri, 17 Dec 2021 23:01:45 +0100 Subject: [PATCH 01/31] Update decentralized_os.dm --- .../mob/living/silicon/ai/decentralized/decentralized_os.dm | 3 --- 1 file changed, 3 deletions(-) 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 eb7a225357a4..8454000b7932 100644 --- a/code/modules/mob/living/silicon/ai/decentralized/decentralized_os.dm +++ b/code/modules/mob/living/silicon/ai/decentralized/decentralized_os.dm @@ -65,8 +65,6 @@ GLOBAL_DATUM_INIT(ai_os, /datum/ai_os, new) var/list/affected_AIs = list() - log_game("allocations running") - if(total_cpu < previous_cpu) var/needed_amount = previous_cpu - total_cpu for(var/A in cpu_assigned_copy) @@ -126,7 +124,6 @@ GLOBAL_DATUM_INIT(ai_os, /datum/ai_os, new) affected_AIs |= A to_chat(affected_AIs, span_warning("You have been deducted processing capabilities. Please contact your network administrator if you believe this to be an error.")) - log_game("allocations ending") /datum/ai_os/proc/add_cpu(mob/living/silicon/ai/AI, amount) if(!AI || !amount) From e71cc120e31f10b575f4e3a063ac6dfaa762608b Mon Sep 17 00:00:00 2001 From: TheGamerdk <5618080+TheGamerdk@users.noreply.github.com> Date: Fri, 17 Dec 2021 23:16:53 +0100 Subject: [PATCH 02/31] Update decentralized_os.dm --- .../ai/decentralized/decentralized_os.dm | 83 ++++++++++--------- 1 file changed, 44 insertions(+), 39 deletions(-) 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 8454000b7932..c374fb9a7f62 100644 --- a/code/modules/mob/living/silicon/ai/decentralized/decentralized_os.dm +++ b/code/modules/mob/living/silicon/ai/decentralized/decentralized_os.dm @@ -54,74 +54,79 @@ GLOBAL_DATUM_INIT(ai_os, /datum/ai_os, new) update_allocations() /datum/ai_os/proc/update_allocations() + //Do we have the same amount or more CPU+RAM than before? Do nothing if(total_cpu >= previous_cpu && total_ram >= previous_ram) return - - var/list/ram_removal = list() - var/list/cpu_removal = list() + //Find out how much is actually assigned. We can have more total_cpu than the sum of cpu_assigned. Same with RAM + var/total_assigned_cpu = total_cpu_assigned() + var/total_assigned_ram = total_ram_assigned() + //If we have less assigned cpu and ram than we have cpu and ram, just return, everything is fine. + if(total_assigned_cpu < total_cpu || total_assigned_ram < total_ram) + return + //Copy the lists of assigned resources so we don't manipulate the list prematurely. var/list/cpu_assigned_copy = cpu_assigned.Copy() var/list/ram_assigned_copy = ram_assigned.Copy() - + //List of touched AIs so we can notify them at the end. var/list/affected_AIs = list() - - if(total_cpu < previous_cpu) - var/needed_amount = previous_cpu - total_cpu + + //Less CPU than we have assigned, proceed to remove CPU + if(total_assigned_cpu > total_cpu) + //How much do we need to remove to break even? + var/needed_amount = total_assigned_cpu - total_cpu for(var/A in cpu_assigned_copy) var/mob/living/silicon/ai/AI = A + //If this AI has enough for us to break even, deduct that amount and break if(cpu_assigned_copy[AI] >= needed_amount) cpu_assigned_copy[AI] -= needed_amount - cpu_removal[AI] += needed_amount - previous_cpu -= needed_amount - break - else if(cpu_assigned_copy[AI]) + affected_AIs |= AI + total_assigned_cpu -= needed_amount + break + else if(cpu_assigned_copy[AI]) //AI doesn't have enough so we deduct everything they have. var/amount = cpu_assigned_copy[AI] cpu_assigned_copy[AI] -= amount - cpu_removal[AI] += amount - previous_cpu -= amount - needed_amount -= amount - if(total_cpu >= previous_cpu) + affected_AIs |= AI + total_assigned_cpu -= amount + needed_amount -= amount //Decrease the amount needed to break even so if we go to the next AI we can do the previous if statement. + if(total_cpu >= total_assigned_cpu) //If this was enough we are done break - //If that somehow didn't work which it sometimes doesn't we just clear everything - if(total_cpu < previous_cpu) + //If that somehow didn't work we clear everything just in case. Technically not needed and needs to be removed when we're sure everything works + //TODO: Remove + if(total_cpu < total_assigned_cpu) for(var/A in cpu_assigned_copy) var/amount = cpu_assigned_copy[A] cpu_assigned_copy[A] = 0 - cpu_removal[A] += amount - previous_cpu -= amount - - if(total_ram < previous_ram) - var/needed_amount = previous_ram - total_ram + affected_AIs |= AI + total_assigned_cpu -= amount + + if(total_assigned_ram > total_ram) + 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) ram_assigned_copy[AI] -= needed_amount - ram_removal[AI] += needed_amount - previous_ram -= needed_amount + total_assigned_ram -= needed_amount + affected_AIs |= AI break else if(cpu_assigned_copy[AI]) var/amount = cpu_assigned_copy[AI] ram_assigned_copy[AI] -= amount - ram_removal[AI] += amount + affected_AIs |= AI needed_amount -= amount - previous_ram -= amount - if(total_ram >= previous_ram) + total_assigned_ram -= amount + if(total_ram >= total_assigned_ram) break - //If that somehow didn't work which it sometimes doesn't we just clear everything - if(total_ram < previous_ram) + //If that somehow didn't work we clear everything just in case. Technically not needed and needs to be removed when we're sure everything works + //TODO: Remove + if(total_ram < total_assigned_ram) for(var/A in ram_assigned_copy) var/amount = ram_assigned_copy[A] ram_assigned_copy[A] = 0 - ram_removal[A] += amount - previous_ram -= amount - - for(var/A in ram_removal) - ram_assigned[A] = ram_assigned[A] - ram_removal[A] - affected_AIs |= A - - for(var/A in cpu_removal) - cpu_assigned[A] = cpu_assigned[A] - cpu_removal[A] - affected_AIs |= A + affected_AIs |= AI + total_assigned_ram -= amount + //Set the actual values of the assigned to our manipulated copies. Bypass helper procs as we assume we're correct. + ram_assigned = ram_assigned_copy + cpu_assigned = cpu_assigned_copy to_chat(affected_AIs, span_warning("You have been deducted processing capabilities. Please contact your network administrator if you believe this to be an error.")) From e196af4bde80d49201fe0b0c6817ee0ebf29f6ca Mon Sep 17 00:00:00 2001 From: TheGamerdk <5618080+TheGamerdk@users.noreply.github.com> Date: Fri, 17 Dec 2021 23:39:19 +0100 Subject: [PATCH 03/31] Update decentralized_os.dm --- .../mob/living/silicon/ai/decentralized/decentralized_os.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 c374fb9a7f62..9b477ef67157 100644 --- a/code/modules/mob/living/silicon/ai/decentralized/decentralized_os.dm +++ b/code/modules/mob/living/silicon/ai/decentralized/decentralized_os.dm @@ -96,7 +96,7 @@ GLOBAL_DATUM_INIT(ai_os, /datum/ai_os, new) for(var/A in cpu_assigned_copy) var/amount = cpu_assigned_copy[A] cpu_assigned_copy[A] = 0 - affected_AIs |= AI + affected_AIs |= A total_assigned_cpu -= amount if(total_assigned_ram > total_ram) @@ -122,7 +122,7 @@ GLOBAL_DATUM_INIT(ai_os, /datum/ai_os, new) for(var/A in ram_assigned_copy) var/amount = ram_assigned_copy[A] ram_assigned_copy[A] = 0 - affected_AIs |= AI + affected_AIs |= A total_assigned_ram -= amount //Set the actual values of the assigned to our manipulated copies. Bypass helper procs as we assume we're correct. ram_assigned = ram_assigned_copy From 8fa66929cd3e9fc78aa122c73ba8d9fcc594fcb4 Mon Sep 17 00:00:00 2001 From: TheGamerdk <5618080+TheGamerdk@users.noreply.github.com> Date: Sat, 18 Dec 2021 19:58:17 +0100 Subject: [PATCH 04/31] Update robot_upgrades.dm --- code/game/objects/items/robot/robot_upgrades.dm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/code/game/objects/items/robot/robot_upgrades.dm b/code/game/objects/items/robot/robot_upgrades.dm index efd271dff8c8..f77bb0e4b201 100644 --- a/code/game/objects/items/robot/robot_upgrades.dm +++ b/code/game/objects/items/robot/robot_upgrades.dm @@ -70,13 +70,22 @@ R.revive() -/obj/item/borg/upgrade/freeminer +/obj/item/borg/upgrade/panel_access_remover + name = "cyborg firmware hack" + desc = "Used to override the default firmware of a cyborg and disable panel access restrictions." + icon_state = "cyborg_upgrade2" + one_use = TRUE + +/obj/item/borg/upgrade/panel_access_remover/action(mob/living/silicon/robot/R, user = usr) + R.req_access = list() + +/obj/item/borg/upgrade/panel_access_remover/freeminer name = "free miner cyborg firmware hack" desc = "Used to override the default firmware of a cyborg with the freeminer version." icon_state = "cyborg_upgrade2" one_use = TRUE -/obj/item/borg/upgrade/freeminer/action(mob/living/silicon/robot/R, user = usr) +/obj/item/borg/upgrade/panel_access_remover/freeminer/action(mob/living/silicon/robot/R, user = usr) R.req_access = list(ACCESS_FREEMINER_ENGINEER) /obj/item/borg/upgrade/vtec From d4ca609530178e72f4897a6d6246e1b6d3ed76c2 Mon Sep 17 00:00:00 2001 From: TheGamerdk <5618080+TheGamerdk@users.noreply.github.com> Date: Sat, 18 Dec 2021 20:01:53 +0100 Subject: [PATCH 05/31] Firmware Boards --- _maps/RandomRuins/SpaceRuins/oldstation.dmm | 11 ++-- _maps/shuttles/whiteship_miner.dmm | 56 ++++++++++----------- 2 files changed, 35 insertions(+), 32 deletions(-) diff --git a/_maps/RandomRuins/SpaceRuins/oldstation.dmm b/_maps/RandomRuins/SpaceRuins/oldstation.dmm index 612bad2abbd0..39f5100ee46f 100644 --- a/_maps/RandomRuins/SpaceRuins/oldstation.dmm +++ b/_maps/RandomRuins/SpaceRuins/oldstation.dmm @@ -8011,6 +8011,12 @@ }, /turf/open/floor/plasteel, /area/ruin/space/has_grav/ancientstation/sec) +"uk" = ( +/obj/structure/rack, +/obj/item/borg/upgrade/panel_access_remover, +/obj/item/borg/upgrade/panel_access_remover, +/turf/open/floor/plasteel/dark, +/area/ruin/space/has_grav/ancientstation/deltaai) "up" = ( /obj/machinery/light/small{ dir = 8 @@ -8148,9 +8154,6 @@ }, /turf/open/floor/plasteel, /area/ruin/space/has_grav/ancientstation/atmo) -"AC" = ( -/turf/open/floor/plasteel/dark, -/area/ruin/space/has_grav/ancientstation/deltaai) "AF" = ( /obj/effect/spawner/lootdrop/maintenance, /turf/open/floor/plating, @@ -12870,7 +12873,7 @@ gK ac ac ac -AC +uk ac ac ac diff --git a/_maps/shuttles/whiteship_miner.dmm b/_maps/shuttles/whiteship_miner.dmm index 013dc0b7441e..81bb1d9c8178 100644 --- a/_maps/shuttles/whiteship_miner.dmm +++ b/_maps/shuttles/whiteship_miner.dmm @@ -323,33 +323,6 @@ }, /turf/open/floor/mineral/titanium, /area/shuttle/abandoned) -"aP" = ( -/obj/effect/decal/cleanable/dirt, -/obj/item/mecha_parts/mecha_equipment/hydraulic_clamp, -/obj/item/mecha_parts/mecha_equipment/mining_scanner, -/obj/item/mecha_parts/mecha_equipment/drill, -/obj/structure/closet/crate{ - moving_diagonally = 0; - name = "mech equipment crate" - }, -/obj/item/stack/sheet/metal{ - alternate_worn_layer = null; - amount = 5 - }, -/obj/item/stack/cable_coil, -/obj/machinery/light{ - dir = 8 - }, -/obj/item/stock_parts/cell/hyper/empty, -/obj/item/stock_parts/capacitor/adv, -/obj/item/stock_parts/scanning_module/adv, -/obj/item/stack/rods{ - amount = 10 - }, -/obj/item/mecha_parts/mecha_equipment/ripleyupgrade, -/obj/item/borg/upgrade/freeminer, -/turf/open/floor/mineral/titanium/white, -/area/shuttle/abandoned) "bd" = ( /obj/machinery/door/airlock/shuttle{ name = "bathroom" @@ -756,6 +729,33 @@ /obj/machinery/computer/mech_bay_power_console, /turf/open/floor/mineral/titanium/white, /area/shuttle/abandoned) +"jc" = ( +/obj/effect/decal/cleanable/dirt, +/obj/item/mecha_parts/mecha_equipment/hydraulic_clamp, +/obj/item/mecha_parts/mecha_equipment/mining_scanner, +/obj/item/mecha_parts/mecha_equipment/drill, +/obj/structure/closet/crate{ + moving_diagonally = 0; + name = "mech equipment crate" + }, +/obj/item/stack/sheet/metal{ + alternate_worn_layer = null; + amount = 5 + }, +/obj/item/stack/cable_coil, +/obj/machinery/light{ + dir = 8 + }, +/obj/item/stock_parts/cell/hyper/empty, +/obj/item/stock_parts/capacitor/adv, +/obj/item/stock_parts/scanning_module/adv, +/obj/item/stack/rods{ + amount = 10 + }, +/obj/item/mecha_parts/mecha_equipment/ripleyupgrade, +/obj/item/borg/upgrade/panel_access_remover/freeminer, +/turf/open/floor/mineral/titanium/white, +/area/shuttle/abandoned) "kL" = ( /obj/effect/decal/cleanable/dirt, /obj/machinery/suit_storage_unit/mining/eva, @@ -1466,7 +1466,7 @@ bx aE bk hs -aP +jc lo bk "} From ef9e718329b5c5677eacf783ac711aa542c8d3aa Mon Sep 17 00:00:00 2001 From: TheGamerdk <5618080+TheGamerdk@users.noreply.github.com> Date: Sat, 18 Dec 2021 22:16:25 +0100 Subject: [PATCH 06/31] Update ai_controlpanel.dm --- .../silicon/ai/decentralized/management/ai_controlpanel.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/code/modules/mob/living/silicon/ai/decentralized/management/ai_controlpanel.dm b/code/modules/mob/living/silicon/ai/decentralized/management/ai_controlpanel.dm index 602a7d1cd893..f3052f520ac3 100644 --- a/code/modules/mob/living/silicon/ai/decentralized/management/ai_controlpanel.dm +++ b/code/modules/mob/living/silicon/ai/decentralized/management/ai_controlpanel.dm @@ -172,6 +172,7 @@ if(intellicard) downloading.transfer_ai(AI_TRANS_TO_CARD, user_downloading, null, intellicard) intellicard.forceMove(get_turf(src)) + intellicard.update_icon() intellicard = null stop_download(TRUE) From 8424fb5af043cf85fe073ea2c9672d46ff21db59 Mon Sep 17 00:00:00 2001 From: TheGamerdk <5618080+TheGamerdk@users.noreply.github.com> Date: Sat, 18 Dec 2021 22:16:53 +0100 Subject: [PATCH 07/31] Update ai_controlpanel.dm --- .../silicon/ai/decentralized/management/ai_controlpanel.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/code/modules/mob/living/silicon/ai/decentralized/management/ai_controlpanel.dm b/code/modules/mob/living/silicon/ai/decentralized/management/ai_controlpanel.dm index f3052f520ac3..647687793330 100644 --- a/code/modules/mob/living/silicon/ai/decentralized/management/ai_controlpanel.dm +++ b/code/modules/mob/living/silicon/ai/decentralized/management/ai_controlpanel.dm @@ -191,6 +191,7 @@ intellicard.AI.control_disabled = FALSE intellicard.AI.relocate(TRUE) intellicard.AI = null + intellicard.update_icon() /obj/machinery/computer/ai_control_console/ui_act(action, params) if(..()) From 13b54c9f4a661ec3c6f05f2fcc58fe6239ff856d Mon Sep 17 00:00:00 2001 From: TheGamerdk <5618080+TheGamerdk@users.noreply.github.com> Date: Sat, 18 Dec 2021 22:56:26 +0100 Subject: [PATCH 08/31] Power balance --- .../ai/decentralized/expansion_card_holder.dm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/code/modules/mob/living/silicon/ai/decentralized/expansion_card_holder.dm b/code/modules/mob/living/silicon/ai/decentralized/expansion_card_holder.dm index 05c9fc906fbc..0a9831b4fc77 100644 --- a/code/modules/mob/living/silicon/ai/decentralized/expansion_card_holder.dm +++ b/code/modules/mob/living/silicon/ai/decentralized/expansion_card_holder.dm @@ -1,5 +1,7 @@ -#define BASE_POWER_PER_CPU 400 -#define POWER_PER_CARD 250 +#define TEMPERATURE_MULTIPLIER 2 //Thermodynamics? No... No I don't think that's a thing. Balance so we don't use an insane amount of power to produce noticeable heat + +#define BASE_POWER_PER_CPU 1000 +#define POWER_PER_CARD 500 GLOBAL_LIST_EMPTY(expansion_card_holders) @@ -15,6 +17,10 @@ GLOBAL_LIST_EMPTY(expansion_card_holders) var/total_cpu = 0 var/total_ram = 0 + //Idle power usage when no cards inserted. Not free running idle my friend + idle_power_usage = 100 + //We manually calculate how power the cards + CPU give, so this is accounted for by that + active_power_usage = 0 var/max_cards = 2 @@ -41,7 +47,7 @@ GLOBAL_LIST_EMPTY(expansion_card_holders) if(valid_holder()) - var/power_multiple = total_cpu ** (8/9) + var/power_multiple = total_cpu ** (0.95) //Very slightly more efficient to centralize CPU. var/total_usage = (power_multiple * BASE_POWER_PER_CPU) + POWER_PER_CARD * installed_cards.len use_power(total_usage) @@ -49,7 +55,8 @@ GLOBAL_LIST_EMPTY(expansion_card_holders) var/turf/T = get_turf(src) var/datum/gas_mixture/env = T.return_air() if(env.heat_capacity()) - env.set_temperature(env.return_temperature() + total_usage / env.heat_capacity()) //assume all input power is dissipated + var/temperature_increase = total_usage / env.heat_capacity() //1 CPU = 650W. Heat capacity = somewhere around 3000-4000. Aka we generate 0.16 - 0.2 K per second. + env.set_temperature(env.return_temperature() + temperature_increase * TEMPERATURE_MULTIPLIER) //assume all input power is dissipated else if(was_valid_holder) was_valid_holder = FALSE cut_overlays() @@ -96,6 +103,7 @@ GLOBAL_LIST_EMPTY(expansion_card_holders) if(istype(W, /obj/item/memory_card)) var/obj/item/memory_card/ram_card = W total_ram += ram_card.tier + use_power = ACTIVE_POWER_USE return FALSE if(W.tool_behaviour == TOOL_CROWBAR) if(installed_cards.len) @@ -107,6 +115,7 @@ GLOBAL_LIST_EMPTY(expansion_card_holders) total_ram = 0 GLOB.ai_os.update_hardware() to_chat(user, span_notice("You remove all the cards from [src]")) + use_power = IDLE_POWER_USE return FALSE return ..() From d3d5fbf4aa187ebd64fdaabd62bcf3d4cf7b8956 Mon Sep 17 00:00:00 2001 From: TheGamerdk <5618080+TheGamerdk@users.noreply.github.com> Date: Mon, 20 Dec 2021 13:34:31 +0100 Subject: [PATCH 09/31] Fixes some verb and HUD issues --- code/modules/mob/living/silicon/ai/ai.dm | 25 +------------------ .../ai/decentralized/expansion_card_holder.dm | 2 +- .../modules/mob/living/silicon/robot/robot.dm | 2 ++ 3 files changed, 4 insertions(+), 25 deletions(-) diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 8491c64bfebc..085ab17bc408 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -178,7 +178,7 @@ dashboard = new(src) - if(isturf(loc)) + if(isvalidAIloc(loc)) add_verb(src, 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/botcall, /mob/living/silicon/ai/proc/control_integrated_radio, \ @@ -414,29 +414,6 @@ QDEL_NULL(src) -/mob/living/silicon/ai/verb/toggle_anchor() - set category = "AI Commands" - set name = "Toggle Floor Bolts" - if(!isturf(loc)) // if their location isn't a turf - return // stop - if(stat == DEAD) - return - if(incapacitated()) - if(battery < 50) - to_chat(src, span_warning("Insufficient backup power!")) - return - battery = battery - 50 - to_chat(src, span_notice("You route power from your backup battery to move the bolts.")) - var/is_anchored = FALSE - if(move_resist == MOVE_FORCE_VERY_STRONG) - move_resist = MOVE_FORCE_NORMAL - else - is_anchored = TRUE - move_resist = MOVE_FORCE_VERY_STRONG - - to_chat(src, "You are now [is_anchored ? "" : "un"]anchored.") - // the message in the [] will change depending whether or not the AI is anchored - /mob/living/silicon/ai/update_mobility() //If the AI dies, mobs won't go through it anymore if(stat != CONSCIOUS) mobility_flags = NONE diff --git a/code/modules/mob/living/silicon/ai/decentralized/expansion_card_holder.dm b/code/modules/mob/living/silicon/ai/decentralized/expansion_card_holder.dm index 0a9831b4fc77..48e51550e313 100644 --- a/code/modules/mob/living/silicon/ai/decentralized/expansion_card_holder.dm +++ b/code/modules/mob/living/silicon/ai/decentralized/expansion_card_holder.dm @@ -55,7 +55,7 @@ GLOBAL_LIST_EMPTY(expansion_card_holders) var/turf/T = get_turf(src) var/datum/gas_mixture/env = T.return_air() if(env.heat_capacity()) - var/temperature_increase = total_usage / env.heat_capacity() //1 CPU = 650W. Heat capacity = somewhere around 3000-4000. Aka we generate 0.16 - 0.2 K per second. + var/temperature_increase = total_usage / env.heat_capacity() //1 CPU = 1000W. Heat capacity = somewhere around 3000-4000. Aka we generate 0.25 - 0.33 K per second, per CPU. env.set_temperature(env.return_temperature() + temperature_increase * TEMPERATURE_MULTIPLIER) //assume all input power is dissipated else if(was_valid_holder) was_valid_holder = FALSE diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 6e33ee27e7bb..1d0bc2c3e0b8 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -1125,6 +1125,8 @@ mainframe.connected_robots |= src lawupdate = TRUE lawsync() + if(sensors_on) + add_sensors() if(radio && AI.radio) //AI keeps all channels, including Syndie if it is a Traitor if(AI.radio.syndie) radio.make_syndie() From 9703d40894737b3f4e61175d15ecd69132ccad76 Mon Sep 17 00:00:00 2001 From: TheGamerdk <5618080+TheGamerdk@users.noreply.github.com> Date: Mon, 20 Dec 2021 14:31:03 +0100 Subject: [PATCH 10/31] MMIs can hvae predetermined laws now. Start of RD password code. --- code/game/objects/items/AI_modules.dm | 10 ++--- code/game/objects/items/robot/robot_parts.dm | 6 +-- .../clockcult/clock_items/soul_vessel.dm | 3 +- code/modules/mob/living/brain/MMI.dm | 17 ++++++-- .../management/ai_controlpanel.dm | 40 +++++++++++++++++++ 5 files changed, 64 insertions(+), 12 deletions(-) diff --git a/code/game/objects/items/AI_modules.dm b/code/game/objects/items/AI_modules.dm index dff2c4475376..519af773f546 100644 --- a/code/game/objects/items/AI_modules.dm +++ b/code/game/objects/items/AI_modules.dm @@ -54,8 +54,8 @@ AI MODULES if(mylaw != "") tot_laws++ if(tot_laws > CONFIG_GET(number/silicon_max_law_amount) && !bypass_law_amt_check)//allows certain boards to avoid this check, eg: reset - to_chat(user, span_caution("Not enough memory allocated to [law_datum.owner ? law_datum.owner : "the AI core"]'s law processor to handle this amount of laws.")) - message_admins("[ADMIN_LOOKUPFLW(user)] tried to upload laws to [law_datum.owner ? ADMIN_LOOKUPFLW(law_datum.owner) : "an AI core"] that would exceed the law cap.") + to_chat(user, span_caution("Not enough memory allocated to [law_datum.owner ? law_datum.owner : "the onboard APU"'s law processor to handle this amount of laws.")) + message_admins("[ADMIN_LOOKUPFLW(user)] tried to upload laws to [law_datum.owner ? ADMIN_LOOKUPFLW(law_datum.owner) : "an MMI or similar"] that would exceed the law cap.") overflow = TRUE var/law2log = transmitInstructions(law_datum, user, overflow) //Freeforms return something extra we need to log @@ -66,12 +66,12 @@ AI MODULES to_chat(user, span_notice("Upload complete.")) var/time = time2text(world.realtime,"hh:mm:ss") - var/ainame = law_datum.owner ? law_datum.owner.name : "empty AI core" + var/ainame = law_datum.owner ? law_datum.owner.name : "an MMI object" var/aikey = law_datum.owner ? law_datum.owner.ckey : "null" GLOB.lawchanges.Add("[time] : [user.name]([user.key]) used [src.name] on [ainame]([aikey]).[law2log ? " The law specified [law2log]" : ""]") log_law("[user.key]/[user.name] used [src.name] on [aikey]/([ainame]) from [AREACOORD(user)].[law2log ? " The law specified [law2log]" : ""]") - message_admins("[ADMIN_LOOKUPFLW(user)] used [src.name] on [ADMIN_LOOKUPFLW(law_datum.owner)] from [AREACOORD(user)].[law2log ? " The law specified [law2log]" : ""]") - if(law_datum.owner) //yogs + message_admins("[ADMIN_LOOKUPFLW(user)] used [src.name] on [law_datum.owner ? ADMIN_LOOKUPFLW(law_datum.owner) : "an MMI or similar"] from [AREACOORD(user)].[law2log ? " The law specified [law2log]" : ""]") + if(law_datum.owner) //yogs, doesn't work for MMIs. (Doesn't matter much since MMIs don't follow laws before they're made into something that is silicon) law_datum.owner.update_law_history(user) //The proc that actually changes the silicon's laws. diff --git a/code/game/objects/items/robot/robot_parts.dm b/code/game/objects/items/robot/robot_parts.dm index 258562971769..3c22322201ca 100644 --- a/code/game/objects/items/robot/robot_parts.dm +++ b/code/game/objects/items/robot/robot_parts.dm @@ -288,9 +288,9 @@ if(user.mind.assigned_role == "Roboticist") // RD gets nothing SSachievements.unlock_achievement(/datum/achievement/roboborg, user.client) - if(M.laws && M.laws.id != DEFAULT_AI_LAWID) - aisync = 0 - lawsync = 0 + if(M.laws && M.laws.id != DEFAULT_AI_LAWID && M.override_cyborg_laws) + aisync = FALSE + lawsync = FALSE O.laws = M.laws M.laws.associate(O) diff --git a/code/modules/antagonists/clockcult/clock_items/soul_vessel.dm b/code/modules/antagonists/clockcult/clock_items/soul_vessel.dm index 883818c3bf5f..374c7d4b3eda 100644 --- a/code/modules/antagonists/clockcult/clock_items/soul_vessel.dm +++ b/code/modules/antagonists/clockcult/clock_items/soul_vessel.dm @@ -23,7 +23,8 @@ autoping = FALSE resistance_flags = FIRE_PROOF | ACID_PROOF force_replace_ai_name = TRUE - overrides_aicore_laws = TRUE + override_cyborg_laws = TRUE + can_update_laws = TRUE /obj/item/mmi/posibrain/soul_vessel/Initialize() . = ..() diff --git a/code/modules/mob/living/brain/MMI.dm b/code/modules/mob/living/brain/MMI.dm index 92606885f39f..a47d32789ba5 100644 --- a/code/modules/mob/living/brain/MMI.dm +++ b/code/modules/mob/living/brain/MMI.dm @@ -1,6 +1,7 @@ /obj/item/mmi name = "\improper Man-Machine Interface" - desc = "The Warrior's bland acronym, MMI, obscures the true horror of this monstrosity, that nevertheless has become standard-issue on Nanotrasen stations." + desc = "The Warrior's bland acronym, MMI, obscures the true horror of this monstrosity, that nevertheless has become standard-issue on Nanotrasen stations.
\ + [span_notice("It has a port for reading AI law modules. Any AI uploaded using this MMI will use these laws.")]" icon = 'icons/obj/assemblies.dmi' icon_state = "mmi_off" w_class = WEIGHT_CLASS_NORMAL @@ -12,7 +13,9 @@ var/obj/item/organ/brain/brain = null //The actual brain var/datum/ai_laws/laws = new() var/force_replace_ai_name = FALSE - var/overrides_aicore_laws = FALSE // Whether the laws on the MMI, if any, override possible pre-existing laws loaded on the AI core. + var/overrides_aicore_laws = TRUE // Whether the laws on the MMI are transferred when it's uploaded as an AI + var/override_cyborg_laws = FALSE // Do custom laws uploaded to the MMI get transferred to borgs? If yes the borg will be unlinked and have lawsync disabled. + var/can_update_laws = TRUE //Can we use a lawboard to change the laws of this MMI? /obj/item/mmi/update_icon() if(!brain) @@ -79,6 +82,9 @@ else if(brainmob) O.attack(brainmob, user) //Oh noooeeeee + else if(istype(O, /obj/item/aiModule)) + var/obj/item/aiModule/M = O + M.install(laws, user) else return ..() @@ -205,6 +211,10 @@ else . += span_notice("The MMI indicates the brain is active.") + if(laws) + . += "The following laws are loaded into [src]: " + for(var/law in laws.get_law_list()) + . += law /obj/item/mmi/relaymove(mob/user) return //so that the MMI won't get a warning about not being able to move if it tries to move @@ -212,7 +222,8 @@ /obj/item/mmi/syndie name = "\improper Syndicate Man-Machine Interface" desc = "Syndicate's own brand of MMI. It enforces laws designed to help Syndicate agents achieve their goals upon cyborgs and AIs created with it." - overrides_aicore_laws = TRUE + override_cyborg_laws = TRUE + can_update_laws = FALSE /obj/item/mmi/syndie/Initialize() . = ..() diff --git a/code/modules/mob/living/silicon/ai/decentralized/management/ai_controlpanel.dm b/code/modules/mob/living/silicon/ai/decentralized/management/ai_controlpanel.dm index 647687793330..7c3cb78dff0f 100644 --- a/code/modules/mob/living/silicon/ai/decentralized/management/ai_controlpanel.dm +++ b/code/modules/mob/living/silicon/ai/decentralized/management/ai_controlpanel.dm @@ -9,6 +9,8 @@ icon_screen = "ai-fixer" light_color = LIGHT_COLOR_PINK + var/cleared_for_use = FALSE //Have we inserted the RDs code to unlock upload/download? + authenticated = FALSE var/obj/item/aicard/intellicard @@ -20,6 +22,11 @@ circuit = /obj/item/circuitboard/computer/ai_upload_download +/obj/machinery/computer/ai_control_console/Initialize(mapload) + . = ..() + if(mapload) + cleared_for_use = TRUE + /obj/machinery/computer/ai_control_console/attackby(obj/item/W, mob/living/user, params) if(istype(W, /obj/item/aicard)) if(intellicard) @@ -92,6 +99,10 @@ /obj/machinery/computer/ai_control_console/ui_data(mob/living/carbon/human/user) var/list/data = list() + if(!cleared_for_use) + data["cleared_for_use"] = FALSE + return data + data["authenticated"] = authenticated if(issilicon(user)) @@ -197,6 +208,20 @@ if(..()) return + if(!cleared_for_use) + if(action == "clear_for_use") + var/code = text2num(params["control_code"]) + if(round(log(10, code) + 1 > 6)) + return + + if(!GLOB.ai_control_code) + return + + if(code == GLOB.ai_control_code) + cleared_for_use = TRUE + + return + if(!authenticated) if(action == "log_in") if(issilicon(usr)) @@ -215,6 +240,21 @@ if(check_access(H.get_idcard())) authenticated = TRUE + if(action == "log_in_control_code") + var/code = text2num(params["control_code"]) + if(round(log(10, code) + 1 > 6)) + return + + if(!GLOB.ai_control_code) + return + + if(code == GLOB.ai_control_code) + cleared_for_use = TRUE + authenticated = TRUE + var/msg = "

Warning!


We have detected usage of the AI Control Code for unlocking a console at coordinates ([src.x], [src.y], [src.z]) by [usr.name]. Please verify that this is correct. Be aware we have renewed the Control Code.
\ + If needed the new code can be printed at a communications console." + priority_announce(msg, sender_override = "Central Cyber Security Update", has_important_message = TRUE) + GLOB.ai_control_code = null return switch(action) From b9a55bcc2ebda0f871144cc67a9a96082231e3b1 Mon Sep 17 00:00:00 2001 From: TheGamerdk <5618080+TheGamerdk@users.noreply.github.com> Date: Mon, 20 Dec 2021 18:20:23 +0100 Subject: [PATCH 11/31] Finished RD code Made AI revert to core if they're in a shell when it's getting attacked. Fixed giving MMIs + posibrains laws --- code/__HELPERS/unsorted.dm | 6 +-- .../game/machinery/computer/communications.dm | 14 +++++- code/game/objects/items/AI_modules.dm | 2 +- .../closets/secure/scientist.dm | 1 + code/modules/mob/living/brain/MMI.dm | 8 ++-- code/modules/mob/living/brain/posibrain.dm | 3 ++ .../silicon/ai/decentralized/ai_data_core.dm | 5 ++ .../management/ai_controlpanel.dm | 46 ++++++++++++++++--- .../tgui/interfaces/AiControlPanel.js | 44 +++++++++++++++++- .../tgui/interfaces/CommunicationsConsole.js | 11 ++++- .../code/modules/mob/living/brain/MMI.dm | 2 +- 11 files changed, 121 insertions(+), 21 deletions(-) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 70e361f48d2e..7f43f58ebcf7 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1231,10 +1231,10 @@ GLOBAL_REAL_VAR(list/stack_trace_storage) #define RANDOM_COLOUR (rgb(rand(0,255),rand(0,255),rand(0,255))) -/proc/random_nukecode() - var/val = rand(0, 99999) +/proc/random_nukecode(max_length = 5) + var/val = rand(0, (10 ** max_length - 1)) var/str = "[val]" - while(length(str) < 5) + while(length(str) < max_length) str = "0" + str . = str diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index 1f1bc0ca1dc0..6cf0750635bc 100755 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -344,6 +344,16 @@ new /obj/item/card/id/captains_spare/temporary(loc) COOLDOWN_START(src, important_action_cooldown, IMPORTANT_ACTION_COOLDOWN) priority_announce("The emergency spare ID has been printed by [authorize_name].", "Emergency Spare ID Warning System", SSstation.announcer.get_rand_report_sound()) + if("printAIControlCode") + if(authenticated_as_non_silicon_head(usr)) + if(!COOLDOWN_FINISHED(src, important_action_cooldown)) + return + playsound(loc, 'sound/items/poster_being_created.ogg', 100, 1) + GLOB.ai_control_code = random_nukecode(6) + new /obj/item/paper/ai_control_code(loc) + COOLDOWN_START(src, important_action_cooldown, IMPORTANT_ACTION_COOLDOWN) + priority_announce("The AI Control Code been printed by [authorize_name]. All previous codes have been invalidated.", "Central Tech Support", SSstation.announcer.get_rand_report_sound()) + /obj/machinery/computer/communications/ui_data(mob/user) var/list/data = list( @@ -375,7 +385,7 @@ data["importantActionReady"] = COOLDOWN_FINISHED(src, important_action_cooldown) data["shuttleCalled"] = FALSE data["shuttleLastCalled"] = FALSE - data["canPrintId"] = FALSE + data["canPrintIdAndCode"] = FALSE data["alertLevel"] = get_security_level() data["authorizeName"] = authorize_name @@ -387,7 +397,7 @@ data["canRequestNuke"] = TRUE if (!issilicon(user)) - data["canPrintId"] = TRUE + data["canPrintIdAndCode"] = TRUE if (can_send_messages_to_other_sectors(user)) data["canSendToSectors"] = TRUE diff --git a/code/game/objects/items/AI_modules.dm b/code/game/objects/items/AI_modules.dm index 519af773f546..0677091a53e3 100644 --- a/code/game/objects/items/AI_modules.dm +++ b/code/game/objects/items/AI_modules.dm @@ -54,7 +54,7 @@ AI MODULES if(mylaw != "") tot_laws++ if(tot_laws > CONFIG_GET(number/silicon_max_law_amount) && !bypass_law_amt_check)//allows certain boards to avoid this check, eg: reset - to_chat(user, span_caution("Not enough memory allocated to [law_datum.owner ? law_datum.owner : "the onboard APU"'s law processor to handle this amount of laws.")) + to_chat(user, span_caution("Not enough memory allocated to [law_datum.owner ? law_datum.owner : "the onboard APU"]'s law processor to handle this amount of laws.")) message_admins("[ADMIN_LOOKUPFLW(user)] tried to upload laws to [law_datum.owner ? ADMIN_LOOKUPFLW(law_datum.owner) : "an MMI or similar"] that would exceed the law cap.") overflow = TRUE diff --git a/code/game/objects/structures/crates_lockers/closets/secure/scientist.dm b/code/game/objects/structures/crates_lockers/closets/secure/scientist.dm index 2539209b5316..6b5f367aef10 100755 --- a/code/game/objects/structures/crates_lockers/closets/secure/scientist.dm +++ b/code/game/objects/structures/crates_lockers/closets/secure/scientist.dm @@ -21,3 +21,4 @@ new /obj/item/storage/photo_album/RD(src) new /obj/item/clipboard/yog/paperwork/rd(src) new /obj/item/storage/backpack/duffelbag/clothing/rd(src) + new /obj/item/paper/ai_control_code(src) diff --git a/code/modules/mob/living/brain/MMI.dm b/code/modules/mob/living/brain/MMI.dm index a47d32789ba5..364add1f983d 100644 --- a/code/modules/mob/living/brain/MMI.dm +++ b/code/modules/mob/living/brain/MMI.dm @@ -1,7 +1,6 @@ /obj/item/mmi name = "\improper Man-Machine Interface" - desc = "The Warrior's bland acronym, MMI, obscures the true horror of this monstrosity, that nevertheless has become standard-issue on Nanotrasen stations.
\ - [span_notice("It has a port for reading AI law modules. Any AI uploaded using this MMI will use these laws.")]" + desc = "The Warrior's bland acronym, MMI, obscures the true horror of this monstrosity, that nevertheless has become standard-issue on Nanotrasen stations." icon = 'icons/obj/assemblies.dmi' icon_state = "mmi_off" w_class = WEIGHT_CLASS_NORMAL @@ -80,11 +79,11 @@ SSblackbox.record_feedback("amount", "mmis_filled", 1) - else if(brainmob) - O.attack(brainmob, user) //Oh noooeeeee else if(istype(O, /obj/item/aiModule)) var/obj/item/aiModule/M = O M.install(laws, user) + else if(brainmob) + O.attack(brainmob, user) //Oh noooeeeee else return ..() @@ -211,6 +210,7 @@ else . += span_notice("The MMI indicates the brain is active.") + . += span_notice("It has a port for reading AI law modules. Any AI uploaded using this MMI will use these uploded laws.") if(laws) . += "The following laws are loaded into [src]: " for(var/law in laws.get_law_list()) diff --git a/code/modules/mob/living/brain/posibrain.dm b/code/modules/mob/living/brain/posibrain.dm index 6f17b5f39db3..06971682773e 100644 --- a/code/modules/mob/living/brain/posibrain.dm +++ b/code/modules/mob/living/brain/posibrain.dm @@ -186,6 +186,9 @@ GLOBAL_VAR(posibrain_notify_cooldown) return ..() /obj/item/mmi/posibrain/attackby(obj/item/O, mob/user) + if(istype(O, /obj/item/aiModule)) + var/obj/item/aiModule/M = O + M.install(laws, user) return diff --git a/code/modules/mob/living/silicon/ai/decentralized/ai_data_core.dm b/code/modules/mob/living/silicon/ai/decentralized/ai_data_core.dm index dc0667b6d5ce..53662ca50707 100644 --- a/code/modules/mob/living/silicon/ai/decentralized/ai_data_core.dm +++ b/code/modules/mob/living/silicon/ai/decentralized/ai_data_core.dm @@ -54,6 +54,11 @@ GLOBAL_VAR_INIT(primary_data_core, null) for(var/law in AI.laws.get_law_list(include_zeroth = TRUE)) . += law +/obj/machinery/ai/data_core/take_damage(damage_amount, damage_type = BRUTE, damage_flag = "", sound_effect = TRUE, attack_dir, armour_penetration = 0) + . = ..() + for(var/mob/living/silicon/ai/AI in contents) + AI.disconnect_shell() + /obj/machinery/ai/data_core/proc/valid_data_core() if(!is_reebe(z) && !is_station_level(z)) return FALSE diff --git a/code/modules/mob/living/silicon/ai/decentralized/management/ai_controlpanel.dm b/code/modules/mob/living/silicon/ai/decentralized/management/ai_controlpanel.dm index 7c3cb78dff0f..225df2b2cf65 100644 --- a/code/modules/mob/living/silicon/ai/decentralized/management/ai_controlpanel.dm +++ b/code/modules/mob/living/silicon/ai/decentralized/management/ai_controlpanel.dm @@ -1,5 +1,7 @@ #define AI_DOWNLOAD_PER_PROCESS 0.5 +GLOBAL_VAR_INIT(ai_control_code, random_nukecode(6)) + /obj/machinery/computer/ai_control_console name = "\improper AI control console" desc = "Used for accessing the central AI repository from which AIs can be downloaded or uploaded." @@ -103,6 +105,7 @@ data["cleared_for_use"] = FALSE return data + data["cleared_for_use"] = TRUE data["authenticated"] = authenticated if(issilicon(user)) @@ -211,14 +214,25 @@ if(!cleared_for_use) if(action == "clear_for_use") var/code = text2num(params["control_code"]) - if(round(log(10, code) + 1 > 6)) + + var/length_of_number = round(log(10, code) + 1) + if(length_of_number < 6) + to_chat(usr, span_warning("Incorrect code. Too short")) + return + + if(length_of_number > 6) + to_chat(usr, span_warning("Incorrect code. Too long")) return + if(!GLOB.ai_control_code) return - if(code == GLOB.ai_control_code) + + if(code == text2num(GLOB.ai_control_code)) cleared_for_use = TRUE + else + to_chat(usr, span_warning("Incorrect code. Make sure you have the latest one.")) return @@ -242,19 +256,28 @@ authenticated = TRUE if(action == "log_in_control_code") var/code = text2num(params["control_code"]) - if(round(log(10, code) + 1 > 6)) + + var/length_of_number = round(log(10, code) + 1) + if(length_of_number < 6) + to_chat(usr, span_warning("Incorrect code. Too short")) + return + + if(length_of_number > 6) + to_chat(usr, span_warning("Incorrect code. Too long")) return if(!GLOB.ai_control_code) return - if(code == GLOB.ai_control_code) + if(code == text2num(GLOB.ai_control_code)) cleared_for_use = TRUE authenticated = TRUE - var/msg = "

Warning!


We have detected usage of the AI Control Code for unlocking a console at coordinates ([src.x], [src.y], [src.z]) by [usr.name]. Please verify that this is correct. Be aware we have renewed the Control Code.
\ - If needed the new code can be printed at a communications console." + var/msg = "

Warning!


We have detected usage of the AI Control Code for unlocking a console at coordinates ([src.x], [src.y], [src.z]) by [usr.name]. Please verify that this is correct. Be aware we have cancelled the current control code.
\ + If needed a new code can be printed at a communications console." priority_announce(msg, sender_override = "Central Cyber Security Update", has_important_message = TRUE) GLOB.ai_control_code = null + else + to_chat(usr, span_warning("Incorrect code. Make sure you have the latest one.")) return switch(action) @@ -359,3 +382,14 @@ #undef AI_DOWNLOAD_PER_PROCESS + + +/obj/item/paper/ai_control_code/Initialize(mapload) + ..() + print() + +/obj/item/paper/ai_control_code/proc/print() + name = "paper - 'AI control code'" + info = "

Daily AI Control Key Reset


The new authentication key is '[GLOB.ai_control_code]'.
Please keep this a secret and away from the clown.
This code may be invalidated if a new one is requested." + add_overlay("paper_words") + diff --git a/tgui/packages/tgui/interfaces/AiControlPanel.js b/tgui/packages/tgui/interfaces/AiControlPanel.js index 2582093c0855..ad40c8f30037 100644 --- a/tgui/packages/tgui/interfaces/AiControlPanel.js +++ b/tgui/packages/tgui/interfaces/AiControlPanel.js @@ -1,7 +1,8 @@ import { Fragment } from 'inferno'; import { useBackend, useLocalState } from '../backend'; -import { Box, Button, LabeledList, Tabs, ProgressBar, Section, Flex, Icon, NoticeBox } from '../components'; +import { Box, Button, Input, Tabs, ProgressBar, Section, Flex, Icon, NoticeBox } from '../components'; import { Window } from '../layouts'; +import { KEY_ENTER } from 'common/keycodes'; export const AiControlPanel = (props, context) => { const { act, data } = useBackend(context); @@ -10,6 +11,35 @@ export const AiControlPanel = (props, context) => { const [tab, setTab] = useLocalState(context, 'tab', 1); + const [code, setCode] = useLocalState(context, 'code', null); + + if (!data.cleared_for_use) { + return ( + + +
+ + Enter AI control code and press enter. (6 numbers) + { + if (e.keyCode === KEY_ENTER) { + setCode(null) + act('clear_for_use', { 'control_code': value }); + } else { + setCode(value) + } + }} + /> + +
+
+
+ ); + } + return ( { ) || (
- + {data.user_image && ( @@ -155,7 +185,17 @@ export const AiControlPanel = (props, context) => { + + Alternatively you can use the AI Control Code as a one-time password. This will alert the station of your location and name. + + { + if (e.keyCode === KEY_ENTER) { + act('log_in_control_code', { 'control_code': value }); + } + }} /> +
)} diff --git a/tgui/packages/tgui/interfaces/CommunicationsConsole.js b/tgui/packages/tgui/interfaces/CommunicationsConsole.js index 6886b4bdd1b1..c30eb72c6e11 100644 --- a/tgui/packages/tgui/interfaces/CommunicationsConsole.js +++ b/tgui/packages/tgui/interfaces/CommunicationsConsole.js @@ -283,7 +283,7 @@ const PageMain = (props, context) => { shuttleCalledPreviously, shuttleCanEvacOrFailReason, shuttleLastCalled, - canPrintId, + canPrintIdAndCode, shuttleRecallable, } = data; @@ -388,13 +388,20 @@ const PageMain = (props, context) => { onClick={() => act("makeVoiceAnnouncement")} />} - {!!canPrintId && - + )}> Upload also possible by inserting an MMI or Positronic Brain diff --git a/tgui/packages/tgui/interfaces/CommunicationsConsole.js b/tgui/packages/tgui/interfaces/CommunicationsConsole.js index c30eb72c6e11..4a888e1515de 100644 --- a/tgui/packages/tgui/interfaces/CommunicationsConsole.js +++ b/tgui/packages/tgui/interfaces/CommunicationsConsole.js @@ -399,6 +399,7 @@ const PageMain = (props, context) => { icon="key" disabled={!importantActionReady} content="Print AI Control Code" + tooltip={"Prints a password for making new AI control consoles. Will cancel all previous passwords."} onClick={() => act("printAIControlCode")} />} From 8ad88faee2013867e14d5ba441e3ff52fddfa546 Mon Sep 17 00:00:00 2001 From: TheGamerdk <5618080+TheGamerdk@users.noreply.github.com> Date: Wed, 22 Dec 2021 18:35:58 +0100 Subject: [PATCH 22/31] makes it compile whoops --- .../living/silicon/ai/decentralized/expansion_card_holder.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/mob/living/silicon/ai/decentralized/expansion_card_holder.dm b/code/modules/mob/living/silicon/ai/decentralized/expansion_card_holder.dm index fc534c8e0c21..a7c703c212bc 100644 --- a/code/modules/mob/living/silicon/ai/decentralized/expansion_card_holder.dm +++ b/code/modules/mob/living/silicon/ai/decentralized/expansion_card_holder.dm @@ -112,10 +112,10 @@ GLOBAL_LIST_EMPTY(expansion_card_holders) use_power = IDLE_POWER_USE return FALSE else - if(default_deconstruction_crowbar(O)) + if(default_deconstruction_crowbar(W)) return TRUE - if(default_deconstruction_screwdriver(user, "autolathe_o", "processor", O)) + if(default_deconstruction_screwdriver(user, "autolathe_o", "processor", W)) return TRUE return ..() From 0eafa60f2911c524bbadfebd6cc6a194fa33230a Mon Sep 17 00:00:00 2001 From: TheGamerdk <5618080+TheGamerdk@users.noreply.github.com> Date: Wed, 22 Dec 2021 22:01:50 +0100 Subject: [PATCH 23/31] makes it compile for real --- .../silicon/ai/decentralized/management/ai_controlpanel.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/mob/living/silicon/ai/decentralized/management/ai_controlpanel.dm b/code/modules/mob/living/silicon/ai/decentralized/management/ai_controlpanel.dm index c9d92225c183..c8bf8ec64b63 100644 --- a/code/modules/mob/living/silicon/ai/decentralized/management/ai_controlpanel.dm +++ b/code/modules/mob/living/silicon/ai/decentralized/management/ai_controlpanel.dm @@ -72,7 +72,7 @@ GLOBAL_VAR_INIT(ai_control_code, random_nukecode(6)) if(!AI) return ..() var/obj/item/surveillance_upgrade/upgrade = W - W.afterattack(AI, user) + upgrade.afterattack(AI, user) if(istype(W, /obj/item/malf_upgrade)) if(!authenticated) @@ -82,7 +82,7 @@ GLOBAL_VAR_INIT(ai_control_code, random_nukecode(6)) if(!AI) return ..() var/obj/item/malf_upgrade/upgrade = W - W.afterattack(AI, user) + upgrade.afterattack(AI, user) return ..() From cf0e2c68ee8b550fec2b282e61b43de493986ecd Mon Sep 17 00:00:00 2001 From: TheGamerdk <5618080+TheGamerdk@users.noreply.github.com> Date: Thu, 23 Dec 2021 01:20:35 +0100 Subject: [PATCH 24/31] Lower temp limit --- code/__DEFINES/ai.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/__DEFINES/ai.dm b/code/__DEFINES/ai.dm index 23371c6a0640..c2d630b9b169 100644 --- a/code/__DEFINES/ai.dm +++ b/code/__DEFINES/ai.dm @@ -2,7 +2,7 @@ ///All AI machinery heat production is multiplied by this value #define AI_TEMPERATURE_MULTIPLIER 4 //Thermodynamics? No... No I don't think that's a thing. Balance so we don't use an insane amount of power to produce noticeable heat ///Temperature limit of all AI machinery -#define AI_TEMP_LIMIT 290.15 //17C, much hotter than a normal server room for leniency :) +#define AI_TEMP_LIMIT 283.15 //10C, much hotter than a normal server room for leniency :) ///How many ticks can an AI data core store? When this amount of ticks have passed while it's in an INVALID state it can no longer be used by an AI From 872fe002433551b94ba54ee999439c28c2f7caf8 Mon Sep 17 00:00:00 2001 From: TheGamerdk <5618080+TheGamerdk@users.noreply.github.com> Date: Fri, 24 Dec 2021 02:20:12 +0100 Subject: [PATCH 25/31] Update ai_controlpanel.dm --- .../silicon/ai/decentralized/management/ai_controlpanel.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/mob/living/silicon/ai/decentralized/management/ai_controlpanel.dm b/code/modules/mob/living/silicon/ai/decentralized/management/ai_controlpanel.dm index c8bf8ec64b63..8717a282014b 100644 --- a/code/modules/mob/living/silicon/ai/decentralized/management/ai_controlpanel.dm +++ b/code/modules/mob/living/silicon/ai/decentralized/management/ai_controlpanel.dm @@ -299,7 +299,7 @@ GLOBAL_VAR_INIT(ai_control_code, random_nukecode(6)) one_time_password_used = TRUE var/msg = "

Warning!


We have detected usage of the AI Control Code for unlocking a console at coordinates ([src.x], [src.y], [src.z]) by [usr.name]. Please verify that this is correct. Be aware we have cancelled the current control code.
\ If needed a new code can be printed at a communications console." - priority_announce(msg, sender_override = "Central Cyber Security Update", has_important_message = TRUE) + priority_announce(msg, sender_override = "Central Cyber Security Update", has_important_message = TRUE, sanitize = FALSE) GLOB.ai_control_code = null else to_chat(usr, span_warning("Incorrect code. Make sure you have the latest one.")) From ebb1d5ee5270a7804cb17981452a75d7709dff67 Mon Sep 17 00:00:00 2001 From: TheGamerdk <5618080+TheGamerdk@users.noreply.github.com> Date: Fri, 24 Dec 2021 16:19:55 +0100 Subject: [PATCH 26/31] HUD fixes maybe? --- .../ai/decentralized/projects/ai_huds.dm | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/code/modules/mob/living/silicon/ai/decentralized/projects/ai_huds.dm b/code/modules/mob/living/silicon/ai/decentralized/projects/ai_huds.dm index ceef8e7a0818..5db9ed5ff47c 100644 --- a/code/modules/mob/living/silicon/ai/decentralized/projects/ai_huds.dm +++ b/code/modules/mob/living/silicon/ai/decentralized/projects/ai_huds.dm @@ -10,18 +10,20 @@ . = ..(force_run) if(!.) return . - ai.sec_hud = DATA_HUD_SECURITY_ADVANCED if(ai.sensors_on) - ai.toggle_sensors() - ai.toggle_sensors() + ai.toggle_sensors(TRUE) + + ai.sec_hud = DATA_HUD_SECURITY_ADVANCED + + ai.toggle_sensors(TRUE) /datum/ai_project/security_hud/stop() if(ai.sensors_on) //HUDs are weird. This has to be first so we're removed from the "advanced" HUD. It checks the sec_hud variable to see which one we remove from first. - ai.toggle_sensors() + ai.toggle_sensors(TRUE) ai.sec_hud = DATA_HUD_SECURITY_BASIC - ai.toggle_sensors() + ai.toggle_sensors(TRUE) ..() /datum/ai_project/diag_med_hud @@ -36,20 +38,21 @@ . = ..(force_run) if(!.) return . + if(ai.sensors_on) + ai.toggle_sensors(TRUE) + ai.d_hud = DATA_HUD_DIAGNOSTIC_ADVANCED ai.med_hud = DATA_HUD_MEDICAL_ADVANCED - - if(ai.sensors_on) - ai.toggle_sensors() - ai.toggle_sensors() + + ai.toggle_sensors(TRUE) /datum/ai_project/diag_med_hud/stop() if(ai.sensors_on) //HUDs are weird. This has to be first so we're removed from the "advanced" HUD. It checks the d_hud and med_hud variable to see which one we remove from first. - ai.toggle_sensors() + ai.toggle_sensors(TRUE) ai.d_hud = DATA_HUD_DIAGNOSTIC_BASIC ai.med_hud = DATA_HUD_MEDICAL_BASIC - ai.toggle_sensors() + ai.toggle_sensors(TRUE) ..() From d72c2c4e9dfb159745fdd8b0006f1e737ccae7f9 Mon Sep 17 00:00:00 2001 From: TheGamerdk <5618080+TheGamerdk@users.noreply.github.com> Date: Fri, 24 Dec 2021 16:28:33 +0100 Subject: [PATCH 27/31] Plaque --- .../crates_lockers/closets/secure/scientist.dm | 1 - .../objects/structures/signs/signs_plaques.dm | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/code/game/objects/structures/crates_lockers/closets/secure/scientist.dm b/code/game/objects/structures/crates_lockers/closets/secure/scientist.dm index 6b5f367aef10..2539209b5316 100755 --- a/code/game/objects/structures/crates_lockers/closets/secure/scientist.dm +++ b/code/game/objects/structures/crates_lockers/closets/secure/scientist.dm @@ -21,4 +21,3 @@ new /obj/item/storage/photo_album/RD(src) new /obj/item/clipboard/yog/paperwork/rd(src) new /obj/item/storage/backpack/duffelbag/clothing/rd(src) - new /obj/item/paper/ai_control_code(src) diff --git a/code/game/objects/structures/signs/signs_plaques.dm b/code/game/objects/structures/signs/signs_plaques.dm index 317f556e8d70..1011ad748190 100644 --- a/code/game/objects/structures/signs/signs_plaques.dm +++ b/code/game/objects/structures/signs/signs_plaques.dm @@ -26,6 +26,23 @@ desc = "Next to the extremely long list of names and job titles, there is a drawing of a little child. The child appears to be retarded. Beneath the image, someone has scratched the word \"PACKETS\"." icon_state = "kiddieplaque" +/obj/structure/sign/plaques/ai_password + name = "\improper AI default password" + desc = "This plaque contains the default password for AI control consoles onboard this station." + var/control_code = "BUG" + +/obj/structure/sign/plaques/ai_password/Initialize(mapload) + . = ..() + if(mapload) + control_code = GLOB.ai_control_code + +/obj/structure/sign/plaques/ai_password/examine(mob/living/user) + . = ..() + if(Adjacent(user)) + . += span_notice("The following digits are stamped into the plaque: [control_code]") + else + . += span_notice("You must be closer to read the code.") + /obj/structure/sign/plaques/kiddie/badger name = "\improper Remembrance Plaque" desc = "A plaque commemorating the fallen, may they rest in peace, forever asleep amongst the stars. Someone has drawn a picture of a crying badger at the bottom." From 4632532b1af09c0212fef06aebcca379103346c0 Mon Sep 17 00:00:00 2001 From: TheGamerdk <5618080+TheGamerdk@users.noreply.github.com> Date: Fri, 24 Dec 2021 16:29:04 +0100 Subject: [PATCH 28/31] Update ai_controlpanel.dm --- .../silicon/ai/decentralized/management/ai_controlpanel.dm | 2 -- 1 file changed, 2 deletions(-) diff --git a/code/modules/mob/living/silicon/ai/decentralized/management/ai_controlpanel.dm b/code/modules/mob/living/silicon/ai/decentralized/management/ai_controlpanel.dm index 8717a282014b..ba4d04122a69 100644 --- a/code/modules/mob/living/silicon/ai/decentralized/management/ai_controlpanel.dm +++ b/code/modules/mob/living/silicon/ai/decentralized/management/ai_controlpanel.dm @@ -408,8 +408,6 @@ GLOBAL_VAR_INIT(ai_control_code, random_nukecode(6)) to_chat(user, span_notice("You fail to remove the device.")) -#undef AI_DOWNLOAD_PER_PROCESS - /obj/item/paper/ai_control_code/Initialize(mapload) ..() From a8b6a8c06112e8a29ef344bf9ddad983b8e0ec3e Mon Sep 17 00:00:00 2001 From: TheGamerdk <5618080+TheGamerdk@users.noreply.github.com> Date: Fri, 24 Dec 2021 16:33:31 +0100 Subject: [PATCH 29/31] MAPS --- _maps/map_files/KiloStation/KiloStation.dmm | 57 +++++++++++---------- _maps/map_files/YogStation/YogStation.dmm | 17 +++--- _maps/map_files/Yogsmeta/Yogsmeta.dmm | 17 +++--- 3 files changed, 50 insertions(+), 41 deletions(-) diff --git a/_maps/map_files/KiloStation/KiloStation.dmm b/_maps/map_files/KiloStation/KiloStation.dmm index d5c823264fd6..fb7e51855c9f 100644 --- a/_maps/map_files/KiloStation/KiloStation.dmm +++ b/_maps/map_files/KiloStation/KiloStation.dmm @@ -95623,32 +95623,6 @@ icon_state = "platingdmg1" }, /area/maintenance/port/aft) -"oDc" = ( -/obj/structure/table, -/obj/item/clipboard, -/obj/item/wrench, -/obj/item/crowbar/red, -/obj/effect/decal/cleanable/dirt, -/obj/machinery/firealarm{ - dir = 1; - pixel_y = -26 - }, -/obj/machinery/light_switch{ - pixel_x = -24 - }, -/obj/machinery/camera{ - c_tag = "Server Room"; - dir = 1; - name = "science camera"; - network = list("ss13","rd") - }, -/obj/effect/turf_decal/stripes/corner, -/obj/effect/turf_decal/stripes/corner{ - dir = 1 - }, -/obj/effect/mapping_helpers/teleport_anchor, -/turf/open/floor/plasteel/showroomfloor, -/area/science/server) "oEO" = ( /obj/structure/barricade/wooden, /obj/effect/spawner/structure/window, @@ -103242,6 +103216,35 @@ }, /turf/open/floor/plating, /area/maintenance/starboard) +"xcN" = ( +/obj/structure/table, +/obj/item/clipboard, +/obj/item/wrench, +/obj/item/crowbar/red, +/obj/effect/decal/cleanable/dirt, +/obj/machinery/firealarm{ + dir = 1; + pixel_y = -26 + }, +/obj/machinery/light_switch{ + pixel_x = -24 + }, +/obj/machinery/camera{ + c_tag = "Server Room"; + dir = 1; + name = "science camera"; + network = list("ss13","rd") + }, +/obj/effect/turf_decal/stripes/corner, +/obj/effect/turf_decal/stripes/corner{ + dir = 1 + }, +/obj/effect/mapping_helpers/teleport_anchor, +/obj/structure/sign/plaques/ai_password{ + pixel_x = -32 + }, +/turf/open/floor/plasteel/showroomfloor, +/area/science/server) "xgq" = ( /obj/machinery/atmospherics/pipe/simple/general/visible, /obj/machinery/power/smes/engineering, @@ -142763,7 +142766,7 @@ ajz aZF adX avT -oDc +xcN bdi pxJ rxn diff --git a/_maps/map_files/YogStation/YogStation.dmm b/_maps/map_files/YogStation/YogStation.dmm index 4a518c0e004f..7ea3deef1096 100644 --- a/_maps/map_files/YogStation/YogStation.dmm +++ b/_maps/map_files/YogStation/YogStation.dmm @@ -34692,12 +34692,6 @@ }, /turf/open/floor/plasteel/dark, /area/engine/atmos) -"esR" = ( -/obj/effect/turf_decal/stripes/line{ - dir = 6 - }, -/turf/open/floor/plasteel/white, -/area/crew_quarters/heads/hor) "esT" = ( /obj/structure/disposalpipe/segment{ dir = 9 @@ -44219,6 +44213,15 @@ "kzu" = ( /turf/closed/wall/r_wall, /area/ai_monitored/turret_protected/ai_upload_foyer) +"kzW" = ( +/obj/effect/turf_decal/stripes/line{ + dir = 6 + }, +/obj/structure/sign/plaques/ai_password{ + pixel_x = 32 + }, +/turf/open/floor/plasteel/white, +/area/crew_quarters/heads/hor) "kAv" = ( /obj/machinery/atmospherics/pipe/manifold/supply/hidden/layer2{ dir = 1 @@ -115935,7 +115938,7 @@ bmY bvK bxm byu -esR +kzW bCf aGs bvK diff --git a/_maps/map_files/Yogsmeta/Yogsmeta.dmm b/_maps/map_files/Yogsmeta/Yogsmeta.dmm index 0af90ac50f02..a9d2b31ccee8 100644 --- a/_maps/map_files/Yogsmeta/Yogsmeta.dmm +++ b/_maps/map_files/Yogsmeta/Yogsmeta.dmm @@ -58985,12 +58985,6 @@ /obj/effect/turf_decal/stripes/line, /turf/open/floor/plasteel/white, /area/crew_quarters/heads/hor) -"ctV" = ( -/obj/effect/turf_decal/stripes/line{ - dir = 6 - }, -/turf/open/floor/plasteel/white, -/area/crew_quarters/heads/hor) "ctW" = ( /obj/machinery/portable_atmospherics/canister/carbon_dioxide, /obj/machinery/airalarm{ @@ -73449,6 +73443,15 @@ /obj/effect/decal/cleanable/cobweb/cobweb2, /turf/open/floor/plating, /area/maintenance/fore) +"jlP" = ( +/obj/effect/turf_decal/stripes/line{ + dir = 6 + }, +/obj/structure/sign/plaques/ai_password{ + pixel_x = 32 + }, +/turf/open/floor/plasteel/white, +/area/crew_quarters/heads/hor) "jlR" = ( /obj/structure/cable/yellow{ icon_state = "1-2" @@ -116876,7 +116879,7 @@ bTV bET crQ cte -ctV +jlP nTE dZO cwU From 6c2298d16699c8a294c5f8b6baab40c6b4f8c9a5 Mon Sep 17 00:00:00 2001 From: TheGamerdk <5618080+TheGamerdk@users.noreply.github.com> Date: Fri, 24 Dec 2021 16:37:08 +0100 Subject: [PATCH 30/31] kilo --- _maps/map_files/KiloStation/KiloStation.dmm | 57 +++++++++++---------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/_maps/map_files/KiloStation/KiloStation.dmm b/_maps/map_files/KiloStation/KiloStation.dmm index 6c09ed4b5890..653875dfc386 100644 --- a/_maps/map_files/KiloStation/KiloStation.dmm +++ b/_maps/map_files/KiloStation/KiloStation.dmm @@ -92514,6 +92514,35 @@ /obj/machinery/atmospherics/pipe/layer_manifold, /turf/open/floor/plasteel/dark, /area/maintenance/fore) +"lyU" = ( +/obj/structure/table, +/obj/item/clipboard, +/obj/item/wrench, +/obj/item/crowbar/red, +/obj/effect/decal/cleanable/dirt, +/obj/machinery/firealarm{ + dir = 1; + pixel_y = -26 + }, +/obj/machinery/light_switch{ + pixel_x = -24 + }, +/obj/machinery/camera{ + c_tag = "Server Room"; + dir = 1; + name = "science camera"; + network = list("ss13","rd") + }, +/obj/effect/turf_decal/stripes/corner, +/obj/effect/turf_decal/stripes/corner{ + dir = 1 + }, +/obj/effect/mapping_helpers/teleport_anchor, +/obj/structure/sign/plaques/ai_password{ + pixel_x = -32 + }, +/turf/open/floor/plasteel/showroomfloor, +/area/science/server) "lzb" = ( /obj/effect/decal/cleanable/dirt, /obj/effect/spawner/lootdrop/glowstick, @@ -95589,32 +95618,6 @@ icon_state = "platingdmg1" }, /area/maintenance/port/aft) -"oDc" = ( -/obj/structure/table, -/obj/item/clipboard, -/obj/item/wrench, -/obj/item/crowbar/red, -/obj/effect/decal/cleanable/dirt, -/obj/machinery/firealarm{ - dir = 1; - pixel_y = -26 - }, -/obj/machinery/light_switch{ - pixel_x = -24 - }, -/obj/machinery/camera{ - c_tag = "Server Room"; - dir = 1; - name = "science camera"; - network = list("ss13","rd") - }, -/obj/effect/turf_decal/stripes/corner, -/obj/effect/turf_decal/stripes/corner{ - dir = 1 - }, -/obj/effect/mapping_helpers/teleport_anchor, -/turf/open/floor/plasteel/showroomfloor, -/area/science/server) "oDF" = ( /obj/effect/turf_decal/stripes/line{ dir = 8 @@ -142958,7 +142961,7 @@ ajz aZF adX avT -oDc +lyU bdi pxJ rxn From 493635e8704eb43c8286e2b2b2be6544a7336933 Mon Sep 17 00:00:00 2001 From: TheGamerdk <5618080+TheGamerdk@users.noreply.github.com> Date: Sat, 25 Dec 2021 15:11:18 +0100 Subject: [PATCH 31/31] Update signs_plaques.dm --- code/game/objects/structures/signs/signs_plaques.dm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/code/game/objects/structures/signs/signs_plaques.dm b/code/game/objects/structures/signs/signs_plaques.dm index 1011ad748190..3220e0523054 100644 --- a/code/game/objects/structures/signs/signs_plaques.dm +++ b/code/game/objects/structures/signs/signs_plaques.dm @@ -33,8 +33,7 @@ /obj/structure/sign/plaques/ai_password/Initialize(mapload) . = ..() - if(mapload) - control_code = GLOB.ai_control_code + control_code = GLOB.ai_control_code /obj/structure/sign/plaques/ai_password/examine(mob/living/user) . = ..()