Heartbeat

This commit is contained in:
volas
2015-03-07 18:03:49 +03:00
parent f09f00d8ac
commit cef52c73f8
2 changed files with 31 additions and 12 deletions

View File

@@ -31,6 +31,7 @@
var/pressure_alert = 0 var/pressure_alert = 0
var/temperature_alert = 0 var/temperature_alert = 0
var/in_stasis = 0 var/in_stasis = 0
var/heartbeat = 0
/mob/living/carbon/human/Life() /mob/living/carbon/human/Life()
@@ -102,6 +103,8 @@
handle_medical_side_effects() handle_medical_side_effects()
handle_heartbeat()
handle_stasis_bag() handle_stasis_bag()
if(life_tick > 5 && timeofdeath && (timeofdeath < 5 || world.time - timeofdeath > 6000)) //We are long dead, or we're junk mobs spawned like the clowns on the clown shuttle if(life_tick > 5 && timeofdeath && (timeofdeath < 5 || world.time - timeofdeath > 6000)) //We are long dead, or we're junk mobs spawned like the clowns on the clown shuttle
@@ -617,7 +620,7 @@
else else
apply_damage(HEAT_GAS_DAMAGE_LEVEL_3, BURN, "head", used_weapon = "Excessive Heat") apply_damage(HEAT_GAS_DAMAGE_LEVEL_3, BURN, "head", used_weapon = "Excessive Heat")
fire_alert = max(fire_alert, 2) fire_alert = max(fire_alert, 2)
else if(breath.temperature <= species.cold_level_1) else if(breath.temperature <= species.cold_level_1)
if(breath.temperature > species.cold_level_2) if(breath.temperature > species.cold_level_2)
apply_damage(COLD_GAS_DAMAGE_LEVEL_1, BURN, "head", used_weapon = "Excessive Cold") apply_damage(COLD_GAS_DAMAGE_LEVEL_1, BURN, "head", used_weapon = "Excessive Cold")
@@ -705,7 +708,7 @@
//Body temperature is too hot. //Body temperature is too hot.
fire_alert = max(fire_alert, 1) fire_alert = max(fire_alert, 1)
if(status_flags & GODMODE) return 1 //godmode if(status_flags & GODMODE) return 1 //godmode
if(bodytemperature < species.heat_level_2) if(bodytemperature < species.heat_level_2)
take_overall_damage(burn=HEAT_DAMAGE_LEVEL_1, used_weapon = "High Body Temperature") take_overall_damage(burn=HEAT_DAMAGE_LEVEL_1, used_weapon = "High Body Temperature")
fire_alert = max(fire_alert, 2) fire_alert = max(fire_alert, 2)
@@ -719,7 +722,7 @@
else if(bodytemperature <= species.cold_level_1) else if(bodytemperature <= species.cold_level_1)
fire_alert = max(fire_alert, 1) fire_alert = max(fire_alert, 1)
if(status_flags & GODMODE) return 1 //godmode if(status_flags & GODMODE) return 1 //godmode
if(!istype(loc, /obj/machinery/atmospherics/unary/cryo_cell)) if(!istype(loc, /obj/machinery/atmospherics/unary/cryo_cell))
if(bodytemperature > species.cold_level_2) if(bodytemperature > species.cold_level_2)
take_overall_damage(burn=COLD_DAMAGE_LEVEL_1, used_weapon = "High Body Temperature") take_overall_damage(burn=COLD_DAMAGE_LEVEL_1, used_weapon = "High Body Temperature")
@@ -1558,6 +1561,22 @@
return temp return temp
proc/handle_heartbeat()
if(pulse == PULSE_NONE)
return
if(pulse >= PULSE_2FAST || shock_stage >= 10 || istype(get_turf(src), /turf/space))
//PULSE_THREADY - maximum value for pulse, currently it 5.
//High pulse value corresponds to a fast rate of heartbeat.
//Divided by 2, otherwise it is too slow.
var/rate = (PULSE_THREADY - pulse)/2
if(heartbeat >= rate)
heartbeat = 0
src << sound('sound/effects/singlebeat.ogg',0,0,0,60)
else
heartbeat++
/* /*
Called by life(), instead of having the individual hud items update icons each tick and check for status changes Called by life(), instead of having the individual hud items update icons each tick and check for status changes
we only set those statuses and icons upon changes. Then those HUD items will simply add those pre-made images. we only set those statuses and icons upon changes. Then those HUD items will simply add those pre-made images.
@@ -1574,14 +1593,14 @@
var/percentage_health = RoundHealth((health-config.health_threshold_crit)/(maxHealth-config.health_threshold_crit)*100) var/percentage_health = RoundHealth((health-config.health_threshold_crit)/(maxHealth-config.health_threshold_crit)*100)
holder.icon_state = "hud[percentage_health]" holder.icon_state = "hud[percentage_health]"
hud_list[HEALTH_HUD] = holder hud_list[HEALTH_HUD] = holder
if (BITTEST(hud_updateflag, LIFE_HUD)) if (BITTEST(hud_updateflag, LIFE_HUD))
var/image/holder = hud_list[STATUS_HUD] var/image/holder = hud_list[STATUS_HUD]
if(stat == DEAD) if(stat == DEAD)
holder.icon_state = "huddead" holder.icon_state = "huddead"
else else
holder.icon_state = "hudhealthy" holder.icon_state = "hudhealthy"
if (BITTEST(hud_updateflag, STATUS_HUD)) if (BITTEST(hud_updateflag, STATUS_HUD))
var/foundVirus = 0 var/foundVirus = 0
for(var/datum/disease/D in viruses) for(var/datum/disease/D in viruses)
@@ -1618,7 +1637,7 @@
hud_list[STATUS_HUD] = holder hud_list[STATUS_HUD] = holder
hud_list[STATUS_HUD_OOC] = holder2 hud_list[STATUS_HUD_OOC] = holder2
if (BITTEST(hud_updateflag, ID_HUD)) if (BITTEST(hud_updateflag, ID_HUD))
var/image/holder = hud_list[ID_HUD] var/image/holder = hud_list[ID_HUD]
if(wear_id) if(wear_id)
@@ -1632,7 +1651,7 @@
hud_list[ID_HUD] = holder hud_list[ID_HUD] = holder
if (BITTEST(hud_updateflag, WANTED_HUD)) if (BITTEST(hud_updateflag, WANTED_HUD))
var/image/holder = hud_list[WANTED_HUD] var/image/holder = hud_list[WANTED_HUD]
holder.icon_state = "hudblank" holder.icon_state = "hudblank"
@@ -1658,11 +1677,11 @@
holder.icon_state = "hudreleased" holder.icon_state = "hudreleased"
break break
hud_list[WANTED_HUD] = holder hud_list[WANTED_HUD] = holder
if ( BITTEST(hud_updateflag, IMPLOYAL_HUD) \ if ( BITTEST(hud_updateflag, IMPLOYAL_HUD) \
|| BITTEST(hud_updateflag, IMPCHEM_HUD) \ || BITTEST(hud_updateflag, IMPCHEM_HUD) \
|| BITTEST(hud_updateflag, IMPTRACK_HUD)) || BITTEST(hud_updateflag, IMPTRACK_HUD))
var/image/holder1 = hud_list[IMPTRACK_HUD] var/image/holder1 = hud_list[IMPTRACK_HUD]
var/image/holder2 = hud_list[IMPLOYAL_HUD] var/image/holder2 = hud_list[IMPLOYAL_HUD]
var/image/holder3 = hud_list[IMPCHEM_HUD] var/image/holder3 = hud_list[IMPCHEM_HUD]
@@ -1683,7 +1702,7 @@
hud_list[IMPTRACK_HUD] = holder1 hud_list[IMPTRACK_HUD] = holder1
hud_list[IMPLOYAL_HUD] = holder2 hud_list[IMPLOYAL_HUD] = holder2
hud_list[IMPCHEM_HUD] = holder3 hud_list[IMPCHEM_HUD] = holder3
if (BITTEST(hud_updateflag, SPECIALROLE_HUD)) if (BITTEST(hud_updateflag, SPECIALROLE_HUD))
var/image/holder = hud_list[SPECIALROLE_HUD] var/image/holder = hud_list[SPECIALROLE_HUD]
holder.icon_state = "hudblank" holder.icon_state = "hudblank"
@@ -1744,10 +1763,10 @@
/mob/living/carbon/human/handle_fire() /mob/living/carbon/human/handle_fire()
if(..()) if(..())
return return
var/burn_temperature = fire_burn_temperature() var/burn_temperature = fire_burn_temperature()
var/thermal_protection = get_heat_protection(burn_temperature) var/thermal_protection = get_heat_protection(burn_temperature)
if (thermal_protection < 1 && bodytemperature < burn_temperature) if (thermal_protection < 1 && bodytemperature < burn_temperature)
bodytemperature += round(BODYTEMP_HEATING_MAX*(1-thermal_protection), 1) bodytemperature += round(BODYTEMP_HEATING_MAX*(1-thermal_protection), 1)

Binary file not shown.