Skip to content

Commit

Permalink
[PORT] [READY] Refactor sm delam into a different file + New Anomaly+…
Browse files Browse the repository at this point in the history
… Anomaly Code improvements + New Resonance Cascade effects + Improved Blob Delam code (#20109)

New resonance cascade effects because old one is boring as shit, this should make the crew panic DEATH RATE: >60%
New hallucination anomaly which creates powerful hallucination pulses.
Each of the reactive armors now have unique negative effects when emp'ed.
Each of the reactive armors now have unique negative effects when emp'ed.
Moves supermatter delamination to its own datum.
Nerf rad anomly particle counts after death
Rad anomaly no longer spin and shoot particles on death, instead shoot at the same time with less particles and release one rad goat only for rad anomaly goat type, should improve performance
Nerfed particle counts of each tick to 5 particles and buff rad pulse to 10000
Nerfed particle counts when anomaly dies to 15 particles and buff rad pulse to 20000
replaces airraid.ogg with a new one from tg
new anomaly and core sprites
new radiation core sprite
fixes overlay of action button for reactive armor
fixes reactive armor sprite not update when active on body
add a fucking supermatter tesla (spawned by SM resonance cascade)
tesla_zap now has dust ability and ignore mob with godmode or spirit
tesla_zap can hit atmos machines, grille and simple animals (except for hostile one and slime)
Improved blob delam code and make the delam more deadly
  • Loading branch information
warface1234455 authored Oct 22, 2023
1 parent 176904c commit 8370bd2
Show file tree
Hide file tree
Showing 49 changed files with 951 additions and 454 deletions.
22 changes: 22 additions & 0 deletions code/__DEFINES/anomalies.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
///Defines for anomaly types
#define ANOMALY_FLUX "flux_anomaly"
#define ANOMALY_FLUX_EXPLOSIVE "flux_explosive_anomaly"
#define ANOMALY_GRAVITATIONAL "gravitational_anomaly"
#define ANOMALY_HALLUCINATION "hallucination_anomaly"
#define ANOMALY_PYRO "pyro_anomaly"
#define ANOMALY_BLUESPACE "bluespace_anomaly"
#define ANOMALY_VORTEX "vortex_anomaly"
#define ANOMALY_RADIATION "radiation_anomaly"
#define ANOMALY_RADIATION_X "radiation_goat_anomaly"

///Defines for area allowances
#define ANOMALY_AREA_BLACKLIST list(/area/ai_monitored/turret_protected/ai,/area/ai_monitored/turret_protected/ai_upload,/area/engine,/area/solar,/area/holodeck,/area/shuttle)
#define ANOMALY_AREA_SUBTYPE_WHITELIST list(/area/engine/break_room)

///Defines for the different types of explosion a flux anomaly can have
#define ANOMALY_FLUX_NO_EXPLOSION 0
#define ANOMALY_FLUX_EXPLOSION 1

///Defines if rad anomaly can spawn rad goat can have
#define ANOMALY_RADIATION_NO_GOAT 0
#define ANOMALY_RADIATION_YES_GOAT 1
1 change: 1 addition & 0 deletions code/__DEFINES/power.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define SOLAR_TRACK_TIMED 1
#define SOLAR_TRACK_AUTO 2

#define TESLA_HYPERCHARGED_POWER TESLA_DEFAULT_POWER*2
#define TESLA_DEFAULT_POWER 1738260
#define TESLA_MINI_POWER 869130
//Multiplier of all power consumed.
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/_machinery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ Class Procs:
/obj/machinery/proc/can_be_overridden()
. = 1

/obj/machinery/tesla_act(power, tesla_flags, shocked_objects)
/obj/machinery/tesla_act(power, tesla_flags, shocked_objects, zap_gib = FALSE)
..()
if((tesla_flags & TESLA_MACHINE_EXPLOSIVE) && !(resistance_flags & INDESTRUCTIBLE))
if(prob(60))
Expand Down
155 changes: 110 additions & 45 deletions code/game/objects/effects/anomalies.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
/// Chance of taking a step per second
#define ANOMALY_MOVECHANCE 45

/////////////////////

/obj/effect/anomaly
name = "anomaly"
desc = "A mysterious anomaly, seen commonly only in the region of space that the station orbits..."
Expand All @@ -10,6 +12,7 @@
anchored = TRUE
light_range = 3
var/obj/item/assembly/signaler/anomaly/aSignal
var/core_type
var/area/impact_area

var/lifespan = 990
Expand All @@ -18,16 +21,32 @@
var/countdown_colour
var/obj/effect/countdown/anomaly/countdown

/// Do we keep on living forever?
var/immortal = FALSE

/obj/effect/anomaly/Initialize(mapload, new_lifespan)
. = ..()
GLOB.poi_list |= src
START_PROCESSING(SSobj, src)
impact_area = get_area(src)

aSignal = new(src)
aSignal.name = "[name] core"
switch(core_type)
if(ANOMALY_RADIATION)
aSignal = new /obj/item/assembly/signaler/anomaly/radiation(src)
if(ANOMALY_HALLUCINATION)
aSignal = new /obj/item/assembly/signaler/anomaly/hallucination(src)
if(ANOMALY_FLUX)
aSignal = new /obj/item/assembly/signaler/anomaly/flux(src)
if(ANOMALY_GRAVITATIONAL)
aSignal = new /obj/item/assembly/signaler/anomaly/grav(src)
if(ANOMALY_PYRO)
aSignal = new /obj/item/assembly/signaler/anomaly/pyro(src)
if(ANOMALY_BLUESPACE)
aSignal = new /obj/item/assembly/signaler/anomaly/bluespace(src)
if(ANOMALY_VORTEX)
aSignal = new /obj/item/assembly/signaler/anomaly/vortex(src)

aSignal.code = rand(1,100)
aSignal.anomaly_type = type

var/frequency = rand(MIN_FREE_FREQ, MAX_FREE_FREQ)
if(ISMULTIPLE(frequency, 2))//signaller frequencies are always uneven!
Expand All @@ -37,14 +56,16 @@
if(new_lifespan)
lifespan = new_lifespan
death_time = world.time + lifespan
if(immortal)
return // no countdown for forever anomalies
countdown = new(src)
if(countdown_colour)
countdown.color = countdown_colour
countdown.start()

/obj/effect/anomaly/process(delta_time)
anomalyEffect(delta_time)
if(death_time < world.time)
if(death_time < world.time && !immortal)
if(loc)
detonate()
qdel(src)
Expand Down Expand Up @@ -84,6 +105,7 @@
/obj/effect/anomaly/grav
name = "gravitational anomaly"
icon_state = "shield2"
core_type = ANOMALY_GRAVITATIONAL
density = FALSE
var/boing = 0

Expand Down Expand Up @@ -140,10 +162,14 @@
/obj/effect/anomaly/flux
name = "flux wave anomaly"
icon_state = "electricity2"
core_type = ANOMALY_FLUX
density = FALSE // so it doesn't awkwardly block movement when it doesn't stun you
var/canshock = 0
var/shockdamage = 30
var/explosive = TRUE
var/explosive = ANOMALY_FLUX_NO_EXPLOSION

/obj/effect/anomaly/flux/explosion
explosive = ANOMALY_FLUX_EXPLOSION

/obj/effect/anomaly/flux/anomalyEffect(delta_time)
..()
Expand Down Expand Up @@ -184,20 +210,19 @@
span_italics("You hear a heavy electrical crack."))

