Skip to content

Commit

Permalink
Crystallizer balance and qol (tgstation#57423)
Browse files Browse the repository at this point in the history
Balance the recipes of the crystallizer to have higher energy release
Some recipes had the recipe cost tweaked for a more balanced experience (TM)
Better cooling and temperature control on the crystallizer
  • Loading branch information
Ghilker authored Mar 14, 2021
1 parent 147131c commit 03a9282
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 32 deletions.
4 changes: 2 additions & 2 deletions code/game/objects/items/grenades/atmos_grenades.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
///Range of the grenade that will cool down and affect mobs
var/freeze_range = 4
///Amount of gas released if the state is optimal
var/gas_amount = 70
var/gas_amount = 200

/obj/item/grenade/gas_crystal/healium_crystal/detonate(mob/living/lanced_by)
. = ..()
Expand Down Expand Up @@ -61,7 +61,7 @@
///Range of the grenade air refilling
var/refill_range = 5
///Amount of Nitrogen gas released (close to the grenade)
var/n2_gas_amount = 60
var/n2_gas_amount = 80
///Amount of Oxygen gas released (close to the grenade)
var/o2_gas_amount = 30

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ GLOBAL_LIST_INIT(gas_recipe_meta, gas_recipes_list())
min_temp = 50000
max_temp = 150000
reaction_type = ENDOTHERMIC_REACTION
energy_release = 250000
requirements = list(/datum/gas/hydrogen = 60, /datum/gas/bz = 20)
energy_release = 2500000
requirements = list(/datum/gas/hydrogen = 300, /datum/gas/bz = 50)
products = list(/obj/item/stack/sheet/mineral/metal_hydrogen = 1)

/datum/gas_recipe/crystallizer/healium_grenade
Expand All @@ -54,8 +54,8 @@ GLOBAL_LIST_INIT(gas_recipe_meta, gas_recipes_list())
min_temp = 200
max_temp = 400
reaction_type = ENDOTHERMIC_REACTION
energy_release = 100000
requirements = list(/datum/gas/healium = 50, /datum/gas/freon = 100, /datum/gas/plasma = 10)
energy_release = 2000000
requirements = list(/datum/gas/healium = 100, /datum/gas/freon = 120, /datum/gas/plasma = 50)
products = list(/obj/item/grenade/gas_crystal/healium_crystal = 1)

/datum/gas_recipe/crystallizer/proto_nitrate_grenade
Expand All @@ -64,8 +64,8 @@ GLOBAL_LIST_INIT(gas_recipe_meta, gas_recipes_list())
min_temp = 200
max_temp = 400
reaction_type = EXOTHERMIC_REACTION
energy_release = 150000
requirements = list(/datum/gas/proto_nitrate = 50, /datum/gas/nitrogen = 80, /datum/gas/oxygen = 80)
energy_release = 1500000
requirements = list(/datum/gas/proto_nitrate = 100, /datum/gas/nitrogen = 80, /datum/gas/oxygen = 80)
products = list(/obj/item/grenade/gas_crystal/proto_nitrate_crystal = 1)

/datum/gas_recipe/crystallizer/hot_ice
Expand All @@ -74,8 +74,8 @@ GLOBAL_LIST_INIT(gas_recipe_meta, gas_recipes_list())
min_temp = 15
max_temp = 35
reaction_type = ENDOTHERMIC_REACTION
energy_release = 300000
requirements = list(/datum/gas/freon = 50, /datum/gas/plasma = 40, /datum/gas/oxygen = 30)
energy_release = 3000000
requirements = list(/datum/gas/freon = 60, /datum/gas/plasma = 160, /datum/gas/oxygen = 80)
products = list(/obj/item/stack/sheet/hot_ice = 1)

/datum/gas_recipe/crystallizer/ammonia_crystal
Expand All @@ -84,7 +84,7 @@ GLOBAL_LIST_INIT(gas_recipe_meta, gas_recipes_list())
min_temp = 200
max_temp = 240
reaction_type = EXOTHERMIC_REACTION
energy_release = 15000
energy_release = 950000
requirements = list(/datum/gas/hydrogen = 50, /datum/gas/nitrogen = 40)
products = list(/obj/item/stack/ammonia_crystals = 2)

Expand All @@ -94,7 +94,7 @@ GLOBAL_LIST_INIT(gas_recipe_meta, gas_recipes_list())
min_temp = TCMB
max_temp = 5
reaction_type = EXOTHERMIC_REACTION
energy_release = 1500000
energy_release = 150000000
dangerous = TRUE
requirements = list(/datum/gas/hypernoblium = 250, /datum/gas/antinoblium = 250, /datum/gas/bz = 200, /datum/gas/plasma = 5000, /datum/gas/oxygen = 4500)
products = list(/obj/machinery/power/supermatter_crystal/shard = 1)
Expand All @@ -105,8 +105,8 @@ GLOBAL_LIST_INIT(gas_recipe_meta, gas_recipes_list())
min_temp = 50
max_temp = 350
reaction_type = EXOTHERMIC_REACTION
energy_release = 350000
requirements = list(/datum/gas/nitrous_oxide = 100, /datum/gas/bz = 5)
energy_release = 3500000
requirements = list(/datum/gas/nitrous_oxide = 150, /datum/gas/bz = 30)
products = list(/obj/item/grenade/gas_crystal/nitrous_oxide_crystal = 1)

/datum/gas_recipe/crystallizer/diamond
Expand All @@ -115,18 +115,18 @@ GLOBAL_LIST_INIT(gas_recipe_meta, gas_recipes_list())
min_temp = 10000
max_temp = 30000
reaction_type = ENDOTHERMIC_REACTION
energy_release = 650000
requirements = list(/datum/gas/carbon_dioxide = 10000)
energy_release = 9500000
requirements = list(/datum/gas/carbon_dioxide = 1500)
products = list(/obj/item/stack/sheet/mineral/diamond = 1)

/datum/gas_recipe/crystallizer/plasma_sheet
id = "plasma_sheet"
name = "Plasma sheet"
min_temp = 100
max_temp = 140
reaction_type = ENDOTHERMIC_REACTION
energy_release = 15000
requirements = list(/datum/gas/plasma = 25)
min_temp = 10
max_temp = 20
reaction_type = EXOTHERMIC_REACTION
energy_release = 3500000
requirements = list(/datum/gas/plasma = 450)
products = list(/obj/item/stack/sheet/mineral/plasma = 1)

/datum/gas_recipe/crystallizer/crystal_cell
Expand All @@ -135,7 +135,7 @@ GLOBAL_LIST_INIT(gas_recipe_meta, gas_recipes_list())
min_temp = 50
max_temp = 90
reaction_type = ENDOTHERMIC_REACTION
energy_release = 80000
energy_release = 800000
requirements = list(/datum/gas/plasma = 800, /datum/gas/helium = 100, /datum/gas/bz = 50)
products = list(/obj/item/stock_parts/cell/crystal_cell = 1)

Expand All @@ -145,6 +145,6 @@ GLOBAL_LIST_INIT(gas_recipe_meta, gas_recipes_list())
min_temp = 5
max_temp = 20
reaction_type = EXOTHERMIC_REACTION
energy_release = 29000
energy_release = 2900000
requirements = list(/datum/gas/antinoblium = 5, /datum/gas/zauker = 20, /datum/gas/bz = 7.5)
products = list(/obj/item/stack/sheet/mineral/zaukerite = 2)
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@

///Checks if the reaction temperature is inside the range of temperature + a little deviation
/obj/machinery/atmospherics/components/binary/crystallizer/proc/check_temp_requirements()
var/datum/gas_mixture/contents = airs[2]
if(contents.temperature >= selected_recipe.min_temp * MIN_DEVIATION_RATE && contents.temperature <= selected_recipe.max_temp * MAX_DEVIATION_RATE)
if(internal.temperature >= selected_recipe.min_temp * MIN_DEVIATION_RATE && internal.temperature <= selected_recipe.max_temp * MAX_DEVIATION_RATE)
return TRUE
return FALSE

Expand All @@ -133,17 +132,15 @@
///Calculation for the heat of the various gas mixes and controls the quality of the item
/obj/machinery/atmospherics/components/binary/crystallizer/proc/heat_calculations()
var/datum/gas_mixture/cooling_port = airs[1]
if(cooling_port.total_moles() * 0.25 > MINIMUM_MOLE_COUNT)
var/datum/gas_mixture/cooling_remove = cooling_port.remove_ratio(0.25)

if(cooling_port.total_moles() > MINIMUM_MOLE_COUNT)
if(internal.total_moles() > 0)
var/coolant_temperature_delta = cooling_remove.temperature - internal.temperature
var/cooling_heat_capacity = cooling_remove.heat_capacity()
var/coolant_temperature_delta = cooling_port.temperature - internal.temperature
var/cooling_heat_capacity = cooling_port.heat_capacity()
var/internal_heat_capacity = internal.heat_capacity()
var/cooling_heat_amount = HIGH_CONDUCTIVITY_RATIO * coolant_temperature_delta * (cooling_heat_capacity * internal_heat_capacity / (cooling_heat_capacity + internal_heat_capacity))
cooling_remove.temperature = max(cooling_remove.temperature - cooling_heat_amount / cooling_heat_capacity, TCMB)
cooling_port.temperature = max(cooling_port.temperature - cooling_heat_amount / cooling_heat_capacity, TCMB)
internal.temperature = max(internal.temperature + cooling_heat_amount / internal_heat_capacity, TCMB)
cooling_port.merge(cooling_remove)
update_parents()

if( (internal.temperature >= (selected_recipe.min_temp * MIN_DEVIATION_RATE) && internal.temperature <= selected_recipe.min_temp) || \
(internal.temperature >= selected_recipe.max_temp && internal.temperature <= (selected_recipe.max_temp * MAX_DEVIATION_RATE)))
Expand Down
16 changes: 16 additions & 0 deletions tgui/packages/tgui/interfaces/Crystallizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { getGasColor, getGasLabel } from '../constants';
import { toFixed } from 'common/math';
import { Window } from '../layouts';

const logScale = value => Math.log2(16 + Math.max(0, value)) - 4;

export const Crystallizer = (props, context) => {
const { act, data } = useBackend(context);
const selectedRecipes = data.selected_recipes || [];
Expand Down Expand Up @@ -72,6 +74,20 @@ export const Crystallizer = (props, context) => {
{requirements}
</Box>
</LabeledList.Item>
<LabeledList.Item label="Temperature">
<ProgressBar
value={logScale(internal_temperature)}
minValue={0}
maxValue={logScale(10000)}
ranges={{
teal: [-Infinity, logScale(80)],
good: [logScale(80), logScale(600)],
average: [logScale(600), logScale(5000)],
bad: [logScale(5000), Infinity],
}}>
{toFixed(internal_temperature) + ' K'}
</ProgressBar>
</LabeledList.Item>
</LabeledList>
</Section>
<Section title="Gases">
Expand Down

0 comments on commit 03a9282

Please sign in to comment.