Transit tube pressure fix

This commit is contained in:
Markolie
2014-12-22 20:31:03 +01:00
parent 728e837be9
commit c8db120dce
3 changed files with 47 additions and 13 deletions
+40 -5
View File
@@ -182,16 +182,51 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc
return 1 - pressure_adjustment_coefficient //want 0 to be bad protection, 1 to be good protection
// Calculate how vulnerable the human is to under- and overpressure.
// Returns 0 (equals 0 %) if sealed in an undamaged suit, 1 if unprotected (equals 100%).
// Suitdamage can modifiy this in 10% steps.
/mob/living/carbon/human/proc/get_pressure_weakness()
var/pressure_adjustment_coefficient = 1 // Assume no protection at first.
if(wear_suit && (wear_suit.flags & STOPSPRESSUREDMAGE) && head && (head.flags & STOPSPRESSUREDMAGE)) // Complete set of pressure-proof suit worn, assume fully sealed.
pressure_adjustment_coefficient = 0
// Handles breaches in your space suit. 10 suit damage equals a 100% loss of pressure protection.
if(istype(wear_suit,/obj/item/clothing/suit/space))
var/obj/item/clothing/suit/space/S = wear_suit
if(S.can_breach && S.damage)
pressure_adjustment_coefficient += S.damage * 0.1
pressure_adjustment_coefficient = min(1,max(pressure_adjustment_coefficient,0)) // So it isn't less than 0 or larger than 1.
return pressure_adjustment_coefficient
/mob/living/carbon/human/calculate_affecting_pressure(var/pressure)
..()
var/pressure_difference = abs( pressure - ONE_ATMOSPHERE )
var/pressure_difference
pressure_difference = pressure_difference * (1 - get_pressure_protection())
// First get the absolute pressure difference.
if(pressure < ONE_ATMOSPHERE) // We are in an underpressure.
pressure_difference = ONE_ATMOSPHERE - pressure
else //We are in an overpressure or standard atmosphere.
pressure_difference = pressure - ONE_ATMOSPHERE
if(pressure_difference < 5) // If the difference is small, don't bother calculating the fraction.
pressure_difference = 0
if(pressure > ONE_ATMOSPHERE)
return ONE_ATMOSPHERE + pressure_difference
else
// Otherwise calculate how much of that absolute pressure difference affects us, can be 0 to 1 (equals 0% to 100%).
// This is our relative difference.
pressure_difference *= get_pressure_weakness()
// The difference is always positive to avoid extra calculations.
// Apply the relative difference on a standard atmosphere to get the final result.
// The return value will be the adjusted_pressure of the human that is the basis of pressure warnings and damage.
if(pressure < ONE_ATMOSPHERE)
return ONE_ATMOSPHERE - pressure_difference
else
return ONE_ATMOSPHERE + pressure_difference
/mob/living/carbon/human