Updated auxmos to 1.0

This commit is contained in:
Putnam3145
2022-04-28 21:07:51 -07:00
parent 7e78b352a8
commit a7408beb4c
18 changed files with 231 additions and 62 deletions
+33 -4
View File
@@ -25,6 +25,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(GAS_O2, GAS_N2, GAS_CO2, GA
var/list/ids = list()
var/list/typepaths = list()
var/list/fusion_powers = list()
var/list/TLV = list()
var/list/breathing_classes = list()
var/list/breath_results = list()
var/list/breath_reagents = list()
@@ -39,13 +40,18 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(GAS_O2, GAS_N2, GAS_CO2, GA
var/list/supermatter = list()
var/list/groups_by_gas = list()
var/list/groups = list()
var/list/TLVs = list()
var/list/odors = list()
var/list/odor_strengths = list()
/datum/gas
var/id = ""
var/specific_heat = 0
var/name = ""
var/gas_overlay = "" //icon_state in icons/effects/atmospherics.dmi
var/color = "#ffff"
var/gas_overlay = "generic" //icon_state in icons/effects/atmospherics.dmi
var/color = "#ffff" // Tints the overlay by this color. Use instead of gas_overlay, usually (but not necessarily).
var/odor = null // Odor string. Null means none; if not null, anyone who breathes the gas will smell it.
var/odor_strength = INFINITY // How strong the odor is; minimal partial pressure to smell, so lower = more.
var/moles_visible = null
var/flags = NONE //currently used by canisters
var/group = null // groups for scrubber/filter listing
@@ -68,6 +74,12 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(GAS_O2, GAS_N2, GAS_CO2, GA
var/heat_resistance = 0 // makes the crystal more resistant against heat damage.
var/powerloss_inhibition = 0 // Reduces how much power the supermatter loses each tick
/datum/gas/proc/generate_TLV()
if(flags & GAS_FLAG_DANGEROUS)
return new/datum/tlv/dangerous
else
return new/datum/tlv(-1, -1, 1000, 1000)
/datum/gas/proc/breath(partial_pressure, light_threshold, heavy_threshold, moles, mob/living/carbon/C, obj/item/organ/lungs/lungs)
// This is only called on gases with the GAS_FLAG_BREATH_PROC flag. When possible, do NOT use this--
// greatly prefer just adding a reagent. This is mostly around for legacy reasons.
@@ -79,11 +91,14 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(GAS_O2, GAS_N2, GAS_CO2, GA
datums[g] = gas
specific_heats[g] = gas.specific_heat
names[g] = gas.name
TLVs[g] = gas.generate_TLV()
if(gas.moles_visible)
visibility[g] = gas.moles_visible
overlays[g] = new /list(FACTOR_GAS_VISIBLE_MAX)
for(var/i in 1 to FACTOR_GAS_VISIBLE_MAX)
overlays[g][i] = new /obj/effect/overlay/gas(gas.gas_overlay, i * 255 / FACTOR_GAS_VISIBLE_MAX)
var/obj/effect/overlay/gas/overlay = new(gas.gas_overlay, i * 255 / FACTOR_GAS_VISIBLE_MAX)
overlay.color = gas.color
overlays[g][i] = overlay
else
visibility[g] = 0
overlays[g] = 0
@@ -114,8 +129,11 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(GAS_O2, GAS_N2, GAS_CO2, GA
if(gas.group)
if(!(gas.group in groups))
groups[gas.group] = list()
groups[gas.group] += gas
groups[gas.group] += g
groups_by_gas[g] = gas.group
if(gas.odor)
odor_strengths[g] = gas.odor_strength
odors[g] = gas.odor
add_supermatter_properties(gas)
_auxtools_register_gas(gas)
if(done_initializing)
@@ -145,6 +163,17 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(GAS_O2, GAS_N2, GAS_CO2, GA
done_initializing = TRUE
finalize_gas_refs()
/datum/auxgm/proc/get_by_flag(flag)
var/static/list/gases_by_flag
if(!gases_by_flag)
gases_by_flag = list()
if(!(flag in gases_by_flag))
gases_by_flag += flag
gases_by_flag[flag] = list()
for(var/g in flags)
if(flags[g] & flag)
gases_by_flag[flag] += g
return gases_by_flag[flag]
GLOBAL_DATUM_INIT(gas_data, /datum/auxgm, new)
@@ -135,6 +135,7 @@ we use a hook instead
/datum/gas_mixture/proc/set_temperature(new_temp)
/datum/gas_mixture/proc/set_volume(new_volume)
/datum/gas_mixture/proc/get_moles(gas_type)
/datum/gas_mixture/proc/get_by_flag(flag)
/datum/gas_mixture/proc/set_moles(gas_type, moles)
// VV WRAPPERS - EXTOOLS HOOKED PROCS DO NOT TAKE ARGUMENTS FROM CALL() FOR SOME REASON.
@@ -152,13 +153,20 @@ we use a hook instead
/datum/gas_mixture/proc/scrub_into(datum/gas_mixture/target, ratio, list/gases)
/datum/gas_mixture/proc/mark_immutable()
/datum/gas_mixture/proc/get_gases()
/datum/gas_mixture/proc/add(amt)
/datum/gas_mixture/proc/subtract(amt)
/datum/gas_mixture/proc/multiply(factor)
/datum/gas_mixture/proc/divide(factor)
/datum/gas_mixture/proc/get_last_share()
/datum/gas_mixture/proc/clear()
/datum/gas_mixture/proc/adjust_moles(gas_type, amt = 0)
set_moles(gas_type, clamp(get_moles(gas_type) + amt,0,INFINITY))
/datum/gas_mixture/proc/adjust_moles_temp(gas_type, amt, temperature)
/datum/gas_mixture/proc/adjust_multi()
/datum/gas_mixture/proc/return_volume() //liters
/datum/gas_mixture/proc/thermal_energy() //joules
@@ -175,6 +183,10 @@ we use a hook instead
//Removes amount of gas from the gas_mixture
//Returns: gas_mixture with the gases removed
/datum/gas_mixture/proc/remove_by_flag(flag, amount)
//Removes amount of gas from the gas mixture by flag
//Returns: gas_mixture with gases that match the flag removed
/datum/gas_mixture/proc/transfer_to(datum/gas_mixture/target, amount)
//Transfers amount of gas to target. Equivalent to target.merge(remove(amount)) but faster.
@@ -235,6 +247,14 @@ we use a hook instead
//Makes every gas in the given list have the same pressure, temperature and gas proportions.
//Returns: null
/datum/gas_mixture/proc/__remove_by_flag()
/datum/gas_mixture/remove_by_flag(flag, amount)
var/datum/gas_mixture/removed = new type
__remove_by_flag(removed, flag, amount)
return removed
/datum/gas_mixture/proc/__remove()
/datum/gas_mixture/remove(amount)
var/datum/gas_mixture/removed = new type
@@ -117,7 +117,6 @@
id = "tritfire"
/datum/gas_reaction/tritfire/init_reqs()
exclude = world.system_type == MS_WINDOWS // temporary stopgap until generic fires work on linux
min_requirements = list(
"TEMP" = FIRE_MINIMUM_TEMPERATURE_TO_EXIST,
GAS_TRITIUM = MINIMUM_MOLE_COUNT,
@@ -199,7 +198,6 @@
id = "plasmafire"
/datum/gas_reaction/plasmafire/init_reqs()
exclude = world.system_type == MS_WINDOWS // temporary stopgap until generic fires work on linux
min_requirements = list(
"TEMP" = FIRE_MINIMUM_TEMPERATURE_TO_EXIST,
GAS_PLASMA = MINIMUM_MOLE_COUNT,