mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-21 13:05:36 +01:00
[MANUAL MIRROR] Supermatter Surge Event (#23811)
* Supermatter Surge Event (#78244) ## About The Pull Request Adds a new random event, Supermatter Surge. For the duration of the event a powerloss inhibition is added, causing the crystal to retain more of its internal energy. Engineers have to keep the crystal stable for a few minutes until it passes. The amount of additional heat is balanced around a roundstart nitrogen engine with no freezers running (*icebox has freezers because planetary) so that even the most basic setup can reasonably be responded to. The event requires at least 3 engineering crew (or one CE) to run. engine_alert3.ogg is a shortened version of bloblarm.ogg ## Why It's Good For The Game Adds an engineering related event that while isn't too difficult to respond to, makes the SM less of a 'set it and forget it' piece of equipment in the round. The gas properties reduce heat generation as it depletes during the event progression, so it remains relatively under control compared to a massive 10K+ SM fire. It creates a series of events that engineers can respond to in their own way, be it adding more cooling, throwing in freezers, using a borg with a fire extinguisher or whatever else they can think of. ## Changelog 🆑 LT3 add: New random event: Supermatter Surge code: Individual supermatter crystals can have custom gas properties /🆑 --------- Co-authored-by: distributivgesetz <distributivgesetz93@gmail.com> Co-authored-by: Jacquerel <hnevard@gmail.com> * remove Skyrat modular --------- Co-authored-by: distributivgesetz <distributivgesetz93@gmail.com> Co-authored-by: Jacquerel <hnevard@gmail.com>
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
#define SURGE_DURATION_MIN 240 EVENT_SECONDS
|
||||
#define SURGE_DURATION_MAX 270 EVENT_SECONDS
|
||||
#define SURGE_SEVERITY_MIN 1
|
||||
#define SURGE_SEVERITY_MAX 4
|
||||
/// The amount of bullet energy we add for the duration of the SM surge
|
||||
#define SURGE_BULLET_ENERGY_ADDITION 5
|
||||
/// The amount of powerloss inhibition (energy retention) we add for the duration of the SM surge
|
||||
#define SURGE_BASE_POWERLOSS_INHIBITION 0.55
|
||||
/// The powerloss inhibition scaling based on surge severity
|
||||
#define SURGE_POWERLOSS_INHIBITION_MODIFIER 0.175
|
||||
/// The power generation scaling based on surge severity
|
||||
#define SURGE_POWER_GENERATION_MODIFIER 0.075
|
||||
/// The heat modifier scaling based on surge severity
|
||||
#define SURGE_HEAT_MODIFIER 0.25
|
||||
|
||||
/**
|
||||
* Supermatter Surge
|
||||
*
|
||||
* An engineering challenge event where the properties of the SM changes to be in a 'surge' of power.
|
||||
* For the duration of the event a powerloss inhibition is added to nitrogen, causing the crystal to retain more of its internal energy.
|
||||
* Heat modifier is lowered to generate some heat but not a high temp burn.
|
||||
* Bullet energy from emitters is raised slightly to raise meV while turned on.
|
||||
*/
|
||||
|
||||
/datum/round_event_control/supermatter_surge
|
||||
name = "Supermatter Surge"
|
||||
typepath = /datum/round_event/supermatter_surge
|
||||
category = EVENT_CATEGORY_ENGINEERING
|
||||
weight = 15
|
||||
max_occurrences = 1
|
||||
earliest_start = 20 MINUTES
|
||||
description = "The supermatter will increase in power and heat by a random amount, and announce it."
|
||||
min_wizard_trigger_potency = 4
|
||||
max_wizard_trigger_potency = 7
|
||||
admin_setup = list(
|
||||
/datum/event_admin_setup/input_number/surge_spiciness,
|
||||
)
|
||||
|
||||
/datum/round_event_control/supermatter_surge/can_spawn_event(players_amt, allow_magic = FALSE)
|
||||
. = ..()
|
||||
|
||||
if(!SSjob.has_minimum_jobs(crew_threshold = 3, jobs = JOB_GROUP_ENGINEERS, head_jobs = list(JOB_CHIEF_ENGINEER)))
|
||||
return FALSE
|
||||
|
||||
/datum/round_event/supermatter_surge
|
||||
announce_when = 4
|
||||
end_when = SURGE_DURATION_MIN
|
||||
/// How powerful is the supermatter surge going to be?
|
||||
var/surge_class = SURGE_SEVERITY_MIN
|
||||
/// Typecasted reference to the supermatter chosen at event start
|
||||
var/obj/machinery/power/supermatter_crystal/engine
|
||||
/// Typecasted reference to the nitrogen properies in the SM chamber
|
||||
var/datum/sm_gas/nitrogen/sm_gas
|
||||
|
||||
/datum/event_admin_setup/input_number/surge_spiciness
|
||||
input_text = "Set surge intensity. (Higher is more severe.)"
|
||||
min_value = 1
|
||||
max_value = 4
|
||||
|
||||
/datum/event_admin_setup/input_number/surge_spiciness/prompt_admins()
|
||||
default_value = rand(1, 4)
|
||||
return ..()
|
||||
|
||||
/datum/event_admin_setup/input_number/surge_spiciness/apply_to_event(datum/round_event/supermatter_surge/event)
|
||||
event.surge_class = chosen_value
|
||||
|
||||
/datum/round_event/supermatter_surge/setup()
|
||||
engine = GLOB.main_supermatter_engine
|
||||
if(isnull(engine))
|
||||
stack_trace("SM surge event failed to find a supermatter engine!")
|
||||
return
|
||||
|
||||
sm_gas = LAZYACCESS(engine.current_gas_behavior, /datum/gas/nitrogen)
|
||||
if(isnull(sm_gas))
|
||||
stack_trace("SM surge event failed to find gas properties for [engine].")
|
||||
return
|
||||
|
||||
if(isnull(surge_class))
|
||||
surge_class = rand(SURGE_SEVERITY_MIN, SURGE_SEVERITY_MAX)
|
||||
|
||||
end_when = rand(SURGE_DURATION_MIN, SURGE_DURATION_MAX)
|
||||
|
||||
/datum/round_event/supermatter_surge/announce()
|
||||
priority_announce("The Crystal Integrity Monitoring System has detected unusual atmospheric properties in the supermatter chamber and energy output from the supermatter crystal has increased significantly. Engineering intervention is required to stabilize the engine.", "Class [surge_class] Supermatter Surge Alert", 'sound/machines/engine_alert3.ogg')
|
||||
|
||||
/datum/round_event/supermatter_surge/start()
|
||||
engine.bullet_energy = surge_class + SURGE_BULLET_ENERGY_ADDITION
|
||||
sm_gas.powerloss_inhibition = (surge_class * SURGE_POWERLOSS_INHIBITION_MODIFIER) + SURGE_BASE_POWERLOSS_INHIBITION
|
||||
sm_gas.heat_power_generation = (surge_class * SURGE_POWER_GENERATION_MODIFIER) - 1
|
||||
sm_gas.heat_modifier = (surge_class * SURGE_HEAT_MODIFIER) - 1
|
||||
|
||||
|
||||
/datum/round_event/supermatter_surge/end()
|
||||
engine.bullet_energy = initial(engine.bullet_energy)
|
||||
sm_gas.powerloss_inhibition = initial(sm_gas.powerloss_inhibition)
|
||||
sm_gas.heat_power_generation = initial(sm_gas.heat_power_generation)
|
||||
sm_gas.heat_modifier = initial(sm_gas.heat_modifier)
|
||||
priority_announce("The supermatter surge has dissipated, crystal output readings have normalized.", "Anomaly Cleared")
|
||||
engine = null
|
||||
sm_gas = null
|
||||
|
||||
#undef SURGE_DURATION_MIN
|
||||
#undef SURGE_DURATION_MAX
|
||||
#undef SURGE_SEVERITY_MIN
|
||||
#undef SURGE_SEVERITY_MAX
|
||||
#undef SURGE_BULLET_ENERGY_ADDITION
|
||||
#undef SURGE_BASE_POWERLOSS_INHIBITION
|
||||
#undef SURGE_POWERLOSS_INHIBITION_MODIFIER
|
||||
#undef SURGE_POWER_GENERATION_MODIFIER
|
||||
#undef SURGE_HEAT_MODIFIER
|
||||
@@ -39,6 +39,8 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
var/absorption_ratio = 0.15
|
||||
/// The gasmix we just recently absorbed. Tile's air multiplied by absorption_ratio
|
||||
var/datum/gas_mixture/absorbed_gasmix
|
||||
/// The current gas behaviors for this particular crystal
|
||||
var/list/current_gas_behavior
|
||||
|
||||
///Refered to as EER on the monitor. This value effects gas output, damage, and power generation.
|
||||
var/internal_energy = 0
|
||||
@@ -109,7 +111,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
///The cutoff for a bolt jumping, grows with heat, lowers with higher mol count,
|
||||
var/zap_cutoff = 1500
|
||||
///How much the bullets damage should be multiplied by when it is added to the internal variables
|
||||
var/bullet_energy = 2
|
||||
var/bullet_energy = SUPERMATTER_DEFAULT_BULLET_ENERGY
|
||||
///How much hallucination should we produce per unit of power?
|
||||
var/hallucination_power = 0.1
|
||||
|
||||
@@ -179,6 +181,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
|
||||
/obj/machinery/power/supermatter_crystal/Initialize(mapload)
|
||||
. = ..()
|
||||
current_gas_behavior = init_sm_gas()
|
||||
gas_percentage = list()
|
||||
absorbed_gasmix = new()
|
||||
uid = gl_uid++
|
||||
@@ -267,7 +270,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
// Some extra effects like [/datum/sm_gas/carbon_dioxide/extra_effects]
|
||||
// needs more than one gas and rely on a fully parsed gas_percentage.
|
||||
for (var/gas_path in absorbed_gasmix.gases)
|
||||
var/datum/sm_gas/sm_gas = GLOB.sm_gas_behavior[gas_path]
|
||||
var/datum/sm_gas/sm_gas = current_gas_behavior[gas_path]
|
||||
sm_gas?.extra_effects(src)
|
||||
|
||||
// PART 3: POWER PROCESSING
|
||||
@@ -601,7 +604,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
if(mole_count < MINIMUM_MOLE_COUNT) //save processing power from small amounts like these
|
||||
continue
|
||||
gas_percentage[gas_path] = mole_count / total_moles
|
||||
var/datum/sm_gas/sm_gas = GLOB.sm_gas_behavior[gas_path]
|
||||
var/datum/sm_gas/sm_gas = current_gas_behavior[gas_path]
|
||||
if(!sm_gas)
|
||||
continue
|
||||
gas_power_transmission += sm_gas.power_transmission * gas_percentage[gas_path]
|
||||
|
||||
Reference in New Issue
Block a user