Makes it work proper, hopefully

This commit is contained in:
Artur
2021-06-16 01:48:54 +03:00
parent 795ab3f835
commit ad0c3d477e
2 changed files with 22 additions and 14 deletions
@@ -48,7 +48,7 @@
//Extra settings //Extra settings
///Don't ever override this or I will come to your house and stand menacingly behind a bush ///Don't ever override this or I will come to your house and stand menacingly behind a bush
var/list/extra_settings = list() VAR_FINAL/list/extra_settings = list()
//Rules //Rules
//Rules that automatically manage if the program's active without requiring separate sensor programs //Rules that automatically manage if the program's active without requiring separate sensor programs
@@ -77,6 +77,9 @@
if(nanites) if(nanites)
nanites.programs -= src nanites.programs -= src
nanites.permanent_programs -= src nanites.permanent_programs -= src
for(var/datum/nanite_rule/rule as anything in rules)
rule.remove()
rules.Cut()
return ..() return ..()
/** /**
@@ -188,14 +191,17 @@
if(timer_shutdown_next && world.time > timer_shutdown_next) if(timer_shutdown_next && world.time > timer_shutdown_next)
deactivate() deactivate()
timer_shutdown_next = 0 timer_shutdown_next = 0
return
if(timer_trigger && world.time > timer_trigger_next) if(timer_trigger && world.time > timer_trigger_next)
trigger() trigger()
timer_trigger_next = world.time + timer_trigger timer_trigger_next = world.time + timer_trigger
return
if(timer_trigger_delay_next && world.time > timer_trigger_delay_next) if(timer_trigger_delay_next && world.time > timer_trigger_delay_next)
trigger(delayed = TRUE) trigger(delayed = TRUE)
timer_trigger_delay_next = 0 timer_trigger_delay_next = 0
return
if(check_conditions() && consume_nanites(use_rate)) if(check_conditions() && consume_nanites(use_rate))
if(!passive_enabled) if(!passive_enabled)
@@ -259,18 +265,22 @@
if(program_flags & NANITE_EMP_IMMUNE) if(program_flags & NANITE_EMP_IMMUNE)
return return
if(prob(severity / 2)) if(prob(severity / 2))
host_mob.investigate_log("[src] nanite program received a software error due to emp.", INVESTIGATE_NANITES)
software_error() software_error()
/datum/nanite_program/proc/on_shock(shock_damage) /datum/nanite_program/proc/on_shock(shock_damage)
if(!(program_flags & NANITE_SHOCK_IMMUNE)) if(!(program_flags & NANITE_SHOCK_IMMUNE))
if(prob(10)) if(prob(10))
host_mob.investigate_log("[src] nanite program received a software error due to shock.", INVESTIGATE_NANITES)
software_error() software_error()
else if(prob(33)) else if(prob(33))
host_mob.investigate_log("[src] nanite program was deleted due to shock.", INVESTIGATE_NANITES)
self_destruct() self_destruct()
/datum/nanite_program/proc/on_minor_shock() /datum/nanite_program/proc/on_minor_shock()
if(!(program_flags & NANITE_SHOCK_IMMUNE)) if(!(program_flags & NANITE_SHOCK_IMMUNE))
if(prob(10)) if(prob(10))
host_mob.investigate_log("[src] nanite program received a software error due to minor shock.", INVESTIGATE_NANITES)
software_error() software_error()
/datum/nanite_program/proc/on_death() /datum/nanite_program/proc/on_death()
@@ -281,10 +291,12 @@
type = rand(1,is_permanent()? 4 : 5) type = rand(1,is_permanent()? 4 : 5)
switch(type) switch(type)
if(1) if(1)
self_destruct() //kill switch host_mob.investigate_log("[src] nanite program was deleted by software error.", INVESTIGATE_NANITES)
qdel(src) //kill switch
return return
if(2) //deprogram codes if(2) //deprogram codes
if(corruptable) if(corruptable)
host_mob.investigate_log("[src] nanite program was de-programmed by software error.", INVESTIGATE_NANITES)
activation_code = 0 activation_code = 0
deactivation_code = 0 deactivation_code = 0
kill_code = 0 kill_code = 0
@@ -292,15 +304,18 @@
if(3) if(3)
if(error_flicking) if(error_flicking)
toggle() //enable/disable toggle() //enable/disable
host_mob.investigate_log("[src] nanite program was toggled by software error.", INVESTIGATE_NANITES)
if(4) if(4)
if(error_flicking && can_trigger) if(can_trigger)
host_mob.investigate_log("[src] nanite program was triggered by software error.", INVESTIGATE_NANITES)
trigger() trigger()
if(5) //Program is scrambled and does something different if(5) //Program is scrambled and does something different
if(corruptable) if(corruptable)
var/rogue_type = pick(rogue_types) var/rogue_type = pick(rogue_types)
var/datum/nanite_program/rogue = new rogue_type var/datum/nanite_program/rogue = new rogue_type
host_mob.investigate_log("[src] nanite program was converted into [rogue.name] by software error.", INVESTIGATE_NANITES)
nanites.add_program(null, rogue, src) nanites.add_program(null, rogue, src)
self_destruct() self_destruct(src)
/datum/nanite_program/proc/receive_signal(code, source) /datum/nanite_program/proc/receive_signal(code, source)
if(activation_code && code == activation_code && !activated) if(activation_code && code == activation_code && !activated)
@@ -323,9 +338,7 @@
if(is_permanent()) if(is_permanent())
return return
qdel(src) qdel(src)
///A nanite program containing a behaviour protocol. Only one protocol of each class can be active at once. ///A nanite program containing a behaviour protocol. Only one protocol of each class can be active at once.
//Moved to being 'normally' researched due to lack of B.E.P.I.S.
/datum/nanite_program/protocol /datum/nanite_program/protocol
name = "Nanite Protocol" name = "Nanite Protocol"
var/protocol_class = NONE var/protocol_class = NONE
@@ -345,4 +358,3 @@
if(nanites) if(nanites)
nanites.protocols -= src nanites.protocols -= src
return ..() return ..()
@@ -53,16 +53,12 @@
rogue_types = list(/datum/nanite_program/suffocating, /datum/nanite_program/necrotic) rogue_types = list(/datum/nanite_program/suffocating, /datum/nanite_program/necrotic)
/datum/nanite_program/purging/check_conditions() /datum/nanite_program/purging/check_conditions()
<<<<<<< HEAD
var/foreign_reagent = length(host_mob.reagents?.reagent_list)
if(!host_mob.getToxLoss() && !foreign_reagent)
return FALSE
return ..()
=======
. = ..() . = ..()
if(!. || !host_mob.reagents) if(!. || !host_mob.reagents)
return FALSE // No trying to purge simple mobs return FALSE // No trying to purge simple mobs
>>>>>>> e543f07... Fixes nanite purge runtime on simple mobs (#55902) var/foreign_reagent = length(host_mob.reagents?.reagent_list)
if(!host_mob.getToxLoss() && !foreign_reagent)
return FALSE
/datum/nanite_program/purging/active_effect() /datum/nanite_program/purging/active_effect()
host_mob.adjustToxLoss(-1) host_mob.adjustToxLoss(-1)