Files
CHOMPStation2/code/modules/organs/pain.dm
Arokha Sieyes ea6754597e Ports Bay's Robolimb Changes (#1779)
* Consolidates copypasta for repairing robolimbs

Also prevents self-repairing a limb you are using to hold the tool

* Fixes robot organs becoming undamagable after reaching cap

* Fixes repairing with cable not using any cable, repairing with weldingtool not doing eyecheck

* Removes ORGAN_ROBOT and ORGAN_ASSISTED flags, fixes #13123

* Fixes damage to robotic limbs not triggering organ processing

At the same time, robotic limbs with damage don't need to process.
However, it's much safer to explicitly have robot limbs return 0 from
needs_process() instead of not rechecking bad external organs.

* Build on HarpyEagle changes to apply to Polaris

Had to apply the change from flag to an enumeration.

* Removes unneeded file

* Fix bruisepacks, remove heart

Well, the unused bay version of the heart anyway

* Tweaks examine, reverts isSynthetic

Reverted that because Bay doesn't use it the same way. Also changed Examine to not list every robo-limb on non-FBPs in red, but left them listed as normal per Spookerton
2016-05-28 14:12:19 +01:00

122 lines
3.6 KiB
Plaintext

mob/proc/flash_pain()
flick("pain",pain)
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 = "<span class='danger'>Your [partname] burns.</span>"
if(11 to 90)
flash_weak_pain()
msg = "<span class='danger'><font size=2>Your [partname] burns badly!</font></span>"
if(91 to 10000)
flash_pain()
msg = "<span class='danger'><font size=3>OH GOD! Your [partname] is on fire!</font></span>"
else
switch(amount)
if(1 to 10)
msg = "<b>Your [partname] hurts.</b>"
if(11 to 90)
flash_weak_pain()
msg = "<b><font size=2>Your [partname] hurts badly.</font></b>"
if(91 to 10000)
flash_pain()
msg = "<b><font size=3>OH GOD! Your [partname] is hurting terribly!</font></b>"
if(msg && (msg != last_pain_message || prob(10)))
last_pain_message = msg
src << msg
next_pain_time = world.time + (100 - amount)
// message is the custom message to be displayed
// flash_strength is 0 for weak pain flash, 1 for strong pain flash
mob/living/carbon/human/proc/custom_pain(var/message, var/flash_strength)
if(stat >= 1)
return
if(!can_feel_pain())
return
if(reagents.has_reagent("tramadol"))
return
if(reagents.has_reagent("oxycodone"))
return
if(analgesic)
return
var/msg = "<span class='danger'>[message]</span>"
if(flash_strength >= 1)
msg = "<span class='danger'><font size=3>[message]</font></span>"
// Anti message spam checks
if(msg && ((msg != last_pain_message) || (world.time >= next_pain_time)))
last_pain_message = msg
src << msg
next_pain_time = world.time + 100
mob/living/carbon/human/proc/handle_pain()
// not when sleeping
if(!can_feel_pain()) return
if(stat >= 2) return
if(analgesic > 70)
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) || E.robotic >= 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)
// Damage to internal organs hurts a lot.
for(var/obj/item/organ/I in internal_organs)
if((I.status & ORGAN_DEAD) || I.robotic >= ORGAN_ROBOT) continue
if(I.damage > 2) if(prob(2))
var/obj/item/organ/external/parent = get_organ(I.parent_organ)
src.custom_pain("You feel a sharp pain in your [parent.name]", 1)
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))
src.custom_pain(toxDamageMessage, getToxLoss() >= 15)