Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMelbert committed Dec 2, 2024
1 parent daf5606 commit 153c135
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 29 deletions.
5 changes: 1 addition & 4 deletions code/__DEFINES/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#define MAX_SHOCK 200

/// Checks if a mob can feel pain.
#define CAN_FEEL_PAIN(mob) (mob?.pain_controller && !HAS_TRAIT(mob, TRAIT_NO_PAIN_EFFECTS) && mob.pain_controller.pain_modifier > 0.5)
#define CAN_FEEL_PAIN(mob) (mob?.stat <= SOFT_CRIT && mob?.pain_controller?.pain_modifier > 0.5)

// Keys for pain modifiers
#define PAIN_MOD_CHEMS "chems"
Expand All @@ -58,9 +58,6 @@

/// If the mob enters shock, they will have +1 cure condition (helps cure it faster)
#define TRAIT_ABATES_SHOCK "shock_abated"
/// Disables pain effects, but without the traditional bonuses numbness gives you
/// such as leaving your consciousness unaffected
#define TRAIT_NO_PAIN_EFFECTS "no_pain_effects"
/// Shock buildup does not increase, only decrease. Cannot enter shock if at the threshold.
/// No effect if already in shock (unlike abates_shock)
#define TRAIT_NO_SHOCK_BUILDUP "no_shock_buildup"
Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/hud/screen_objects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@
// NON-MODULE CHANGE
var/has_noticable_wound = FALSE
for(var/datum/wound/wound as anything in body_part.wounds)
if(!(wound.wound_flags & ALERTS_VICTIM))
if(wound.wound_flags & ALERTS_VICTIM)
has_noticable_wound = TRUE
break

Expand Down
2 changes: 1 addition & 1 deletion code/datums/status_effects/_status_effect_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@

. = FALSE
for(var/datum/status_effect/existing_effect as anything in status_effects)
if(existing_effect.id == initial(removed_effect.id) && existing_effect.before_remove(arglist(arguments))) // melbert todo : major bug upstream later
if(existing_effect.id == initial(removed_effect.id) && existing_effect.before_remove(arglist(arguments)))
qdel(existing_effect)
. = TRUE

Expand Down
2 changes: 0 additions & 2 deletions code/datums/status_effects/wound_effects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
if(ishuman(owner))
var/mob/living/carbon/human/human_owner = owner
human_owner.physiology.bleed_mod *= WOUND_DETERMINATION_BLEED_MOD
ADD_TRAIT(owner, TRAIT_NO_PAIN_EFFECTS, TRAIT_STATUS_EFFECT(id))
ADD_TRAIT(owner, TRAIT_ABATES_SHOCK, TRAIT_STATUS_EFFECT(id))
owner.add_consciousness_multiplier(id, 1.15)
if(duration >= WOUND_DETERMINATION_SEVERE)
Expand All @@ -53,7 +52,6 @@
if(ishuman(owner))
var/mob/living/carbon/human/human_owner = owner
human_owner.physiology.bleed_mod /= WOUND_DETERMINATION_BLEED_MOD
REMOVE_TRAIT(owner, TRAIT_NO_PAIN_EFFECTS, TRAIT_STATUS_EFFECT(id))
REMOVE_TRAIT(owner, TRAIT_ABATES_SHOCK, TRAIT_STATUS_EFFECT(id))
owner.remove_consciousness_multiplier(id)
owner.clear_alert(id)
Expand Down
2 changes: 0 additions & 2 deletions code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2180,7 +2180,6 @@ GLOBAL_LIST_EMPTY(fire_appearances)
TRAIT_IMMOBILIZED,
TRAIT_INCAPACITATED,
TRAIT_KNOCKEDOUT,
TRAIT_NO_PAIN_EFFECTS,
)
// All the traits associated with the mob's current stat
var/list/added_traits = list()
Expand Down Expand Up @@ -2208,7 +2207,6 @@ GLOBAL_LIST_EMPTY(fire_appearances)
TRAIT_IMMOBILIZED,
TRAIT_INCAPACITATED,
TRAIT_KNOCKEDOUT,
TRAIT_NO_PAIN_EFFECTS,
)
remove_from_alive_mob_list()
add_to_dead_mob_list()
Expand Down
19 changes: 6 additions & 13 deletions maplestation_modules/code/datums/pain/pain.dm
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
RegisterSignal(parent, COMSIG_LIVING_POST_FULLY_HEAL, PROC_REF(remove_all_pain))
RegisterSignal(parent, COMSIG_MOB_APPLY_DAMAGE, PROC_REF(add_damage_pain))
RegisterSignal(parent, COMSIG_MOB_STATCHANGE, PROC_REF(on_parent_statchance))
RegisterSignals(parent, list(SIGNAL_ADDTRAIT(TRAIT_NO_PAIN_EFFECTS), SIGNAL_REMOVETRAIT(TRAIT_NO_PAIN_EFFECTS)), PROC_REF(refresh_pain_attributes))
RegisterSignal(parent, COMSIG_LIVING_TREAT_MESSAGE, PROC_REF(handle_message))
RegisterSignal(parent, COMSIG_MOB_FIRED_GUN, PROC_REF(on_mob_fired_gun))
RegisterSignal(parent, COMSIG_LIVING_REVIVE, PROC_REF(revived))
Expand All @@ -109,8 +108,6 @@
COMSIG_MOB_APPLY_DAMAGE,
COMSIG_MOB_FIRED_GUN,
COMSIG_MOB_STATCHANGE,
SIGNAL_ADDTRAIT(TRAIT_NO_PAIN_EFFECTS),
SIGNAL_REMOVETRAIT(TRAIT_NO_PAIN_EFFECTS),
))

