Add Sandstorm balance config (#279)

* Add Sandstorm balance config

Allows changing settings for the Cryptominer, Autodoc, and Bluespace Miner.

* Update server config with real-time values

Sandstorm balance configurations have been updated to read values in real time whenever possible.

Values are now set using defines, and any that could not use them have been disabled.

A new configuration has been added to control when the bluespace mining machine can produce bluespace crystals.

* Fixes a critical cryptominer issue

Fixes a tremendous coding oversight that added two additional whitespace characters to the cryptominer machine file.

* Fix incorrect config value for BSMs

Fixes a mistaken definition for BLUESPACE_MINER_CRYSTAL_TIER pointing to a previously used value.

* Undefine balance config defines

Adds an undefine statement for all balance config value defines.

* Properly undefine definitions

Fixes incorrect term usage for undefining a value.
This commit is contained in:
Darius
2023-01-29 22:29:33 -03:00
committed by GitHub
parent 8ae64b1bd8
commit eb0b27889b
7 changed files with 239 additions and 34 deletions
+1
View File
@@ -42,3 +42,4 @@ $include entries/vote.txt
$include plushies/defines.txt
# Special Sandstorm configs
$include sandstorm/config.txt
$include sandstorm/balance.txt
+59
View File
@@ -0,0 +1,59 @@
# Special Sandstorm balance config!
###
## CRYPTOMINER
###
## Should cryptominers work in non-atmos turf (ex. space)?
## Uncomment this to disable atmos processing (cheat mode)
#CRYPTO_IGNORE_ATMOS
## What point multiplier should cryptominers use?
## Determined by heat level, or uses MAX in cheat mode
CRYPTO_MULTIPLIER_MIN 0.2
CRYPTO_MULTIPLIER_MID 1
CRYPTO_MULTIPLIER_MAX 3
## What heat thresholds should cryptominers use?
## This is measured in Kelvins
CRYPTO_HEAT_THRESHOLD_MIN 225
CRYPTO_HEAT_THRESHOLD_MID 273
CRYPTO_HEAT_THRESHOLD_MAX 500
## How much heat should cryptominers produce?
## This amount is added to the environment on process
CRYPTO_HEAT_POWER 100
## How long between cryptominers producing resources?
## Currently unimplemented!
CRYPTO_MINING_TIME 3000
## What material amount should the cryptominers produce?
## This is modified by the MULTIPLIER value
## Currently unimplemented!
CRYPTO_PAYOUT_AMOUNT 50
## How much power should the cryptominer use?
## Currently unimplemented!
CRYPTO_POWER_USE_IDLE 20
CRYPTO_POWER_USE_ACTIVE 200
CRYPTO_POWER_USE_PROCESS 20
###
## AUTODOC
###
## How long should the autodoc take to perform surgery?
## This is modified by stock part ratings
AUTODOC_TIME_SURGERY_BASE 350
###
## BLUESPACE MINER
###
## How much should the bluespace miner produce, compared to normal?
## This is modified by stock part ratings
BLUESPACEMINER_MULT_OUTPUT 1
## What is the minimum stock part tier to produce bluespace crystals?
BLUESPACEMINER_CRYSTAL_TIER 5
@@ -0,0 +1,66 @@
/// CRYPTOMINERS ///
// Should cryptominers work in non-atmos turf
/datum/config_entry/flag/crypto_ignore_atmos
// Cryptominer point multipliers
/datum/config_entry/number/crypto_multiplier_min
config_entry_value = 0.20
integer = FALSE
/datum/config_entry/number/crypto_multiplier_mid
config_entry_value = 1
integer = FALSE
/datum/config_entry/number/crypto_multiplier_max
config_entry_value = 3
integer = FALSE
// Cryptominer heat thresholds
/datum/config_entry/number/crypto_heat_threshold_min
config_entry_value = 225
/datum/config_entry/number/crypto_heat_threshold_mid
config_entry_value = 273
/datum/config_entry/number/crypto_heat_threshold_max
config_entry_value = 500
// Cryptominer heat produced
/datum/config_entry/number/crypto_heat_power
config_entry_value = 100
/*
* The contained configuration values are currently unimplemented
*
// Cryptominer processing time
/datum/config_entry/number/crypto_mining_time
config_entry_value = 3000
// Cryptominer base payout
/datum/config_entry/number/crypto_payout_amount
config_entry_value = 50
// Cryptominer power use
/datum/config_entry/number/crypto_power_use_idle
config_entry_value = 20
/datum/config_entry/number/crypto_power_use_active
config_entry_value = 200
/datum/config_entry/number/crypto_power_use_process
config_entry_value = 20
*/
/// AUTODOC ///
// Autodoc processing time
/datum/config_entry/number/autodoc_time_surgery_base
config_entry_value = 350
/// BLUESPACE MINER ///
// BSM production output multiplier
/datum/config_entry/number/bluespaceminer_mult_output
config_entry_value = 1
// BSM minimum tier for bluespace crystals
/datum/config_entry/number/bluespaceminer_crystal_tier
config_entry_value = 5
+9 -1
View File
@@ -1,3 +1,6 @@
// Configuration defines
#define AUTODOC_TIME_BASE CONFIG_GET(number/autodoc_time_surgery_base)
/obj/machinery/autodoc
name = "autodoc"
desc = "An advanced machine used for inserting organs and implants into the occupant."
@@ -17,8 +20,11 @@
. = ..()
update_icon()
// Set initial time based on config
surgerytime = max(AUTODOC_TIME_BASE,10)
/obj/machinery/autodoc/RefreshParts()
var/max_time = 350
var/max_time = AUTODOC_TIME_BASE
for(var/obj/item/stock_parts/L in component_parts)
max_time -= (L.rating*10)
surgerytime = max(max_time,10)
@@ -165,3 +171,5 @@
return
obj_flags |= EMAGGED
to_chat(user, span_warning("You reprogram [src]'s surgery procedures."))
#undef AUTODOC_TIME_BASE
@@ -1,3 +1,22 @@
// Configuration defines
/*
* Some entries are currently unimplemented
*
#define CRYPTO_POWER_USE CONFIG_GET(number/crypto_power_use_process)
#define CRYPTO_POWER_IDLE CONFIG_GET(number/crypto_power_use_idle)
#define CRYPTO_POWER_ACTIVE CONFIG_GET(number/crypto_power_use_active)
#define CRYPTO_MININGTIME CONFIG_GET(number/crypto_mining_time)
#define CRYPTO_MININGPOINTS CONFIG_GET(number/crypto_payout_amount)
*/
#define CRYPTO_TEMP_MIN CONFIG_GET(number/crypto_heat_threshold_min)
#define CRYPTO_TEMP_MID CONFIG_GET(number/crypto_heat_threshold_mid)
#define CRYPTO_TEMP_MAX CONFIG_GET(number/crypto_heat_threshold_max)
#define CRYPTO_MULT_MIN CONFIG_GET(number/crypto_multiplier_min)
#define CRYPTO_MULT_MID CONFIG_GET(number/crypto_multiplier_mid)
#define CRYPTO_MULT_MAX CONFIG_GET(number/crypto_multiplier_max)
#define CRYPTO_HEATING_POWER CONFIG_GET(number/crypto_heat_power)
#define CRYPTO_IGNORE_ATMOS CONFIG_GET(flag/crypto_ignore_atmos)
/obj/machinery/cryptominer
name = "cryptocurrency miner"
desc = "This handy-dandy machine will produce credits for your enjoyment."
@@ -12,11 +31,6 @@
var/mining = FALSE
var/miningtime = 3000
var/miningpoints = 50
var/mintemp = TCRYO // 225K equals approximately -55F or -48C
var/midtemp = T0C // 273K equals 32F or 0C
var/maxtemp = 500 // 500K equals approximately 440F or 226C
var/heatingPower = 100 // Heat added each processing
var/require_conductivity = TRUE // Prevent use in space
var/datum/bank_account/pay_me = null
/obj/machinery/cryptominer/Initialize(mapload)
@@ -59,7 +73,7 @@
return
to_chat(user, span_notice("You link \the [CARD] to \the [src]."))
pay_me = CARD.registered_account
say("Now using [pay_me.account_holder ? "[pay_me.account_holder]'s" : span_boldwarning("ERROR")] account.")
say("Now using [pay_me.account_holder ? "[pay_me.account_holder]s" : span_boldwarning("ERROR")] account.")
return
/obj/machinery/cryptominer/AltClick(mob/user)
@@ -68,13 +82,13 @@
balloon_alert(user, "resetting")
if(do_after(user, 5 SECONDS, target = src))
pay_me = SSeconomy.get_dep_account(ACCOUNT_CAR)
say("Now using [pay_me.account_holder]'s account.")
say("Now using [pay_me.account_holder]s account.")
/obj/machinery/cryptominer/examine(mob/user)
. = ..()
if(in_range(user, src) || isobserver(user))
. += span_notice("A little screen on the machine reads: Currently the linked bank account is [pay_me.account_holder ? "[pay_me.account_holder]'s" : span_boldwarning("ERROR")].")
. += "Modify the destination of the credits using your id on it while it is inactive and has it's panel open."
. += span_notice("A little screen on the machine reads: Currently the linked bank account is [pay_me.account_holder ? "[pay_me.account_holder]s" : span_boldwarning("ERROR")].")
. += "Modify the destination of the credits using your id on it while it is inactive and has its panel open."
. += "Alt-Click to reset to the Cargo budget.</span>"
/obj/machinery/cryptominer/process()
@@ -85,18 +99,19 @@
// Check for tiles with no conductivity (space)
if(T.thermal_conductivity == 0)
// Cheat mode: Skip all atmos code and give points
// Placed first, as servers are more likely to use it
if(CRYPTO_IGNORE_ATMOS)
produce_points(CRYPTO_MULT_MAX)
return
// Normal mode: Warn the user and stop processing
if(require_conductivity)
else
say("Invalid atmospheric conditions detected! Shutting off!")
playsound(loc, 'sound/machines/beep.ogg', 50, TRUE, -1)
set_mining(FALSE)
return
// Cheat mode: Skip all atmos code and give points
else
produce_points(3)
return
// Get air
var/datum/gas_mixture/env = T.return_air()
if(!env)
@@ -105,24 +120,29 @@
// Get temp
var/env_temp = env.return_temperature()
// Define temperature settings
var/temp_min = CRYPTO_TEMP_MIN // 225K equals approximately -55F or -48C
var/temp_mid = CRYPTO_TEMP_MID // 273K equals 32F or 0C
var/temp_max = CRYPTO_TEMP_MAX // 500K equals approximately 440F or 226C
// Check for temperature effects
// Minimum (most likely)
if(env_temp <= mintemp)
produce_points(3)
if(env_temp <= temp_min)
produce_points(CRYPTO_MULT_MAX)
// Mid
else if((env_temp <= midtemp) && (env_temp >= mintemp))
produce_points(1)
else if((env_temp <= temp_mid) && (env_temp >= temp_min))
produce_points(CRYPTO_MULT_MID)
// Maximum
else if((env_temp <= maxtemp) && (env_temp >= midtemp))
produce_points(0.20)
else if((env_temp <= temp_max) && (env_temp >= temp_mid))
produce_points(CRYPTO_MULT_MIN)
// Overheat
else if(env_temp >= maxtemp)
else if(env_temp >= temp_max)
say("Critical overheating detected! Shutting off!")
playsound(loc, 'sound/machines/beep.ogg', 50, TRUE, -1)
set_mining(FALSE)
// Increase heat by heatingPower
env.set_temperature(env_temp + heatingPower)
// Increase heat by heating_power
env.set_temperature(env_temp + CRYPTO_HEATING_POWER)
// Update air
air_update_turf()
@@ -148,15 +168,25 @@
set_mining(TRUE)
/obj/machinery/cryptominer/proc/set_mining(new_value)
// Check if status changed
if(new_value == mining)
return //No changes
mining = new_value
if(mining)
START_PROCESSING(SSmachines, src)
else
STOP_PROCESSING(SSmachines, src)
update_icon()
// Set status new value
mining = new_value
// Check if mining should run
if(mining)
// Start processing
START_PROCESSING(SSmachines, src)
// Mining should not run
else
// Stop processing
STOP_PROCESSING(SSmachines, src)
// Update machine icon
update_icon()
/obj/machinery/cryptominer/syndie
name = "syndicate cryptocurrency miner"
@@ -198,3 +228,21 @@
icon_state = "loop_nano"
else
icon_state = "on_nano"
/*
* Some entries are currently unimplemented
*
#undef CRYPTO_POWER_USE
#undef CRYPTO_POWER_IDLE
#undef CRYPTO_POWER_ACTIVE
#undef CRYPTO_MININGTIME
#undef CRYPTO_MININGPOINTS
*/
#undef CRYPTO_TEMP_MIN
#undef CRYPTO_TEMP_MID
#undef CRYPTO_TEMP_MAX
#undef CRYPTO_MULT_MIN
#undef CRYPTO_MULT_MID
#undef CRYPTO_MULT_MAX
#undef CRYPTO_HEATING_POWER
#undef CRYPTO_IGNORE_ATMOS
@@ -1,3 +1,7 @@
// Configuration defines
#define BLUESPACE_MINER_BONUS_MULT CONFIG_GET(number/bluespaceminer_mult_output)
#define BLUESPACE_MINER_CRYSTAL_TIER CONFIG_GET(number/bluespaceminer_crystal_tier)
/obj/machinery/mineral/bluespace_miner
name = "bluespace mining machine"
desc = "A machine that uses the magic of Bluespace to slowly generate materials and add them to a linked ore silo."
@@ -8,7 +12,16 @@
circuit = /obj/item/circuitboard/machine/bluespace_miner
layer = BELOW_OBJ_LAYER
init_process = TRUE
var/list/ore_rates = list(/datum/material/iron = 0.3, /datum/material/glass = 0.3, /datum/material/plasma = 0.1, /datum/material/silver = 0.1, /datum/material/gold = 0.05, /datum/material/titanium = 0.05, /datum/material/uranium = 0.05, /datum/material/diamond = 0.02)
var/list/ore_rates = list(
/datum/material/iron = 0.3,
/datum/material/glass = 0.3,
/datum/material/plasma = 0.1,
/datum/material/silver = 0.1,
/datum/material/gold = 0.05,
/datum/material/titanium = 0.05,
/datum/material/uranium = 0.05,
/datum/material/diamond = 0.02
)
var/datum/component/remote_materials/materials
var/multiplier = 0 //Multiplier by tier, has been made fair and everything
@@ -16,11 +29,14 @@
. = ..()
materials = AddComponent(/datum/component/remote_materials, "bsm", mapload)
// Set initial multiplier based on config
multiplier *= BLUESPACE_MINER_BONUS_MULT
/obj/machinery/mineral/bluespace_miner/examine(mob/user)
. = ..()
if(in_range(user, src) || isobserver(user))
. += span_notice("A small screen on the machine reads, \"Efficiency at [multiplier * 100]%\"")
if(multiplier >= 5)
if(multiplier >= BLUESPACE_MINER_CRYSTAL_TIER)
. += span_notice("Bluespace generation is active.")
if(!anchored)
. += span_warning("The machine won't work while not firmly secured to the ground.")
@@ -38,11 +54,14 @@
multiplier += L.rating
stock_amt++
multiplier /= stock_amt
if(multiplier >= 5)
if(multiplier >= BLUESPACE_MINER_CRYSTAL_TIER)
ore_rates[/datum/material/bluespace] = 0.01
else
ore_rates -= /datum/material/bluespace
// Apply config multiplier here to not interfere with bluespace material check
multiplier *= BLUESPACE_MINER_BONUS_MULT
/obj/machinery/mineral/bluespace_miner/Destroy()
materials = null
return ..()
@@ -108,3 +127,6 @@
if(default_unfasten_wrench(user, I))
return TRUE
return FALSE
#undef BLUESPACE_MINER_BONUS_MULT
#undef BLUESPACE_MINER_CRYSTAL_TIER
+1
View File
@@ -3910,6 +3910,7 @@
#include "modular_sand\code\_onclick\hud\hud.dm"
#include "modular_sand\code\_onclick\hud\screen_objects.dm"
#include "modular_sand\code\controllers\configuration\entries\sandstorm.dm"
#include "modular_sand\code\controllers\configuration\entries\sandstorm_balance.dm"
#include "modular_sand\code\controllers\subsystem\interactions.dm"
#include "modular_sand\code\controllers\subsystem\job.dm"
#include "modular_sand\code\controllers\subsystem\language.dm"