auxgm part 1
see also https://github.com/Baystation12/Baystation12/blob/dev/code/modules/xgm/xgm_gas_data.dm
This commit is contained in:
@@ -47,29 +47,29 @@
|
||||
if(!loaded_tank)
|
||||
return
|
||||
if(!bitcoinmining)
|
||||
if(loaded_tank.air_contents.get_moles(/datum/gas/plasma) < 0.0001)
|
||||
if(loaded_tank.air_contents.get_moles(GAS_PLASMA) < 0.0001)
|
||||
investigate_log("<font color='red'>out of fuel</font>.", INVESTIGATE_SINGULO)
|
||||
playsound(src, 'sound/machines/ding.ogg', 50, 1)
|
||||
Radio.talk_into(src, "Insufficient plasma in [get_area(src)] [src], ejecting \the [loaded_tank].", FREQ_ENGINEERING)
|
||||
eject()
|
||||
else
|
||||
var/gasdrained = min(powerproduction_drain*drainratio,loaded_tank.air_contents.get_moles(/datum/gas/plasma))
|
||||
loaded_tank.air_contents.adjust_moles(/datum/gas/plasma, -gasdrained)
|
||||
loaded_tank.air_contents.adjust_moles(/datum/gas/tritium, gasdrained)
|
||||
var/gasdrained = min(powerproduction_drain*drainratio,loaded_tank.air_contents.get_moles(GAS_PLASMA))
|
||||
loaded_tank.air_contents.adjust_moles(GAS_PLASMA, -gasdrained)
|
||||
loaded_tank.air_contents.adjust_moles(GAS_TRITIUM, gasdrained)
|
||||
|
||||
var/power_produced = RAD_COLLECTOR_OUTPUT
|
||||
add_avail(power_produced)
|
||||
stored_power-=power_produced
|
||||
else if(is_station_level(z) && SSresearch.science_tech)
|
||||
if(!loaded_tank.air_contents.get_moles(/datum/gas/tritium) || !loaded_tank.air_contents.get_moles(/datum/gas/oxygen))
|
||||
if(!loaded_tank.air_contents.get_moles(GAS_TRITIUM) || !loaded_tank.air_contents.get_moles(GAS_O2))
|
||||
playsound(src, 'sound/machines/ding.ogg', 50, 1)
|
||||
Radio.talk_into(src, "Insufficient oxygen and tritium in [get_area(src)] [src] to produce research points, ejecting \the [loaded_tank].", FREQ_ENGINEERING)
|
||||
eject()
|
||||
else
|
||||
var/gasdrained = bitcoinproduction_drain*drainratio
|
||||
loaded_tank.air_contents.adjust_moles(/datum/gas/tritium, -gasdrained)
|
||||
loaded_tank.air_contents.adjust_moles(/datum/gas/oxygen, -gasdrained)
|
||||
loaded_tank.air_contents.adjust_moles(/datum/gas/carbon_dioxide, gasdrained*2)
|
||||
loaded_tank.air_contents.adjust_moles(GAS_TRITIUM, -gasdrained)
|
||||
loaded_tank.air_contents.adjust_moles(GAS_O2, -gasdrained)
|
||||
loaded_tank.air_contents.adjust_moles(GAS_CO2, gasdrained*2)
|
||||
var/bitcoins_mined = stored_power*RAD_COLLECTOR_MINING_CONVERSION_RATE
|
||||
var/datum/bank_account/D = SSeconomy.get_dep_account(ACCOUNT_ENG)
|
||||
if(D)
|
||||
@@ -84,7 +84,7 @@
|
||||
toggle_power()
|
||||
user.visible_message("[user.name] turns the [src.name] [active? "on":"off"].", \
|
||||
"<span class='notice'>You turn the [src.name] [active? "on":"off"].</span>")
|
||||
var/fuel = loaded_tank.air_contents.get_moles(/datum/gas/plasma)
|
||||
var/fuel = loaded_tank.air_contents.get_moles(GAS_PLASMA)
|
||||
investigate_log("turned [active?"<font color='green'>on</font>":"<font color='red'>off</font>"] by [key_name(user)]. [loaded_tank?"Fuel: [round(fuel/0.29)]%":"<font color='red'>It is empty</font>"].", INVESTIGATE_SINGULO)
|
||||
return
|
||||
else
|
||||
|
||||
@@ -150,71 +150,71 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
var/gas_change_rate = 0.05
|
||||
///The list of gases we will be interacting with in process_atoms()
|
||||
var/list/gases_we_care_about = list(
|
||||
/datum/gas/oxygen,
|
||||
/datum/gas/water_vapor,
|
||||
/datum/gas/plasma,
|
||||
/datum/gas/carbon_dioxide,
|
||||
/datum/gas/nitrous_oxide,
|
||||
/datum/gas/nitrogen,
|
||||
/datum/gas/pluoxium,
|
||||
/datum/gas/tritium,
|
||||
/datum/gas/bz,
|
||||
GAS_O2,
|
||||
GAS_H2O,
|
||||
GAS_PLASMA,
|
||||
GAS_CO2,
|
||||
GAS_NITROUS,
|
||||
GAS_N2,
|
||||
GAS_PLUOXIUM,
|
||||
GAS_TRITIUM,
|
||||
GAS_BZ,
|
||||
// /datum/gas/freon,
|
||||
// /datum/gas/hydrogen,
|
||||
)
|
||||
///The list of gases mapped against their current comp. We use this to calculate different values the supermatter uses, like power or heat resistance. It doesn't perfectly match the air around the sm, instead moving up at a rate determined by gas_change_rate per call. Ranges from 0 to 1
|
||||
var/list/gas_comp = list(
|
||||
/datum/gas/oxygen = 0,
|
||||
/datum/gas/water_vapor = 0,
|
||||
/datum/gas/plasma = 0,
|
||||
/datum/gas/carbon_dioxide = 0,
|
||||
/datum/gas/nitrous_oxide = 0,
|
||||
/datum/gas/nitrogen = 0,
|
||||
/datum/gas/pluoxium = 0,
|
||||
/datum/gas/tritium = 0,
|
||||
/datum/gas/bz = 0,
|
||||
GAS_O2 = 0,
|
||||
GAS_H2O = 0,
|
||||
GAS_PLASMA = 0,
|
||||
GAS_CO2 = 0,
|
||||
GAS_NITROUS = 0,
|
||||
GAS_N2 = 0,
|
||||
GAS_PLUOXIUM = 0,
|
||||
GAS_TRITIUM = 0,
|
||||
GAS_BZ = 0,
|
||||
// /datum/gas/freon = 0,
|
||||
// /datum/gas/hydrogen = 0,
|
||||
)
|
||||
///The list of gases mapped against their transmit values. We use it to determine the effect different gases have on radiation
|
||||
var/list/gas_trans = list(
|
||||
/datum/gas/oxygen = OXYGEN_TRANSMIT_MODIFIER,
|
||||
/datum/gas/water_vapor = H2O_TRANSMIT_MODIFIER,
|
||||
/datum/gas/plasma = PLASMA_TRANSMIT_MODIFIER,
|
||||
/datum/gas/pluoxium = PLUOXIUM_TRANSMIT_MODIFIER,
|
||||
/datum/gas/tritium = TRITIUM_TRANSMIT_MODIFIER,
|
||||
/datum/gas/bz = BZ_TRANSMIT_MODIFIER,
|
||||
GAS_O2 = OXYGEN_TRANSMIT_MODIFIER,
|
||||
GAS_H2O = H2O_TRANSMIT_MODIFIER,
|
||||
GAS_PLASMA = PLASMA_TRANSMIT_MODIFIER,
|
||||
GAS_PLUOXIUM = PLUOXIUM_TRANSMIT_MODIFIER,
|
||||
GAS_TRITIUM = TRITIUM_TRANSMIT_MODIFIER,
|
||||
GAS_BZ = BZ_TRANSMIT_MODIFIER,
|
||||
// /datum/gas/hydrogen = HYDROGEN_TRANSMIT_MODIFIER,
|
||||
)
|
||||
///The list of gases mapped against their heat penaltys. We use it to determin molar and heat output
|
||||
var/list/gas_heat = list(
|
||||
/datum/gas/oxygen = OXYGEN_HEAT_PENALTY,
|
||||
/datum/gas/water_vapor = H2O_HEAT_PENALTY,
|
||||
/datum/gas/plasma = PLASMA_HEAT_PENALTY,
|
||||
/datum/gas/carbon_dioxide = CO2_HEAT_PENALTY,
|
||||
/datum/gas/nitrogen = NITROGEN_HEAT_PENALTY,
|
||||
/datum/gas/pluoxium = PLUOXIUM_HEAT_PENALTY,
|
||||
/datum/gas/tritium = TRITIUM_HEAT_PENALTY,
|
||||
/datum/gas/bz = BZ_HEAT_PENALTY,
|
||||
GAS_O2 = OXYGEN_HEAT_PENALTY,
|
||||
GAS_H2O = H2O_HEAT_PENALTY,
|
||||
GAS_PLASMA = PLASMA_HEAT_PENALTY,
|
||||
GAS_CO2 = CO2_HEAT_PENALTY,
|
||||
GAS_N2 = NITROGEN_HEAT_PENALTY,
|
||||
GAS_PLUOXIUM = PLUOXIUM_HEAT_PENALTY,
|
||||
GAS_TRITIUM = TRITIUM_HEAT_PENALTY,
|
||||
GAS_BZ = BZ_HEAT_PENALTY,
|
||||
// /datum/gas/freon = FREON_HEAT_PENALTY,
|
||||
// /datum/gas/hydrogen = HYDROGEN_HEAT_PENALTY,
|
||||
)
|
||||
///The list of gases mapped against their heat resistance. We use it to moderate heat damage.
|
||||
var/list/gas_resist = list(
|
||||
/datum/gas/nitrous_oxide = N2O_HEAT_RESISTANCE,
|
||||
/datum/gas/pluoxium = PLUOXIUM_HEAT_RESISTANCE,
|
||||
GAS_NITROUS = N2O_HEAT_RESISTANCE,
|
||||
GAS_PLUOXIUM = PLUOXIUM_HEAT_RESISTANCE,
|
||||
// /datum/gas/hydrogen = HYDROGEN_HEAT_RESISTANCE,
|
||||
)
|
||||
///The list of gases mapped against their powermix ratio
|
||||
var/list/gas_powermix = list(
|
||||
/datum/gas/oxygen = 1,
|
||||
/datum/gas/water_vapor = 1,
|
||||
/datum/gas/plasma = 1,
|
||||
/datum/gas/carbon_dioxide = 1,
|
||||
/datum/gas/nitrogen = -1,
|
||||
/datum/gas/pluoxium = -1,
|
||||
/datum/gas/tritium = 1,
|
||||
/datum/gas/bz = 1,
|
||||
GAS_O2 = 1,
|
||||
GAS_H2O = 1,
|
||||
GAS_PLASMA = 1,
|
||||
GAS_CO2 = 1,
|
||||
GAS_N2 = -1,
|
||||
GAS_PLUOXIUM = -1,
|
||||
GAS_TRITIUM = 1,
|
||||
GAS_BZ = 1,
|
||||
// /datum/gas/freon = -1,
|
||||
// /datum/gas/hydrogen = 1,
|
||||
)
|
||||
@@ -538,13 +538,13 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
var/list/resistance_mod = gases_we_care_about.Copy()
|
||||
|
||||
//We're concerned about pluoxium being too easy to abuse at low percents, so we make sure there's a substantial amount.
|
||||
var/pluoxiumbonus = (gas_comp[/datum/gas/pluoxium] >= 0.15) //makes pluoxium only work at 15%+
|
||||
var/h2obonus = 1 - (gas_comp[/datum/gas/water_vapor] * 0.25)//At max this value should be 0.75
|
||||
var/pluoxiumbonus = (gas_comp[GAS_PLUOXIUM] >= 0.15) //makes pluoxium only work at 15%+
|
||||
var/h2obonus = 1 - (gas_comp[GAS_H2O] * 0.25)//At max this value should be 0.75
|
||||
// var/freonbonus = (gas_comp[/datum/gas/freon] <= 0.03) //Let's just yeet power output if this shit is high
|
||||
|
||||
heat_mod[/datum/gas/pluoxium] = pluoxiumbonus
|
||||
transit_mod[/datum/gas/pluoxium] = pluoxiumbonus
|
||||
resistance_mod[/datum/gas/pluoxium] = pluoxiumbonus
|
||||
heat_mod[GAS_PLUOXIUM] = pluoxiumbonus
|
||||
transit_mod[GAS_PLUOXIUM] = pluoxiumbonus
|
||||
resistance_mod[GAS_PLUOXIUM] = pluoxiumbonus
|
||||
|
||||
//No less then zero, and no greater then one, we use this to do explosions and heat to power transfer
|
||||
//Be very careful with modifing this var by large amounts, and for the love of god do not push it past 1
|
||||
@@ -578,8 +578,8 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
//Ramps up or down in increments of 0.02 up to the proportion of co2
|
||||
//Given infinite time, powerloss_dynamic_scaling = co2comp
|
||||
//Some value between 0 and 1
|
||||
if (combined_gas > POWERLOSS_INHIBITION_MOLE_THRESHOLD && gas_comp[/datum/gas/carbon_dioxide] > POWERLOSS_INHIBITION_GAS_THRESHOLD) //If there are more then 20 mols, and more then 20% co2
|
||||
powerloss_dynamic_scaling = clamp(powerloss_dynamic_scaling + clamp(gas_comp[/datum/gas/carbon_dioxide] - powerloss_dynamic_scaling, -0.02, 0.02), 0, 1)
|
||||
if (combined_gas > POWERLOSS_INHIBITION_MOLE_THRESHOLD && gas_comp[GAS_CO2] > POWERLOSS_INHIBITION_GAS_THRESHOLD) //If there are more then 20 mols, and more then 20% co2
|
||||
powerloss_dynamic_scaling = clamp(powerloss_dynamic_scaling + clamp(gas_comp[GAS_CO2] - powerloss_dynamic_scaling, -0.02, 0.02), 0, 1)
|
||||
else
|
||||
powerloss_dynamic_scaling = clamp(powerloss_dynamic_scaling - 0.05, 0, 1)
|
||||
//Ranges from 0 to 1(1-(value between 0 and 1 * ranges from 1 to 1.5(mol / 500)))
|
||||
@@ -611,8 +611,8 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
|
||||
if(prob(50))
|
||||
//(1 + (tritRad + pluoxDampen * bzDampen * o2Rad * plasmaRad / (10 - bzrads))) * freonbonus
|
||||
radiation_pulse(src, power * max(0, (1 + (power_transmission_bonus/(10-(gas_comp[/datum/gas/bz] * BZ_RADIOACTIVITY_MODIFIER)))) * 1))//freonbonus))// RadModBZ(500%)
|
||||
if(gas_comp[/datum/gas/bz] >= 0.4 && prob(30 * gas_comp[/datum/gas/bz]))
|
||||
radiation_pulse(src, power * max(0, (1 + (power_transmission_bonus/(10-(gas_comp[GAS_BZ] * BZ_RADIOACTIVITY_MODIFIER)))) * 1))//freonbonus))// RadModBZ(500%)
|
||||
if(gas_comp[GAS_BZ] >= 0.4 && prob(30 * gas_comp[GAS_BZ]))
|
||||
src.fire_nuclear_particle() // Start to emit radballs at a maximum of 30% chance per tick
|
||||
|
||||
//Power * 0.55 * a value between 1 and 0.8
|
||||
@@ -632,9 +632,9 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
|
||||
//Calculate how much gas to release
|
||||
//Varies based on power and gas content
|
||||
removed.adjust_moles(/datum/gas/plasma, max((device_energy * dynamic_heat_modifier) / PLASMA_RELEASE_MODIFIER, 0))
|
||||
removed.adjust_moles(GAS_PLASMA, max((device_energy * dynamic_heat_modifier) / PLASMA_RELEASE_MODIFIER, 0))
|
||||
//Varies based on power, gas content, and heat
|
||||
removed.adjust_moles(/datum/gas/oxygen, max(((device_energy + removed.return_temperature() * dynamic_heat_modifier) - T0C) / OXYGEN_RELEASE_MODIFIER, 0))
|
||||
removed.adjust_moles(GAS_O2, max(((device_energy + removed.return_temperature() * dynamic_heat_modifier) - T0C) / OXYGEN_RELEASE_MODIFIER, 0))
|
||||
|
||||
if(produces_gas)
|
||||
env.merge(removed)
|
||||
|
||||
Reference in New Issue
Block a user