forked from tgstation/tgstation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pain.dm
56 lines (51 loc) · 1.58 KB
/
pain.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
mob/proc/flash_pain()
// flick("pain",pain)
return
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/proc/pain(var/partname, var/amount, var/force)
if(stat >= 2) 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()
/*
switch(amount)
if(1 to 10)
msg = "<b>Your [partname] hurts a bit.</b>"
if(11 to 90)
// flash_weak_pain()
msg = "<b><font size=1>Ouch! Your [partname] hurts.</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)
mob/living/carbon/human/proc/handle_pain()
// not when sleeping
if(stat >= 2) return
if(reagents.has_reagent("tramadol"))
return
if(reagents.has_reagent("oxycodone"))
return
var/maxdam = 0
var/datum/limb/damaged_organ = null
for(var/name in organs)
var/datum/limb/E = organs[name]
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.display_name, maxdam, 0)