Skip to content

Commit

Permalink
Grown plants and gas values
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorDinamit committed Feb 14, 2024
1 parent 57c8c06 commit 24560e5
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 3 deletions.
7 changes: 6 additions & 1 deletion code/_helpers/atmospherics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,9 @@

/proc/print_atmos_analysis(user, var/list/result)
for(var/line in result)
to_chat(user, "<span class='notice'>[line]</span>")
to_chat(user, "<span class='notice'>[line]</span>")

/proc/GetGasDatum(gas_id)
if(!(gas_id in gas_data.gases))
return null
return gas_data.gases[gas_id]
42 changes: 42 additions & 0 deletions code/modules/hydroponics/seed.dm
Original file line number Diff line number Diff line change
Expand Up @@ -861,3 +861,45 @@
res.overlays += I

return res

/datum/seed/proc/Value(check_chems = TRUE)
. = 5
for(var/trait in traits)
var/trait_value = get_trait(trait)
if(!trait_value)
continue

switch(trait)
if(TRAIT_POTENCY)
. += trait_value * 0.4
if(TRAIT_EXPLOSIVE)
. += 15
if(TRAIT_HARVEST_REPEAT)
. += 15
if(TRAIT_PRODUCTION)
. += trait_value
if(TRAIT_YIELD)
. += trait_value
if(TRAIT_MATURATION)
. -= trait_value
if(TRAIT_ENDURANCE)
. += trait_value * 0.25
if(TRAIT_JUICY)
. += trait_value * 5
if(TRAIT_STINGS)
. += 15

for(var/gas_id in exude_gasses)
var/decl/xgm_gas/gas = GetGasDatum(gas_id)
if(!istype(gas))
continue
. += gas.value * exude_gasses[gas_id]

if(check_chems)
for(var/chem in chems)
var/datum/reagent/R = GLOB.chemical_reagents_list[chem]
if(!istype(R))
continue
. += R.value * chems[chem]

. = round(max(2, .))
26 changes: 26 additions & 0 deletions code/modules/item_worth/value_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,29 @@
. += length(allowed_spells * 1000)
if(!isnull(owner))
. *= 0.5

/obj/item/reagent_containers/food/snacks/grown/Value(base)
. = ..()
. += seed.Value(FALSE)

// Seeds cost less than fully grown plants
/obj/item/seeds/Value(base)
. = ..()
. += round(seed.Value(TRUE) * 0.3)

/obj/item/tank/Value(base)
. = ..()
for(var/gas_id in air_contents.gas)
var/decl/xgm_gas/gas = GetGasDatum(gas_id)
if(!istype(gas))
continue
. += gas.value * air_contents.gas[gas_id]

