Merge pull request #3241 from Spamcat/pulse

Pulse
This commit is contained in:
Zuhayr
2013-07-04 23:08:11 -07:00
11 changed files with 120 additions and 3 deletions
+3
View File
@@ -61,6 +61,9 @@
t1 = "<font color='red'>*dead*</font>"
else
dat += text("[]\tHealth %: [] ([])</FONT><BR>", (occupant.health > 50 ? "<font color='blue'>" : "<font color='red'>"), occupant.health, t1)
if(iscarbon(occupant))
var/mob/living/carbon/C = occupant
dat += text("[]\t-Pulse, bpm: []</FONT><BR>", (C.pulse == PULSE_NONE || C.pulse == PULSE_THREADY ? "<font color='red'>" : "<font color='blue'>"), C.get_pulse(GETPULSE_TOOL))
dat += text("[]\t-Brute Damage %: []</FONT><BR>", (occupant.getBruteLoss() < 60 ? "<font color='blue'>" : "<font color='red'>"), occupant.getBruteLoss())
dat += text("[]\t-Respiratory Damage %: []</FONT><BR>", (occupant.getOxyLoss() < 60 ? "<font color='blue'>" : "<font color='red'>"), occupant.getOxyLoss())
dat += text("[]\t-Toxin Content %: []</FONT><BR>", (occupant.getToxLoss() < 60 ? "<font color='blue'>" : "<font color='red'>"), occupant.getToxLoss())
@@ -55,6 +55,7 @@
<B>Fire Damage:</B> [src.victim.getFireLoss()]<BR>
<B>Suffocation Damage:</B> [src.victim.getOxyLoss()]<BR>
<B>Patient Status:</B> [src.victim.stat ? "Non-Responsive" : "Stable"]<BR>
<B>Heartbeat rate:</B> [victim.get_pulse(GETPULSE_TOOL)]<BR>
"}
else
src.victim = null
+1 -1
View File
@@ -87,7 +87,7 @@
<B>Current cell temperature:</B> [temp_text]K<BR>
<B>Cryo status:</B> [ on ? "<A href='?src=\ref[src];start=1'>Off</A> <B>On</B>" : "<B>Off</B> <A href='?src=\ref[src];start=1'>On</A>"]<BR>
[beaker_text]<BR><BR>
<B>Current occupant:</B> [occupant ? "<BR>Name: [occupant]<BR>Health: [health_text]<BR>Oxygen deprivation: [round(occupant.getOxyLoss(),0.1)]<BR>Brute damage: [round(occupant.getBruteLoss(),0.1)]<BR>Fire damage: [round(occupant.getFireLoss(),0.1)]<BR>Toxin damage: [round(occupant.getToxLoss(),0.1)]<BR>Body temperature: [occupant.bodytemperature]" : "<FONT color=red>None</FONT>"]<BR>
<B>Current occupant:</B> [occupant ? "<BR>Name: [occupant]<BR>Health: [health_text]<BR>Oxygen deprivation: [round(occupant.getOxyLoss(),0.1)]<BR>Brute damage: [round(occupant.getBruteLoss(),0.1)]<BR>Fire damage: [round(occupant.getFireLoss(),0.1)]<BR>Toxin damage: [round(occupant.getToxLoss(),0.1)]<BR>Body temperature: [occupant.bodytemperature]<BR>Heartbeat rate: [occupant.get_pulse(GETPULSE_TOOL)]" : "<FONT color=red>None</FONT>"]<BR>
"}
user.set_machine(src)
user << browse(dat, "window=cryo")
@@ -174,6 +174,8 @@ MASS SPECTROMETER
user.show_message("\red <b>Warning: Blood Level CRITICAL: [blood_percent]% [blood_volume]cl")
else
user.show_message("\blue Blood Level Normal: [blood_percent]% [blood_volume]cl")
if(H.pulse)
user.show_message("\blue Subject's pulse: [H.get_pulse(GETPULSE_TOOL)] bpm.")
src.add_fingerprint(user)
return
+23 -1
View File
@@ -455,4 +455,26 @@
<BR>"}
user << browse(dat, text("window=mob[];size=325x500", name))
onclose(user, "mob[name]")
return
return
//generates realistic-ish pulse output based on preset levels
/mob/living/carbon/proc/get_pulse(var/method) //method 0 is for hands, 1 is for machines, more accurate
var/temp = 0 //see setup.dm:694
switch(src.pulse)
if(PULSE_NONE)
return "0"
if(PULSE_SLOW)
temp = rand(40, 60)
return num2text(method ? temp : temp + rand(-10, 10))
if(PULSE_NORM)
temp = rand(60, 90)
return num2text(method ? temp : temp + rand(-10, 10))
if(PULSE_FAST)
temp = rand(90, 120)
return num2text(method ? temp : temp + rand(-10, 10))
if(PULSE_2FAST)
temp = rand(120, 160)
return num2text(method ? temp : temp + rand(-10, 10))
if(PULSE_THREADY)
return method ? ">250" : "extremely weak and fast, patient's artery feels like a thread"
// output for machines^ ^^^^^^^output for people^^^^^^^^^
@@ -19,4 +19,6 @@
//Surgery info
var/datum/surgery_status/op_stage = new/datum/surgery_status
//Active emote/pose
var/pose = null
var/pose = null
var/pulse = PULSE_NORM //current pulse level
@@ -223,6 +223,7 @@
else
usr << "<span class='deadsay'>[t_He] has no pulse...</span>"
msg += "<span class='warning'>"
if(nutrition < 100)
@@ -1218,3 +1218,36 @@ mob/living/carbon/human/yank_out_object()
organ.status |= ORGAN_BLEEDING
organ.take_damage(rand(1,3), 0, 0)
src.adjustToxLoss(rand(1,3))
/mob/living/carbon/human/verb/check_pulse()
set category = "Object"
set name = "Check pulse"
set desc = "Approximately count somebody's pulse. Requires you to stand still at least 6 seconds."
set src in view(1)
var/self = 0
if(usr.stat == 1 || usr.restrained() || !isliving(usr)) return
if(usr == src)
self = 1
if(!self)
usr.visible_message("\blue [usr] kneels down, puts \his hand on [src]'s wrist and begins counting their pulse.",\
"You begin counting [src]'s pulse")
else
usr.visible_message("\blue [usr] begins counting their pulse.",\
"You begin counting your pulse.")
if(src.pulse)
usr << "\blue [self ? "I have" : "[src] has"] pulse! Counting..."
else
usr << "\red [src] has no pulse!"
return
usr << "Don't move until counting is finished."
var/time = world.timeofday
sleep(60)
if(usr.l_move_time >= time) //checks if our mob has moved during the sleep()
usr << "You moved while counting. Try again."
else
usr << "\blue [self ? "My" : "[src]'s"] pulse is [src.get_pulse(GETPULSE_HAND)]."
@@ -113,6 +113,8 @@
handle_regular_hud_updates()
pulse = handle_pulse()
// Grabbing
for(var/obj/item/weapon/grab/G in src)
G.process()
@@ -1414,5 +1416,34 @@
if (shock_stage > 80)
Paralyse(rand(15,28))
proc/handle_pulse()
//if(life_tick % 100) return pulse //update pulse every 100 life ticks
if(stat == DEAD)
return PULSE_NONE //that's it, you're dead, nothing can influence your pulse
var/temp = PULSE_NORM
if(round(vessel.get_reagent_amount("blood")) <= BLOOD_VOLUME_BAD) //how much blood do we have
temp = PULSE_THREADY //not enough :(
if(reagents.get_reagent_amount("zombiepowder"))
temp = PULSE_NONE //pretend that we're dead. unlike actual death, can be inflienced by meds
for(var/R in bradycardics)
if(reagents.get_reagent_amount(R))
if(temp <= PULSE_THREADY && temp >= PULSE_NORM)
temp--
break //one reagent is enough
//comment out the breaks to make med effects stack
for(var/R in tachycardics) //handles different chems' influence on pulse
if(reagents.get_reagent_amount(R))
if(temp <= PULSE_FAST && temp >= PULSE_NONE)
temp++
break
return temp
#undef HUMAN_MAX_OXYLOSS
#undef HUMAN_CRIT_MAX_OXYLOSS
+15
View File
@@ -678,3 +678,18 @@ var/list/be_special_flags = list(
#define IMPLOYAL_HUD 5 // loyality implant
#define IMPCHEM_HUD 6 // chemical implant
#define IMPTRACK_HUD 7 // tracking implant
//Pulse levels, very simplified
#define PULSE_NONE 0 //so !M.pulse checks would be possible
#define PULSE_SLOW 1 //<60 bpm
#define PULSE_NORM 2 //60-90 bpm
#define PULSE_FAST 3 //90-120 bpm
#define PULSE_2FAST 4 //>120 bpm
#define PULSE_THREADY 5 //occurs during hypovolemic shock
//feel free to add shit to lists below
var/list/tachycardics = list("coffee", "inaprovaline", "hyperzine", "nitroglycerin", "thirteenloko", "nicotine") //increase heart rate
var/list/bradycardics = list("neurotoxin", "cryoxadone", "clonexadone", "space_drugs", "stoxin") //decrease heart rate
//proc/get_pulse methods
#define GETPULSE_HAND 0 //less accurate (hand)
#define GETPULSE_TOOL 1 //more accurate (med scanner, sleeper, etc)
+7
View File
@@ -57,6 +57,13 @@ Stuff which is in development and not yet visible to players or just code relate
(ie. code improvements for expandability, etc.) should not be listed here. They
should be listed in the changelog upon commit though. Thanks. -->
<div class="commit sansserif">
<h2 class="date">05.07.2013</h2>
<h3 class="author">Spamcat updated:</h3>
<ul class="changes bgimages16">
<li class="rscadd">Pulse! Humans now have hearbeat rate, which can be measured by right-clicking someone - Check pulse or by health analyzer. Medical machinery also has heartbeat monitors. Certain meds and conditions can influence it.</li>
</ul>
</div>
<div class="commit sansserif">
<h2 class="date">03.07.2013</h2>
<h3 class="author">Segrain updated:</h3>