Skip to content

Commit

Permalink
pain & painkillers rework (TauCetiStation#13310)
Browse files Browse the repository at this point in the history
* 999

* pumpumpum

* Update colors.dm

* 999

* defines & anesthetic fix

* обезбол не усыпляет если персонаж испытывает боль

* Update life.dm

* Update human_movement.dm

* убирает усыпление от обезбола, слишком сильный дебафф...

* Update carbon.dm

* be

* 4

* Update pain.dm

* Update life.dm

* Update living.dm

* Update mood.dm

* небольшая задержка перед падением

* Update carbon.dm

* Update carbon.dm

* Update carbon.dm
  • Loading branch information
simb11 committed Sep 8, 2024
1 parent 2da27bc commit 83e4de8
Show file tree
Hide file tree
Showing 27 changed files with 158 additions and 175 deletions.
6 changes: 6 additions & 0 deletions code/__DEFINES/colors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -210,3 +210,9 @@
0, 0, 0, 1, \
0, 0, 0, 0)


#define PAINKILLERS_FILTER list(1.25, 0, 0, 0, \
0, 1.25, 0, 0, \
0, 0, 1.25, 0, \
0, 0, 0, 1, \
-0.05,-0.05,-0.05, 0)
6 changes: 6 additions & 0 deletions code/__DEFINES/combat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,9 @@
#define MOVESET_TYPE "moveset_type"
#define MOVESET_ROLES "moveset_role"
#define MOVESET_QUALITY "moveset_quality"

//Painkiller effectiveness (for get_painkiller_effect() comparison)
#define PAINKILLERS_EFFECT_SLIGHT 0.95 //all painkillers.
#define PAINKILLERS_EFFECT_MEDIUM 0.75 //weak painkillers, allow you to ignore minor pain and not see pain() messages.
#define PAINKILLERS_EFFECT_HEAVY 0.6 //powerful painkillers, allow you to not see custom_pain() messages.
#define PAINKILLERS_EFFECT_VERY_HEAVY 0.5 //very powerful painkillers that does not allow the user to determine the location of the injury.
8 changes: 8 additions & 0 deletions code/__DEFINES/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -262,3 +262,11 @@
#define LOGOUT_GHOST 2
#define LOGOUT_REENTER 3
#define LOGOUT_SWAP 4 // not so safe, check other things if available

// traumatic shock levels
#define TRAUMATIC_SHOCK_MINOR 10
#define TRAUMATIC_SHOCK_SERIOUS 30
#define TRAUMATIC_SHOCK_INTENSE 50
#define TRAUMATIC_SHOCK_MIND_SHATTERING 80
#define TRAUMATIC_SHOCK_CRITICAL 100

2 changes: 1 addition & 1 deletion code/_globalvars/lists/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ var/global/list/gods_list = list()

//feel free to add shit to lists below
var/global/list/tachycardics = list("coffee", "inaprovaline", "hyperzine", "nitroglycerin", "thirteenloko", "nicotine", "ambrosium", "jenkem") //increase heart rate
var/global/list/bradycardics = list("neurotoxin", "cryoxadone", "clonexadone", "space_drugs", "stoxin") //decrease heart rate
var/global/list/bradycardics = list("neurotoxin", "cryoxadone", "clonexadone", "space_drugs", "stoxin", "tramadol", "oxycodone") //decrease heart rate
var/global/list/heartstopper = list("potassium_phorochloride", "zombie_powder") //this stops the heart
var/global/list/cheartstopper = list("potassium_chloride") //this stops the heart when overdose is met -- c = conditional
20 changes: 9 additions & 11 deletions code/datums/components/mood.dm
Original file line number Diff line number Diff line change
Expand Up @@ -355,22 +355,20 @@
return
var/mob/living/carbon/C = parent

if(C.shock_stage <= 0)
if(C.traumatic_shock < 10)
clear_event(null, "pain")
else
add_event(null, "pain", /datum/mood_event/mild_pain)

if(!C.traumatic_shock)
clear_event(null, "pain")
return

