From a103acd509ea05a4b7771d9fdd34ef4e711a9f97 Mon Sep 17 00:00:00 2001 From: SandPoot Date: Tue, 10 Sep 2024 02:00:55 -0300 Subject: [PATCH] cavalry's here --- code/datums/elements/cleaning.dm | 43 ++++++++++--------- .../modules/mob/living/silicon/robot/robot.dm | 8 ++-- config/config.txt | 6 +-- config/sandstorm/includes.txt | 4 ++ config/sandstorm/qol.txt | 7 +++ .../configuration/entries/sandstorm.dm | 3 ++ .../code/modules/jobs/job_types/ai.dm | 19 +++++++- .../code/modules/mob/living/silicon/ai/ai.dm | 14 ------ 8 files changed, 61 insertions(+), 43 deletions(-) create mode 100644 config/sandstorm/includes.txt create mode 100644 config/sandstorm/qol.txt diff --git a/code/datums/elements/cleaning.dm b/code/datums/elements/cleaning.dm index 0232eb9fc0..21ea954f21 100644 --- a/code/datums/elements/cleaning.dm +++ b/code/datums/elements/cleaning.dm @@ -1,33 +1,36 @@ /datum/element/cleaning + element_flags = ELEMENT_BESPOKE|ELEMENT_DETACH + id_arg_index = 2 + /// Range of cleaning on moving var/range = 0 -/datum/element/cleaning/Attach(datum/target, cleaning_range = 0) +/datum/element/cleaning/Attach(atom/movable/cleaner, cleaning_range) . = ..() - if(!ismovable(target)) + if(!istype(cleaner)) return ELEMENT_INCOMPATIBLE - range = cleaning_range - RegisterSignal(target, COMSIG_MOVABLE_MOVED, PROC_REF(Clean)) + if(cleaning_range) + range = cleaning_range + RegisterSignal(cleaner, COMSIG_MOVABLE_MOVED, PROC_REF(Clean)) -/datum/element/cleaning/Detach(datum/target) +/datum/element/cleaning/Detach(atom/movable/cleaner) . = ..() - UnregisterSignal(target, COMSIG_MOVABLE_MOVED) + UnregisterSignal(cleaner, COMSIG_MOVABLE_MOVED) -/datum/element/cleaning/proc/Clean(datum/source) - var/atom/movable/AM = source - for (var/turf/T in RANGE_TURFS(range, AM.loc)) - SEND_SIGNAL(T, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_WEAK) - for(var/A in T) - if(is_cleanable(A)) - qdel(A) - else if(isitem(A)) - var/obj/item/cleaned_item = A +/datum/element/cleaning/proc/Clean(atom/movable/cleaner) + for (var/turf/turf in RANGE_TURFS(range, cleaner.loc)) + SEND_SIGNAL(turf, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_WEAK) + for(var/atom/atom as anything in turf) + if(is_cleanable(atom)) + qdel(atom) + else if(isitem(atom)) + var/obj/item/cleaned_item = atom SEND_SIGNAL(cleaned_item, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_WEAK) cleaned_item.clean_blood() if(ismob(cleaned_item.loc)) - var/mob/M = cleaned_item.loc - M.regenerate_icons() - else if(ishuman(A)) - var/mob/living/carbon/human/cleaned_human = A + var/mob/mob = cleaned_item.loc + mob.regenerate_icons() + else if(ishuman(atom)) + var/mob/living/carbon/human/cleaned_human = atom if(cleaned_human.lying) if(cleaned_human.head) SEND_SIGNAL(cleaned_human.head, COMSIG_COMPONENT_CLEAN_ACT, CLEAN_WEAK) @@ -67,4 +70,4 @@ cleaned_human.clean_blood() cleaned_human.wash_cream() cleaned_human.regenerate_icons() - to_chat(cleaned_human, "[AM] cleans your face!") + to_chat(cleaned_human, span_danger("[cleaner] cleans your face!")) diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 6d95f947ed..a5272cad6c 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -937,9 +937,9 @@ status_flags &= ~CANPUSH if(module.clean_on_move) - AddElement(/datum/element/cleaning, 1) + AddElement(/datum/element/cleaning, range = 1) else - RemoveElement(/datum/element/cleaning, 1) + RemoveElement(/datum/element/cleaning) hat_offset = module.hat_offset @@ -1206,8 +1206,8 @@ var/mob/unbuckle_me_now = i unbuckle_mob(unbuckle_me_now, FALSE) -/mob/living/silicon/robot/proc/TryConnectToAI() - set_connected_ai(select_active_ai_with_fewest_borgs(z)) +/mob/living/silicon/robot/proc/TryConnectToAI(mob/living/silicon/ai/connect_to) + set_connected_ai(connect_to || select_active_ai_with_fewest_borgs(z)) if(connected_ai) lawsync() lawupdate = TRUE diff --git a/config/config.txt b/config/config.txt index 897967be2e..112101889e 100644 --- a/config/config.txt +++ b/config/config.txt @@ -40,6 +40,6 @@ $include entries/urls.txt $include entries/vote.txt $include plushies/defines.txt -# Special Sandstorm configs -$include sandstorm/config.txt -$include sandstorm/balance.txt + +# Sandstorm configs +$include sandstorm/includes.txt diff --git a/config/sandstorm/includes.txt b/config/sandstorm/includes.txt new file mode 100644 index 0000000000..adf290da66 --- /dev/null +++ b/config/sandstorm/includes.txt @@ -0,0 +1,4 @@ +# This file is mostly so main config file relays to here, and this one relays to the rest +$include sandstorm/balance.txt +$include sandstorm/config.txt +$include sandstorm/qol.txt diff --git a/config/sandstorm/qol.txt b/config/sandstorm/qol.txt new file mode 100644 index 0000000000..4f2b082bd2 --- /dev/null +++ b/config/sandstorm/qol.txt @@ -0,0 +1,7 @@ +### +## AI +### + +## How many shells would an AI gain at roundstart +## Comment to disable +ROUNDSTART_AI_SHELLS 1 diff --git a/modular_sand/code/controllers/configuration/entries/sandstorm.dm b/modular_sand/code/controllers/configuration/entries/sandstorm.dm index 155cfb32c5..b8461801e4 100644 --- a/modular_sand/code/controllers/configuration/entries/sandstorm.dm +++ b/modular_sand/code/controllers/configuration/entries/sandstorm.dm @@ -28,3 +28,6 @@ value_mode = VALUE_MODE_TYPE splitter = " | " lowercase_key = FALSE + +/datum/config_entry/number/roundstart_ai_shells // Per AI, if you ever do get a triumvirate! + min_val = 0 diff --git a/modular_sand/code/modules/jobs/job_types/ai.dm b/modular_sand/code/modules/jobs/job_types/ai.dm index 5f80699ea7..df0f3ff842 100644 --- a/modular_sand/code/modules/jobs/job_types/ai.dm +++ b/modular_sand/code/modules/jobs/job_types/ai.dm @@ -1,6 +1,21 @@ /datum/job/ai/after_spawn(mob/living/silicon/ai/AI, client/player_client, latejoin) . = ..() - if(!istype(AI)) + setup_silicon_law_prefs(AI, player_client) + + if(latejoin) return - setup_silicon_law_prefs(AI, player_client) + var/free_shells = CONFIG_GET(number/roundstart_ai_shells) + if(!free_shells) + return + + var/turf/open/turf = locate() in RANGE_TURFS(1, AI) + + // Why the fuck is the station AI completely blocked + var/turf/where = turf || get_turf(AI) + + // Creating AI shells for the AI. + for(var/iteration in 1 to free_shells) + var/mob/living/silicon/robot/free_borg = new(where) + free_borg.shell = TRUE + free_borg.TryConnectToAI(AI) diff --git a/modular_sand/code/modules/mob/living/silicon/ai/ai.dm b/modular_sand/code/modules/mob/living/silicon/ai/ai.dm index f02d79831b..30c0a87779 100644 --- a/modular_sand/code/modules/mob/living/silicon/ai/ai.dm +++ b/modular_sand/code/modules/mob/living/silicon/ai/ai.dm @@ -1,16 +1,2 @@ /mob/living/silicon/ai vore_flags = NO_VORE - -/mob/living/silicon/ai/Initialize(mapload, datum/ai_laws/L, mob/target_ai) - . = ..() - if (!mapload) - return - - // Creating a AI shell for the AI. - var/turf/open/T = locate() in RANGE_TURFS(1, src) - if (T) - new /mob/living/silicon/robot/shell(T) - return - - // Why the fuck is the station AI completely blocked - new /mob/living/silicon/robot/shell(get_turf(src))