/obj/effect/anomaly/flux/detonate()
if(explosive)
message_admins("An anomaly has detonated.") //yogs
log_game("An anomaly has detonated.") //yogs
explosion(src, 1, 4, 16, 18) //Low devastation, but hits a lot of stuff.
else
new /obj/effect/particle_effect/sparks(loc)

switch(explosive)
if(ANOMALY_FLUX_EXPLOSION)
explosion(src, devastation_range = 1, heavy_impact_range = 4, light_impact_range = 16, flash_range = 18) //Low devastation, but hits a lot of stuff.
if(ANOMALY_FLUX_NO_EXPLOSION)
new /obj/effect/particle_effect/sparks(loc)

/////////////////////

/obj/effect/anomaly/bluespace
name = "bluespace anomaly"
icon = 'icons/obj/projectiles.dmi'
icon_state = "bluespace"
core_type = ANOMALY_BLUESPACE
density = TRUE

/obj/effect/anomaly/bluespace/anomalyEffect()
Expand Down Expand Up @@ -269,6 +294,7 @@
name = "pyroclastic anomaly"
icon_state = "pyro"
color = "#ffa952"
core_type = ANOMALY_PYRO
var/ticks = 0
/// How many seconds between each gas release
var/releasedelay = 10
Expand Down Expand Up @@ -308,6 +334,7 @@
/obj/effect/anomaly/bhole
name = "vortex anomaly"
icon_state = "bhole3"
core_type = ANOMALY_VORTEX
desc = "That's a nice station you have there. It'd be a shame if something happened to it."

