diff --git a/code/modules/research/nanites/nanite_cloud_controller.dm b/code/modules/research/nanites/nanite_cloud_controller.dm index a525b47797..eda9224bfb 100644 --- a/code/modules/research/nanites/nanite_cloud_controller.dm +++ b/code/modules/research/nanites/nanite_cloud_controller.dm @@ -145,6 +145,7 @@ cloud_program["rules"] = rules if(LAZYLEN(rules)) cloud_program["has_rules"] = TRUE + cloud_program["all_rules_required"] = P.all_rules_required var/list/extra_settings = P.get_extra_settings_frontend() cloud_program["extra_settings"] = extra_settings @@ -233,6 +234,15 @@ investigate_log("[key_name(usr)] removed rule [rule.display()] from program [P.name] in cloud #[current_view]", INVESTIGATE_NANITES) . = TRUE + if("toggle_rule_logic") + var/datum/nanite_cloud_backup/backup = get_backup(current_view) + if(backup) + playsound(src, 'sound/machines/terminal_prompt.ogg', 50, FALSE) + var/datum/component/nanites/nanites = backup.nanites + var/datum/nanite_program/P = nanites.programs[text2num(params["program_id"])] + P.all_rules_required = !P.all_rules_required + investigate_log("[key_name(usr)] edited rule logic for program [P.name] into [P.all_rules_required ? "All" : "Any"] in cloud #[current_view]", INVESTIGATE_NANITES) + . = TRUE /datum/nanite_cloud_backup var/cloud_id = 0 diff --git a/code/modules/research/nanites/nanite_programs.dm b/code/modules/research/nanites/nanite_programs.dm index 946dec3f49..7ed6d02e8e 100644 --- a/code/modules/research/nanites/nanite_programs.dm +++ b/code/modules/research/nanites/nanite_programs.dm @@ -53,6 +53,7 @@ //Rules //Rules that automatically manage if the program's active without requiring separate sensor programs var/list/datum/nanite_rule/rules = list() + var/all_rules_required = TRUE //Whether all rules are required for positive condition or any of specified /// Corruptable - able to have code/configuration changed var/corruptable = TRUE @@ -108,6 +109,7 @@ for(var/R in rules) var/datum/nanite_rule/rule = R rule.copy_to(target) + target.all_rules_required = all_rules_required if(istype(target,src)) copy_extra_settings_to(target) @@ -206,11 +208,15 @@ //If false, disables active and passive effects, but doesn't consume nanites //Can be used to avoid consuming nanites for nothing /datum/nanite_program/proc/check_conditions() + if (!LAZYLEN(rules)) + return TRUE for(var/R in rules) var/datum/nanite_rule/rule = R - if(!rule.check_rule()) + if(!all_rules_required && rule.check_rule()) + return TRUE + if(all_rules_required && !rule.check_rule()) return FALSE - return TRUE + return all_rules_required ? TRUE : FALSE //Constantly procs as long as the program is active /datum/nanite_program/proc/active_effect() diff --git a/tgui/packages/tgui/interfaces/NaniteCloudControl.js b/tgui/packages/tgui/interfaces/NaniteCloudControl.js index e9eb566464..a24c60a20d 100644 --- a/tgui/packages/tgui/interfaces/NaniteCloudControl.js +++ b/tgui/packages/tgui/interfaces/NaniteCloudControl.js @@ -196,7 +196,7 @@ export const NaniteCloudBackupDetails = (props, context) => { !!has_program && (