From 6e61fe391480c4bb37837d18c2d56b2535c16554 Mon Sep 17 00:00:00 2001 From: Spamcat Date: Fri, 5 Jul 2013 03:11:50 +0400 Subject: [PATCH 1/5] Initial pulse code. WIP --- .../mob/living/carbon/carbon_defines.dm | 4 +- .../mob/living/carbon/human/examine.dm | 1 + code/modules/mob/living/carbon/human/human.dm | 40 +++++++++++++++++++ code/modules/mob/living/carbon/human/life.dm | 33 +++++++++++++++ code/setup.dm | 15 +++++++ 5 files changed, 92 insertions(+), 1 deletion(-) diff --git a/code/modules/mob/living/carbon/carbon_defines.dm b/code/modules/mob/living/carbon/carbon_defines.dm index 2ea08f56a48..dd1a80a80c4 100644 --- a/code/modules/mob/living/carbon/carbon_defines.dm +++ b/code/modules/mob/living/carbon/carbon_defines.dm @@ -19,4 +19,6 @@ //Surgery info var/datum/surgery_status/op_stage = new/datum/surgery_status //Active emote/pose - var/pose = null \ No newline at end of file + var/pose = null + + var/pulse = PULSE_NORM //current pulse level \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index 20f56dd0228..c929d5e952b 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -440,6 +440,7 @@ if( findtext(pose,".",lentext(pose)) == 0 && findtext(pose,"!",lentext(pose)) == 0 && findtext(pose,"?",lentext(pose)) == 0 ) pose = addtext(pose,".") //Makes sure all emotes end with a period. msg += "\n[t_He] is [pose]" + msg += "\n\red pulse:[src.pulse]" usr << msg diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 78546ceea22..ea98ee5631e 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1218,3 +1218,43 @@ 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) + + if(usr.stat == 1 || usr.restrained() || !isliving(usr)) return + + usr.visible_message("\blue [usr] kneels down, puts \his hand on [src]'s wrist and begins counting their pulse.",\ + "\blue Don't move until counting is finished.") + if(src.pulse) + usr << "\blue [src] has pulse! Counting..." + else + usr << "\red [src] has no pulse!" + return + + sleep(60) + if(usr.move_speed >= 60) + usr << "\blue [src]'s pulse is [src.get_pulse(0)]." + +/mob/living/carbon/human/proc/get_pulse(var/method) //method 0 is for hands, 1 is for machines, more accurate + var/temp = 0 + switch(src.pulse) + if(PULSE_NONE) + return "0" + if(PULSE_SLOW) + temp = rand(40, 60) + return method ? num2text(temp) : temp + rand(-10, 10) + if(PULSE_NORM) + temp = rand(60, 90) + return method ? num2text(temp) : temp + rand(-10, 10) + if(PULSE_FAST) + temp = rand(90, 120) + return method ? num2text(temp) : temp + rand(-10, 10) + if(PULSE_2FAST) + temp = rand(120, 160) + return method ? num2text(temp) : temp + rand(-10, 10) + if(PULSE_THREADY) + return method ? ">250" : "extremely weak and fast, patient's artery feels like a thread" \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 366ea5e02b3..566e5a24e27 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -113,6 +113,8 @@ handle_regular_hud_updates() + pulse = handle_pulse() + // Grabbing for(var/obj/item/weapon/grab/G in src) G.process() @@ -211,6 +213,8 @@ // Next, the method to induce stasis has some adverse side-effects, manifesting // as cloneloss adjustCloneLoss(0.1) + //no pulse in stasis + pulse = PULSE_NONE proc/handle_mutations_and_radiation() if(getFireLoss()) @@ -1414,5 +1418,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 + + 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 diff --git a/code/setup.dm b/code/setup.dm index f4b8d35e2ff..d817150d909 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -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 + +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 + +//get_pulse methods +#define GETPULSE_HAND 0 //less accurate (hand) +#define GETPULSE_TOOL 1 //more accurate (med scanner, sleeper, etc) \ No newline at end of file From 24eddd6eaaa61ec246efcdfbe99055134d550f56 Mon Sep 17 00:00:00 2001 From: Spamcat Date: Fri, 5 Jul 2013 04:12:41 +0400 Subject: [PATCH 2/5] Now 100% more machinery! --- code/game/machinery/computer/Operating.dm | 1 + code/game/objects/items/devices/scanners.dm | 2 ++ .../mob/living/carbon/human/examine.dm | 2 +- code/modules/mob/living/carbon/human/human.dm | 33 +++++++++++++------ code/setup.dm | 6 ++-- 5 files changed, 30 insertions(+), 14 deletions(-) diff --git a/code/game/machinery/computer/Operating.dm b/code/game/machinery/computer/Operating.dm index 2022dc79da7..accd7b7a683 100644 --- a/code/game/machinery/computer/Operating.dm +++ b/code/game/machinery/computer/Operating.dm @@ -55,6 +55,7 @@ Fire Damage: [src.victim.getFireLoss()]
Suffocation Damage: [src.victim.getOxyLoss()]
Patient Status: [src.victim.stat ? "Non-Responsive" : "Stable"]
+Heartbeat rate: [victim.get_pulse(GETPULSE_TOOL)]
"} else src.victim = null diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm index f86f38cc83a..37f4a80937b 100644 --- a/code/game/objects/items/devices/scanners.dm +++ b/code/game/objects/items/devices/scanners.dm @@ -174,6 +174,8 @@ MASS SPECTROMETER user.show_message("\red 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 diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index c929d5e952b..dbb721afa91 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -223,6 +223,7 @@ else usr << "[t_He] has no pulse..." + msg += "" if(nutrition < 100) @@ -440,7 +441,6 @@ if( findtext(pose,".",lentext(pose)) == 0 && findtext(pose,"!",lentext(pose)) == 0 && findtext(pose,"?",lentext(pose)) == 0 ) pose = addtext(pose,".") //Makes sure all emotes end with a period. msg += "\n[t_He] is [pose]" - msg += "\n\red pulse:[src.pulse]" usr << msg diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index ea98ee5631e..e841bb27184 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1224,20 +1224,32 @@ mob/living/carbon/human/yank_out_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 - usr.visible_message("\blue [usr] kneels down, puts \his hand on [src]'s wrist and begins counting their pulse.",\ - "\blue Don't move until counting is finished.") + 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 [src] has pulse! Counting..." + 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.move_speed >= 60) - usr << "\blue [src]'s pulse is [src.get_pulse(0)]." + 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 [src]'s pulse is [src.get_pulse(GETPULSE_HAND)]." /mob/living/carbon/human/proc/get_pulse(var/method) //method 0 is for hands, 1 is for machines, more accurate var/temp = 0 @@ -1246,15 +1258,16 @@ mob/living/carbon/human/yank_out_object() return "0" if(PULSE_SLOW) temp = rand(40, 60) - return method ? num2text(temp) : temp + rand(-10, 10) + return num2text(method ? temp : temp + rand(-10, 10)) if(PULSE_NORM) temp = rand(60, 90) - return method ? num2text(temp) : temp + rand(-10, 10) + return num2text(method ? temp : temp + rand(-10, 10)) if(PULSE_FAST) temp = rand(90, 120) - return method ? num2text(temp) : temp + rand(-10, 10) + return num2text(method ? temp : temp + rand(-10, 10)) if(PULSE_2FAST) temp = rand(120, 160) - return method ? num2text(temp) : temp + rand(-10, 10) + 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" \ No newline at end of file + return method ? ">250" : "extremely weak and fast, patient's artery feels like a thread" +// output for machines^ ^^^^^^^output for people^^^^^^^^^ \ No newline at end of file diff --git a/code/setup.dm b/code/setup.dm index d817150d909..046ba2a189e 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -686,10 +686,10 @@ var/list/be_special_flags = list( #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 +var/list/bradycardics = list("neurotoxin", "cryoxadone", "clonexadone", "space_drugs", "stoxin") //decrease heart rate -//get_pulse methods +//proc/get_pulse methods #define GETPULSE_HAND 0 //less accurate (hand) #define GETPULSE_TOOL 1 //more accurate (med scanner, sleeper, etc) \ No newline at end of file From 3a1ea41ff266447d73801d0439b295b1701d114e Mon Sep 17 00:00:00 2001 From: Spamcat Date: Fri, 5 Jul 2013 04:39:57 +0400 Subject: [PATCH 3/5] Moar machinery. --- code/game/machinery/Sleeper.dm | 3 +++ code/game/machinery/cryo.dm | 2 +- code/modules/mob/living/carbon/carbon.dm | 24 ++++++++++++++++++- code/modules/mob/living/carbon/human/human.dm | 22 +---------------- code/modules/mob/living/carbon/human/life.dm | 2 +- 5 files changed, 29 insertions(+), 24 deletions(-) diff --git a/code/game/machinery/Sleeper.dm b/code/game/machinery/Sleeper.dm index 5c53d4ce8bb..9f9ff56f780 100644 --- a/code/game/machinery/Sleeper.dm +++ b/code/game/machinery/Sleeper.dm @@ -61,6 +61,9 @@ t1 = "*dead*" else dat += text("[]\tHealth %: [] ([])
", (occupant.health > 50 ? "" : ""), occupant.health, t1) + if(iscarbon(occupant)) + var/mob/living/carbon/C = occupant + dat += text("[]\t-Pulse, bpm: []
", (C.pulse == PULSE_NONE || C.pulse == PULSE_THREADY ? "" : ""), C.get_pulse(GETPULSE_TOOL)) dat += text("[]\t-Brute Damage %: []
", (occupant.getBruteLoss() < 60 ? "" : ""), occupant.getBruteLoss()) dat += text("[]\t-Respiratory Damage %: []
", (occupant.getOxyLoss() < 60 ? "" : ""), occupant.getOxyLoss()) dat += text("[]\t-Toxin Content %: []
", (occupant.getToxLoss() < 60 ? "" : ""), occupant.getToxLoss()) diff --git a/code/game/machinery/cryo.dm b/code/game/machinery/cryo.dm index 4b095488f9d..abe63412304 100644 --- a/code/game/machinery/cryo.dm +++ b/code/game/machinery/cryo.dm @@ -87,7 +87,7 @@ Current cell temperature: [temp_text]K
Cryo status: [ on ? "Off On" : "Off On"]
[beaker_text]

