mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-17 18:13:34 +01:00
Transit tube pressure fix
This commit is contained in:
@@ -61,18 +61,21 @@ var/list/karma_spenders = list()
|
||||
usr << "\red You can't award karma until the game has started."
|
||||
return
|
||||
|
||||
var/list/karma_list = list()
|
||||
var/list/karma_list = list("Cancel")
|
||||
for(var/mob/M in player_list) if(M.client && M.mind)
|
||||
var/special_role = M.mind.special_role
|
||||
if (special_role == "Wizard" || special_role == "Ninja" || special_role == "Syndicate" || special_role == "Syndicate Commando" || special_role == "Vox Raider" || special_role == "Alien") // Don't include special roles, because players use it to meta
|
||||
continue
|
||||
karma_list += M
|
||||
|
||||
if(!karma_list.len)
|
||||
if(!karma_list.len || karma_list.len == 1)
|
||||
usr << "\red There's no-one to spend your karma on."
|
||||
return
|
||||
|
||||
var/pickedmob = input("Who would you like to award Karma to?", "Award Karma", null) as mob in karma_list
|
||||
var/pickedmob = input("Who would you like to award Karma to?", "Award Karma", "Cancel") as null|mob in karma_list
|
||||
|
||||
if(isnull(pickedmob))
|
||||
return
|
||||
|
||||
if(!istype(pickedmob, /mob))
|
||||
usr << "\red That's not a mob."
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user