// Mostly for canisters
/obj/machinery/portable_atmospherics/Value(base)
. = ..()
for(var/gas_id in air_contents.gas)
var/decl/xgm_gas/gas = GetGasDatum(gas_id)
if(!istype(gas))
continue
. += gas.value * air_contents.gas[gas_id]
4 changes: 2 additions & 2 deletions code/modules/item_worth/worths_list.dm
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,8 @@ var/list/worths = list(
/obj/item/melee/classic_baton = 40,
/obj/item/melee/telebaton = 100,
/obj/item/excalibur = 5000,
/obj/item/tank/jetpack = 450,
/obj/item/tank = 50,
/obj/item/tank/jetpack = -250,
/obj/item/tank = -50,
/obj/item/contraband/poster = 25,
//MATERIAL,
/obj/item/material/sword/katana/replica = -120,
Expand Down
22 changes: 22 additions & 0 deletions code/modules/xgm/gases.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
breathed_product = /datum/reagent/oxygen
symbol_html = "O<sub>2</sub>"
symbol = "O2"
value = 4


/decl/xgm_gas/nitrogen
Expand All @@ -16,6 +17,7 @@
molar_mass = 0.028 // kg/mol
symbol_html = "N<sub>2</sub>"
symbol = "N2"
value = 2

/decl/xgm_gas/carbon_dioxide
id = GAS_CO2
Expand All @@ -24,6 +26,7 @@
molar_mass = 0.044 // kg/mol
symbol_html = "CO<sub>2</sub>"
symbol = "CO2"
value = 4

/decl/xgm_gas/methyl_bromide
id = GAS_METHYL_BROMIDE
Expand All @@ -33,6 +36,7 @@
breathed_product = /datum/reagent/toxin/methyl_bromide
symbol_html = "CH<sub>3</sub>Br"
symbol = "CH3Br"
value = 8

/decl/xgm_gas/phoron
id = GAS_PHORON
Expand All @@ -53,6 +57,7 @@
breathed_product = /datum/reagent/toxin/phoron
symbol_html = "Ph"
symbol = "Ph"
value = 12

/decl/xgm_gas/sleeping_agent
id = GAS_N2O
Expand All @@ -63,6 +68,7 @@
breathed_product = /datum/reagent/nitrous_oxide
symbol_html = "N<sub>2</sub>O"
symbol = "N2O"
value = 3

/decl/xgm_gas/methane
id = GAS_METHANE
Expand All @@ -72,13 +78,15 @@
flags = XGM_GAS_FUEL
symbol_html = "CH<sub>4</sub>"
symbol = "CH4"
value = 3

/decl/xgm_gas/alium
id = GAS_ALIEN
name = "Aliether"
hidden_from_codex = TRUE
symbol_html = "X"
symbol = "X"
value = 20

/decl/xgm_gas/alium/New()
var/num = rand(100,999)
Expand Down Expand Up @@ -109,18 +117,21 @@
burn_product = GAS_STEAM
symbol_html = "H<sub>2</sub>"
symbol = "H2"
value = 10

/decl/xgm_gas/hydrogen/deuterium
id = GAS_DEUTERIUM
name = "Deuterium"
symbol_html = "D"
symbol = "D"
value = 10

/decl/xgm_gas/hydrogen/tritium
id = GAS_TRITIUM
name = "Tritium"
symbol_html = "T"
symbol = "T"
value = 15

/decl/xgm_gas/helium
id = GAS_HELIUM
Expand All @@ -131,6 +142,7 @@
breathed_product = /datum/reagent/helium
symbol_html = "He"
symbol = "He"
value = 7

/decl/xgm_gas/argon
id = GAS_ARGON
Expand All @@ -139,6 +151,7 @@
molar_mass = 0.018 // kg/mol
symbol_html = "Ar"
symbol = "Ar"
value = 25

// If narcosis is ever simulated, krypton has a narcotic potency seven times greater than regular airmix.
/decl/xgm_gas/krypton
Expand All @@ -148,6 +161,7 @@
molar_mass = 0.036 // kg/mol
symbol_html = "Kr"
symbol = "Kr"
value = 25

/decl/xgm_gas/neon
id = GAS_NEON
Expand All @@ -156,6 +170,7 @@
molar_mass = 0.01 // kg/mol
symbol_html = "Ne"
symbol = "Ne"
value = 10

/decl/xgm_gas/xenon
id = GAS_XENON
Expand All @@ -165,6 +180,7 @@
breathed_product = /datum/reagent/nitrous_oxide/xenon
symbol_html = "Xe"
symbol = "Xe"
value = 10

/decl/xgm_gas/nitrodioxide
id = GAS_NO2
Expand All @@ -186,6 +202,7 @@
flags = XGM_GAS_OXIDIZER
symbol_html = "NO"
symbol = "NO"
value = 15

/decl/xgm_gas/chlorine
id = GAS_CHLORINE
Expand All @@ -198,6 +215,7 @@
breathed_product = /datum/reagent/toxin/chlorine
symbol_html = "Cl"
symbol = "Cl"
value = 7

/decl/xgm_gas/vapor
id = GAS_STEAM
Expand All @@ -211,6 +229,7 @@
condensation_point = 308.15 // 35C. Dew point is ~20C but this is better for gameplay considerations.
symbol_html = "H<sub>2</sub>O"
symbol = "H2O"
value = 1

/decl/xgm_gas/sulfurdioxide
id = GAS_SULFUR
Expand All @@ -220,6 +239,7 @@
molar_mass = 0.044 // kg/mol
symbol_html = "SO<sub>2</sub>"
symbol = "SO2"
value = 12

/decl/xgm_gas/ammonia
id = GAS_AMMONIA
Expand All @@ -230,6 +250,7 @@
breathed_product = /datum/reagent/ammonia
symbol_html = "NH<sub>3</sub>"
symbol = "NH3"
value = 1

/decl/xgm_gas/carbon_monoxide
id = GAS_CO
Expand All @@ -239,3 +260,4 @@
breathed_product = /datum/reagent/carbon_monoxide
symbol_html = "CO"
symbol = "CO"
value = 5
2 changes: 2 additions & 0 deletions code/modules/xgm/xgm_gas_data.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
var/symbol_html = "X"
var/symbol = "X"

/// Cost per mole
var/value = 0

/hook/startup/proc/generateGasData()
gas_data = new
Expand Down

0 comments on commit 24560e5

Please sign in to comment.