Supermatter anomaly fixes/explosion scaled hallucination (#90788)

## About The Pull Request

- Some fixes for the supermatter crystal anomaly generation, ensuring
they spawn outside the chamber windows and adds the outright missing
dimensional anomalies.
- Hallucination duration is calculated based on both distance from the
SM as well as the size of the delam explosion (a modifier of 0.75x for a
small explosion, up to 1.25x for the largest delam explosion)

## Why It's Good For The Game

Bugfixes, improvement on the delam hallucination.

## Changelog

🆑 LT3
fix: Fixed supermatter anomaly generation, hallucination is based on
distance and delam explosion size
/🆑
This commit is contained in:
LT3
2025-04-25 08:08:33 -07:00
committed by lessthanthree
parent 5340af2c97
commit a1125ede4b
3 changed files with 27 additions and 19 deletions

View File

@@ -34,8 +34,9 @@
/// The base zap power transmission of the supermatter crystal in W/MeV.
#define BASE_POWER_TRANSMISSION_RATE 1040
//These would be what you would get at point blank, decreases with distance
#define DETONATION_HALLUCINATION (20 MINUTES)
//These would be what you would get at point blank, decreases with distance up to a minimum
#define DETONATION_HALLUCINATION_MAX (20 MINUTES)
#define DETONATION_HALLUCINATION_MIN (100 SECONDS)
/// All humans within this range will be irradiated
#define DETONATION_RADIATION_RANGE 20

View File

@@ -1,3 +1,5 @@
#define DELAM_MAX_DEVASTATION 17.5
// These are supposed to be discrete effects so we can tell at a glance what does each override
// of [/datum/sm_delam/proc/delaminate] does.
// Please keep them discrete and give them proper, descriptive function names.
@@ -25,7 +27,8 @@
continue
//Hilariously enough, running into a closet should make you get hit the hardest.
var/hallucination_amount = max(100 SECONDS, min(600 SECONDS, DETONATION_HALLUCINATION * sqrt(1 / (get_dist(victim, sm) + 1))))
//duration between min and max, calculated by distance from the supermatter and size of the delam explosion
var/hallucination_amount = LERP(DETONATION_HALLUCINATION_MIN, DETONATION_HALLUCINATION_MAX, 1 - get_dist(victim, sm) / 128) * LERP(0.75, 1.25, calculate_explosion(sm) * 0.5 / DELAM_MAX_DEVASTATION)
victim.adjust_hallucinations(hallucination_amount)
for(var/mob/victim as anything in GLOB.player_list)
@@ -75,20 +78,20 @@
/// Explodes
/datum/sm_delam/proc/effect_explosion(obj/machinery/power/supermatter_crystal/sm)
var/explosion_power = sm.explosion_power
var/power_scaling = sm.gas_heat_power_generation
var/turf/sm_turf = get_turf(sm)
//Dear mappers, balance the sm max explosion radius to 17.5, 37, 39, 41
explosion(origin = sm_turf,
devastation_range = explosion_power * max(power_scaling, 0.205) * 0.5,
heavy_impact_range = explosion_power * max(power_scaling, 0.205) + 2,
light_impact_range = explosion_power * max(power_scaling, 0.205) + 4,
flash_range = explosion_power * max(power_scaling, 0.205) + 6,
devastation_range = calculate_explosion(sm) * 0.5, // max 17.5
heavy_impact_range = calculate_explosion(sm) + 2, // max 37
light_impact_range = calculate_explosion(sm) + 4, // max 39
flash_range = calculate_explosion(sm) + 6, //max 41
adminlog = TRUE,
ignorecap = TRUE
)
return TRUE
/datum/sm_delam/proc/calculate_explosion(obj/machinery/power/supermatter_crystal/sm)
return sm.explosion_power * max(sm.gas_heat_power_generation, 0.205)
/// Spawns a scrung and eat the SM.
/datum/sm_delam/proc/effect_singulo(obj/machinery/power/supermatter_crystal/sm)
var/turf/sm_turf = get_turf(sm)
@@ -228,3 +231,5 @@
spawn_location = pick_n_take(possible_spawns)
while(get_dist(spawn_location, avoid) < 30)
new /obj/crystal_mass(get_turf(spawn_location))
#undef DELAM_MAX_DEVASTATION

View File

@@ -137,13 +137,13 @@
supermatter_zap(src, range = range, zap_str = discharged_energy, zap_flags = flags, zap_cutoff = src.zap_cutoff, power_level = internal_energy, zap_icon = src.zap_icon)
last_high_energy_accumulation_perspective_machines = SSmachines.times_fired
if(prob(5))
supermatter_anomaly_gen(src, FLUX_ANOMALY, rand(5, 10))
supermatter_anomaly_gen(get_ranged_target_turf(src, pick(GLOB.cardinals), rand(5, 10)), FLUX_ANOMALY, 3)
if(prob(5))
supermatter_anomaly_gen(src, HALLUCINATION_ANOMALY, rand(5, 10))
supermatter_anomaly_gen(get_ranged_target_turf(src, pick(GLOB.cardinals), rand(5, 10)), HALLUCINATION_ANOMALY, 3)
if(internal_energy > SEVERE_POWER_PENALTY_THRESHOLD && prob(5) || prob(1))
supermatter_anomaly_gen(src, GRAVITATIONAL_ANOMALY, rand(5, 10))
supermatter_anomaly_gen(get_ranged_target_turf(src, pick(GLOB.cardinals), rand(5, 10)), GRAVITATIONAL_ANOMALY, 3)
if((internal_energy > SEVERE_POWER_PENALTY_THRESHOLD && prob(2)) || (prob(0.3) && internal_energy > POWER_PENALTY_THRESHOLD))
supermatter_anomaly_gen(src, PYRO_ANOMALY, rand(5, 10))
supermatter_anomaly_gen(get_ranged_target_turf(src, pick(GLOB.cardinals), rand(5, 10)), PYRO_ANOMALY, 3)
/obj/machinery/power/supermatter_crystal/proc/supermatter_pull(turf/center, pull_range = 3)
playsound(center, 'sound/items/weapons/marauder.ogg', 100, TRUE, extrarange = pull_range - world.view)
@@ -166,17 +166,19 @@
switch(type)
if(FLUX_ANOMALY)
var/explosive = has_changed_lifespan ? FLUX_NO_EXPLOSION : FLUX_LOW_EXPLOSIVE
new /obj/effect/anomaly/flux(local_turf, has_changed_lifespan ? rand(250, 350) : null, FALSE, explosive)
new /obj/effect/anomaly/flux(local_turf, has_changed_lifespan ? rand(25 SECONDS, 35 SECONDS) : null, FALSE, explosive)
if(GRAVITATIONAL_ANOMALY)
new /obj/effect/anomaly/grav(local_turf, has_changed_lifespan ? rand(200, 300) : null, FALSE)
new /obj/effect/anomaly/grav(local_turf, has_changed_lifespan ? rand(20 SECONDS, 30 SECONDS) : null, FALSE)
if(PYRO_ANOMALY)
new /obj/effect/anomaly/pyro(local_turf, has_changed_lifespan ? rand(150, 250) : null, FALSE)
new /obj/effect/anomaly/pyro(local_turf, has_changed_lifespan ? rand(15 SECONDS, 25 SECONDS) : null, FALSE)
if(HALLUCINATION_ANOMALY)
new /obj/effect/anomaly/hallucination(local_turf, has_changed_lifespan ? rand(150, 250) : null, FALSE)
new /obj/effect/anomaly/hallucination(local_turf, has_changed_lifespan ? rand(15 SECONDS, 25 SECONDS) : null, FALSE)
if(VORTEX_ANOMALY)
new /obj/effect/anomaly/bhole(local_turf, 20, FALSE)
new /obj/effect/anomaly/bhole(local_turf, 2 SECONDS, FALSE)
if(BIOSCRAMBLER_ANOMALY)
new /obj/effect/anomaly/bioscrambler/docile(local_turf, null, FALSE)
if(DIMENSIONAL_ANOMALY)
new /obj/effect/anomaly/dimensional(local_turf, null, FALSE)
#undef CHANCE_EQUATION_SLOPE
#undef INTEGRITY_EXPONENTIAL_DEGREE