From c08e59fde715c60b66b64f330656bbee7101c487 Mon Sep 17 00:00:00 2001 From: MistakeNot4892 Date: Sat, 15 Oct 2022 01:16:33 +1100 Subject: [PATCH] Added getters/setters for species pressure bounds, made vox space immunity a toggle. --- .../mob/living/carbon/human/human_movement.dm | 5 +- code/modules/mob/living/carbon/human/life.dm | 42 ++++++------- .../carbon/human/species/outsider/vox.dm | 60 ++++++++++++++++++- .../carbon/human/species/species_getters.dm | 18 ++++++ .../human/species/station/prometheans.dm | 2 +- 5 files changed, 100 insertions(+), 27 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human_movement.dm b/code/modules/mob/living/carbon/human/human_movement.dm index aae07314d4..6f4cd20429 100644 --- a/code/modules/mob/living/carbon/human/human_movement.dm +++ b/code/modules/mob/living/carbon/human/human_movement.dm @@ -7,8 +7,7 @@ if (istype(loc, /turf/space)) return ..() - 1 - if(species.slowdown) - . += species.slowdown + . += species.get_slowdown(src) if(force_max_speed) return ..() + HUMAN_LOWEST_SLOWDOWN @@ -263,4 +262,4 @@ /mob/living/carbon/human/set_dir(var/new_dir) . = ..() if(. && species.tail) - update_tail_showing() \ No newline at end of file + update_tail_showing() diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index e415895d3e..ca173606fb 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -82,7 +82,7 @@ handle_shock() handle_pain() - + handle_allergens() handle_medical_side_effects() @@ -167,11 +167,12 @@ var/pressure_difference // First get the absolute pressure difference. - if(pressure < species.safe_pressure) // We are in an underpressure. - pressure_difference = species.safe_pressure - pressure + var/species_safe_pressure = species.get_safe_pressure(src) + if(pressure < species_safe_pressure) // We are in an underpressure. + pressure_difference = species_safe_pressure - pressure else //We are in an overpressure or standard atmosphere. - pressure_difference = pressure - species.safe_pressure + pressure_difference = pressure - species_safe_pressure if(pressure_difference < 5) // If the difference is small, don't bother calculating the fraction. pressure_difference = 0 @@ -184,10 +185,10 @@ // 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 < species.safe_pressure) - return species.safe_pressure - pressure_difference + if(pressure < species_safe_pressure) + return species_safe_pressure - pressure_difference else - return species.safe_pressure + pressure_difference + return species_safe_pressure + pressure_difference /mob/living/carbon/human/handle_disabilities() ..() @@ -565,7 +566,7 @@ else failed_last_breath = 0 adjustOxyLoss(-5) - + if(!does_not_breathe && client) // If we breathe, and have an active client, check if we have synthetic lungs. var/obj/item/organ/internal/lungs/L = internal_organs_by_name[O_LUNGS] var/turf = get_turf(src) @@ -588,7 +589,7 @@ to_chat(src, "You feel your face burning and a searing heat in your lungs!") if(breath.temperature >= species.heat_discomfort_level) - + if(breath.temperature >= species.breath_heat_level_3) apply_damage(HEAT_GAS_DAMAGE_LEVEL_3, BURN, BP_HEAD, used_weapon = "Excessive Heat") throw_alert("temp", /obj/screen/alert/hot, HOT_ALERT_SEVERITY_MAX) @@ -641,25 +642,25 @@ breath.update_values() return 1 - + /mob/living/carbon/human/proc/play_inhale(var/mob/living/M, var/exhale) var/suit_inhale_sound if(species.suit_inhale_sound) suit_inhale_sound = species.suit_inhale_sound else // Failsafe suit_inhale_sound = 'sound/effects/mob_effects/suit_breathe_in.ogg' - + playsound_local(get_turf(src), suit_inhale_sound, 100, pressure_affected = FALSE, volume_channel = VOLUME_CHANNEL_AMBIENCE) if(!exhale) // Did we fail exhale? If no, play it after inhale finishes. addtimer(CALLBACK(src, .proc/play_exhale, M), 5 SECONDS) - + /mob/living/carbon/human/proc/play_exhale(var/mob/living/M) var/suit_exhale_sound if(species.suit_exhale_sound) suit_exhale_sound = species.suit_exhale_sound else // Failsafe suit_exhale_sound = 'sound/effects/mob_effects/suit_breathe_out.ogg' - + playsound_local(get_turf(src), suit_exhale_sound, 100, pressure_affected = FALSE, volume_channel = VOLUME_CHANNEL_AMBIENCE) /mob/living/carbon/human/proc/handle_allergens() @@ -729,7 +730,7 @@ else loc_temp = environment.temperature - if(adjusted_pressure < species.warning_high_pressure && adjusted_pressure > species.warning_low_pressure && abs(loc_temp - bodytemperature) < 20 && bodytemperature < species.heat_level_1 && bodytemperature > species.cold_level_1) + if(adjusted_pressure < species.get_warning_high_pressure(src) && adjusted_pressure > species.get_warning_low_pressure(src) && abs(loc_temp - bodytemperature) < 20 && bodytemperature < species.heat_level_1 && bodytemperature > species.cold_level_1) clear_alert("pressure") return // Temperatures are within normal ranges, fuck all this processing. ~Ccomp @@ -798,15 +799,16 @@ if(status_flags & GODMODE) return 1 //godmode - if(adjusted_pressure >= species.hazard_high_pressure) - var/pressure_damage = min( ( (adjusted_pressure / species.hazard_high_pressure) -1 )*PRESSURE_DAMAGE_COEFFICIENT , MAX_HIGH_PRESSURE_DAMAGE) + var/species_hazard_high_pressure = species.get_hazard_high_pressure(src) + if(adjusted_pressure >= species_hazard_high_pressure) + var/pressure_damage = min( ( (adjusted_pressure / species_hazard_high_pressure) -1 )*PRESSURE_DAMAGE_COEFFICIENT , MAX_HIGH_PRESSURE_DAMAGE) take_overall_damage(brute=pressure_damage, used_weapon = "High Pressure") throw_alert("pressure", /obj/screen/alert/highpressure, 2) - else if(adjusted_pressure >= species.warning_high_pressure) + else if(adjusted_pressure >= species.get_warning_high_pressure(src)) throw_alert("pressure", /obj/screen/alert/highpressure, 1) - else if(adjusted_pressure >= species.warning_low_pressure) + else if(adjusted_pressure >= species.get_warning_low_pressure(src)) clear_alert("pressure") - else if(adjusted_pressure >= species.hazard_low_pressure) + else if(adjusted_pressure >= species.get_hazard_low_pressure(src)) throw_alert("pressure", /obj/screen/alert/lowpressure, 1) else if( !(COLD_RESISTANCE in mutations)) @@ -814,7 +816,7 @@ if(getOxyLoss() < 55) // 12 OxyLoss per 4 ticks when wearing internals; unconsciousness in 16 ticks, roughly half a minute var/pressure_dam = 3 // 16 OxyLoss per 4 ticks when no internals present; unconsciousness in 13 ticks, roughly twenty seconds // (Extra 1 oxyloss from failed breath) - // Being in higher pressure decreases the damage taken, down to a minimum of (species.hazard_low_pressure / ONE_ATMOSPHERE) at species.hazard_low_pressure + // Being in higher pressure decreases the damage taken, down to a minimum of (species.get_hazard_low_pressure(src) / ONE_ATMOSPHERE) at species.get_hazard_low_pressure(src) pressure_dam *= (ONE_ATMOSPHERE - adjusted_pressure) / ONE_ATMOSPHERE if(wear_suit && wear_suit.min_pressure_protection && head && head.min_pressure_protection) diff --git a/code/modules/mob/living/carbon/human/species/outsider/vox.dm b/code/modules/mob/living/carbon/human/species/outsider/vox.dm index 9166e3cd6a..c7e3f3ec53 100644 --- a/code/modules/mob/living/carbon/human/species/outsider/vox.dm +++ b/code/modules/mob/living/carbon/human/species/outsider/vox.dm @@ -14,6 +14,7 @@ /datum/unarmed_attack/claws/strong, /datum/unarmed_attack/bite/strong ) + rarity_value = 5 blurb = "The Vox are the broken remnants of a once-proud race, now reduced to little more than \ scavenging vermin who prey on isolated stations, ships or planets to keep their own ancient arkships \ @@ -40,9 +41,6 @@ male_sneeze_sound = 'sound/voice/shrieksneeze.ogg' female_sneeze_sound = 'sound/voice/shrieksneeze.ogg' - warning_low_pressure = 50 - hazard_low_pressure = 0 - cold_level_1 = 210 //Default 260 cold_level_2 = 150 //Default 200 cold_level_3 = 90 //Default 120 @@ -98,6 +96,8 @@ default_emotes = list( /decl/emote/audible/vox_shriek ) + inherent_verbs = list(/mob/living/carbon/human/proc/toggle_vox_pressure_seal) + var/list/current_pressure_toggle = list() /datum/species/vox/get_random_name(var/gender) var/datum/language/species_language = GLOB.all_languages[default_language] @@ -106,3 +106,57 @@ /datum/species/vox/equip_survival_gear(var/mob/living/carbon/human/H, var/extendedtank = 0,var/comprehensive = 0) . = ..() H.equip_to_slot_or_del(new /obj/item/clothing/mask/gas/vox(H), slot_wear_mask) + +/datum/species/vox/get_slowdown(var/mob/living/carbon/human/H) + if(current_pressure_toggle["\ref[H]"]) + return 1.5 + return ..() + +/datum/species/vox/get_warning_low_pressure(var/mob/living/carbon/human/H) + if(current_pressure_toggle["\ref[H]"]) + return 50 + return ..() + +/datum/species/vox/get_hazard_low_pressure(var/mob/living/carbon/human/H) + if(current_pressure_toggle["\ref[H]"]) + return 0 + return ..() + +/mob/living/carbon/human/proc/toggle_vox_pressure_seal() + set name = "Toggle Vox Pressure Seal" + set category = "Abilities" + set src = usr + + if(!istype(species, /datum/species/vox)) + verbs -= /mob/living/carbon/human/proc/toggle_vox_pressure_seal + return + + if(incapacitated(INCAPACITATION_KNOCKOUT)) + to_chat(src, SPAN_WARNING("You are in no state to do that.")) + return + + var/datum/gender/G = gender_datums[get_visible_gender()] + visible_message(SPAN_NOTICE("\The [src] begins flexing and realigning [G.his] scaling...")) + if(!do_after(src, 2 SECONDS, src, FALSE)) + visible_message( + SPAN_NOTICE("\The [src] ceases adjusting [G.his] scaling."), + self_message = SPAN_WARNING("You must remain still to seal or unseal your scaling.")) + return + + if(incapacitated(INCAPACITATION_KNOCKOUT)) + to_chat(src, SPAN_WARNING("You are in no state to do that.")) + return + + // TODO: maybe add cold and heat thresholds to this. + var/my_ref = "\ref[src]" + var/datum/species/vox/kikiki = species + if((kikiki.current_pressure_toggle[my_ref] = !kikiki.current_pressure_toggle[my_ref])) + visible_message( + SPAN_NOTICE("\The [src]'s scaling flattens and smooths out."), + self_message = SPAN_NOTICE("You flatten your scaling and inflate internal bladders, protecting yourself against low pressure at the cost of dexterity.") + ) + else + visible_message( + SPAN_NOTICE("\The [src]'s scaling bristles roughly."), + self_message = SPAN_NOTICE("You bristle your scaling and deflate your internal bladders, restoring mobility but leaving yourself vulnerable to low pressure.") + ) diff --git a/code/modules/mob/living/carbon/human/species/species_getters.dm b/code/modules/mob/living/carbon/human/species/species_getters.dm index 9053e66e0b..b288005f42 100644 --- a/code/modules/mob/living/carbon/human/species/species_getters.dm +++ b/code/modules/mob/living/carbon/human/species/species_getters.dm @@ -113,3 +113,21 @@ /datum/species/proc/get_vision_flags(var/mob/living/carbon/human/H) return vision_flags + +/datum/species/proc/get_hazard_high_pressure(var/mob/living/carbon/human/H) + return hazard_high_pressure + +/datum/species/proc/get_warning_high_pressure(var/mob/living/carbon/human/H) + return warning_high_pressure + +/datum/species/proc/get_warning_low_pressure(var/mob/living/carbon/human/H) + return warning_low_pressure + +/datum/species/proc/get_hazard_low_pressure(var/mob/living/carbon/human/H) + return hazard_low_pressure + +/datum/species/proc/get_safe_pressure(var/mob/living/carbon/human/H) + return safe_pressure + +/datum/species/proc/get_slowdown(var/mob/living/carbon/human/H) + return slowdown diff --git a/code/modules/mob/living/carbon/human/species/station/prometheans.dm b/code/modules/mob/living/carbon/human/species/station/prometheans.dm index 71657c63fd..a8d85a21b6 100644 --- a/code/modules/mob/living/carbon/human/species/station/prometheans.dm +++ b/code/modules/mob/living/carbon/human/species/station/prometheans.dm @@ -225,7 +225,7 @@ var/global/datum/species/shapeshifter/promethean/prometheans var/datum/gas_mixture/environment = T.return_air() var/pressure = environment.return_pressure() var/affecting_pressure = H.calculate_affecting_pressure(pressure) - if(affecting_pressure <= hazard_low_pressure) // Dangerous low pressure stops the regeneration of physical wounds. Body is focusing on keeping them intact rather than sealing. + if(affecting_pressure <= get_hazard_low_pressure(H)) // Dangerous low pressure stops the regeneration of physical wounds. Body is focusing on keeping them intact rather than sealing. regen_brute = FALSE regen_burn = FALSE