Skip to content

Commit

Permalink
Slight nanite changes
Browse files Browse the repository at this point in the history
  • Loading branch information
PowerfulBacon committed Nov 2, 2024
1 parent 2c2c550 commit d1d4c60
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 13 deletions.
35 changes: 28 additions & 7 deletions code/modules/research/nanites/nanite_programs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -183,16 +196,21 @@
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)
disable_passive_effect()
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()
Expand Down Expand Up @@ -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]
Expand Down
18 changes: 12 additions & 6 deletions code/modules/research/nanites/nanite_programs/buffing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -34,25 +34,31 @@

/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

/datum/nanite_program/hardening/enable_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
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"
Expand Down

0 comments on commit d1d4c60

Please sign in to comment.