Artur
2021-06-16 01:16:08 +03:00
parent f3e16b298b
commit a430dc4d4d
3 changed files with 37 additions and 11 deletions
@@ -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()