Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pulse optimisation #7624

Merged
merged 4 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/__DEFINES/objects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
#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_FASTER 4 //>120 bpm
#define PULSE_THREADY 5 //occurs during hypovolemic shock

//proc/get_pulse methods
Expand Down
22 changes: 0 additions & 22 deletions code/modules/mob/living/carbon/carbon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -430,28 +430,6 @@

observer.client.add_to_screen(action.button)

//generates realistic-ish pulse output based on preset levels
/mob/living/carbon/proc/get_pulse(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^^^^^^^^^

/mob/living/carbon/verb/mob_sleep()
set name = "Sleep"
set category = "IC"
Expand Down
1 change: 1 addition & 0 deletions code/modules/mob/living/carbon/human/examine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@
user.visible_message("<b>[user]</b> checks [src]'s pulse.", "You check [src]'s pulse.", null, 4)
spawn(15)
if(user && src && distance <= 1)
get_pulse(GETPULSE_HAND) // to update it
if(pulse == PULSE_NONE || status_flags & FAKEDEATH)
to_chat(user, SPAN_DEADSAY("[t_He] has no pulse[client ? "" : " and [t_his] soul has departed"]..."))
else
Expand Down
35 changes: 35 additions & 0 deletions code/modules/mob/living/carbon/human/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1764,3 +1764,38 @@

return .

/// generates realistic-ish pulse output based on preset levels.
/// method == GETPULSE_HAND is for hands, GETPULSE_TOOL is for machines, more accurate
/mob/living/carbon/human/proc/get_pulse(method)
var/temp = 0 //see setup.dm:694

if(species && species.flags & NO_BLOOD)
pulse = PULSE_NONE //No blood, no pulse.

else if(stat == DEAD || status_flags & FAKEDEATH)
pulse = PULSE_NONE //That's it, you're dead, nothing can influence your pulse

else if(floor(blood_volume) <= BLOOD_VOLUME_BAD) //How much blood do we have
pulse = PULSE_THREADY //not enough :(

else
pulse = PULSE_NORM

switch(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_FASTER)
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^^^^^^^^^
2 changes: 0 additions & 2 deletions code/modules/mob/living/carbon/human/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@

handle_regular_hud_updates()

pulse = handle_pulse()

if(!client && !mind && species)
species.handle_npc(src)

Expand Down
14 changes: 0 additions & 14 deletions code/modules/mob/living/carbon/human/life/handle_pulse.dm

This file was deleted.

3 changes: 2 additions & 1 deletion code/modules/mob/living/living_healthscan.dm
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,8 @@ GLOBAL_LIST_INIT(known_implants, subtypesof(/obj/item/implant))
else
dat += "\tBlood Level normal: [blood_percent]% [blood_volume]cl. Type: [blood_type]\n"
// Show pulse
dat += "\tPulse: <span class='[H.pulse == PULSE_THREADY || H.pulse == PULSE_NONE ? INTERFACE_RED : ""]'>[H.get_pulse(GETPULSE_TOOL)] bpm.</span>\n"
var/target_pulse = H.get_pulse(GETPULSE_TOOL)
dat += "\tPulse: <span class='[H.pulse == PULSE_THREADY || H.pulse == PULSE_NONE ? INTERFACE_RED : ""]'>[target_pulse] bpm.</span>\n"
if((H.stat == DEAD && !H.client))
unrevivable = 1
if(!unrevivable)
Expand Down
1 change: 0 additions & 1 deletion colonialmarines.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1969,7 +1969,6 @@
#include "code\modules\mob\living\carbon\human\life\handle_fire.dm"
#include "code\modules\mob\living\carbon\human\life\handle_grabbed.dm"
#include "code\modules\mob\living\carbon\human\life\handle_organs.dm"
#include "code\modules\mob\living\carbon\human\life\handle_pulse.dm"
#include "code\modules\mob\living\carbon\human\life\handle_regular_hud_updates.dm"
#include "code\modules\mob\living\carbon\human\life\handle_regular_status_updates.dm"
#include "code\modules\mob\living\carbon\human\life\handle_stasis_bag.dm"
Expand Down
Loading