mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-14 16:44:33 +01:00
Reboots the CNS implant (#23813)
* Reboots the CNS implant * Update code/modules/surgery/organs/augments_internal.dm Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com> * contra you nerd you forgot a bracket * Apply suggestions from code review Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com> * requested changes --------- Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
This commit is contained in:
@@ -525,7 +525,12 @@
|
||||
#define COMSIG_CARBON_UPDATE_HANDCUFFED "carbon_update_handcuff"
|
||||
/// From /mob/living/carbon/regenerate_icons()
|
||||
#define COMSIG_CARBON_REGENERATE_ICONS "carbon_regen_icons"
|
||||
|
||||
/// From /mob/living/carbon/enter_stamcrit()
|
||||
#define COMSIG_CARBON_ENTER_STAMINACRIT "carbon_enter_staminacrit"
|
||||
/// From /mob/living/carbon/update_stamina()
|
||||
#define COMSIG_CARBON_EXIT_STAMINACRIT "carbon_exit_staminacrit"
|
||||
/// From /mob/living/carbon/handle_status_effects()
|
||||
#define COMSIG_CARBON_STAMINA_REGENERATED "carbon_stamina_regenerated"
|
||||
|
||||
// /mob/living/simple_animal/hostile signals
|
||||
#define COMSIG_HOSTILE_ATTACKINGTARGET "hostile_attackingtarget"
|
||||
|
||||
@@ -254,6 +254,7 @@
|
||||
update_stamina()
|
||||
if(staminaloss)
|
||||
setStaminaLoss(0, FALSE)
|
||||
SEND_SIGNAL(src, COMSIG_CARBON_STAMINA_REGENERATED)
|
||||
update_health_hud()
|
||||
|
||||
// Keep SSD people asleep
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
return
|
||||
if(!IsWeakened())
|
||||
to_chat(src, "<span class='notice'>You're too exhausted to keep going...</span>")
|
||||
SEND_SIGNAL(src, COMSIG_CARBON_ENTER_STAMINACRIT)
|
||||
stam_regen_start_time = world.time + (STAMINA_REGEN_BLOCK_TIME * stamina_regen_block_modifier)
|
||||
var/prev = stam_paralyzed
|
||||
stam_paralyzed = TRUE
|
||||
ADD_TRAIT(src, TRAIT_IMMOBILIZED, "stam_crit") // make defines later
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
if(stam > DAMAGE_PRECISION && (maxHealth - stam) <= HEALTH_THRESHOLD_CRIT && !stat)
|
||||
enter_stamcrit()
|
||||
else if(stam_paralyzed)
|
||||
SEND_SIGNAL(src, COMSIG_CARBON_EXIT_STAMINACRIT)
|
||||
stam_paralyzed = FALSE
|
||||
REMOVE_TRAIT(src, TRAIT_IMMOBILIZED, "stam_crit") // make defines later
|
||||
REMOVE_TRAIT(src, TRAIT_FLOORED, "stam_crit")
|
||||
|
||||
@@ -284,7 +284,7 @@
|
||||
else
|
||||
. = STATUS_UPDATE_STAMINA
|
||||
if(amount > 0)
|
||||
stam_regen_start_time = world.time + STAMINA_REGEN_BLOCK_TIME
|
||||
stam_regen_start_time = world.time + (STAMINA_REGEN_BLOCK_TIME * stamina_regen_block_modifier)
|
||||
if(updating)
|
||||
update_health_hud()
|
||||
update_stamina()
|
||||
@@ -300,7 +300,7 @@
|
||||
else
|
||||
. = STATUS_UPDATE_STAMINA
|
||||
if(amount > 0)
|
||||
stam_regen_start_time = world.time + STAMINA_REGEN_BLOCK_TIME
|
||||
stam_regen_start_time = world.time + (STAMINA_REGEN_BLOCK_TIME * stamina_regen_block_modifier)
|
||||
if(updating)
|
||||
update_health_hud()
|
||||
update_stamina()
|
||||
|
||||
@@ -71,6 +71,8 @@
|
||||
|
||||
var/stun_absorption = null //converted to a list of stun absorption sources this mob has when one is added
|
||||
var/stam_regen_start_time = 0 //used to halt stamina regen temporarily
|
||||
/// A multiplier for the ammount of time it takes for someone to regenerate stamina damage.
|
||||
var/stamina_regen_block_modifier = 1
|
||||
var/stam_paralyzed = FALSE //knocks you down
|
||||
|
||||
/// Number of degrees of rotation of a mob. 0 means no rotation, up-side facing NORTH. 90 means up-side rotated to face EAST, and so on.
|
||||
|
||||
@@ -132,27 +132,44 @@
|
||||
implant_color = "#FFFF00"
|
||||
slot = "brain_antistun"
|
||||
origin_tech = "materials=5;programming=4;biotech=5"
|
||||
var/last_stamina_damage = 0
|
||||
var/max_stamina_increment = 40
|
||||
/// How much we multiply the owners stamina regen block modifier by.
|
||||
var/stamina_crit_time_multiplier = 0.4
|
||||
/// Are we currently modifying somoeones stamina regen block modifier? If so, we will want to undo it on removal.
|
||||
var/currently_modifying_stamina = FALSE
|
||||
COOLDOWN_DECLARE(implant_cooldown)
|
||||
|
||||
/obj/item/organ/internal/cyberimp/brain/anti_stam/on_life()
|
||||
/obj/item/organ/internal/cyberimp/brain/anti_stam/insert(mob/living/carbon/M, special = FALSE)
|
||||
..()
|
||||
if(crit_fail)
|
||||
return
|
||||
if(last_stamina_damage + max_stamina_increment < owner.getStaminaLoss())
|
||||
owner.setStaminaLoss(last_stamina_damage + max_stamina_increment)
|
||||
last_stamina_damage = owner.getStaminaLoss()
|
||||
RegisterSignal(M, COMSIG_CARBON_ENTER_STAMINACRIT, PROC_REF(on_enter))
|
||||
RegisterSignal(M, COMSIG_CARBON_EXIT_STAMINACRIT, PROC_REF(on_exit))
|
||||
RegisterSignal(M, COMSIG_CARBON_STAMINA_REGENERATED, PROC_REF(on_regen))
|
||||
|
||||
/obj/item/organ/internal/cyberimp/brain/anti_stam/remove(mob/living/carbon/M, special = FALSE)
|
||||
UnregisterSignal(M, list(COMSIG_CARBON_ENTER_STAMINACRIT, COMSIG_CARBON_EXIT_STAMINACRIT, COMSIG_CARBON_STAMINA_REGENERATED))
|
||||
on_exit()
|
||||
return ..()
|
||||
|
||||
/obj/item/organ/internal/cyberimp/brain/anti_stam/proc/on_enter()
|
||||
SIGNAL_HANDLER // COMSIG_CARBON_ENTER_STAMINACRIT
|
||||
if(currently_modifying_stamina || !COOLDOWN_FINISHED(src, implant_cooldown))
|
||||
return
|
||||
owner.stamina_regen_block_modifier *= stamina_crit_time_multiplier
|
||||
currently_modifying_stamina = TRUE
|
||||
|
||||
/obj/item/organ/internal/cyberimp/brain/anti_stam/proc/on_exit()
|
||||
SIGNAL_HANDLER // COMSIG_CARBON_EXIT_STAMINACRIT
|
||||
if(!currently_modifying_stamina)
|
||||
return
|
||||
owner.stamina_regen_block_modifier /= stamina_crit_time_multiplier
|
||||
currently_modifying_stamina = FALSE
|
||||
|
||||
/obj/item/organ/internal/cyberimp/brain/anti_stam/proc/on_regen()
|
||||
SIGNAL_HANDLER // COMSIG_CARBON_STAMINA_REGENERATED
|
||||
owner.update_stamina() //This is here so they actually get unstaminacrit when it triggers, vs 2-4 seconds later
|
||||
|
||||
/obj/item/organ/internal/cyberimp/brain/anti_stam/emp_act(severity)
|
||||
..()
|
||||
if(crit_fail || emp_proof)
|
||||
return
|
||||
crit_fail = TRUE
|
||||
addtimer(CALLBACK(src, PROC_REF(reboot)), 90 / severity)
|
||||
|
||||
/obj/item/organ/internal/cyberimp/brain/anti_stam/proc/reboot()
|
||||
crit_fail = FALSE
|
||||
COOLDOWN_START(src, implant_cooldown, 1 MINUTES / severity)
|
||||
|
||||
/obj/item/organ/internal/cyberimp/brain/anti_stam/hardened
|
||||
name = "Hardened CNS Rebooter implant"
|
||||
|
||||
Reference in New Issue
Block a user