Adds heartbeats

This commit is contained in:
CitadelStationBot
2017-06-28 14:01:39 -05:00
parent c5aa34c8e9
commit 98ff55f786
8 changed files with 58 additions and 1 deletions

View File

@@ -0,0 +1,7 @@
diff a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm (rejected hunks)
@@ -440,4 +440,4 @@ GLOBAL_LIST_INIT(ghost_others_options, list(GHOST_OTHERS_SIMPLE, GHOST_OTHERS_DE
#define BEAT_SLOW 2
#define BEAT_NONE 0
-#define BEAT_CHANNEL 150 //sound channel for heartbeats
+

View File

@@ -0,0 +1,8 @@
diff a/code/__DEFINES/sound.dm b/code/__DEFINES/sound.dm (rejected hunks)
@@ -9,5 +9,5 @@
//THIS SHOULD ALWAYS BE THE LOWEST ONE!
//KEEP IT UPDATED
-#define CHANNEL_HIGHEST_AVAILABLE 1019
+#define CHANNEL_HIGHEST_AVAILABLE 1018

View File

@@ -45,6 +45,6 @@
//Gets filled up in create_bodyparts() //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/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/icon_render_key = ""
var/static/list/limb_icon_cache = list() var/static/list/limb_icon_cache = list()

View File

@@ -20,6 +20,7 @@
//Updates the number of stored chemicals for powers //Updates the number of stored chemicals for powers
handle_changeling() handle_changeling()
if(stat != DEAD) if(stat != DEAD)
return 1 return 1
@@ -363,6 +364,12 @@
if(jitteriness) if(jitteriness)
do_jitter_animation(jitteriness) do_jitter_animation(jitteriness)
jitteriness = max(jitteriness - restingpwr, 0) jitteriness = max(jitteriness - restingpwr, 0)
var/obj/item/organ/heart/heart = getorgan(/obj/item/organ/heart)
if(heart)
if(!heart.beat || heart.beat == BEAT_SLOW)
stop_sound_channel(BEAT_CHANNEL)
playsound_local(src,'sound/health/fastbeat.ogg',40,0, channel = BEAT_CHANNEL)
heart.beat = BEAT_FAST
if(stuttering) if(stuttering)
stuttering = max(stuttering-1, 0) stuttering = max(stuttering-1, 0)

View File

@@ -0,0 +1,19 @@
diff a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm (rejected hunks)
@@ -347,16 +347,10 @@
AdjustSleeping(20)
Unconscious(100)
- //Jitteryness
+ //Jitteriness
if(jitteriness)
do_jitter_animation(jitteriness)
jitteriness = max(jitteriness - restingpwr, 0)
- var/obj/item/organ/heart/heart = getorgan(/obj/item/organ/heart)
- if(heart)
- if(!heart.beat || heart.beat == BEAT_SLOW)
- stop_sound_channel(BEAT_CHANNEL)
- playsound_local(src,'sound/health/fastbeat.ogg',40,0, channel = BEAT_CHANNEL)
- heart.beat = BEAT_FAST
if(stuttering)
stuttering = max(stuttering-1, 0)

View File

@@ -8,6 +8,7 @@
var/beating = 1 var/beating = 1
var/icon_base = "heart" var/icon_base = "heart"
attack_verb = list("beat", "thumped") 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() /obj/item/organ/heart/update_icon()
if(beating) if(beating)
@@ -48,6 +49,21 @@
S.icon_state = "heart-off" S.icon_state = "heart-off"
return S 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 /obj/item/organ/heart/cursed
name = "cursed heart" name = "cursed heart"

BIN
sound/health/fastbeat.ogg Normal file

Binary file not shown.

BIN
sound/health/slowbeat.ogg Normal file

Binary file not shown.