A preliminary implementation of chem gases

This commit is contained in:
Putnam3145
2021-06-27 07:58:35 -07:00
parent d2dc56123d
commit b213aaec2e
14 changed files with 165 additions and 20 deletions
+55 -2
View File
@@ -54,6 +54,9 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent())
var/chemical_flags // See fermi/readme.dm REAGENT_DEAD_PROCESS, REAGENT_DONOTSPLIT, REAGENT_ONLYINVERSE, REAGENT_ONMOBMERGE, REAGENT_INVISIBLE, REAGENT_FORCEONNEW, REAGENT_SNEAKYNAME
var/value = REAGENT_VALUE_NONE //How much does it sell for in cargo?
var/datum/material/material //are we made of material?
var/gas //do we have an associated gas?
var/boiling_point = null // point at which this gas boils; if null, will never boil (and thus not become a gas)
var/condensation_amount = 1
/datum/reagent/New()
. = ..()
@@ -80,8 +83,18 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent())
/datum/reagent/proc/reaction_obj(obj/O, volume)
return
/datum/reagent/proc/reaction_turf(turf/T, volume)
return
/datum/reagent/proc/reaction_turf(turf/T, volume, show_message, from_gas)
if(!from_gas && boiling_point)
var/temp = holder?.chem_temp
if(!temp)
if(isopenturf(T))
var/turf/open/O = T
var/datum/gas_mixture/air = O.return_air()
temp = air.return_temperature()
else
temp = T20C
if(temp > boiling_point)
T.atmos_spawn_air("[get_gas()]=[volume/2];TEMP=[temp]")
/datum/reagent/proc/on_mob_life(mob/living/carbon/M)
current_cycle++
@@ -231,6 +244,46 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent())
return rs.Join(" | ")
/datum/reagent/proc/define_gas()
if(reagent_state == SOLID)
return null // doesn't make that much sense
var/list/cached_reactions = GLOB.chemical_reactions_list
for(var/reaction in cached_reactions[src.type])
var/datum/chemical_reaction/C = reaction
if(!istype(C))
continue
if(C.required_reagents.len < 2) // no reagents that react on their own
return null
var/datum/gas/G = new
G.id = "[src.type]"
G.name = name
G.specific_heat = specific_heat / 10
G.color = color
G.breath_reagent = src.type
G.turf_reagent = src.type
return G
/datum/reagent/proc/create_gas()
var/datum/gas/G = define_gas()
if(istype(G)) // if this reagent should never be a gas, define_gas may return null
GLOB.gas_data.add_gas(G)
/datum/reagent/proc/get_gas()
if(gas)
return gas
else
var/datum/auxgm/cached_gas_data = GLOB.gas_data
. = "[src.type]"
if(!(. in cached_gas_data.ids))
var/datum/gas/G = define_gas()
if(istype(G))
cached_gas_data.add_gas(G)
else // this codepath should probably not happen at all, since we never use get_gas() on anything with no boiling point
return null
//For easy bloodsucker disgusting and blood removal
/datum/reagent/proc/disgust_bloodsucker(mob/living/carbon/C, disgust, blood_change, blood_puke = TRUE, force)
if(AmBloodsucker(C))