Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] [SEMI-MODULAR] Forbids synth electrical damage from getting worse if they are currently being repaired #2946

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions code/__DEFINES/~nova_defines/traits/declarations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
/// The trait which is applied when a `slick skin` trait haver actually gets wet_stacks
#define TRAIT_SLIPPERY "slippery"

/// When someone is fixing electrical damage, this trait is set and prevents the wound from worsening.
// We use a trait to avoid erronous setting of a variable to false if two people are repairing and one stops.
#define TRAIT_ELECTRICAL_DAMAGE_REPAIRING "electrical_damage_repairing"

// felinid traits
#define TRAIT_FELINE "feline_aspect"

Expand Down
5 changes: 5 additions & 0 deletions code/_globalvars/traits/_traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ GLOBAL_LIST_INIT(traits_by_type, list(
/datum/wound = list(
"TRAIT_WOUND_SCANNED" = TRAIT_WOUND_SCANNED,
),
// NOVA EDIT ADDITON BEGIN - Synthetic wounds
/datum/wound/electrical_damage = list(
"TRAIT_ELECTRICAL_DAMAGE_REPAIRING" = TRAIT_ELECTRICAL_DAMAGE_REPAIRING,
),
// NOVA EDIT ADDITON END - Synthetic wounds
/obj = list(
"TRAIT_WALLMOUNTED" = TRAIT_WALLMOUNTED,
),
Expand Down
12 changes: 6 additions & 6 deletions modular_nova/modules/medical/code/wounds/synth/robotic_pierce.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
process_shock_spark_count_max = 1
process_shock_spark_count_min = 1

wirecut_repair_percent = 0.104
wire_repair_percent = 0.026
wirecut_repair_percent = 0.078
wire_repair_percent = 0.018

initial_sparks_amount = 1

Expand Down Expand Up @@ -84,8 +84,8 @@
process_shock_spark_count_max = 2
process_shock_spark_count_min = 1

wirecut_repair_percent = 0.08
wire_repair_percent = 0.02
wirecut_repair_percent = 0.046
wire_repair_percent = 0.01

initial_sparks_amount = 3

Expand Down Expand Up @@ -129,8 +129,8 @@
process_shock_spark_count_max = 3
process_shock_spark_count_min = 2

wirecut_repair_percent = 0.072
wire_repair_percent = 0.018
wirecut_repair_percent = 0.032
wire_repair_percent = 0.008

initial_sparks_amount = 8

Expand Down
44 changes: 30 additions & 14 deletions modular_nova/modules/medical/code/wounds/synth/robotic_slash.dm
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@
if (seconds_for_intensity > 0 && HAS_TRAIT(victim, TRAIT_COAGULATING))
seconds_for_intensity *= ELECTRICAL_DAMAGE_CLOTTING_PROGRESS_MULT

if (HAS_TRAIT(src, TRAIT_ELECTRICAL_DAMAGE_REPAIRING))
seconds_for_intensity = min(seconds_for_intensity, 0) // it cant get any worse

return seconds_for_intensity

/// Returns how many deciseconds progress should be reduced by, based on the current heat of our victim's body.
Expand Down Expand Up @@ -344,14 +347,22 @@
if (HAS_TRAIT(src, TRAIT_WOUND_SCANNED))
change *= 1.5

ADD_TRAIT(src, TRAIT_ELECTRICAL_DAMAGE_REPAIRING, REF(user))
do_suture_repairs(suturing_item, user, change, delay_mult)
REMOVE_TRAIT(src, TRAIT_ELECTRICAL_DAMAGE_REPAIRING, REF(user))
return TRUE

/// Does a while loop that repairs us with cables. A proc for containing runtimes and allowing trait removal at all times.
/datum/wound/electrical_damage/proc/do_suture_repairs(obj/item/stack/suturing_item, mob/living/carbon/human/user, change, delay_mult)
var/is_suture = (istype(suturing_item, /obj/item/stack/medical/suture))
var/their_or_other = (user == victim ? "[user.p_their()]" : "[victim]'s")
var/your_or_other = (user == victim ? "your" : "[victim]'s")
var/replacing_or_suturing = (is_suture ? "repairing some" : "replacing")
while (suturing_item.tool_start_check())
user?.visible_message(span_danger("[user] begins [replacing_or_suturing] wiring within [their_or_other] [limb.plaintext_zone] with [suturing_item]..."), \
span_notice("You begin [replacing_or_suturing] wiring within [your_or_other] [limb.plaintext_zone] with [suturing_item]..."))
if (!suturing_item.use_tool(target = victim, user = user, delay = ELECTRICAL_DAMAGE_SUTURE_WIRE_BASE_DELAY * delay_mult, amount = 1, volume = 50, extra_checks = CALLBACK(src, PROC_REF(still_exists))))
return TRUE
return

if (user != victim && user.combat_mode)
user?.visible_message(span_danger("[user] mangles some of [their_or_other] [limb.plaintext_zone]'s wiring!"), \
Expand All @@ -364,11 +375,10 @@
user?.visible_message(span_notice("[user] [repairs_or_replaces] some of [their_or_other] [limb.plaintext_zone]'s wiring!"), \
span_notice("You [repair_or_replace] some of [your_or_other] [limb.plaintext_zone]'s wiring!"))
adjust_intensity(-change)
victim.balloon_alert(user, "intensity reduced to [get_intensity_mult() * 100]%")
victim?.balloon_alert(user, "intensity reduced to [get_intensity_mult() * 100]%")

if (fixed())
return TRUE
return TRUE
return

/**
* The "proper" treatment, done with wirecutters/retractors. Retractors get a debuff.
Expand Down Expand Up @@ -403,13 +413,20 @@
if (HAS_TRAIT(src, TRAIT_WOUND_SCANNED))
change *= 1.5

ADD_TRAIT(src, TRAIT_ELECTRICAL_DAMAGE_REPAIRING, REF(user))
do_wirecutter_repairs(wirecutting_tool, user, change, delay_mult)
REMOVE_TRAIT(src, TRAIT_ELECTRICAL_DAMAGE_REPAIRING, REF(user))
return TRUE

/// Does a while loop that repairs us with a wirecutter. A proc for containing runtimes and allowing trait removal at all times.
/datum/wound/electrical_damage/proc/do_wirecutter_repairs(obj/item/wirecutting_tool, mob/living/carbon/human/user, change, delay_mult)
var/their_or_other = (user == victim ? "[user.p_their()]" : "[victim]'s")
var/your_or_other = (user == victim ? "your" : "[victim]'s")
while (wirecutting_tool.tool_start_check())
user?.visible_message(span_danger("[user] begins resetting misplaced wiring within [their_or_other] [limb.plaintext_zone]..."), \
span_notice("You begin resetting misplaced wiring within [your_or_other] [limb.plaintext_zone]..."))
if (!wirecutting_tool.use_tool(target = victim, user = user, delay = ELECTRICAL_DAMAGE_WIRECUTTER_BASE_DELAY * delay_mult, volume = 50, extra_checks = CALLBACK(src, PROC_REF(still_exists))))
return TRUE
return

if (user != victim && user.combat_mode)
user?.visible_message(span_danger("[user] mangles some of [their_or_other] [limb.plaintext_zone]'s wiring!"), \
Expand All @@ -420,11 +437,10 @@
user?.visible_message(span_notice("[user] resets some of [their_or_other] [limb.plaintext_zone]'s wiring!"), \
span_notice("You reset some of [your_or_other] [limb.plaintext_zone]'s wiring!"))
adjust_intensity(-change)
victim.balloon_alert(user, "intensity reduced to [get_intensity_mult() * 100]%")
victim?.balloon_alert(user, "intensity reduced to [get_intensity_mult() * 100]%")

if (fixed())
return TRUE
return TRUE
return

/// If fixed() is true, we remove ourselves and return TRUE. FALSE otherwise.
/datum/wound/electrical_damage/proc/remove_if_fixed()
Expand Down Expand Up @@ -516,8 +532,8 @@
process_shock_spark_count_max = 1
process_shock_spark_count_min = 1

wirecut_repair_percent = 0.14
wire_repair_percent = 0.035
wirecut_repair_percent = 0.1
wire_repair_percent = 0.023

initial_sparks_amount = 1

Expand Down Expand Up @@ -559,8 +575,8 @@
process_shock_spark_count_max = 2
process_shock_spark_count_min = 1

wirecut_repair_percent = 0.128
wire_repair_percent = 0.032
wirecut_repair_percent = 0.09
wire_repair_percent = 0.015

initial_sparks_amount = 3

Expand Down Expand Up @@ -604,8 +620,8 @@
process_shock_spark_count_max = 3
process_shock_spark_count_min = 2

wirecut_repair_percent = 0.12
wire_repair_percent = 0.03
wirecut_repair_percent = 0.08
wire_repair_percent = 0.01

initial_sparks_amount = 8

Expand Down
Loading