/obj/effect/anomaly/bhole/anomalyEffect()
Expand Down Expand Up @@ -371,51 +398,89 @@
/////////////////////////
/obj/effect/anomaly/radiation
name = "radiation anomaly"
icon = 'icons/obj/projectiles.dmi'
icon_state = "radiation_anomaly"
core_type = ANOMALY_RADIATION
density = TRUE
var/spawn_goat = FALSE //For goat spawning
var/spawn_goat = ANOMALY_RADIATION_NO_GOAT //For goat spawning

/obj/effect/anomaly/radiation/admin //bussing
spawn_goat = TRUE
/obj/effect/anomaly/radiation/goat //bussing
spawn_goat = ANOMALY_RADIATION_YES_GOAT

/obj/effect/anomaly/radiation/anomalyEffect()
..()
for(var/i = 1 to 15)
for(var/i = 1 to 5)
fire_nuclear_particle()
radiation_pulse(src, 500, 5)
radiation_pulse(src, 10000, 5)

/obj/effect/anomaly/radiation/proc/makegoat()
var/turf/open/T = get_turf(src)
var/mob/living/simple_animal/hostile/retaliate/goat/radioactive/S = new(T)

var/list/mob/dead/observer/candidates = pollCandidatesForMob("Do you want to play as a radioactive goat?", ROLE_SENTIENCE, null, null, 100, S, POLL_IGNORE_PYROSLIME)
if(LAZYLEN(candidates))
var/mob/dead/observer/chosen = pick(candidates)
S.key = chosen.key
var/datum/action/cooldown/spell/conjure/radiation_anomaly/spell
spell.Grant(S)
log_game("[key_name(S.key)] was made into a radioactive goat by radiation anomaly at [AREACOORD(T)].")
for(var/i=1 to 15)
fire_nuclear_particle()
radiation_pulse(src, 20000, 7)
if(spawn_goat == ANOMALY_RADIATION_YES_GOAT)
var/turf/open/T = get_turf(src)
var/mob/living/simple_animal/hostile/retaliate/goat/radioactive/S = new(T)

var/list/mob/dead/observer/candidates = pollCandidatesForMob("Do you want to play as a radioactive goat?", ROLE_SENTIENCE, null, null, 100, S, POLL_IGNORE_PYROSLIME)
if(LAZYLEN(candidates))
var/mob/dead/observer/chosen = pick(candidates)
S.key = chosen.key
var/datum/action/cooldown/spell/conjure/radiation_anomaly/spell
spell.Grant(S)
log_game("[key_name(S.key)] was made into a radioactive goat by radiation anomaly at [AREACOORD(T)].")

/obj/effect/anomaly/radiation/detonate()
INVOKE_ASYNC(src, PROC_REF(rad_Spin))
INVOKE_ASYNC(src, PROC_REF(makegoat))

