mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-18 19:44:58 +01:00
Mild rewrite of screen alerts to enable more functionality
Specifically I wanted to allow #12043 to correctly implement clicking an "on fire" alert to call resist without affecting other alerts which is currently impssible. Plus this whole mess was stupid and bothering me so here we go.
This commit is contained in:
@@ -74,7 +74,7 @@
|
||||
|
||||
if(bodytemperature > 360.15)
|
||||
//Body temperature is too hot.
|
||||
throw_alert("alien_fire")
|
||||
throw_alert("alien_fire", /obj/screen/alert/alien_fire)
|
||||
switch(bodytemperature)
|
||||
if(360 to 400)
|
||||
apply_damage(HEAT_DAMAGE_LEVEL_1, BURN)
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
if(Toxins_pp) // Detect toxins in air
|
||||
adjustPlasma(breath.toxins*250)
|
||||
throw_alert("alien_tox")
|
||||
throw_alert("alien_tox", /obj/screen/alert/alien_tox)
|
||||
|
||||
toxins_used = breath.toxins
|
||||
|
||||
|
||||
@@ -379,7 +379,7 @@ emp_act
|
||||
if(I.throw_speed >= EMBED_THROWSPEED_THRESHOLD)
|
||||
if(can_embed(I))
|
||||
if(prob(I.embed_chance) && !(dna && (PIERCEIMMUNE in dna.species.specflags)))
|
||||
throw_alert("embeddedobject")
|
||||
throw_alert("embeddedobject", /obj/screen/alert/embeddedobject)
|
||||
var/obj/item/organ/limb/L = pick(organs)
|
||||
L.embedded_objects |= I
|
||||
I.add_blood(src)//it embedded itself in you, of course it's bloody!
|
||||
|
||||
@@ -695,7 +695,7 @@
|
||||
|
||||
if(H.blind)
|
||||
if(H.eye_blind)
|
||||
H.throw_alert("blind")
|
||||
H.throw_alert("blind", /obj/screen/alert/blind)
|
||||
H.blind.layer = 18
|
||||
else
|
||||
H.clear_alert("blind")
|
||||
@@ -709,7 +709,7 @@
|
||||
if(H.eye_blurry) H.client.screen += global_hud.blurry
|
||||
if(H.druggy)
|
||||
H.client.screen += global_hud.druggy
|
||||
H.throw_alert("high")
|
||||
H.throw_alert("high", /obj/screen/alert/high)
|
||||
else
|
||||
H.clear_alert("high")
|
||||
|
||||
@@ -766,13 +766,13 @@
|
||||
|
||||
switch(H.nutrition)
|
||||
if(NUTRITION_LEVEL_FULL to INFINITY)
|
||||
H.throw_alert("nutrition","fat")
|
||||
H.throw_alert("nutrition", /obj/screen/alert/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")
|
||||
H.throw_alert("nutrition", /obj/screen/alert/hungry)
|
||||
else
|
||||
H.throw_alert("nutrition","starving")
|
||||
H.throw_alert("nutrition", /obj/screen/alert/starving)
|
||||
|
||||
return 1
|
||||
|
||||
@@ -1145,7 +1145,7 @@
|
||||
H.adjustOxyLoss(HUMAN_CRIT_MAX_OXYLOSS)
|
||||
H.failed_last_breath = 1
|
||||
|
||||
H.throw_alert("oxy")
|
||||
H.throw_alert("oxy", /obj/screen/alert/oxy)
|
||||
|
||||
return 0
|
||||
|
||||
@@ -1163,14 +1163,14 @@
|
||||
if(safe_oxygen_max && O2_pp > safe_oxygen_max && !(NOBREATH in specflags))
|
||||
var/ratio = (breath.oxygen/safe_oxygen_max) * 10
|
||||
H.adjustOxyLoss(Clamp(ratio,oxy_breath_dam_min,oxy_breath_dam_max))
|
||||
H.throw_alert("too_much_oxy")
|
||||
H.throw_alert("too_much_oxy", /obj/screen/alert/too_much_oxy)
|
||||
else
|
||||
H.clear_alert("too_much_oxy")
|
||||
|
||||
//Too little oxygen!
|
||||
if(safe_oxygen_min && O2_pp < safe_oxygen_min)
|
||||
gas_breathed = handle_too_little_breath(H,O2_pp,safe_oxygen_min,breath.oxygen)
|
||||
H.throw_alert("oxy")
|
||||
H.throw_alert("oxy", /obj/screen/alert/oxy)
|
||||
else
|
||||
H.failed_last_breath = 0
|
||||
H.adjustOxyLoss(-5)
|
||||
@@ -1194,7 +1194,7 @@
|
||||
H.adjustOxyLoss(3) // Lets hurt em a little, let them know we mean business
|
||||
if(world.time - H.co2overloadtime > 300) // They've been in here 30s now, lets start to kill them for their own good!
|
||||
H.adjustOxyLoss(8)
|
||||
H.throw_alert("too_much_co2")
|
||||
H.throw_alert("too_much_co2", /obj/screen/alert/too_much_co2)
|
||||
if(prob(20)) // Lets give them some chance to know somethings not right though I guess.
|
||||
spawn(0) H.emote("cough")
|
||||
|
||||
@@ -1205,7 +1205,7 @@
|
||||
//Too little CO2!
|
||||
if(safe_co2_min && CO2_pp < safe_co2_min)
|
||||
gas_breathed = handle_too_little_breath(H,CO2_pp, safe_co2_min,breath.carbon_dioxide)
|
||||
H.throw_alert("not_enough_co2")
|
||||
H.throw_alert("not_enough_co2", /obj/screen/alert/not_enough_co2)
|
||||
else
|
||||
H.failed_last_breath = 0
|
||||
H.adjustOxyLoss(-5)
|
||||
@@ -1225,7 +1225,7 @@
|
||||
var/ratio = (breath.toxins/safe_toxins_max) * 10
|
||||
if(H.reagents)
|
||||
H.reagents.add_reagent("plasma", Clamp(ratio, tox_breath_dam_min, tox_breath_dam_max))
|
||||
H.throw_alert("tox_in_air")
|
||||
H.throw_alert("tox_in_air", /obj/screen/alert/tox_in_air)
|
||||
else
|
||||
H.clear_alert("tox_in_air")
|
||||
|
||||
@@ -1233,7 +1233,7 @@
|
||||
//Too little toxins!
|
||||
if(safe_toxins_min && Toxins_pp < safe_toxins_min && !(NOBREATH in specflags))
|
||||
gas_breathed = handle_too_little_breath(H,Toxins_pp, safe_toxins_min, breath.toxins)
|
||||
H.throw_alert("not_enough_tox")
|
||||
H.throw_alert("not_enough_tox", /obj/screen/alert/not_enough_tox)
|
||||
else
|
||||
H.failed_last_breath = 0
|
||||
H.adjustOxyLoss(-5)
|
||||
@@ -1333,13 +1333,13 @@
|
||||
//Body temperature is too hot.
|
||||
switch(H.bodytemperature)
|
||||
if(360 to 400)
|
||||
H.throw_alert("temp","hot",1)
|
||||
H.throw_alert("temp", /obj/screen/alert/hot, 1)
|
||||
H.apply_damage(HEAT_DAMAGE_LEVEL_1*heatmod, BURN)
|
||||
if(400 to 460)
|
||||
H.throw_alert("temp","hot",2)
|
||||
H.throw_alert("temp", /obj/screen/alert/hot, 2)
|
||||
H.apply_damage(HEAT_DAMAGE_LEVEL_2*heatmod, BURN)
|
||||
if(460 to INFINITY)
|
||||
H.throw_alert("temp","hot",3)
|
||||
H.throw_alert("temp", /obj/screen/alert/hot, 3)
|
||||
if(H.on_fire)
|
||||
H.apply_damage(HEAT_DAMAGE_LEVEL_3*heatmod, BURN)
|
||||
else
|
||||
@@ -1349,13 +1349,13 @@
|
||||
if(!istype(H.loc, /obj/machinery/atmospherics/components/unary/cryo_cell))
|
||||
switch(H.bodytemperature)
|
||||
if(200 to 260)
|
||||
H.throw_alert("temp","cold",1)
|
||||
H.throw_alert("temp", /obj/screen/alert/cold, 1)
|
||||
H.apply_damage(COLD_DAMAGE_LEVEL_1*coldmod, BURN)
|
||||
if(120 to 200)
|
||||
H.throw_alert("temp","cold",2)
|
||||
H.throw_alert("temp", /obj/screen/alert/cold, 2)
|
||||
H.apply_damage(COLD_DAMAGE_LEVEL_2*coldmod, BURN)
|
||||
if(-INFINITY to 120)
|
||||
H.throw_alert("temp","cold",3)
|
||||
H.throw_alert("temp", /obj/screen/alert/cold, 3)
|
||||
H.apply_damage(COLD_DAMAGE_LEVEL_3*coldmod, BURN)
|
||||
else
|
||||
H.clear_alert("temp")
|
||||
@@ -1372,21 +1372,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.throw_alert("pressure","highpressure",2)
|
||||
H.throw_alert("pressure", /obj/screen/alert/highpressure, 2)
|
||||
else
|
||||
H.clear_alert("pressure")
|
||||
if(WARNING_HIGH_PRESSURE to HAZARD_HIGH_PRESSURE)
|
||||
H.throw_alert("pressure","highpressure",1)
|
||||
H.throw_alert("pressure", /obj/screen/alert/highpressure, 1)
|
||||
if(WARNING_LOW_PRESSURE to WARNING_HIGH_PRESSURE)
|
||||
H.clear_alert("pressure")
|
||||
if(HAZARD_LOW_PRESSURE to WARNING_LOW_PRESSURE)
|
||||
H.throw_alert("pressure","lowpressure",1)
|
||||
H.throw_alert("pressure", /obj/screen/alert/lowpressure, 1)
|
||||
else
|
||||
if(H.dna.check_mutation(COLDRES) || (COLDRES in specflags))
|
||||
H.clear_alert("pressure")
|
||||
else
|
||||
H.adjustBruteLoss( LOW_PRESSURE_DAMAGE )
|
||||
H.throw_alert("pressure","lowpressure",2)
|
||||
H.throw_alert("pressure", /obj/screen/alert/lowpressure, 2)
|
||||
|
||||
//////////
|
||||
// FIRE //
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
return
|
||||
adjustOxyLoss(1)
|
||||
failed_last_breath = 1
|
||||
throw_alert("oxy")
|
||||
throw_alert("oxy", /obj/screen/alert/oxy)
|
||||
|
||||
return 0
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
else
|
||||
adjustOxyLoss(3)
|
||||
failed_last_breath = 1
|
||||
throw_alert("oxy")
|
||||
throw_alert("oxy", /obj/screen/alert/oxy)
|
||||
|
||||
else //Enough oxygen
|
||||
failed_last_breath = 0
|
||||
@@ -165,7 +165,7 @@
|
||||
var/ratio = (breath.toxins/safe_tox_max) * 10
|
||||
if(reagents)
|
||||
reagents.add_reagent("plasma", Clamp(ratio, MIN_PLASMA_DAMAGE, MAX_PLASMA_DAMAGE))
|
||||
throw_alert("tox_in_air")
|
||||
throw_alert("tox_in_air", /obj/screen/alert/tox_in_air)
|
||||
else
|
||||
clear_alert("tox_in_air")
|
||||
|
||||
@@ -291,7 +291,7 @@
|
||||
CheckStamina()
|
||||
|
||||
if(sleeping)
|
||||
throw_alert("asleep")
|
||||
throw_alert("asleep", /obj/screen/alert/asleep)
|
||||
handle_dreams()
|
||||
adjustStaminaLoss(-10)
|
||||
sleeping = max(sleeping-1, 0)
|
||||
|
||||
@@ -80,13 +80,13 @@
|
||||
if(bodytemperature > BODYTEMP_HEAT_DAMAGE_LIMIT)
|
||||
switch(bodytemperature)
|
||||
if(360 to 400)
|
||||
throw_alert("temp","hot",1)
|
||||
throw_alert("temp", /obj/screen/alert/hot, 1)
|
||||
adjustFireLoss(2)
|
||||
if(400 to 460)
|
||||
throw_alert("temp","hot",2)
|
||||
throw_alert("temp", /obj/screen/alert/hot, 2)
|
||||
adjustFireLoss(3)
|
||||
if(460 to INFINITY)
|
||||
throw_alert("temp","hot",3)
|
||||
throw_alert("temp", /obj/screen/alert/hot, 3)
|
||||
if(on_fire)
|
||||
adjustFireLoss(8)
|
||||
else
|
||||
@@ -96,13 +96,13 @@
|
||||
if(!istype(loc, /obj/machinery/atmospherics/components/unary/cryo_cell))
|
||||
switch(bodytemperature)
|
||||
if(200 to 260)
|
||||
throw_alert("temp","cold",1)
|
||||
throw_alert("temp", /obj/screen/alert/cold, 1)
|
||||
adjustFireLoss(0.5)
|
||||
if(120 to 200)
|
||||
throw_alert("temp","cold",2)
|
||||
throw_alert("temp", /obj/screen/alert/cold, 2)
|
||||
adjustFireLoss(1.5)
|
||||
if(-INFINITY to 120)
|
||||
throw_alert("temp","cold",3)
|
||||
throw_alert("temp", /obj/screen/alert/cold, 3)
|
||||
adjustFireLoss(3)
|
||||
else
|
||||
clear_alert("temp")
|
||||
@@ -117,16 +117,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) )
|
||||
throw_alert("pressure","highpressure",2)
|
||||
throw_alert("pressure", /obj/screen/alert/highpressure, 2)
|
||||
if(WARNING_HIGH_PRESSURE to HAZARD_HIGH_PRESSURE)
|
||||
throw_alert("pressure","highpressure",1)
|
||||
throw_alert("pressure", /obj/screen/alert/highpressure, 1)
|
||||
if(WARNING_LOW_PRESSURE to WARNING_HIGH_PRESSURE)
|
||||
clear_alert("pressure")
|
||||
if(HAZARD_LOW_PRESSURE to WARNING_LOW_PRESSURE)
|
||||
throw_alert("pressure","lowpressure",1)
|
||||
throw_alert("pressure", /obj/screen/alert/lowpressure, 1)
|
||||
else
|
||||
adjustBruteLoss( LOW_PRESSURE_DAMAGE )
|
||||
throw_alert("pressure","lowpressure",2)
|
||||
throw_alert("pressure", /obj/screen/alert/lowpressure, 2)
|
||||
|
||||
return
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@
|
||||
if(blind)
|
||||
if(eye_blind)
|
||||
blind.layer = 18
|
||||
throw_alert("blind")
|
||||
throw_alert("blind", /obj/screen/alert/blind)
|
||||
else
|
||||
blind.layer = 0
|
||||
clear_alert("blind")
|
||||
@@ -203,7 +203,7 @@
|
||||
|
||||
if (druggy)
|
||||
client.screen += global_hud.druggy
|
||||
throw_alert("high")
|
||||
throw_alert("high", /obj/screen/alert/high)
|
||||
else
|
||||
clear_alert("high")
|
||||
|
||||
|
||||
@@ -681,7 +681,7 @@ Sorry Giacom. Please don't be mad :(
|
||||
if(has_gravity)
|
||||
clear_alert("weightless")
|
||||
else
|
||||
throw_alert("weightless")
|
||||
throw_alert("weightless", /obj/screen/alert/weightless)
|
||||
float(!has_gravity)
|
||||
|
||||
/mob/living/proc/float(on)
|
||||
|
||||
@@ -6,37 +6,37 @@
|
||||
make_laws()
|
||||
|
||||
/mob/living/silicon/proc/set_zeroth_law(law, law_borg)
|
||||
throw_alert("newlaw")
|
||||
throw_alert("newlaw", /obj/screen/alert/newlaw)
|
||||
src.laws_sanity_check()
|
||||
src.laws.set_zeroth_law(law, law_borg)
|
||||
|
||||
/mob/living/silicon/proc/add_inherent_law(law)
|
||||
throw_alert("newlaw")
|
||||
throw_alert("newlaw", /obj/screen/alert/newlaw)
|
||||
laws_sanity_check()
|
||||
laws.add_inherent_law(law)
|
||||
|
||||
/mob/living/silicon/proc/clear_inherent_laws()
|
||||
throw_alert("newlaw")
|
||||
throw_alert("newlaw", /obj/screen/alert/newlaw)
|
||||
laws_sanity_check()
|
||||
laws.clear_inherent_laws()
|
||||
|
||||
/mob/living/silicon/proc/add_supplied_law(number, law)
|
||||
throw_alert("newlaw")
|
||||
throw_alert("newlaw", /obj/screen/alert/newlaw)
|
||||
laws_sanity_check()
|
||||
laws.add_supplied_law(number, law)
|
||||
|
||||
/mob/living/silicon/proc/clear_supplied_laws()
|
||||
throw_alert("newlaw")
|
||||
throw_alert("newlaw", /obj/screen/alert/newlaw)
|
||||
laws_sanity_check()
|
||||
laws.clear_supplied_laws()
|
||||
|
||||
/mob/living/silicon/proc/add_ion_law(law)
|
||||
throw_alert("newlaw")
|
||||
throw_alert("newlaw", /obj/screen/alert/newlaw)
|
||||
laws_sanity_check()
|
||||
laws.add_ion_law(law)
|
||||
|
||||
/mob/living/silicon/proc/clear_ion_laws()
|
||||
throw_alert("newlaw")
|
||||
throw_alert("newlaw", /obj/screen/alert/newlaw)
|
||||
laws_sanity_check()
|
||||
laws.clear_ion_laws()
|
||||
|
||||
|
||||
@@ -153,15 +153,15 @@
|
||||
if(0.75 to INFINITY)
|
||||
clear_alert("charge")
|
||||
if(0.5 to 0.75)
|
||||
throw_alert("charge","lowcell",1)
|
||||
throw_alert("charge", /obj/screen/alert/lowcell, 1)
|
||||
if(0.25 to 0.5)
|
||||
throw_alert("charge","lowcell",2)
|
||||
throw_alert("charge", /obj/screen/alert/lowcell, 2)
|
||||
if(0.01 to 0.25)
|
||||
throw_alert("charge","lowcell",3)
|
||||
throw_alert("charge", /obj/screen/alert/lowcell, 3)
|
||||
else
|
||||
throw_alert("charge","emptycell")
|
||||
throw_alert("charge", /obj/screen/alert/emptycell)
|
||||
else
|
||||
throw_alert("charge","nocell")
|
||||
throw_alert("charge", /obj/screen/alert/nocell)
|
||||
|
||||
/mob/living/silicon/robot/proc/update_items()
|
||||
if (client)
|
||||
|
||||
@@ -998,7 +998,7 @@
|
||||
if(wires.LockedCut())
|
||||
state = 1
|
||||
if(state)
|
||||
throw_alert("locked")
|
||||
throw_alert("locked", /obj/screen/alert/locked)
|
||||
else
|
||||
clear_alert("locked")
|
||||
lockcharge = state
|
||||
@@ -1016,7 +1016,7 @@
|
||||
hud_used.update_robot_modules_display() //Shows/hides the emag item if the inventory screen is already open.
|
||||
update_icons()
|
||||
if(emagged)
|
||||
throw_alert("hacked")
|
||||
throw_alert("hacked", /obj/screen/alert/hacked)
|
||||
else
|
||||
clear_alert("hacked")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user