/// Add a bodypart to be tracked.
Expand Down Expand Up @@ -212,10 +209,6 @@
pain_modifier *= pain_mods[mod]
if(old_pain_mod == pain_modifier)
return FALSE
if(pain_modifier <= 0.5)
ADD_TRAIT(parent, TRAIT_NO_PAIN_EFFECTS, "pain_mod")
else
REMOVE_TRAIT(parent, TRAIT_NO_PAIN_EFFECTS, "pain_mod")
return TRUE

/**
Expand Down Expand Up @@ -470,8 +463,8 @@
if(checked_bodypart.pain_feedback(seconds_per_tick, no_recent_pain))
COOLDOWN_START(src, time_since_last_pain_message, rand(8 SECONDS, 12 SECONDS))

if(!has_pain)
// no-op if none of our bodyparts are in pain
if(!has_pain && shock_buildup <= 0)
// no-op if none of our bodyparts are in pain and we're not building up shock
return

var/shock_mod = max(pain_modifier, 0.33)
Expand Down Expand Up @@ -647,13 +640,13 @@
SIGNAL_HANDLER

var/pain = get_total_pain()
// Even if you can't feel pain it still contributes to consciousness loss
// Consciousness penalty from pain is unnaffected by pain modifier
if(pain <= 25)
parent.remove_consciousness_modifier(PAIN)
else
parent.add_consciousness_modifier(PAIN, round(-0.5 * (max(pain + shock_buildup, 0) ** 0.8)), 0.01)
// Modify pain by modifier or traits before messing with the modifiers
pain *= CAN_FEEL_PAIN(parent) ? pain_modifier : 0
// Buuut the other modifiers aren't
pain *= pain_modifier

switch(pain)
if(0 to 25)
Expand Down Expand Up @@ -754,7 +747,7 @@
return

var/num_repeats = floor(((get_total_pain() / 75) + (shock_buildup / 75)) * pain_modifier)
if(!CAN_FEEL_PAIN(parent) && shock_buildup < 90)
if(shock_buildup < 90)
num_repeats *= 0.5

if(num_repeats <= 1)
Expand Down
6 changes: 3 additions & 3 deletions maplestation_modules/code/datums/pain/pain_bodyparts.dm
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"but feels faint",
)

switch(pain)
switch(get_modified_pain())
if(10 to 25)
owner.flash_pain_overlay(1)
feedback_phrases += list("aches", "feels sore", "stings slightly", "tingles", "twinges")
Expand Down Expand Up @@ -145,7 +145,7 @@
"but it subsides",
)

switch(pain)
switch(get_modified_pain())
if(10 to 40)
owner.flash_pain_overlay(1)
feedback_phrases += list("aches", "feels sore", "stings slightly", "tingles", "twinges")
Expand Down Expand Up @@ -210,7 +210,7 @@
"but the pressure fades",
)

switch(pain)
switch(get_modified_pain())
if(10 to 30)
owner.flash_pain_overlay(1)
feedback_phrases += list("aches", "feels sore", "stings slightly", "tingles", "twinges")
Expand Down
4 changes: 2 additions & 2 deletions maplestation_modules/code/datums/pain/pain_modifiers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@
// Fake healthy is supposed to mimic feeling no pain
/datum/status_effect/grouped/screwy_hud/fake_healthy/on_apply()
. = ..()
ADD_TRAIT(owner, TRAIT_NO_PAIN_EFFECTS, TRAIT_STATUS_EFFECT(id))
owner.set_pain_mod(TRAIT_STATUS_EFFECT(id), 0.33)

/datum/status_effect/grouped/screwy_hud/fake_healthy/on_remove()
. = ..()
REMOVE_TRAIT(owner, TRAIT_NO_PAIN_EFFECTS, TRAIT_STATUS_EFFECT(id))
owner.unset_pain_mod(TRAIT_STATUS_EFFECT(id))

// Being drunk gives a slight one, note the actual reagent gives one based on its strength
/datum/status_effect/inebriated/drunk/on_apply()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
return FALSE
RegisterSignal(owner, SIGNAL_ADDTRAIT(TRAIT_SLEEPIMMUNE), PROC_REF(qdel_us))
owner.add_max_consciousness_value(type, 10)
owner.set_pain_mod(type, 0.4)
owner.set_pain_mod(type, 0.33)
applied_at = world.time
return TRUE

Expand Down

0 comments on commit 153c135

Please sign in to comment.