Overhauls pain message/status displaying, fixes oxyloss. (#9173)

Pain message/status displaying has been unified into custom_pain. This might cause some weirdness with when people go unconscious or get paralysis from excessive pain.

Oxyloss has been fixed and so has the oxygen damage overlay, which is now back. I'm not sure of the actual impact this has on damage.

Also added a fullscreen BIG RED overlay when you have BIG PAIN.
This commit is contained in:
Matt Atlas
2020-06-27 17:47:15 +03:00
committed by GitHub
parent 3b448ef174
commit b132f4509b
12 changed files with 150 additions and 146 deletions
+10 -7
View File
@@ -114,8 +114,10 @@
oxygen_reserve = max(0, oxygen_reserve-1)
else
oxygen_reserve = min(initial(oxygen_reserve), oxygen_reserve+1)
if(!oxygen_reserve) //(hardcrit)
owner.Paralyse(3)
owner.Paralyse(10)
var/can_heal = damage && damage < max_damage && (damage % damage_threshold_value || owner.chem_effects[CE_BRAIN_REGEN] || (!past_damage_threshold(3) && owner.chem_effects[CE_STABLE]))
var/damprob
//Effects of bloodloss
@@ -143,8 +145,8 @@
damprob = owner.chem_effects[CE_STABLE] ? 60 : 100
if(!past_damage_threshold(8) && prob(damprob))
take_internal_damage(1)
if(!owner.paralysis)
owner.Paralyse(3,5)
if(!owner.paralysis && prob(15))
owner.Paralyse(rand(3, 5))
to_chat(owner, "<span class='warning'>You feel extremely [pick("dizzy","woozy","faint")]...</span>")
if(-(INFINITY) to BLOOD_VOLUME_SURVIVE) // Also see heart.dm, being below this point puts you into cardiac arrest.
owner.eye_blurry = max(owner.eye_blurry,6)
@@ -170,21 +172,22 @@
addtimer(CALLBACK(src, .proc/brain_damage_callback, damage), rand(6, 20) SECONDS, TIMER_UNIQUE)
/obj/item/organ/internal/brain/proc/brain_damage_callback(var/damage) //Confuse them as a somewhat uncommon aftershock. Side note: Only here so a spawn isn't used. Also, for the sake of a unique timer.
to_chat(owner, "<span class = 'notice' font size='10'><B>I can't remember which way is forward...</B></span>")
to_chat(owner, "<span class = 'notice'><font size=3><B>I can't remember which way is forward...</B></font></span>")
owner?.confused += damage
/obj/item/organ/internal/brain/proc/handle_severe_brain_damage()
set waitfor = FALSE
healed_threshold = 0
to_chat(owner, "<span class = 'notice' font size='10'><B>Where am I...?</B></span>")
to_chat(owner, "<span class = 'notice'><font size=4><B>Where am I...?</B></font></span>")
owner.Paralyse(20)
sleep(5 SECONDS)
if(!owner)
return
to_chat(owner, "<span class = 'notice' font size='10'><B>What's going on...?</B></span>")
to_chat(owner, "<span class = 'notice'><font size=4><B>What's going on...?</B></font></span>")
sleep(10 SECONDS)
if(!owner)
return
to_chat(owner, "<span class = 'notice' font size='10'><B>What happened...?</B></span>")
to_chat(owner, "<span class = 'notice'><font size=4><B>What happened...?</B></font></span>")
alert(owner.find_mob_consciousness(), "You have taken massive brain damage! You will not be able to remember the events leading up to your injury.", "Brain Damaged")
/obj/item/organ/internal/brain/proc/handle_damage_effects()
+1 -1
View File
@@ -63,7 +63,7 @@
"<span class='danger'>You can't breathe!</span>",
"You hear someone gasp for air!",
)
owner.losebreath = 1
owner.losebreath = round(damage/2)
if(is_bruised() && rescued)
if(prob(4))
+4 -2
View File
@@ -855,6 +855,7 @@ Note that amputating the affected organ does in fact remove the infection from t
if(!clean)
victim.shock_stage += min_broken_damage
victim.flash_strong_pain()
removed(null, ignore_children)
@@ -997,13 +998,14 @@ Note that amputating the affected organ does in fact remove the infection from t
return
if(owner)
var/message = pick("snapped in half", "shattered", "was pulverized")
var/message = pick("broke in half", "shattered")
owner.visible_message(\
"<span class='warning'><font size='2'>You hear a loud cracking sound coming from \the [owner]!</font></span>",\
"<span class='warning'><font size=2>You hear a loud cracking sound coming from \the [owner]!</font></span>",\
"<span class='danger'><font size=3>Something feels like it [message] in your [name]!</font></span>",\
"You hear a sickening crack!")
if(owner.species && (owner.can_feel_pain()))
owner.emote("scream")
owner.flash_strong_pain()
playsound(src.loc, "fracture", 100, 1, -2)
status |= ORGAN_BROKEN
+49 -88
View File
@@ -9,50 +9,6 @@ mob/var/list/pain_stored = list()
mob/var/last_pain_message = ""
mob/var/next_pain_time = 0
// partname is the name of a body part
// amount is a num from 1 to 100
/mob/living/carbon/proc/pain(var/partname, var/amount, var/force, var/burning = 0)
if(stat >= 1)
return
if(!can_feel_pain())
return
if(analgesic > 40)
return
if(world.time < next_pain_time && !force)
return
if(amount > 10 && istype(src,/mob/living/carbon/human))
if(src:paralysis)
src:paralysis = max(0, src:paralysis-round(amount/10))
if(amount > 50 && prob(amount / 5))
src:drop_item()
var/msg
if(burning)
switch(amount)
if(1 to 10)
msg = species.organ_low_burn_message
if(11 to 90)
flash_weak_pain()
msg = species.organ_med_burn_message
if(91 to 10000)
flash_pain()
msg = species.organ_high_burn_message
else
switch(amount)
if(5 to 14)
msg = species.organ_low_pain_message
if(15 to 90)
flash_weak_pain()
msg = species.organ_med_pain_message
if(91 to 10000)
flash_pain()
msg = species.organ_high_pain_message
if(msg && (msg != last_pain_message || prob(10)))
msg = replacetext(msg, "%PARTNAME%", partname)
last_pain_message = msg
to_chat(src, msg)
next_pain_time = world.time + 50
// message is the custom message to be displayed
// power decides how much painkillers will stop the message
// force means it ignores anti-spam timer
@@ -68,18 +24,21 @@ mob/var/next_pain_time = 0
adjustHalLoss(Ceiling(power/2))
else
affecting.add_pain(Ceiling(power/2))
flash_pain(min(round(2*power)+55, 255))
// Anti message spam checks
if(force || (message != last_pain_message) || (world.time >= next_pain_time))
last_pain_message = message
if(power >= 70)
if(power >= 110)
flash_strong_pain()
to_chat(src, "<span class='danger'><font size=3>[message]</font></span>")
else if(power >= 70)
flash_pain()
to_chat(src, "<span class='danger'><font size=3>[message]</font></span>")
else if(power >= 40)
flash_pain()
to_chat(src, "<span class='danger'><font size=2>[message]</font></span>")
else if(power >= 10)
flash_weak_pain()
to_chat(src, "<span class='danger'>[message]</span>")
else
to_chat(src, "<span class='warning'>[message]</span>")
@@ -87,64 +46,66 @@ mob/var/next_pain_time = 0
next_pain_time = world.time + (100-power)
/mob/living/carbon/human/proc/handle_pain()
// not when sleeping
if(!can_feel_pain())
return
if(stat >= DEAD)
return
if(analgesic > 70)
if(!can_feel_pain())
return
if(world.time < next_pain_time)
return
var/maxdam = 0
var/obj/item/organ/external/damaged_organ = null
for(var/obj/item/organ/external/E in organs)
if(E.status & (ORGAN_DEAD|ORGAN_ROBOT)) continue
if(E.status & (ORGAN_DEAD|ORGAN_ROBOT))
continue
var/dam = E.get_damage()
// make the choice of the organ depend on damage,
// but also sometimes use one of the less damaged ones
if(dam > maxdam && (maxdam == 0 || prob(70)) )
damaged_organ = E
maxdam = dam
if(damaged_organ)
pain(damaged_organ.name, maxdam, 0)
if(damaged_organ && chem_effects[CE_PAINKILLER] < maxdam)
if(maxdam > 10 && paralysis)
paralysis = max(0, paralysis - round(maxdam / 10))
if(maxdam > 50 && prob(maxdam / 5))
drop_item()
var/burning = damaged_organ.burn_dam > damaged_organ.brute_dam
var/msg
switch(maxdam)
if(1 to 10)
msg = "[burning ? species.organ_low_burn_message : species.organ_low_pain_message]"
if(11 to 60)
msg = "[burning ? species.organ_med_burn_message : species.organ_med_pain_message]"
if(70 to 10000)
msg = "[burning ? species.organ_high_burn_message : species.organ_high_pain_message]"
msg = replacetext(msg, "%PARTNAME%", damaged_organ.name)
custom_pain(msg, maxdam, prob(10), damaged_organ, TRUE)
// Damage to internal organs hurts a lot.
for(var/obj/item/organ/internal/I in internal_organs)
if(I.status & (ORGAN_DEAD|ORGAN_ROBOT))
continue
if(prob(2))
if(prob(1) && !((I.status & ORGAN_DEAD) || BP_IS_ROBOTIC(I)) && I.damage > 5)
var/obj/item/organ/external/parent = get_organ(I.parent_organ)
var/painmessage
var/pain = 10
var/message = "You feel a dull pain in your [parent.name]..."
if(I.is_bruised())
pain = 25
message = "You feel a stinging pain in your [parent.name]."
if(I.is_broken())
painmessage = "You feel an excrutiating pain in your [parent.name]!"
else if (I.is_bruised())
painmessage = "You feel a sharp pain in your [parent.name]..."
else if (I.is_damaged())
painmessage = "You feel discomfort in your [parent.name]."
if(painmessage)
custom_pain(painmessage, 5, 5)
//The less hardcoded values, the better.
pain = 50
message = "You feel a sharp pain in your [parent.name]!"
src.custom_pain(message, pain, affecting = parent)
var/toxDamageMessage = null
var/toxMessageProb = 1
switch(getToxLoss())
if(1 to 5)
toxMessageProb = 1
toxDamageMessage = "Your body stings slightly."
if(6 to 10)
toxMessageProb = 2
toxDamageMessage = "Your whole body hurts a little."
if(11 to 15)
toxMessageProb = 2
toxDamageMessage = "Your whole body hurts."
if(15 to 25)
toxMessageProb = 3
toxDamageMessage = "Your whole body hurts badly!"
if(26 to INFINITY)
toxMessageProb = 5
toxDamageMessage = "Your body aches all over, it's driving you mad!"
if(toxDamageMessage && prob(toxMessageProb))
custom_pain(toxDamageMessage, 5, 5)
if(prob(1))
switch(getToxLoss())
if(5 to 17)
custom_pain("Your body stings slightly.", getToxLoss())
if(17 to 35)
custom_pain("Your body stings.", getToxLoss())
if(35 to 60)
custom_pain("Your body stings strongly.", getToxLoss())
if(60 to 100)
custom_pain("Your whole body hurts badly!", getToxLoss())
if(100 to INFINITY)
custom_pain("Your body aches all over, it's driving you mad!", getToxLoss())