- Current occupant: [occupant ? "
Name: [occupant]
Health: [health_text]
Oxygen deprivation: [round(occupant.getOxyLoss(),0.1)]
Brute damage: [round(occupant.getBruteLoss(),0.1)]
Fire damage: [round(occupant.getFireLoss(),0.1)]
Toxin damage: [round(occupant.getToxLoss(),0.1)]
Body temperature: [occupant.bodytemperature]" : "None"]
+ Current occupant: [occupant ? "
Name: [occupant]
Health: [health_text]
Oxygen deprivation: [round(occupant.getOxyLoss(),0.1)]
Brute damage: [round(occupant.getBruteLoss(),0.1)]
Fire damage: [round(occupant.getFireLoss(),0.1)]
Toxin damage: [round(occupant.getToxLoss(),0.1)]
Body temperature: [occupant.bodytemperature]
Heartbeat rate: [occupant.get_pulse(GETPULSE_TOOL)]" : "None"]
"} user.set_machine(src) user << browse(dat, "window=cryo") diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 8e92cf653d9..061f06fe7d8 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -455,4 +455,26 @@
"} user << browse(dat, text("window=mob[];size=325x500", name)) onclose(user, "mob[name]") - return \ No newline at end of file + 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^^^^^^^^^ \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index e841bb27184..58c0f09373c 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1249,25 +1249,5 @@ mob/living/carbon/human/yank_out_object() 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 [src]'s pulse is [src.get_pulse(GETPULSE_HAND)]." + usr << "\blue [self ? "My" : "[src]'s"] pulse is [src.get_pulse(GETPULSE_HAND)]." -/mob/living/carbon/human/proc/get_pulse(var/method) //method 0 is for hands, 1 is for machines, more accurate - var/temp = 0 - 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^^^^^^^^^ \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 566e5a24e27..a1d714ba17c 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -1437,7 +1437,7 @@ 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) From 1541b5dec8fe390be5096891d02e2584017cf2c1 Mon Sep 17 00:00:00 2001 From: Spamcat Date: Fri, 5 Jul 2013 04:44:54 +0400 Subject: [PATCH 4/5] Changelog. --- html/changelog.html | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/html/changelog.html b/html/changelog.html index 83de3037b73..4e37e06ec64 100644 --- a/html/changelog.html +++ b/html/changelog.html @@ -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. --> +
+

05.07.2013

+

Spamcat updated:

+
    +
  • 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.
  • +
+

03.07.2013

Segrain updated:

From f7dc8f8c0a867f4d50749c5ed00fff1a223ca46e Mon Sep 17 00:00:00 2001 From: Spamcat Date: Fri, 5 Jul 2013 04:50:18 +0400 Subject: [PATCH 5/5] derp --- code/modules/mob/living/carbon/human/life.dm | 2 -- 1 file changed, 2 deletions(-) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index a1d714ba17c..1806bf17000 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -213,8 +213,6 @@ // Next, the method to induce stasis has some adverse side-effects, manifesting // as cloneloss adjustCloneLoss(0.1) - //no pulse in stasis - pulse = PULSE_NONE proc/handle_mutations_and_radiation() if(getFireLoss())