mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-31 20:11:56 +00:00
## About The Pull Request Fixes #76661 Also adds new PLUOXIUM_PROPORTION define, this is set to 8 which is currently how better pluoxium is at metabolism compared to oxygen ## Why It's Good For The Game Since pluoxium is 8 times as effective as oxygen, mobs only need 0.625 mol of it compared to 5 mol of oxygen. This is a very small amount, maybe it should just be the same as oxygen? Also pluoxium and oxygen are counted together, so you could have a mix of 0.5 mol of pluoxium and 1 mol of oxygen for example. ## Changelog 🆑 fix:Mobs can breathe pluoxium /🆑 Define not player-facing
76 lines
3.1 KiB
Plaintext
76 lines
3.1 KiB
Plaintext
/**
|
|
* ## atmos requirements element!
|
|
*
|
|
* bespoke element that deals damage to the attached mob when the atmos requirements aren't satisfied
|
|
*/
|
|
/datum/element/atmos_requirements
|
|
element_flags = ELEMENT_BESPOKE
|
|
argument_hash_start_idx = 2
|
|
/// An assoc list of "what atmos does this mob require to survive in".
|
|
var/list/atmos_requirements
|
|
/// How much (brute) damage we take from being in unsuitable atmos.
|
|
var/unsuitable_atmos_damage
|
|
|
|
/datum/element/atmos_requirements/Attach(datum/target, list/atmos_requirements, unsuitable_atmos_damage = 5)
|
|
. = ..()
|
|
if(!isliving(target))
|
|
return ELEMENT_INCOMPATIBLE
|
|
if(!atmos_requirements)
|
|
stack_trace("[type] added to [target] without any requirements specified.")
|
|
src.atmos_requirements = atmos_requirements
|
|
src.unsuitable_atmos_damage = unsuitable_atmos_damage
|
|
RegisterSignal(target, COMSIG_LIVING_HANDLE_BREATHING, PROC_REF(on_non_stasis_life))
|
|
|
|
/datum/element/atmos_requirements/Detach(datum/target)
|
|
. = ..()
|
|
UnregisterSignal(target, COMSIG_LIVING_HANDLE_BREATHING)
|
|
|
|
///signal called by the living mob's life() while non stasis
|
|
/datum/element/atmos_requirements/proc/on_non_stasis_life(mob/living/target, seconds_per_tick = SSMOBS_DT)
|
|
SIGNAL_HANDLER
|
|
if(is_breathable_atmos(target))
|
|
target.clear_alert(ALERT_NOT_ENOUGH_OXYGEN)
|
|
return
|
|
target.adjustBruteLoss(unsuitable_atmos_damage * seconds_per_tick)
|
|
target.throw_alert(ALERT_NOT_ENOUGH_OXYGEN, /atom/movable/screen/alert/not_enough_oxy)
|
|
|
|
/datum/element/atmos_requirements/proc/is_breathable_atmos(mob/living/target)
|
|
if(target.pulledby && target.pulledby.grab_state >= GRAB_KILL && atmos_requirements["min_oxy"])
|
|
return FALSE
|
|
|
|
if(!isopenturf(target.loc))
|
|
return TRUE
|
|
|
|
var/turf/open/open_turf = target.loc
|
|
if(!open_turf.air && (atmos_requirements["min_oxy"] || atmos_requirements["min_tox"] || atmos_requirements["min_n2"] || atmos_requirements["min_co2"]))
|
|
return FALSE
|
|
|
|
var/open_turf_gases = open_turf.air.gases
|
|
open_turf.air.assert_gases(/datum/gas/oxygen, /datum/gas/pluoxium, /datum/gas/nitrogen, /datum/gas/carbon_dioxide, /datum/gas/plasma)
|
|
|
|
var/plas = open_turf_gases[/datum/gas/plasma][MOLES]
|
|
var/oxy = open_turf_gases[/datum/gas/oxygen][MOLES] + (open_turf_gases[/datum/gas/pluoxium][MOLES] * PLUOXIUM_PROPORTION)
|
|
var/n2 = open_turf_gases[/datum/gas/nitrogen][MOLES]
|
|
var/co2 = open_turf_gases[/datum/gas/carbon_dioxide][MOLES]
|
|
|
|
open_turf.air.garbage_collect()
|
|
|
|
if(atmos_requirements["min_oxy"] && oxy < atmos_requirements["min_oxy"])
|
|
return FALSE
|
|
else if(atmos_requirements["max_oxy"] && oxy > atmos_requirements["max_oxy"])
|
|
return FALSE
|
|
else if(atmos_requirements["min_plas"] && plas < atmos_requirements["min_plas"])
|
|
return FALSE
|
|
else if(atmos_requirements["max_plas"] && plas > atmos_requirements["max_plas"])
|
|
return FALSE
|
|
else if(atmos_requirements["min_n2"] && n2 < atmos_requirements["min_n2"])
|
|
return FALSE
|
|
else if(atmos_requirements["max_n2"] && n2 > atmos_requirements["max_n2"])
|
|
return FALSE
|
|
else if(atmos_requirements["min_co2"] && co2 < atmos_requirements["min_co2"])
|
|
return FALSE
|
|
else if(atmos_requirements["max_co2"] && co2 > atmos_requirements["max_co2"])
|
|
return FALSE
|
|
|
|
return TRUE
|