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
+11 -14
View File
@@ -77,25 +77,22 @@
#define ui_borg_radio "EAST-1:28,SOUTH+1:7"
#define ui_borg_intents "EAST-2:26,SOUTH:5"
//Upper-middle right (damage indicators)
#define ui_toxin "EAST-1:28,CENTER+5:27"
#define ui_fire "EAST-1:28,CENTER+4:25"
#define ui_oxygen "EAST-1:28,CENTER+3:23"
#define ui_pressure "EAST-1:28,CENTER+2:21"
#define ui_alien_toxin "EAST-1:28,CENTER+5:25"
#define ui_alien_fire "EAST-1:28,CENTER+4:25"
#define ui_alien_oxygen "EAST-1:28,CENTER+3:25"
#define ui_alien_nightvision "EAST-1:28,CENTER+2:25"
//Upper-middle right (alerts)
#define ui_alert1 "EAST-1:28,CENTER+5:27"
#define ui_alert2 "EAST-1:28,CENTER+4:25"
#define ui_alert3 "EAST-1:28,CENTER+3:23"
#define ui_alert4 "EAST-1:28,CENTER+2:21"
#define ui_alert5 "EAST-1:28,CENTER+1:19"
//Middle right (status indicators)
#define ui_nutrition "EAST-1:28,CENTER-3:11"
#define ui_temp "EAST-1:28,CENTER-2:13"
#define ui_healthdoll "EAST-1:28,CENTER-1:15"
#define ui_health "EAST-1:28,CENTER:17"
#define ui_internal "EAST-1:28,CENTER+1:19"
#define ui_healthdoll "EAST-1:28,CENTER-2:13"
#define ui_health "EAST-1:28,CENTER-1:15"
#define ui_internal "EAST-1:28,CENTER:17"
//borgs and aliens
#define ui_alien_nightvision "EAST-1:28,CENTER:17"
#define ui_borg_health "EAST-1:28,CENTER-1:15" //borgs have the health display where humans have the pressure damage indicator.
#define ui_alien_health "EAST-1:28,CENTER-1:15" //aliens have the health display where humans have the pressure damage indicator.
#define ui_alienplasmadisplay "EAST-1:28,CENTER-2:15"
+204
View File
@@ -0,0 +1,204 @@
//A system to manage and display alerts on screen without needing you to do it yourself
//PUBLIC - call these wherever you want
/mob/proc/throw_alert(category, id, severity, obj/new_master)
/* Proc to create or update an alert. Returns 1 if the alert is new or updated, 0 if it was thrown already
category is a text string. Each mob may only have one alert per category; the previous one will be replaced
id is a text string, If you don't provide one, category will be used as id
Either way it MUST match a type path like so: /obj/screen/alert/[id]
Also the alert's icon_state will be [id] so you must add it to screen_alert.dmi
severity is an optional number that will be placed at the end of the icon_state for this alert
For example, high pressure's id is "highpressure" and can be serverity 1 or 2 to get "highpressure1" or "highpressure2" as icon_states
new_master is optional and sets the alert's icon state to "template" in the ui_style icons with the master as an overlay.
Clicks are forwarded to master */
if(!category)
return
if(!id)
id = category
var/obj/screen/alert/alert
if(alerts[category])
alert = alerts[category]
if(new_master && new_master != alert.master)
WARNING("[src] threw alert [category] with new_master [new_master] while already having that alert with master [alert.master]")
// alert.overlays.Cut() // This is apparently an invalid expression
clear_alert(category)
return .()
else if(alert.icon_state == "[id][severity]")
// src << "threw alert not in need of update [category] [id] [severity]"
return 0
// src << "updating alert [category] [id] [severity]"
else
alert = PoolOrNew(/obj/screen/alert)
// src << "throwing new alert [category] [id] [severity]"
if(new_master)
var/old_layer = new_master.layer
new_master.layer = FLOAT_LAYER
alert.overlays += new_master
new_master.layer = old_layer
alert.icon_state = "template" // We'll set the icon to the client's ui pref in reorganize_alerts()
alert.master = new_master
else
alert.icon_state = "[id][severity]"
alerts[category] = alert
if(client && hud_used)
hud_used.reorganize_alerts()
alert.transform = matrix(32, 6, MATRIX_TRANSLATE)
animate(alert, transform = matrix(), time = 2.5, easing = CUBIC_EASING)
var/obj/screen/alert/path_as_obj = text2path("/obj/screen/alert/[id]")
// BYOND magic-fu - we'll be storing a path in this reference and retrieving vars from it.
if(!path_as_obj)
ERROR("[src] threw alert [category] with invalid path /obj/screen/alert/[id]")
return 0
alert.name = initial(path_as_obj.name)
alert.desc = initial(path_as_obj.desc)
alert.mouse_opacity = 1
return alert
// Proc to clear an existing alert.
/mob/proc/clear_alert(category)
var/obj/screen/alert/alert = alerts[category]
if(!alert)
return 0
alerts -= category
if(client && hud_used)
hud_used.reorganize_alerts()
client.screen -= alert
qdel(alert)
// Make sure any alerts you throw have a path that matches /obj/screen/alert/[id] or /obj/screen/alert/[category]
/obj/screen/alert
icon = 'icons/mob/screen_alert.dmi'
icon_state = "default"
name = "Alert"
desc = "Something seems to have gone wrong with this alert, so report this bug please"
/obj/screen/alert/oxy
name = "Choking"
desc = "You're not getting enough oxygen. Find some good air before you pass out! \
The box in your backpack has an oxygen tank and gas mask in it."
/obj/screen/alert/tox_in_air
name = "Toxic Gas"
desc = "There's highly flammable, toxic plasma in the air and you're breathing it in. Find some fresh air. \
The box in your backpack has an oxygen tank and gas mask in it."
/obj/screen/alert/fat
name = "Fat"
desc = "You ate too much food, lardass. Run around the station and lose some weight."
/obj/screen/alert/hungry
name = "Hungry"
desc = "Some food would be good right about now."
/obj/screen/alert/starving
name = "Starving"
desc = "Some food would be to kill for right about now. The hunger pains make moving around a chore."
/obj/screen/alert/hot
name = "Too Hot"
desc = "You're flaming hot! Get somewhere cooler and take off any insulating clothing like a fire suit."
/obj/screen/alert/cold
name = "Too Cold"
desc = "You're freezing cold! Get somewhere warmer and take off any insulating clothing like a space suit."
/obj/screen/alert/lowpressure
name = "Low Pressure"
desc = "The air around you is hazardously thin. A space suit would protect you."
/obj/screen/alert/highpressure
name = "High Pressure"
desc = "The air around you is hazardously thick. A fire suit would protect you."
/obj/screen/alert/alien_tox
name = "Plasma"
desc = "There's flammable plasma in the air. If it lights up, you'll be toast."
/obj/screen/alert/alien_fire
// This alert is temporarily gonna be thrown for all hot air but one day it will be used for literally being on fire
name = "Burning"
desc = "It's too hot! Flee to space or at least away from the flames. Standing on weeds will heal you up."
/obj/screen/alert/nocell
name = "Missing Power Cell"
desc = "Unit has no power cell. No modules available until a power cell is reinstalled. Robotics may provide assistance."
/obj/screen/alert/emptycell
name = "Out of Power"
desc = "Unit's power cell has no charge remaining. No modules available until power cell is recharged. \
Reharging stations are available in robotics, the dormitory's bathrooms. and the AI satelite."
/obj/screen/alert/lowcell
name = "Low Charge"
desc = "Unit's power cell is running low. Reharging stations are available in robotics, the dormitory's bathrooms. and the AI satelite."
/obj/screen/alert/buckled
name = "Buckled"
desc = "You've been buckled to something and can't move. Click the alert to unbuckle unless you're handcuffed."
/obj/screen/alert/handcuffed // Not used right now.
name = "Handcuffed"
desc = "You're handcuffed and can't act. If anyone drags you, you won't be able to move. Click the alert to free yourself."
// PRIVATE = only edit, use, or override these if you're editing the system as a whole
// Re-render all alerts - also called in /datum/hud/show_hud() because it's needed there
/datum/hud/proc/reorganize_alerts()
var/list/alerts = mymob.alerts
var/icon_pref
if(!hud_shown)
for(var/i = 1, i <= alerts.len, i++)
mymob.client.screen -= alerts[alerts[i]]
return 1
for(var/i = 1, i <= alerts.len, i++)
var/obj/screen/alert/alert = alerts[alerts[i]]
if(alert.icon_state == "template")
if(!icon_pref)
icon_pref = ui_style2icon(mymob.client.prefs.UI_style)
alert.icon = icon_pref
switch(i)
if(1)
. = ui_alert1
if(2)
. = ui_alert2
if(3)
. = ui_alert3
if(4)
. = ui_alert4
if(5)
. = ui_alert5 // Right now there's 5 slots
alert.screen_loc = .
mymob.client.screen |= alert
return 1
/mob
var/list/alerts = list() // contains /obj/screen/alert only // On /mob so clientless mobs will throw alerts properly
/obj/screen/alert/Click(location, control, params)
if(!usr || !usr.client)
return
var/paramslist = params2list(params)
if(paramslist["shift"]) // screen objects don't do the normal Click() stuff so we'll cheat
usr << "<span class='boldnotice'>[name]</span> - <span class='info'>[desc]</span>"
return
if(master)
return usr.client.Click(master, location, control, params)
/obj/screen/alert/Destroy()
PlaceInPool(src)
return 1 // Don't destroy me, I have a family!
+1 -19
View File
@@ -111,24 +111,6 @@
//begin indicators
mymob.oxygen = new /obj/screen()
mymob.oxygen.icon = 'icons/mob/screen_alien.dmi'
mymob.oxygen.icon_state = "oxy0"
mymob.oxygen.name = "oxygen"
mymob.oxygen.screen_loc = ui_alien_oxygen
mymob.toxin = new /obj/screen()
mymob.toxin.icon = 'icons/mob/screen_alien.dmi'
mymob.toxin.icon_state = "tox0"
mymob.toxin.name = "toxin"
mymob.toxin.screen_loc = ui_alien_toxin
mymob.fire = new /obj/screen()
mymob.fire.icon = 'icons/mob/screen_alien.dmi'
mymob.fire.icon_state = "fire0"
mymob.fire.name = "fire"
mymob.fire.screen_loc = ui_alien_fire
mymob.healths = new /obj/screen()
mymob.healths.icon = 'icons/mob/screen_alien.dmi'
mymob.healths.icon_state = "health0"
@@ -164,6 +146,6 @@
mymob.client.screen = null
mymob.client.screen += list( mymob.throw_icon, mymob.zone_sel, mymob.oxygen, mymob.toxin, mymob.fire, mymob.healths, nightvisionicon, alien_plasma_display, mymob.pullin, mymob.blind, mymob.flash) //, mymob.hands, mymob.rest, mymob.sleep, mymob.mach )
mymob.client.screen += list( mymob.throw_icon, mymob.zone_sel, mymob.healths, nightvisionicon, alien_plasma_display, mymob.pullin, mymob.blind, mymob.flash) //, mymob.hands, mymob.rest, mymob.sleep, mymob.mach )
mymob.client.screen += adding + other
+1 -21
View File
@@ -18,26 +18,6 @@
adding += using
move_intent = using
mymob.oxygen = new /obj/screen()
mymob.oxygen.icon = 'icons/mob/screen_alien.dmi'
mymob.oxygen.icon_state = "oxy0"
mymob.oxygen.name = "oxygen"
mymob.oxygen.screen_loc = ui_alien_oxygen
mymob.toxin = new /obj/screen()
mymob.toxin.icon = 'icons/mob/screen_alien.dmi'
mymob.toxin.icon_state = "tox0"
mymob.toxin.name = "toxin"
mymob.toxin.screen_loc = ui_alien_toxin
mymob.fire = new /obj/screen()
mymob.fire.icon = 'icons/mob/screen_alien.dmi'
mymob.fire.icon_state = "fire0"
mymob.fire.name = "fire"
mymob.fire.screen_loc = ui_alien_fire
mymob.healths = new /obj/screen()
mymob.healths.icon = 'icons/mob/screen_alien.dmi'
mymob.healths.icon_state = "health0"
@@ -72,5 +52,5 @@
mymob.client.screen = null
mymob.client.screen += list( mymob.zone_sel, mymob.oxygen, mymob.toxin, mymob.fire, mymob.healths, nightvisionicon, mymob.pullin, mymob.blind, mymob.flash) //, mymob.rest, mymob.sleep, mymob.mach )
mymob.client.screen += list( mymob.zone_sel, mymob.healths, nightvisionicon, mymob.pullin, mymob.blind, mymob.flash) //, mymob.rest, mymob.sleep, mymob.mach )
mymob.client.screen += adding + other
+4 -13
View File
@@ -225,21 +225,16 @@ datum/hud/New(mob/owner)
action_intent.screen_loc = ui_acti //Restore intent selection to the original position
mymob.client.screen += mymob.zone_sel //This one is a special snowflake
mymob.client.screen += mymob.bodytemp //As are the rest of these...
mymob.client.screen += mymob.fire
mymob.client.screen += mymob.healths
mymob.client.screen += mymob.healths //As are the rest of these.
mymob.client.screen += mymob.healthdoll
mymob.client.screen += mymob.internals
mymob.client.screen += mymob.nutrition_icon
mymob.client.screen += mymob.oxygen
mymob.client.screen += mymob.pressure
mymob.client.screen += mymob.toxin
mymob.client.screen += lingstingdisplay
mymob.client.screen += lingchemdisplay
hidden_inventory_update()
persistant_inventory_update()
mymob.update_action_buttons()
reorganize_alerts()
if(HUD_STYLE_REDUCED) //Reduced HUD
hud_shown = 0 //Governs behavior of other procs
if(adding)
@@ -265,6 +260,7 @@ datum/hud/New(mob/owner)
hidden_inventory_update()
persistant_inventory_update()
mymob.update_action_buttons()
reorganize_alerts()
if(HUD_STYLE_NOHUD) //No HUD
hud_shown = 0 //Governs behavior of other procs
if(adding)
@@ -278,21 +274,16 @@ datum/hud/New(mob/owner)
//These ones are not a part of 'adding', 'other' or 'hotkeybuttons' but we want them gone.
mymob.client.screen -= mymob.zone_sel //zone_sel is a mob variable for some reason.
mymob.client.screen -= mymob.bodytemp
mymob.client.screen -= mymob.fire
mymob.client.screen -= mymob.healths
mymob.client.screen -= mymob.healthdoll
mymob.client.screen -= mymob.internals
mymob.client.screen -= mymob.nutrition_icon
mymob.client.screen -= mymob.oxygen
mymob.client.screen -= mymob.pressure
mymob.client.screen -= mymob.toxin
mymob.client.screen -= lingstingdisplay
mymob.client.screen -= lingchemdisplay
hidden_inventory_update()
persistant_inventory_update()
mymob.update_action_buttons()
reorganize_alerts()
hud_version = display_hud_version
//Triggered when F12 is pressed (Unless someone changed something in the DMF)
+1 -30
View File
@@ -252,34 +252,10 @@
mymob.throw_icon.screen_loc = ui_drop_throw
hotkeybuttons += mymob.throw_icon
mymob.oxygen = new /obj/screen()
mymob.oxygen.icon_state = "oxy0"
mymob.oxygen.name = "oxygen"
mymob.oxygen.screen_loc = ui_oxygen
mymob.pressure = new /obj/screen()
mymob.pressure.icon_state = "pressure0"
mymob.pressure.name = "pressure"
mymob.pressure.screen_loc = ui_pressure
mymob.toxin = new /obj/screen()
mymob.toxin.icon_state = "tox0"
mymob.toxin.name = "toxin"
mymob.toxin.screen_loc = ui_toxin
mymob.internals = new /obj/screen/internals()
mymob.internals.screen_loc = ui_internal
mymob.fire = new /obj/screen()
mymob.fire.icon_state = "fire0"
mymob.fire.name = "fire"
mymob.fire.screen_loc = ui_fire
mymob.bodytemp = new /obj/screen()
mymob.bodytemp.icon_state = "temp1"
mymob.bodytemp.name = "body temperature"
mymob.bodytemp.screen_loc = ui_temp
mymob.healths = new /obj/screen()
mymob.healths.icon_state = "health0"
mymob.healths.name = "health"
@@ -289,11 +265,6 @@
mymob.healthdoll.name = "health doll"
mymob.healthdoll.screen_loc = ui_healthdoll
mymob.nutrition_icon = new /obj/screen()
mymob.nutrition_icon.icon_state = "nutrition0"
mymob.nutrition_icon.name = "nutrition"
mymob.nutrition_icon.screen_loc = ui_nutrition
mymob.pullin = new /obj/screen/pull()
mymob.pullin.icon = ui_style
mymob.pullin.icon_state = "pull0"
@@ -336,7 +307,7 @@
mymob.client.screen = null
mymob.client.screen += list( mymob.throw_icon, mymob.zone_sel, mymob.oxygen, mymob.pressure, mymob.toxin, mymob.bodytemp, mymob.internals, mymob.fire, mymob.healths, mymob.healthdoll, mymob.nutrition_icon, mymob.pullin, mymob.blind, mymob.flash, mymob.damageoverlay, lingchemdisplay, lingstingdisplay) //, mymob.hands, mymob.rest, mymob.sleep) //, mymob.mach )
mymob.client.screen += list( mymob.throw_icon, mymob.zone_sel, mymob.internals, mymob.healths, mymob.healthdoll, mymob.pullin, mymob.blind, mymob.flash, mymob.damageoverlay, lingchemdisplay, lingstingdisplay) //, mymob.hands, mymob.rest, mymob.sleep) //, mymob.mach )
mymob.client.screen += adding + hotkeybuttons
inventory_shown = 0;
+1 -26
View File
@@ -86,34 +86,9 @@
mymob.throw_icon.icon = ui_style
mymob.throw_icon.screen_loc = ui_drop_throw
mymob.oxygen = new /obj/screen()
mymob.oxygen.icon_state = "oxy0"
mymob.oxygen.name = "oxygen"
mymob.oxygen.screen_loc = ui_oxygen
mymob.pressure = new /obj/screen()
mymob.pressure.icon_state = "pressure0"
mymob.pressure.name = "pressure"
mymob.pressure.screen_loc = ui_pressure
mymob.toxin = new /obj/screen()
mymob.toxin.icon_state = "tox0"
mymob.toxin.name = "toxin"
mymob.toxin.screen_loc = ui_toxin
mymob.internals = new /obj/screen/internals()
mymob.internals.screen_loc = ui_internal
mymob.fire = new /obj/screen()
mymob.fire.icon_state = "fire0"
mymob.fire.name = "fire"
mymob.fire.screen_loc = ui_fire
mymob.bodytemp = new /obj/screen()
mymob.bodytemp.icon_state = "temp1"
mymob.bodytemp.name = "body temperature"
mymob.bodytemp.screen_loc = ui_temp
mymob.healths = new /obj/screen()
mymob.healths.icon_state = "health0"
mymob.healths.name = "health"
@@ -164,5 +139,5 @@
using.screen_loc = ui_pull_resist
adding += using
mymob.client.screen += list( mymob.throw_icon, mymob.zone_sel, mymob.oxygen, mymob.pressure, mymob.toxin, mymob.bodytemp, mymob.internals, mymob.fire, mymob.healths, mymob.pullin, mymob.blind, mymob.flash, lingchemdisplay, lingstingdisplay) //, mymob.hands, mymob.rest, mymob.sleep, mymob.mach )
mymob.client.screen += list( mymob.throw_icon, mymob.zone_sel, mymob.internals, mymob.healths, mymob.pullin, mymob.blind, mymob.flash, lingchemdisplay, lingstingdisplay) //, mymob.hands, mymob.rest, mymob.sleep, mymob.mach )
mymob.client.screen += adding + other
+1 -27
View File
@@ -110,13 +110,6 @@
adding += using
action_intent = using
//Cell
mymobR.cells = new /obj/screen()
mymobR.cells.icon = 'icons/mob/screen_cyborg.dmi'
mymobR.cells.icon_state = "charge-empty"
mymobR.cells.name = "cell"
mymobR.cells.screen_loc = ui_toxin
//Health
mymob.healths = new /obj/screen()
mymob.healths.icon = 'icons/mob/screen_cyborg.dmi'
@@ -132,25 +125,6 @@
mymob.throw_icon = new /obj/screen/robot/store()
mymob.throw_icon.screen_loc = ui_borg_store
//Temp
mymob.bodytemp = new /obj/screen()
mymob.bodytemp.icon_state = "temp0"
mymob.bodytemp.name = "body temperature"
mymob.bodytemp.screen_loc = ui_temp
mymob.oxygen = new /obj/screen()
mymob.oxygen.icon = 'icons/mob/screen_cyborg.dmi'
mymob.oxygen.icon_state = "oxy0"
mymob.oxygen.name = "oxygen"
mymob.oxygen.screen_loc = ui_oxygen
mymob.fire = new /obj/screen()
mymob.fire.icon = 'icons/mob/screen_cyborg.dmi'
mymob.fire.icon_state = "fire0"
mymob.fire.name = "fire"
mymob.fire.screen_loc = ui_fire
mymob.pullin = new /obj/screen/pull()
mymob.pullin.icon = 'icons/mob/screen_cyborg.dmi'
mymob.pullin.icon_state = "pull0"
@@ -176,7 +150,7 @@
mymob.client.screen = null
mymob.client.screen += list(mymob.zone_sel, mymob.oxygen, mymob.fire, mymob.hands, mymob.healths, mymobR.cells, mymob.pullin, mymob.blind, mymob.flash) //, mymob.rest, mymob.sleep, mymob.mach )
mymob.client.screen += list(mymob.zone_sel, mymob.hands, mymob.healths, mymob.pullin, mymob.blind, mymob.flash) //, mymob.rest, mymob.sleep, mymob.mach )
mymob.client.screen += adding + other
return
+2 -1
View File
@@ -823,7 +823,8 @@ var/list/sacrificed = list()
))
user << "<span class='danger'>The [cultist] is already free.</span>"
return
cultist.buckled = null
if(cultist.buckled)
cultist.buckled.unbuckle_mob()
if (cultist.handcuffed)
cultist.handcuffed.loc = cultist.loc
cultist.handcuffed = null
+2
View File
@@ -42,6 +42,7 @@
buckled_mob = M
M.update_canmove()
post_buckle_mob(M)
M.throw_alert("buckled", new_master = src)
return 1
/obj/proc/unbuckle_mob()
@@ -50,6 +51,7 @@
buckled_mob.buckled = null
buckled_mob.anchored = initial(buckled_mob.anchored)
buckled_mob.update_canmove()
buckled_mob.clear_alert("buckled")
buckled_mob = null
post_buckle_mob(.)
@@ -44,6 +44,7 @@
/obj/item/weapon/restraints/handcuffs/proc/apply_cuffs(mob/living/carbon/target, mob/user)
if(!target.handcuffed)
user.drop_item()
//target.throw_alert("handcuffed", src) // Can't do this because escaping cuffs isn't standardized. Also zipties.
if(trashtype)
target.handcuffed = new trashtype(target)
qdel(src)
@@ -16,8 +16,7 @@
if(ishuman(L) || ismonkey(L) || iscorgi(L))
if(L.buckled)
L.buckled = 0
L.anchored = 0
L.buckled.unbuckle_mob()
if(L.client)
L.client.perspective = EYE_PERSPECTIVE
L.client.eye = src
@@ -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.