Merge pull request #8101 from MrPerson/alert_alert_ur_a_faget

On screen alert system
This commit is contained in:
Cheridan
2015-03-04 19:39:04 -06:00
28 changed files with 305 additions and 354 deletions
@@ -90,22 +90,19 @@
// +/- 50 degrees from 310.15K is the 'safe' zone, where no damage is dealt.
if(bodytemperature > 360.15)
//Body temperature is too hot.
fire_alert = max(fire_alert, 1)
throw_alert("alien_fire")
switch(bodytemperature)
if(360 to 400)
apply_damage(HEAT_DAMAGE_LEVEL_1, BURN)
fire_alert = max(fire_alert, 2)
if(400 to 460)
apply_damage(HEAT_DAMAGE_LEVEL_2, BURN)
fire_alert = max(fire_alert, 2)
if(460 to INFINITY)
if(on_fire)
apply_damage(HEAT_DAMAGE_LEVEL_3, BURN)
fire_alert = max(fire_alert, 2)
else
apply_damage(HEAT_DAMAGE_LEVEL_2, BURN)
fire_alert = max(fire_alert, 2)
return
else
clear_alert("alien_fire")
/mob/living/carbon/alien/ex_act(severity, target)
@@ -1,9 +1,6 @@
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:32
/mob/living/carbon/alien/humanoid
oxygen_alert = 0
toxins_alert = 0
fire_alert = 0
pass_flags = PASSTABLE
+2 -14
View File
@@ -16,12 +16,12 @@
if(Toxins_pp) // Detect toxins in air
adjustToxLoss(breath.toxins*250)
toxins_alert = max(toxins_alert, 1)
throw_alert("alien_tox")
toxins_used = breath.toxins
else
toxins_alert = 0
clear_alert("alien_tox")
//Breathe in toxins and out oxygen
breath.toxins -= toxins_used
@@ -30,15 +30,6 @@
//BREATH TEMPERATURE
handle_breath_temperature(breath)
/mob/living/carbon/alien/handle_breath_temperature(datum/gas_mixture/breath)
if(breath.temperature > (T0C+66)) // Hot air hurts :(
if(prob(20))
src << "<span class='danger'>You feel a searing heat in your lungs!</span>"
fire_alert = max(fire_alert, 1)
else
fire_alert = 0
return 1
/mob/living/carbon/alien/handle_regular_status_updates()
..()
@@ -106,8 +97,5 @@
pullin.icon_state = "pull0"
if (toxin) toxin.icon_state = "tox[toxins_alert ? 1 : 0]"
if (oxygen) oxygen.icon_state = "oxy[oxygen_alert ? 1 : 0]"
if (fire) fire.icon_state = "fire[fire_alert ? 1 : 0]"
return 1
+1 -2
View File
@@ -35,7 +35,6 @@
if (notransform)
return
fire_alert = 0 //Reset this here, because both breathe() and handle_environment() have a chance to set it.
tinttotal = tintcheck() //here as both hud updates and status updates call it
if(..())
@@ -357,4 +356,4 @@
I.loc = get_turf(src)
visible_message("<span class='danger'>\the [I] falls out of [name]'s [L.getDisplayName()]!</span>","<span class='userdanger'>\the [I] falls out of your [L.getDisplayName()]!</span>")
#undef HUMAN_MAX_OXYLOSS
#undef HUMAN_MAX_OXYLOSS
+32 -85
View File
@@ -598,23 +598,15 @@
if(icon_num)
H.healthdoll.overlays += image('icons/mob/screen_gen.dmi',"[L.name][icon_num]")
if(H.nutrition_icon)
switch(H.nutrition)
if(NUTRITION_LEVEL_FULL to INFINITY)
H.nutrition_icon.icon_state = "nutritionFAT"
if(NUTRITION_LEVEL_WELL_FED to NUTRITION_LEVEL_FULL)
H.nutrition_icon.icon_state = "nutrition0"
if(NUTRITION_LEVEL_FED to NUTRITION_LEVEL_WELL_FED)
H.nutrition_icon.icon_state = "nutrition1"
if(NUTRITION_LEVEL_HUNGRY to NUTRITION_LEVEL_FED)
H.nutrition_icon.icon_state = "nutrition2"
if(NUTRITION_LEVEL_STARVING to NUTRITION_LEVEL_HUNGRY)
H.nutrition_icon.icon_state = "nutrition3"
else
H.nutrition_icon.icon_state = "nutrition4"
if(H.pressure)
H.pressure.icon_state = "pressure[H.pressure_alert]"
switch(H.nutrition)
if(NUTRITION_LEVEL_FULL to INFINITY)
H.throw_alert("nutrition","fat")
if(NUTRITION_LEVEL_HUNGRY to NUTRITION_LEVEL_FULL)
H.clear_alert("nutrition")
if(NUTRITION_LEVEL_STARVING to NUTRITION_LEVEL_HUNGRY)
H.throw_alert("nutrition","hungry")
else
H.throw_alert("nutrition","starving")
if(H.pullin)
if(H.pulling) H.pullin.icon_state = "pull"
@@ -622,31 +614,7 @@
// if(rest) //Not used with new UI
// if(resting || lying || sleeping) rest.icon_state = "rest1"
// else rest.icon_state = "rest0"
if(H.toxin)
if(H.hal_screwyhud == 4 || H.toxins_alert) H.toxin.icon_state = "tox1"
else H.toxin.icon_state = "tox0"
if(H.oxygen)
if(H.hal_screwyhud == 3 || H.oxygen_alert) H.oxygen.icon_state = "oxy1"
else H.oxygen.icon_state = "oxy0"
if(H.fire)
if(H.fire_alert) H.fire.icon_state = "fire[H.fire_alert]" //fire_alert is either 0 if no alert, 1 for cold and 2 for heat.
else H.fire.icon_state = "fire0"
if(H.bodytemp)
if(!(HEATRES in specflags))
switch(H.bodytemperature) //310.055 optimal body temp
if(370 to INFINITY) H.bodytemp.icon_state = "temp4"
if(350 to 370) H.bodytemp.icon_state = "temp3"
if(335 to 350) H.bodytemp.icon_state = "temp2"
switch(H.bodytemperature)
if(320 to 335) H.bodytemp.icon_state = "temp1"
if(300 to 320) H.bodytemp.icon_state = "temp0"
if(295 to 300) H.bodytemp.icon_state = "temp-1"
if(!(COLDRES in specflags))
switch(H.bodytemperature)
if(280 to 295) H.bodytemp.icon_state = "temp-2"
if(260 to 280) H.bodytemp.icon_state = "temp-3"
if(-INFINITY to 260) H.bodytemp.icon_state = "temp-4"
return 1
@@ -1105,7 +1073,7 @@
H.adjustOxyLoss(HUMAN_CRIT_MAX_OXYLOSS)
H.failed_last_breath = 1
H.oxygen_alert = max(H.oxygen_alert, 1)
H.throw_alert("oxy")
return 0
@@ -1138,18 +1106,12 @@
else
H.adjustOxyLoss(HUMAN_MAX_OXYLOSS)
H.failed_last_breath = 1
H.oxygen_alert = max(H.oxygen_alert, 1)
/*else if (O2_pp > safe_oxygen_max) // Too much oxygen (commented this out for now, I'll deal with pressure damage elsewhere I suppose)
spawn(0) emote("cough")
var/ratio = O2_pp/safe_oxygen_max
oxyloss += 5*ratio
oxygen_used = breath.oxygen*ratio/6
oxygen_alert = max(oxygen_alert, 1)*/
H.throw_alert("oxy")
else // We're in safe limits
H.failed_last_breath = 0
H.adjustOxyLoss(-5)
oxygen_used = breath.oxygen/6
H.oxygen_alert = 0
H.clear_alert("oxy")
breath.oxygen -= oxygen_used
breath.carbon_dioxide += oxygen_used
@@ -1174,9 +1136,9 @@
//adjustToxLoss(Clamp(ratio, MIN_PLASMA_DAMAGE, MAX_PLASMA_DAMAGE)) //Limit amount of damage toxin exposure can do per second
if(H.reagents)
H.reagents.add_reagent("plasma", Clamp(ratio, MIN_PLASMA_DAMAGE, MAX_PLASMA_DAMAGE))
H.toxins_alert = max(H.toxins_alert, 1)
H.throw_alert("tox_in_air")
else
H.toxins_alert = 0
H.clear_alert("tox_in_air")
if(breath.trace_gases.len && !(NOBREATH in specflags)) // If there's some other shit in the air lets deal with it here.
for(var/datum/gas/sleeping_agent/SA in breath.trace_gases)
@@ -1195,39 +1157,24 @@
/datum/species/proc/handle_breath_temperature(datum/gas_mixture/breath, var/mob/living/carbon/human/H) // called by human/life, handles temperatures
if( (abs(310.15 - breath.temperature) > 50) && !(mutations_list[COLDRES] in H.dna.mutations) && !(COLDRES in specflags)) // Hot air hurts :(
if(breath.temperature < 260.15)
if(prob(20))
H << "<span class='danger'>You feel your face freezing and an icicle forming in your lungs!</span>"
else if(breath.temperature > 360.15 && !(HEATRES in specflags))
if(prob(20))
H << "<span class='danger'>You feel your face burning and a searing heat in your lungs!</span>"
if(!(mutations_list[COLDRES] in H.dna.mutations)) // COLD DAMAGE
switch(breath.temperature)
if(-INFINITY to 120)
H.apply_damage(COLD_GAS_DAMAGE_LEVEL_3, BURN, "head")
H.fire_alert = max(H.fire_alert, 1)
if(120 to 200)
H.apply_damage(COLD_GAS_DAMAGE_LEVEL_2, BURN, "head")
H.fire_alert = max(H.fire_alert, 1)
if(200 to 260)
H.apply_damage(COLD_GAS_DAMAGE_LEVEL_1, BURN, "head")
H.fire_alert = max(H.fire_alert, 1)
if(!(HEATRES in specflags)) // HEAT DAMAGE
switch(breath.temperature)
if(360 to 400)
H.apply_damage(HEAT_GAS_DAMAGE_LEVEL_1, BURN, "head")
H.fire_alert = max(H.fire_alert, 2)
if(400 to 1000)
H.apply_damage(HEAT_GAS_DAMAGE_LEVEL_2, BURN, "head")
H.fire_alert = max(H.fire_alert, 2)
if(1000 to INFINITY)
H.apply_damage(HEAT_GAS_DAMAGE_LEVEL_3, BURN, "head")
H.fire_alert = max(H.fire_alert, 2)
return
/datum/species/proc/handle_environment(datum/gas_mixture/environment, var/mob/living/carbon/human/H)
if(!environment)
return
@@ -1255,35 +1202,37 @@
// +/- 50 degrees from 310.15K is the 'safe' zone, where no damage is dealt.
if(H.bodytemperature > BODYTEMP_HEAT_DAMAGE_LIMIT && !(HEATRES in specflags))
//Body temperature is too hot.
H.fire_alert = max(H.fire_alert, 1)
switch(H.bodytemperature)
if(360 to 400)
H.throw_alert("temp","hot",1)
H.apply_damage(HEAT_DAMAGE_LEVEL_1*heatmod, BURN)
H.fire_alert = max(H.fire_alert, 2)
if(400 to 460)
H.throw_alert("temp","hot",2)
H.apply_damage(HEAT_DAMAGE_LEVEL_2*heatmod, BURN)
H.fire_alert = max(H.fire_alert, 2)
if(460 to INFINITY)
H.throw_alert("temp","hot",3)
if(H.on_fire)
H.apply_damage(HEAT_DAMAGE_LEVEL_3*heatmod, BURN)
H.fire_alert = max(H.fire_alert, 2)
else
H.apply_damage(HEAT_DAMAGE_LEVEL_2*heatmod, BURN)
H.fire_alert = max(H.fire_alert, 2)
else if(H.bodytemperature < BODYTEMP_COLD_DAMAGE_LIMIT && !(mutations_list[COLDRES] in H.dna.mutations))
H.fire_alert = max(H.fire_alert, 1)
if(!istype(H.loc, /obj/machinery/atmospherics/unary/cryo_cell))
switch(H.bodytemperature)
if(200 to 260)
H.throw_alert("temp","cold",1)
H.apply_damage(COLD_DAMAGE_LEVEL_1*coldmod, BURN)
H.fire_alert = max(H.fire_alert, 1)
if(120 to 200)
H.throw_alert("temp","cold",2)
H.apply_damage(COLD_DAMAGE_LEVEL_2*coldmod, BURN)
H.fire_alert = max(H.fire_alert, 1)
if(-INFINITY to 120)
H.throw_alert("temp","cold",3)
H.apply_damage(COLD_DAMAGE_LEVEL_3*coldmod, BURN)
H.fire_alert = max(H.fire_alert, 1)
else
H.clear_alert("temp")
else
H.clear_alert("temp")
// Account for massive pressure differences. Done by Polymorph
// Made it possible to actually have something that can protect against high pressure... Done by Errorage. Polymorph now has an axe sticking from his head for his previous hardcoded nonsense!
@@ -1294,23 +1243,21 @@
if(HAZARD_HIGH_PRESSURE to INFINITY)
if(!(HEATRES in specflags))
H.adjustBruteLoss( min( ( (adjusted_pressure / HAZARD_HIGH_PRESSURE) -1 )*PRESSURE_DAMAGE_COEFFICIENT , MAX_HIGH_PRESSURE_DAMAGE) )
H.pressure_alert = 2
H.throw_alert("pressure","highpressure",2)
else
H.pressure_alert = 1
H.clear_alert("pressure")
if(WARNING_HIGH_PRESSURE to HAZARD_HIGH_PRESSURE)
H.pressure_alert = 1
H.throw_alert("pressure","highpressure",1)
if(WARNING_LOW_PRESSURE to WARNING_HIGH_PRESSURE)
H.pressure_alert = 0
H.clear_alert("pressure")
if(HAZARD_LOW_PRESSURE to WARNING_LOW_PRESSURE)
H.pressure_alert = -1
H.throw_alert("pressure","lowpressure",1)
else
if(H.dna.check_mutation(COLDRES) || (COLDRES in specflags))
H.pressure_alert = -1
H.clear_alert("pressure")
else
H.adjustBruteLoss( LOW_PRESSURE_DAMAGE )
H.pressure_alert = -2
return
H.throw_alert("pressure","lowpressure",2)
//////////
// FIRE //
+5 -15
View File
@@ -151,7 +151,7 @@
return
adjustOxyLoss(1)
failed_last_breath = 1
oxygen_alert = max(oxygen_alert, 1)
throw_alert("oxy")
return 0
@@ -181,13 +181,13 @@
else
adjustOxyLoss(3)
failed_last_breath = 1
oxygen_alert = max(oxygen_alert, 1)
throw_alert("oxy")
else //Enough oxygen
failed_last_breath = 0
adjustOxyLoss(-5)
oxygen_used = breath.oxygen/6
oxygen_alert = 0
clear_alert("oxy")
breath.oxygen -= oxygen_used
breath.carbon_dioxide += oxygen_used
@@ -212,9 +212,9 @@
var/ratio = (breath.toxins/safe_tox_max) * 10
if(reagents)
reagents.add_reagent("plasma", Clamp(ratio, MIN_PLASMA_DAMAGE, MAX_PLASMA_DAMAGE))
toxins_alert = max(toxins_alert, 1)
throw_alert("tox_in_air")
else
toxins_alert = 0
clear_alert("tox_in_air")
//TRACE GASES
if(breath.trace_gases.len)
@@ -235,16 +235,6 @@
//Fourth and final link in a breath chain
/mob/living/carbon/proc/handle_breath_temperature(datum/gas_mixture/breath)
if(breath.temperature > (T0C+66)) // Hot air hurts :(
if(prob(20))
src << "<span class='danger'>You feel a searing heat in your lungs!</span>"
fire_alert = max(fire_alert, 2)
else
fire_alert = 0
if(breath.temperature < (T0C-20))
if(prob(20))
src << "<span class='danger'>You feel your face freezing and an icicle forming in your lungs!</span>"
return
/mob/living/carbon/proc/get_breath_from_internal(volume_needed)
+7 -31
View File
@@ -71,16 +71,16 @@
switch(adjusted_pressure)
if(HAZARD_HIGH_PRESSURE to INFINITY)
adjustBruteLoss( min( ( (adjusted_pressure / HAZARD_HIGH_PRESSURE) -1 )*PRESSURE_DAMAGE_COEFFICIENT , MAX_HIGH_PRESSURE_DAMAGE) )
pressure_alert = 2
throw_alert("pressure","highpressure",2)
if(WARNING_HIGH_PRESSURE to HAZARD_HIGH_PRESSURE)
pressure_alert = 1
throw_alert("pressure","highpressure",1)
if(WARNING_LOW_PRESSURE to WARNING_HIGH_PRESSURE)
pressure_alert = 0
clear_alert("pressure")
if(HAZARD_LOW_PRESSURE to WARNING_LOW_PRESSURE)
pressure_alert = -1
throw_alert("pressure","lowpressure",1)
else
adjustBruteLoss( LOW_PRESSURE_DAMAGE )
pressure_alert = -2
throw_alert("pressure","lowpressure",2)
return
@@ -97,8 +97,7 @@
handle_hud_icons_health()
if(pressure)
pressure.icon_state = "pressure[pressure_alert]"
if(pullin)
if(pulling)
@@ -106,30 +105,7 @@
else
pullin.icon_state = "pull0"
if (toxin) toxin.icon_state = "tox[toxins_alert ? 1 : 0]"
if (oxygen) oxygen.icon_state = "oxy[oxygen_alert ? 1 : 0]"
if (fire) fire.icon_state = "fire[fire_alert ? 2 : 0]"
if(bodytemp)
switch(bodytemperature) //310.055 optimal body temp
if(345 to INFINITY)
bodytemp.icon_state = "temp4"
if(335 to 345)
bodytemp.icon_state = "temp3"
if(327 to 335)
bodytemp.icon_state = "temp2"
if(316 to 327)
bodytemp.icon_state = "temp1"
if(300 to 316)
bodytemp.icon_state = "temp0"
if(295 to 300)
bodytemp.icon_state = "temp-1"
if(280 to 295)
bodytemp.icon_state = "temp-2"
if(260 to 280)
bodytemp.icon_state = "temp-3"
else
bodytemp.icon_state = "temp-4"
//blame the person who coded them. Temporary fix added.
return 1
+21 -38
View File
@@ -190,45 +190,28 @@
src.mind.special_role = "traitor"
ticker.mode.traitors += src.mind
if (src.cells)
if (src.cell)
var/cellcharge = src.cell.charge/src.cell.maxcharge
switch(cellcharge)
if(0.75 to INFINITY)
src.cells.icon_state = "charge4"
if(0.5 to 0.75)
src.cells.icon_state = "charge3"
if(0.25 to 0.5)
src.cells.icon_state = "charge2"
if(0 to 0.25)
src.cells.icon_state = "charge1"
else
src.cells.icon_state = "charge0"
if (src.cell)
var/cellcharge = src.cell.charge/src.cell.maxcharge
switch(cellcharge)
if(0.75 to INFINITY)
clear_alert("charge")
if(0.5 to 0.75)
throw_alert("charge","lowcell",1)
if(0.25 to 0.5)
throw_alert("charge","lowcell",2)
if(0.01 to 0.25)
throw_alert("charge","lowcell",3)
else
throw_alert("charge","emptycell")
else
throw_alert("charge","nocell")
if(pullin)
if(pulling)
pullin.icon_state = "pull"
else
src.cells.icon_state = "charge-empty"
if(bodytemp)
switch(bodytemperature) //310.055 optimal body temp
if(335 to INFINITY)
bodytemp.icon_state = "temp2"
if(320 to 335)
bodytemp.icon_state = "temp1"
if(300 to 320)
bodytemp.icon_state = "temp0"
if(260 to 300)
bodytemp.icon_state = "temp-1"
else
bodytemp.icon_state = "temp-2"
if(pullin)
if(pulling)
pullin.icon_state = "pull"
else
pullin.icon_state = "pull0"
//Oxygen and fire does nothing yet!!
// if (src.oxygen) src.oxygen.icon_state = "oxy[src.oxygen_alert ? 1 : 0]"
// if (src.fire) src.fire.icon_state = "fire[src.fire_alert ? 1 : 0]"
pullin.icon_state = "pull0"
client.screen.Remove(global_hud.blurry,global_hud.druggy,global_hud.vimpaired)
@@ -11,7 +11,6 @@
//Hud stuff
var/obj/screen/cells = null
var/obj/screen/inv1 = null
var/obj/screen/inv2 = null
var/obj/screen/inv3 = null
-5
View File
@@ -13,15 +13,10 @@
var/obj/screen/hands = null
var/obj/screen/pullin = null
var/obj/screen/internals = null
var/obj/screen/oxygen = null
var/obj/screen/i_select = null
var/obj/screen/m_select = null
var/obj/screen/toxin = null
var/obj/screen/fire = null
var/obj/screen/bodytemp = null
var/obj/screen/healths = null
var/obj/screen/throw_icon = null
var/obj/screen/nutrition_icon = null
var/obj/screen/pressure = null
var/obj/screen/damageoverlay = null
/*A bunch of this stuff really needs to go under their own defines instead of being globally attached to mob.