- Changed human breath processing to work like this:

- - If a breath is successful, meaning it had enough oxygen, another breath will be taken in 4 ticks. This is the same as it was before. (The presence of other gases will damage you, but it will not make the breath not count as a 'successful' one)
- - If a breath is not successful, you will not wait another 4 ticks for another breath! You will try to breathe again in the next tick. Every time a breath is deemed unsuccessful, it will cause damage to you. If there is no oxygen on the tile, it will cause 3 oxyloss damage to you, if there is some oxygen, but not enough, it will do a percentage of that. The amount of damage is the same as before, but it's dealt as 3 per tick instead of 12 per four ticks. The reason for this is to make the 'slowly passing out' effects more visible, as the overlay changes for every 5 points of oxy damage.
- - The healing effect of an area to oxyloss remains at 5 points per FOUR ticks, as it's only applied on successful breaths, which then don't try to breathe again for another 4 ticks.
- - You still pass out at 50 oxygen damage.
- The dark image overlay you have when blind or in critical condition now has mouse opacity set to 0, which means all mouse clicks pass through. If this causes any problems - let me know, it is however needed as it otherwise prevents any clicks. So while you could see a small circle around you, you wouldn't be able to interact with anything in it.

Video: http://youtu.be/fJAU8Tppxi0

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4281 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
baloh.matevz
2012-08-02 10:54:01 +00:00
parent 49f3db9954
commit d6ba1aef02
6 changed files with 44 additions and 9 deletions
+10 -4
View File
@@ -1,7 +1,5 @@
/obj/hud/proc/human_hud(var/ui_style='icons/mob/screen1_old.dmi')
//ui_style='icons/mob/screen1_old.dmi' //Overriding the parameter. Only this UI style is acceptable with the 'sleek' layout.
src.adding = list( )
src.other = list( )
src.vimpaired = list( )
@@ -554,9 +552,17 @@
mymob.blind.icon_state = "blackimageoverlay"
mymob.blind.name = " "
mymob.blind.screen_loc = "1,1"
mymob.blind.mouse_opacity = 0
mymob.blind.layer = 0
mymob.damageoverlay = new /obj/screen( null )
mymob.damageoverlay.icon = 'icons/mob/screen1_full.dmi'
mymob.damageoverlay.icon_state = "oxydamageoverlay0"
mymob.damageoverlay.name = "dmg"
mymob.damageoverlay.screen_loc = "1,1"
mymob.damageoverlay.mouse_opacity = 0
mymob.damageoverlay.layer = 17
mymob.flash = new /obj/screen( null )
mymob.flash.icon = ui_style
mymob.flash.icon_state = "blank"
@@ -680,7 +686,7 @@
mymob.client.screen = null
//, mymob.i_select, mymob.m_select
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.nutrition_icon, 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.oxygen, mymob.pressure, mymob.toxin, mymob.bodytemp, mymob.internals, mymob.fire, mymob.healths, mymob.nutrition_icon, mymob.pullin, mymob.blind, mymob.flash, mymob.damageoverlay) //, mymob.hands, mymob.rest, mymob.sleep) //, mymob.mach )
mymob.client.screen += src.adding + src.hotkeybuttons
inventory_shown = 0;
@@ -47,4 +47,6 @@
var/list/organs = list()
var/miming = null //Toggle for the mime's abilities.
var/miming = null //Toggle for the mime's abilities.
var/failed_last_breath = 0 //This is used to determine if the mob failed a breath. If they did fail a brath, they will attempt to breathe each tick, otherwise just once per 4 ticks.
+29 -3
View File
@@ -1,7 +1,8 @@
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:32
#define HUMAN_MAX_OXYLOSS 12 //Defines how much oxyloss humans can get per tick. No air applies this value.
#define HUMAN_CRIT_MAX_OXYLOSS ( (4 * last_tick_duration) /3) //The amount of damage you'll get when in critical condition. We want this to be a 5 minute deal = 300s. There are 100HP to get through, so (1/3)*last_tick_duration per second. Breaths however only happen every 4 ticks.
//NOTE: Breathing happens once per FOUR TICKS, unless the last breath fails. In which case it happens once per ONE TICK! So oxyloss healing is done once per 4 ticks while oxyloss damage is applied once per tick!
#define HUMAN_MAX_OXYLOSS 3 //Defines how much oxyloss humans can get per tick. A tile with no air at all (such as space) applies this value, otherwise it's a percentage of it.
#define HUMAN_CRIT_MAX_OXYLOSS ( (last_tick_duration) /3) //The amount of damage you'll get when in critical condition. We want this to be a 5 minute deal = 300s. There are 100HP to get through, so (1/3)*last_tick_duration per second. Breaths however only happen every 4 ticks.
/mob/living/carbon/human
var/oxygen_alert = 0
@@ -31,7 +32,7 @@
//No need to update all of these procs if the guy is dead.
if(stat != DEAD)
if(air_master.current_cycle%4==2) //First, resolve location and get a breath
if(air_master.current_cycle%4==2 || failed_last_breath) //First, resolve location and get a breath
spawn(0) breathe() //Only try to take a breath every 4 ticks, unless suffocating
else //Still give containing object the chance to interact
@@ -323,8 +324,10 @@
return
if(health > 0)
adjustOxyLoss(HUMAN_MAX_OXYLOSS)
failed_last_breath = 1
else
adjustOxyLoss(HUMAN_CRIT_MAX_OXYLOSS)
failed_last_breath = 1
oxygen_alert = max(oxygen_alert, 1)
@@ -353,9 +356,11 @@
if(O2_pp > 0)
var/ratio = safe_oxygen_min/O2_pp
adjustOxyLoss(min(5*ratio, HUMAN_MAX_OXYLOSS)) // Don't fuck them up too fast (space only does HUMAN_MAX_OXYLOSS after all!)
failed_last_breath = 1
oxygen_used = breath.oxygen*ratio/6
else
adjustOxyLoss(HUMAN_MAX_OXYLOSS)
failed_last_breath = 1
oxygen_alert = max(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")
@@ -364,6 +369,7 @@
oxygen_used = breath.oxygen*ratio/6
oxygen_alert = max(oxygen_alert, 1)*/
else // We're in safe limits
failed_last_breath = 0
adjustOxyLoss(-5)
oxygen_used = breath.oxygen/6
oxygen_alert = 0
@@ -371,6 +377,7 @@
breath.oxygen -= oxygen_used
breath.carbon_dioxide += oxygen_used
//CO2 does not affect failed_last_breath. So if there was enough oxygen in the air but too much co2, this will hurt you, but only once per 4 ticks, instead of once per tick.
if(CO2_pp > safe_co2_max)
if(!co2overloadtime) // If it's the first breath with too much CO2 in it, lets start a counter, then have them pass out after 12s or so.
co2overloadtime = world.time
@@ -803,6 +810,25 @@
update_action_buttons()
if(src.oxyloss)
switch(oxyloss)
if(0 to 10)
damageoverlay.icon_state = "oxydamageoverlay0"
if(10 to 20)
damageoverlay.icon_state = "oxydamageoverlay1"
if(20 to 25)
damageoverlay.icon_state = "oxydamageoverlay2"
if(25 to 30)
damageoverlay.icon_state = "oxydamageoverlay3"
if(30 to 35)
damageoverlay.icon_state = "oxydamageoverlay4"
if(35 to 40)
damageoverlay.icon_state = "oxydamageoverlay5"
if(40 to 45)
damageoverlay.icon_state = "oxydamageoverlay6"
if(45 to INFINITY)
damageoverlay.icon_state = "oxydamageoverlay7"
if( stat == DEAD )
sight |= (SEE_TURFS|SEE_MOBS|SEE_OBJS)
see_in_dark = 8
+1 -1
View File
@@ -21,4 +21,4 @@
var/last_special = 0 //Used by the resist verb, likely used to prevent players from bypassing next_move by logging in/out.
//Allows mobs to move through dense areas without restriction. For instance, in space or out of holder objects.
var/incorporeal_move = 0 //0 is off, 1 is normal, 2 is for ninjas.
var/incorporeal_move = 0 //0 is off, 1 is normal, 2 is for ninjas.
+1
View File
@@ -29,6 +29,7 @@
var/obj/screen/throw_icon = null
var/obj/screen/nutrition_icon = null
var/obj/screen/pressure = null
var/obj/screen/damageoverlay = null
var/total_luminosity = 0 //This controls luminosity for mobs, when you pick up lights and such this is edited. If you want the mob to use lights it must update its lum in its life proc or such. Note clamp this value around 7 or such to prevent massive light lag.
var/last_luminosity = 0