switch(C.shock_stage)
if(0 to 30)
switch(C.traumatic_shock)
if(0 to TRAUMATIC_SHOCK_MINOR)
add_event(null, "pain", /datum/mood_event/mild_pain)
if(TRAUMATIC_SHOCK_MINOR to TRAUMATIC_SHOCK_SERIOUS)
add_event(null, "pain", /datum/mood_event/moderate_pain)
if(30 to 60)
if(TRAUMATIC_SHOCK_SERIOUS to TRAUMATIC_SHOCK_INTENSE)
add_event(null, "pain", /datum/mood_event/intense_pain)
if(60 to 120)
if(TRAUMATIC_SHOCK_INTENSE to TRAUMATIC_SHOCK_MIND_SHATTERING)
add_event(null, "pain", /datum/mood_event/unspeakable_pain)
if(120 to INFINITY)
if(TRAUMATIC_SHOCK_MIND_SHATTERING to INFINITY)
add_event(null, "pain", /datum/mood_event/agony)

/datum/component/mood/proc/check_area_mood(datum/source, area/A, atom/OldLoc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
if(ishuman(user))
var/mob/living/carbon/human/H = user
H.setHalLoss(0)
H.shock_stage = 0

feedback_add_details("changeling_powers","UNS")
return TRUE
1 change: 0 additions & 1 deletion code/game/gamemodes/modes_gameplays/cult/eminence.dm
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@
L.SetDrunkenness(0)
if(iscarbon(L))
var/mob/living/carbon/C = L
C.shock_stage = 0
if(ishuman(C))
var/mob/living/carbon/human/H = C
H.restore_blood()
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/fitness.dm
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
to_chat(user, "You should get off the [user.buckled] first.")
return

if(gymnast.halloss > 80 || gymnast.shock_stage > 80)
if(gymnast.halloss > 80 || gymnast.traumatic_shock > 80)
to_chat(user, "You are too exausted.")
return

Expand Down Expand Up @@ -171,7 +171,7 @@
if(user.buckled && user.buckled != src)
to_chat(user, "You should get off the [user.buckled] first.")
return
if(user.halloss > 80 || user.shock_stage > 80)
if(user.halloss > 80 || user.traumatic_shock > 80)
to_chat(user, "You are too exausted.")
return

Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/stacks/medical.dm
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@
// Suturing yourself brings much more pain.
var/pain_factor = H == user ? 40 : 20
if(H.stat == CONSCIOUS)
H.AdjustShockStage(pain_factor)
H.adjustHalLoss(pain_factor)
BP.status &= ~ORGAN_ARTERY_CUT
BP.strap()
user.visible_message(
Expand Down
1 change: 0 additions & 1 deletion code/game/objects/items/weapons/implants/implant.dm
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@
if(ishuman(S.imp_in))
var/mob/living/carbon/human/H = S.imp_in
H.setHalLoss(0)
H.shock_stage = 0
S.imp_in.stat = CONSCIOUS
S.imp_in.SetParalysis(0)
S.imp_in.SetStunned(0)
Expand Down
6 changes: 3 additions & 3 deletions code/game/turfs/simulated/walls.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
smooth = SMOOTH_TRUE

// todo:
// probably we should make /obj/structure/falsewall
// and /turf/simulated/wall as meta-types not used in the game, and move
// probably we should make /obj/structure/falsewall
// and /turf/simulated/wall as meta-types not used in the game, and move
// real walls and falsewalls to subtypes
/turf/simulated/wall/yellow
icon = 'icons/turf/walls/has_false_walls/wall_yellow.dmi'
Expand Down Expand Up @@ -447,7 +447,7 @@
//slowdown, user. No need destruct all walls without debuff
if(iscarbon(user))
var/mob/living/carbon/C = user
C.shock_stage += 5
C.adjustHalLoss(15)
user.visible_message("<span class='danger'><B>[user]</B> бьет стену!</span>")
user.do_attack_animation(src)
playsound(user, pick(hammer.hitsound), VOL_EFFECTS_MASTER)
Expand Down
2 changes: 1 addition & 1 deletion code/game/turfs/simulated/walls_reinforced.dm
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@
//slowdown, user. No need destruct all walls without debuff
if(iscarbon(user))
var/mob/living/carbon/C = user
C.shock_stage += 5
C.adjustHalLoss(15)
user.do_attack_animation(src)
user.visible_message("<span class='warning'><B>[user]</B> бьет укрепленную стену!</span>",
"<span class='warning'>Вы пытаетесь снести укрепленную стену!</span>",
Expand Down
2 changes: 1 addition & 1 deletion code/modules/clothing/spacesuits/rig/modules/ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@
if(H.getBruteLoss() > 40)
if(try_inject(H, chem_disp, list("bicaridine", "tricordrazine")))
return
if(H.traumatic_shock > 40 || H.shock_stage > 40)
if(H.traumatic_shock > 40)
if(try_inject(H, chem_disp, list("oxycodone", "tramadol", "paracetamol")))
return
if(H.getToxLoss() > 20)
Expand Down
4 changes: 4 additions & 0 deletions code/modules/mob/living/carbon/carbon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@
// Enough to make us sleep as well
if(SA_pp > SA_sleep_min)
Sleeping(10 SECONDS)
analgesic = clamp(analgesic + 5, 0, 10)

// There is sleeping gas in their lungs, but only a little, so give them a bit of a warning
else if(SA_pp > SA_giggle_min)
Expand Down Expand Up @@ -841,6 +842,9 @@
if(IsSleeping())
to_chat(src, "<span class='rose'>You are already sleeping</span>")
return
if(traumatic_shock >= TRAUMATIC_SHOCK_SERIOUS)
to_chat(src, "<span class='danger'>The pain keeps you from sleeping.</span>")
return
if(tgui_alert(src, "You sure you want to sleep for a while?","Sleep", list("Yes","No")) == "Yes")
SetSleeping(40 SECONDS) //Short nap

Expand Down
1 change: 0 additions & 1 deletion code/modules/mob/living/carbon/human/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1403,7 +1403,6 @@
maxHealth = species.total_health

if(species.flags[NO_PAIN])
shock_stage = 0
traumatic_shock = 0

if(species.base_color && default_colour)
Expand Down
12 changes: 0 additions & 12 deletions code/modules/mob/living/carbon/human/human_damage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -214,18 +214,6 @@
else
..()


//========== Shock Stage =========
/mob/living/carbon/human/SetShockStage(amount)
if(species.flags[NO_PAIN])
return
shock_stage = max(amount, 0)

/mob/living/carbon/human/AdjustShockStage(amount)
if(species.flags[NO_PAIN])
return
shock_stage = max(shock_stage + amount, 0)

////////////////////////////////////////////

//Returns a list of damaged bodyparts
Expand Down
8 changes: 2 additions & 6 deletions code/modules/mob/living/carbon/human/human_movement.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,13 @@
if(embedded_flag)
handle_embedded_objects() // Moving with objects stuck in you can cause bad times.

var/health_deficiency = (100 - health + halloss)
if(health_deficiency >= 40)
tally += health_deficiency / 25
if(traumatic_shock >= TRAUMATIC_SHOCK_INTENSE)
tally += traumatic_shock * 0.05

var/hungry = NUTRITION_LEVEL_FULL - get_satiation()
if(hungry >= NUTRITION_LEVEL_NORMAL) // Slow down if nutrition <= 40%
tally += hungry / 250 // 1,4 - 2

if(shock_stage >= 10)
tally += round(log(3.5, shock_stage), 0.1) // (40 = ~3.0) and (starts at ~1.83)

if(bodytemperature < species.cold_level_1)
tally += 1.75 * (species.cold_level_1 - bodytemperature) / 10

Expand Down
85 changes: 39 additions & 46 deletions code/modules/mob/living/carbon/human/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,11 @@ var/global/list/tourette_bad_words= list(
else
icon_num = 5

healthdoll.add_overlay(image('icons/hud/screen_gen.dmi',"[BP.body_zone][icon_num]"))
if(get_painkiller_effect() <= PAINKILLERS_EFFECT_VERY_HEAVY)
healthdoll.icon_state = "health_numb"
healthdoll.cut_overlays()
else
healthdoll.add_overlay(image('icons/hud/screen_gen.dmi',"[BP.body_zone][icon_num]"))

if(!healths)
return
Expand Down Expand Up @@ -977,7 +981,7 @@ var/global/list/tourette_bad_words= list(
clear_fullscreen("oxy")

//Fire and Brute damage overlay (BSSR)
var/hurtdamage = getBruteLoss() + getFireLoss() + damageoverlaytemp
var/hurtdamage = ((getBruteLoss() + getFireLoss() + damageoverlaytemp) * get_painkiller_effect())
damageoverlaytemp = 0 // We do this so we can detect if someone hits us or not.
if(hurtdamage)
var/severity = 0
Expand Down Expand Up @@ -1097,6 +1101,11 @@ var/global/list/tourette_bad_words= list(
else
animate(client, color = null, time = 5)

if(painkiller_overlay_time)
animate(client, color = PAINKILLERS_FILTER, time = 5)
else
animate(client, color = null, time = 5)

return TRUE

/mob/living/carbon/human/proc/handle_random_events()
Expand Down Expand Up @@ -1155,68 +1164,52 @@ var/global/list/tourette_bad_words= list(

/mob/living/carbon/human/handle_shock()
..()
if(status_flags & GODMODE) return 0 //godmode
if(status_flags & GODMODE) return FALSE //godmode
if(species && species.flags[NO_PAIN])
return
if(analgesic && !reagents.has_reagent("prismaline"))
return // analgesic avoids all traumatic shock temporarily

if(health < config.health_threshold_softcrit)// health 0 makes you immediately collapse
shock_stage = max(shock_stage, 61)
var/message

if(traumatic_shock >= 80 && shock_stage <= 150)
shock_stage += 1
else if(health < config.health_threshold_softcrit)
shock_stage = max(shock_stage, 61)
else
shock_stage = min(shock_stage, 160)
shock_stage = max(shock_stage-1, 0)
return

if(shock_stage == 10)
to_chat(src, "<span class='danger'>[pick("It hurts so much!", "You really need some painkillers..", "Dear god, the pain!")]</span>")
if(traumatic_shock >= TRAUMATIC_SHOCK_MINOR)
message = "<span class='warning'>[pick("You feel slight pain.", "Ow... That hurts.")]</span>"

if(shock_stage >= 30)
if(shock_stage == 30) me_emote("is having trouble keeping their eyes open.")
if(traumatic_shock >= TRAUMATIC_SHOCK_SERIOUS)
message = "<span class='boldwarning'><B>[pick("Ughhh... When will it end?", "You're wincing in pain!", "You really need some painkillers!")]</B></span>"
blurEyes(2)
stuttering = max(stuttering, 5)

if(shock_stage == 40)
to_chat(src, "<span class='danger'>[pick("The pain is excrutiating!", "Please, just end the pain!", "Your whole body is going numb!")]</span>")

if (shock_stage >= 60)
if(shock_stage == 60)
visible_message("<span class='name'>[src]'s</span> body becomes limp.")
if (prob(2))
to_chat(src, "<span class='danger'>[pick("The pain is excrutiating!", "Please, just end the pain!", "Your whole body is going numb!")]</span>")
Stun(10)
Weaken(20)

if(shock_stage >= 80)
if (prob(5))
to_chat(src, "<span class='danger'>[pick("The pain is excrutiating!", "Please, just end the pain!", "Your whole body is going numb!")]</span>")
Stun(10)
Weaken(20)

if(shock_stage >= 120)
if (prob(2))
if(traumatic_shock >= TRAUMATIC_SHOCK_INTENSE)
message = "<span class='danger'>[pick("Stop this pain!", "This pain is unbearable!", "Your whole body is going numb!")]</span>"

if(traumatic_shock >= TRAUMATIC_SHOCK_MIND_SHATTERING)
message = "<span class='userdanger'><font size=5>[pick("The pain is excrutiating!", "Please, just end the pain!", "Your whole body is going numb!")]</font></span>"
if(prob(10) && !crawling)
Weaken(1)

if(traumatic_shock >= TRAUMATIC_SHOCK_CRITICAL)
if(!crawling)
addtimer(CALLBACK(src, PROC_REF(knockdown_by_pain)), 7.5 SECOND)
if(prob(10))
to_chat(src, "<span class='danger'>[pick("You black out!", "You feel like you could die any moment now.", "You're about to lose consciousness.")]</span>")
Paralyse(5)
AdjustSleeping(10)

if(shock_stage == 150)
me_emote("can no longer stand, collapsing!")
Stun(10)
Weaken(20)
if(prob(15) && message)
to_chat(src, message)

if(shock_stage >= 150)
Stun(10)
Weaken(20)
/mob/living/carbon/human/proc/knockdown_by_pain()
if(crawling || traumatic_shock <= TRAUMATIC_SHOCK_CRITICAL)
return
SetCrawling(TRUE)
drop_from_inventory(l_hand)
drop_from_inventory(r_hand)

/mob/living/carbon/human/proc/handle_heart_beat()

if(pulse == PULSE_NONE) return

if(pulse == PULSE_2FAST || shock_stage >= 10 || isspaceturf(get_turf(src)))
if(pulse == PULSE_2FAST || traumatic_shock >= TRAUMATIC_SHOCK_INTENSE || isspaceturf(get_turf(src)))

var/temp = (5 - pulse)/2

Expand Down
Loading

0 comments on commit 83e4de8

Please sign in to comment.