From d1d4c605aae42b6a1b28e899e5c9e96af4f7dbd4 Mon Sep 17 00:00:00 2001 From: PowerfulBacon <26465327+PowerfulBacon@users.noreply.github.com> Date: Sat, 2 Nov 2024 09:19:18 +0000 Subject: [PATCH] Slight nanite changes --- .../research/nanites/nanite_programs.dm | 35 +++++++++++++++---- .../nanites/nanite_programs/buffing.dm | 18 ++++++---- 2 files changed, 40 insertions(+), 13 deletions(-) diff --git a/code/modules/research/nanites/nanite_programs.dm b/code/modules/research/nanites/nanite_programs.dm index 39f00741e7f1d..b2daee9d40bf3 100644 --- a/code/modules/research/nanites/nanite_programs.dm +++ b/code/modules/research/nanites/nanite_programs.dm @@ -5,14 +5,27 @@ var/datum/component/nanites/nanites var/mob/living/host_mob - var/use_rate = 0 //Amount of nanites used while active - var/unique = TRUE //If there can be more than one copy in the same nanites - var/can_trigger = FALSE //If the nanites have a trigger function (used for the programming UI) - var/trigger_cost = 0 //Amount of nanites required to trigger - var/trigger_cooldown = 50 //Deciseconds required between each trigger activation - var/next_trigger = 0 //World time required for the next trigger activation - var/activate_cooldown = 0 //Deciseconds required between each activation + ///Amount of nanites used while active + var/use_rate = 0 + ///If there can be more than one copy in the same nanites + var/unique = TRUE + ///If the nanites have a trigger function (used for the programming UI) + var/can_trigger = FALSE + ///Amount of nanites required to trigger + var/trigger_cost = 0 + ///Deciseconds required between each trigger activation + var/trigger_cooldown = 50 + ///Deciseconds required between each activation + var/activate_cooldown = 0 + /// Maximum duration that this program can be active for before turning off + /// If set to null, there will be no maximum duration + var/maximum_duration = null + + ///World time required for the next trigger activation + var/next_trigger = 0 COOLDOWN_DECLARE(next_activate) + /// Time that the nanite program will be automatically disabled + var/disable_time = null var/program_flags = NONE var/passive_enabled = FALSE //If the nanites have an on/off-style effect, it's tracked by this var @@ -183,6 +196,8 @@ timer_shutdown_next = world.time + timer_shutdown if(activate_cooldown) COOLDOWN_START(src, next_activate, activate_cooldown) + if (!isnull(maximum_duration)) + disable_time = world.time + maximum_duration /datum/nanite_program/proc/deactivate() if(passive_enabled) @@ -190,9 +205,12 @@ activated = FALSE if(timer_restart) timer_restart_next = world.time + timer_restart + if (!isnull(disable_time)) + disable_time = null /// Processes every second /datum/nanite_program/proc/on_process() + SHOULD_CALL_PARENT(TRUE) if(!activated) if(timer_restart_next && world.time > timer_restart_next) activate() @@ -225,6 +243,9 @@ //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() + // Nanites automatically disabled when time passes the disable timer + if (!isnull(disable_time) && world.time > disable_time) + return FALSE var/rule_amt = length(rules) if(rule_amt) var/datum/nanite_extra_setting/logictype = extra_settings[NES_RULE_LOGIC] diff --git a/code/modules/research/nanites/nanite_programs/buffing.dm b/code/modules/research/nanites/nanite_programs/buffing.dm index eb11675deeff4..351df230f9a4b 100644 --- a/code/modules/research/nanites/nanite_programs/buffing.dm +++ b/code/modules/research/nanites/nanite_programs/buffing.dm @@ -23,7 +23,7 @@ desc = "The nanites cause a burst of adrenaline when triggered, allowing the user to push their body past its normal limits." can_trigger = TRUE trigger_cost = 20 - trigger_cooldown = 1200 + trigger_cooldown = 2 MINUTES rogue_types = list(/datum/nanite_program/toxic, /datum/nanite_program/nerve_decay) /datum/nanite_program/adrenaline/on_trigger() @@ -34,9 +34,11 @@ /datum/nanite_program/hardening name = "Dermal Hardening" - desc = "The nanites form a mesh under the host's skin, protecting them from melee and bullet impacts." + desc = "The nanites form a mesh under the host's skin, protecting them from melee and bullet impacts for 20 seconds." use_rate = 0.5 rogue_types = list(/datum/nanite_program/skin_decay) + activate_cooldown = 60 SECONDS + maximum_duration = 20 SECONDS //TODO on_hit effect that turns skin grey for a moment @@ -44,15 +46,19 @@ . = ..() if(ishuman(host_mob)) var/mob/living/carbon/human/H = host_mob - H.physiology.armor.melee += 30 - H.physiology.armor.bullet += 30 + H.physiology.armor.melee += 25 + H.physiology.armor.bullet += 25 + ADD_TRAIT(H, TRAIT_NANITE_SKIN, SOURCE_NANITES) + H.update_body_parts() /datum/nanite_program/hardening/disable_passive_effect() . = ..() if(ishuman(host_mob)) var/mob/living/carbon/human/H = host_mob - H.physiology.armor.melee -= 30 - H.physiology.armor.bullet -= 30 + H.physiology.armor.melee -= 25 + H.physiology.armor.bullet -= 25 + REMOVE_TRAIT(H, TRAIT_NANITE_SKIN, SOURCE_NANITES) + H.update_body_parts() /datum/nanite_program/refractive name = "Dermal Refractive Surface"