Skip to content
This repository has been archived by the owner on Sep 12, 2021. It is now read-only.

Commit

Permalink
Adds heartbeats (#28858)
Browse files Browse the repository at this point in the history
* beatz

* use defines

* comments

* start refactor

* refactor 2

* finish refactor

* fix

* Update misc.dm

* Update life.dm

* Update heart.dm

* Update heart.dm

* remove human checks

* move things around

* woops

* wew

* update lowest sound channel

* remove stopsound

* get_turf
  • Loading branch information
Tacolizard authored and Cyberboss committed Jun 28, 2017
1 parent 2c3a40c commit 848690e
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 4 deletions.
7 changes: 7 additions & 0 deletions code/__DEFINES/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -434,3 +434,10 @@ GLOBAL_LIST_INIT(ghost_others_options, list(GHOST_OTHERS_SIMPLE, GHOST_OTHERS_DE

//for obj explosion block calculation
#define EXPLOSION_BLOCK_PROC -1

//for determining which type of heartbeat sound is playing
#define BEAT_FAST 1
#define BEAT_SLOW 2
#define BEAT_NONE 0


3 changes: 2 additions & 1 deletion code/__DEFINES/sound.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
#define CHANNEL_VOX 1022
#define CHANNEL_JUKEBOX 1021
#define CHANNEL_JUSTICAR_ARK 1020
#define CHANNEL_HEARTBEAT 1019 //sound channel for heartbeats

//THIS SHOULD ALWAYS BE THE LOWEST ONE!
//KEEP IT UPDATED

#define CHANNEL_HIGHEST_AVAILABLE 1019
#define CHANNEL_HIGHEST_AVAILABLE 1018

2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/carbon_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@
//Gets filled up in create_bodyparts()

var/list/hand_bodyparts = list() //a collection of arms (or actually whatever the fug /bodyparts you monsters use to wreck my systems)

var/icon_render_key = ""
var/static/list/limb_icon_cache = list()
4 changes: 2 additions & 2 deletions code/modules/mob/living/carbon/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
//Updates the number of stored chemicals for powers
handle_changeling()


if(stat != DEAD)
return 1

Expand Down Expand Up @@ -300,7 +301,6 @@
//this updates all special effects: stun, sleeping, knockdown, druggy, stuttering, etc..
/mob/living/carbon/handle_status_effects()
..()

if(staminaloss)
adjustStaminaLoss(-3)

Expand Down Expand Up @@ -347,7 +347,7 @@
AdjustSleeping(20)
Unconscious(100)

//Jitteryness
//Jitteriness
if(jitteriness)
do_jitter_animation(jitteriness)
jitteriness = max(jitteriness - restingpwr, 0)
Expand Down
16 changes: 16 additions & 0 deletions code/modules/surgery/organs/heart.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
var/beating = 1
var/icon_base = "heart"
attack_verb = list("beat", "thumped")
var/beat = BEAT_NONE//is this mob having a heatbeat sound played? if so, which?

/obj/item/organ/heart/update_icon()
if(beating)
Expand Down Expand Up @@ -48,6 +49,21 @@
S.icon_state = "heart-off"
return S

/obj/item/organ/heart/on_life()
if(owner.client)
var/mob/living/carbon/H = owner
if(H.health <= HEALTH_THRESHOLD_CRIT && beat != BEAT_SLOW)
beat = BEAT_SLOW
H.playsound_local(get_turf(H),'sound/health/slowbeat.ogg',40,0, channel = CHANNEL_HEARTBEAT)
to_chat(owner, "<span class = 'notice'>You feel your heart slow down...</span>")
if(beat == BEAT_SLOW && H.health > HEALTH_THRESHOLD_CRIT)
H.stop_sound_channel(CHANNEL_HEARTBEAT)
beat = BEAT_NONE

if(H.jitteriness)
if(!beat || beat == BEAT_SLOW)
H.playsound_local(get_turf(H),'sound/health/fastbeat.ogg',40,0, channel = CHANNEL_HEARTBEAT)
beat = BEAT_FAST

/obj/item/organ/heart/cursed
name = "cursed heart"
Expand Down
Binary file added sound/health/fastbeat.ogg
Binary file not shown.
Binary file added sound/health/slowbeat.ogg
Binary file not shown.

0 comments on commit 848690e

Please sign in to comment.