/obj/effect/anomaly/radiation/proc/rad_Spin(increment = 1)
if(increment > 100)
if(spawn_goat)//only spawn the goat once, when the anomaly explodes
INVOKE_ASYNC(src, PROC_REF(makegoat))
qdel(src)
radiation_pulse(src, 5000, 7)
var/turf/T = get_turf(src)
var/angle = increment * 10
T.fire_nuclear_particle(angle)
addtimer(CALLBACK(src, PROC_REF(rad_Spin), increment + 1), 0.7)

/////////////////////

/obj/effect/anomaly/radiation/process(delta_time)
anomalyEffect(delta_time)
if(death_time < world.time)
if(loc)
detonate()
/obj/effect/anomaly/hallucination
name = "hallucination anomaly"
icon_state = "hallucination_anomaly"
core_type = ANOMALY_HALLUCINATION
/// Time passed since the last effect, increased by delta_time of the SSobj
var/ticks = 0
/// How many seconds between each small hallucination pulses
var/release_delay = 5

/obj/effect/anomaly/hallucination/anomalyEffect(delta_time)
. = ..()
ticks += delta_time
if(ticks < release_delay)
return
ticks -= release_delay
var/turf/open/our_turf = get_turf(src)
if(istype(our_turf))
hallucination_pulse(our_turf, 5)

/obj/effect/anomaly/hallucination/detonate()
var/turf/open/our_turf = get_turf(src)
if(istype(our_turf))
hallucination_pulse(our_turf, 10)

/proc/hallucination_pulse(turf/location, range, strength = 50)
for(var/mob/living/carbon/human/near in view(location, range))
// If they are immune to hallucinations
if (HAS_TRAIT(near, TRAIT_MESONS) || (near.mind && HAS_TRAIT(near.mind, TRAIT_MESONS)))
continue

// Blind people don't get hallucinations
if (is_blind(near))
continue

// Everyone else
var/dist = sqrt(1 / max(1, get_dist(near, location)))
near.adjust_hallucinations(max(150, strength * dist))
near.adjust_jitter(10 SECONDS)
near.adjust_confusion(10 SECONDS)
near.adjust_dizzy(10 SECONDS)
near.adjust_drowsiness(10 SECONDS)
var/static/list/messages = list(
"You feel your conscious mind fall apart!",
"Reality warps around you!",
"Something's wispering around you!",
"You are going insane!",
"What was that?!"
)
to_chat(near, span_warning("[pick(messages)]"))

#undef ANOMALY_MOVECHANCE
4 changes: 2 additions & 2 deletions code/game/objects/obj_defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,13 @@ GLOBAL_DATUM_INIT(acid_overlay, /mutable_appearance, mutable_appearance('icons/e
SSfire_burning.processing -= src

///Called when the obj is hit by a tesla bolt.
/obj/proc/tesla_act(power, tesla_flags, shocked_targets)
/obj/proc/tesla_act(power, tesla_flags, shocked_targets, zap_gib = FALSE)
obj_flags |= BEING_SHOCKED
addtimer(CALLBACK(src, PROC_REF(reset_shocked)), 10)
if(power < TESLA_MINI_POWER) //tesla bolts bounce twice, tesla miniball bolts bounce only once
return
var/power_bounced = power / 2
tesla_zap(src, 3, power_bounced, tesla_flags, shocked_targets)
tesla_zap(src, 3, power_bounced, tesla_flags, shocked_targets, zap_gib)

//The surgeon general warns that being buckled to certain objects receiving powerful shocks is greatly hazardous to your health
///Only tesla coils and grounding rods currently call this because mobs are already targeted over all other objects, but this might be useful for more things later.
Expand Down
2 changes: 1 addition & 1 deletion code/modules/antagonists/blob/structures/_blob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
if(prob(100 - severity * 30))
new /obj/effect/temp_visual/emp(get_turf(src))

/obj/structure/blob/tesla_act(power)
/obj/structure/blob/tesla_act(power, tesla_flags, shocked_targets, zap_gib = FALSE)
..()
if(overmind)
if(overmind.blobstrain.tesla_reaction(src, power))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/antagonists/clockcult/clock_mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
/mob/living/simple_animal/hostile/clockwork/ratvar_act()
fully_heal(TRUE)

/mob/living/simple_animal/hostile/clockwork/electrocute_act(shock_damage, obj/source, siemens_coeff = 1, safety = 0, tesla_shock = 0, illusion = 0, stun = TRUE)
/mob/living/simple_animal/hostile/clockwork/electrocute_act(shock_damage, obj/source, siemens_coeff = 1, safety = 0, tesla_shock = 0, illusion = 0, stun = TRUE, gib = FALSE)
return 0 //ouch, my metal-unlikely-to-be-damaged-by-electricity-body

/mob/living/simple_animal/hostile/clockwork/examine(mob/user)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/antagonists/nukeop/equipment/nuclearbomb.dm
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@
return
qdel(src)

/obj/machinery/nuclearbomb/tesla_act(power, tesla_flags)
/obj/machinery/nuclearbomb/tesla_act(power, tesla_flags, shocked_targets, zap_gib = FALSE)
..()
if(tesla_flags & TESLA_MACHINE_EXPLOSIVE)
qdel(src)//like the singulo, tesla deletes it. stops it from exploding over and over
Expand Down
36 changes: 34 additions & 2 deletions code/modules/assembly/signaler.dm
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
/obj/item/assembly/signaler/anomaly
name = "anomaly core"
desc = "The neutralized core of an anomaly. It'd probably be valuable for research."
icon_state = "anomaly core"
icon_state = "anomaly_core"
item_state = "electronic"
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
Expand Down Expand Up @@ -217,10 +217,42 @@
/obj/item/assembly/signaler/anomaly/attack_self()
return

//Anomaly cores
/obj/item/assembly/signaler/anomaly/pyro
name = "\improper pyroclastic anomaly core"
desc = "The neutralized core of a pyroclastic anomaly. It feels warm to the touch. It'd probably be valuable for research."
anomaly_type = /obj/effect/anomaly/pyro

/obj/item/assembly/signaler/anomaly/grav
name = "\improper gravitational anomaly core"
desc = "The neutralized core of a gravitational anomaly. It feels much heavier than it looks. It'd probably be valuable for research."
anomaly_type = /obj/effect/anomaly/grav

/obj/item/assembly/signaler/anomaly/flux
name = "\improper flux anomaly core"
desc = "The neutralized core of a flux anomaly. Touching it makes your skin tingle. It'd probably be valuable for research."
anomaly_type = /obj/effect/anomaly/flux

/obj/item/assembly/signaler/anomaly/bluespace
name = "\improper bluespace anomaly core"
desc = "The neutralized core of a bluespace anomaly. It keeps phasing in and out of view. It'd probably be valuable for research."
anomaly_type = /obj/effect/anomaly/bluespace

/obj/item/assembly/signaler/anomaly/vortex
name = "\improper vortex anomaly core"
desc = "The neutralized core of a vortex anomaly. It won't sit still, as if some invisible force is acting on it. It'd probably be valuable for research."
anomaly_type = /obj/effect/anomaly/bhole

/obj/item/assembly/signaler/anomaly/hallucination
name = "\improper hallucination anomaly core"
desc = "The neutralized core of a hallucination anomaly. It seems to be moving, but it's probably your imagination. It'd probably be valuable for research."
icon_state = "hallucination_core"
anomaly_type = /obj/effect/anomaly/hallucination

/obj/item/assembly/signaler/anomaly/radiation
name = "\improper radiation anomaly core"
desc = "The neutralized core of a radiation anomaly. It keeps pulsing an ominous green. It'd probably be valuable for research."
icon_state = "anomaly core"
icon_state = "radiation_core"
anomaly_type = /obj/effect/anomaly/radiation

/obj/item/assembly/signaler/cyborg
Expand Down
Loading

0 comments on commit 8370bd2

Please sign in to comment.