Skip to content

Commit

Permalink
[PORT] The roundstart SM Crystal delamination now spawns anomalies ac…
Browse files Browse the repository at this point in the history
…ross the station + New Anomalies + Anomaly Code improvements (BeeStation#6857)

* why does all my supermatter keep blowing up

* we need to port _list.dm cleanups

* I have no idea why no anomalies spawn

* forgot to global define anomaly types 😳

* rebalance sm delamination anomalies amount (tgstation#66390)

* Refactor supermatter proximity effects (tgstation#55653)

* Reactive armor now has user-dangerous effects when it is EMP'd, updates table armor to 2021 (+Documentation) (tgstation#56408)

* Reactive armour code improvements (tgstation#63586)

* Anomaly expansion - part 1 - Hallucination anomaly (tgstation#66392)

* No build errors

* (tgstation#66420) Anomaly expansion - part 2 - Delimber anomaly

* my bad

* why does compiler want to delete things from beestation.dme 😳

* ticked anomaly delimber

* Fix monkey attack message + spawn a glass table

* actually lets just force the table to shatter regardless of gravity

* updates
  • Loading branch information
mystery3525 authored Aug 2, 2022
1 parent bcb3a46 commit 2f45a1b
Show file tree
Hide file tree
Showing 16 changed files with 703 additions and 222 deletions.
4 changes: 4 additions & 0 deletions beestation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
#include "code\__DEFINES\dcs\flags.dm"
#include "code\__DEFINES\dcs\helpers.dm"
#include "code\__DEFINES\dcs\signals.dm"
#include "code\__DEFINES\research\anomalies.dm"
#include "code\__HELPERS\_extools_api.dm"
#include "code\__HELPERS\_lists.dm"
#include "code\__HELPERS\_logging.dm"
Expand Down Expand Up @@ -2008,8 +2009,10 @@
#include "code\modules\events\alien_infestation.dm"
#include "code\modules\events\anomaly.dm"
#include "code\modules\events\anomaly_bluespace.dm"
#include "code\modules\events\anomaly_delimber.dm"
#include "code\modules\events\anomaly_flux.dm"
#include "code\modules\events\anomaly_grav.dm"
#include "code\modules\events\anomaly_hallucination.dm"
#include "code\modules\events\anomaly_pyro.dm"
#include "code\modules\events\anomaly_vortex.dm"
#include "code\modules\events\asteroid_impact.dm"
Expand Down Expand Up @@ -2876,6 +2879,7 @@
#include "code\modules\power\singularity\particle_accelerator\particle_control.dm"
#include "code\modules\power\singularity\particle_accelerator\particle_emitter.dm"
#include "code\modules\power\supermatter\supermatter.dm"
#include "code\modules\power\supermatter\supermatter_delamination.dm"
#include "code\modules\power\tesla\coil.dm"
#include "code\modules\power\tesla\energy_ball.dm"
#include "code\modules\power\tesla\generator.dm"
Expand Down
19 changes: 19 additions & 0 deletions code/__DEFINES/research/anomalies.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
///Defines for anomaly types
#define ANOMALY_DELIMBER "delimber_anomaly"
#define ANOMALY_FLUX "flux_anomaly"
#define ANOMALY_GRAVITATIONAL "gravitational_anomaly"
#define ANOMALY_HALLUCINATION "hallucination_anomaly"
#define ANOMALY_PYRO "pyro_anomaly"
#define ANOMALY_VORTEX "vortex_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 weighted anomaly chances
#define ANOMALY_WEIGHTS list(ANOMALY_GRAVITATIONAL = 55, ANOMALY_HALLUCINATION = 45, ANOMALY_DELIMBER = 35, ANOMALY_FLUX = 25, ANOMALY_PYRO = 5, ANOMALY_VORTEX = 1)

///Defines for the different types of explosion a flux anomaly can have
#define ANOMALY_FLUX_NO_EXPLOSION 0
#define ANOMALY_FLUX_EXPLOSIVE 1
#define ANOMALY_FLUX_LOW_EXPLOSIVE 2
5 changes: 5 additions & 0 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,11 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
#define TRAIT_DROPS_ITEMS_ON_DEATH "drops_items_on_death" //used for battle royale
#define TRAIT_DRINKSBLOOD "drinks_blood"

// You can stare into the abyss, but it does not stare back.
// You're immune to the hallucination effect of the supermatter, either
// through force of will, or equipment.
#define TRAIT_MADNESS_IMMUNE "supermatter_madness_immune"

//non-mob traits
#define TRAIT_PARALYSIS "paralysis" //Used for limb-based paralysis, where replacing the limb will fix it

Expand Down
174 changes: 164 additions & 10 deletions code/game/objects/effects/anomalies.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
/// Chance of taking a step per second
#define ANOMALY_MOVECHANCE 45

/// Lists for zones and bodyparts to swap and randomize
#define ANOMALY_DELIMBER_ZONES list(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_L_ARM, BODY_ZONE_R_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG)
#define ANOMALY_DELIMBER_ZONE_CHEST typesof(/obj/item/bodypart/chest)
#define ANOMALY_DELIMBER_ZONE_HEAD typesof(/obj/item/bodypart/head)
#define ANOMALY_DELIMBER_ZONE_L_LEG typesof(/obj/item/bodypart/l_arm)
#define ANOMALY_DELIMBER_ZONE_R_LEG typesof(/obj/item/bodypart/r_arm)
#define ANOMALY_DELIMBER_ZONE_L_ARM typesof(/obj/item/bodypart/l_leg)
#define ANOMALY_DELIMBER_ZONE_R_ARM typesof(/obj/item/bodypart/r_leg)
#define ANOMALY_DELIMBER_ZONE_ORGANS typesof(/obj/item/organ) - typesof(/obj/item/organ/brain) - typesof(/obj/item/organ/body_egg) - /obj/item/organ/alien/eggsac - /obj/item/organ/zombie_infection

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

/obj/effect/anomaly
name = "anomaly"
desc = "A mysterious anomaly, seen commonly only in the region of space that the station orbits..."
Expand All @@ -20,6 +32,9 @@
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
Expand All @@ -39,14 +54,17 @@
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 @@ -153,11 +171,11 @@
density = TRUE
var/canshock = 0
var/shockdamage = 20
var/explosive = TRUE
var/explosive = ANOMALY_FLUX_EXPLOSIVE

/obj/effect/anomaly/flux/Initialize(mapload, new_lifespan, drops_core = TRUE, _explosive = TRUE)
/obj/effect/anomaly/flux/Initialize(mapload, new_lifespan, drops_core = TRUE, explosive = ANOMALY_FLUX_EXPLOSIVE)
. = ..()
explosive = _explosive
src.explosive = explosive
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
Expand Down Expand Up @@ -196,12 +214,13 @@
"<span class='italics'>You hear a heavy electrical crack.</span>")

/obj/effect/anomaly/flux/detonate()
if(explosive)
explosion(src, 1, 4, 16, 18) //Low devastation, but hits a lot of stuff.
log_game("A flux anomaly has detonated at [loc].")
message_admins("A flux anomaly has detonated at [ADMIN_VERBOSEJMP(loc)].")
else
new /obj/effect/particle_effect/sparks(loc)
switch(explosive)
if(ANOMALY_FLUX_EXPLOSIVE)
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_LOW_EXPLOSIVE)
explosion(src, heavy_impact_range = 1, light_impact_range = 4, flash_range = 6)
if(ANOMALY_FLUX_NO_EXPLOSION)
new /obj/effect/particle_effect/sparks(loc)


/////////////////////
Expand Down Expand Up @@ -375,3 +394,138 @@
SSexplosions.medturf += T
if(EXPLODE_LIGHT)
SSexplosions.lowturf += T

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

/obj/effect/anomaly/hallucination
name = "hallucination anomaly"
icon_state = "hallucination_anomaly"
aSignal = /obj/item/assembly/signaler/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_MADNESS_IMMUNE) || (near.mind && HAS_TRAIT(near.mind, TRAIT_MADNESS_IMMUNE)))
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.hallucination += strength * dist
near.hallucination = clamp(near.hallucination, 0, 150)
var/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 class='warning'>[pick(messages)]</span>")

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

/obj/effect/anomaly/delimber
name = "delimber anomaly"
icon_state = "delimber_anomaly"
aSignal = /obj/item/assembly/signaler/anomaly/delimber
immortal = TRUE
/// Cooldown for every anomaly pulse
COOLDOWN_DECLARE(pulse_cooldown)
/// How many seconds between each anomaly pulses
var/pulse_delay = 15 SECONDS
/// Range of the anomaly pulse
var/range = 5

/obj/effect/anomaly/delimber/Initialize(mapload, new_lifespan)
. = ..()
if(new_lifespan)
immortal = FALSE //manually override the immortality lifespan

/obj/effect/anomaly/delimber/anomalyEffect(delta_time)
. = ..()

if(!COOLDOWN_FINISHED(src, pulse_cooldown))
return

COOLDOWN_START(src, pulse_cooldown, pulse_delay)

delimber_pulse(src, range)

/proc/delimber_pulse(atom/owner, range = 5, ignore_owner = FALSE, message_admins = FALSE)
var/list/mob/living/carbon/affected = list()
for(var/mob/living/carbon/target in range(range, owner))
if(!ignore_owner && target == owner)
continue
if(target.run_armor_check(attack_flag = "bio", absorb_text = "Your armor protects you from [owner]!") >= 100)
continue //We are protected

// Add target
affected += target

// Insert a random organ
var/obj/item/organ/picked_organ = pick(ANOMALY_DELIMBER_ZONE_ORGANS)
var/obj/item/organ/new_organ = new picked_organ
new_organ.Insert(target, TRUE, FALSE)

// Replace a random limb
var/picked_zone = pick(ANOMALY_DELIMBER_ZONES)
var/obj/item/bodypart/picked_user_part = target.get_bodypart(picked_zone)
if(!picked_user_part)
target.update_body(TRUE)
target.balloon_alert(target, "something has changed about you")
return
var/obj/item/bodypart/picked_part
switch(picked_zone)
if(BODY_ZONE_HEAD)
picked_part = pick(ANOMALY_DELIMBER_ZONE_HEAD)
if(BODY_ZONE_CHEST)
picked_part = pick(ANOMALY_DELIMBER_ZONE_CHEST)
if(BODY_ZONE_L_ARM)
picked_part = pick(ANOMALY_DELIMBER_ZONE_L_ARM)
if(BODY_ZONE_R_ARM)
picked_part = pick(ANOMALY_DELIMBER_ZONE_R_ARM)
if(BODY_ZONE_L_LEG)
picked_part = pick(ANOMALY_DELIMBER_ZONE_L_LEG)
if(BODY_ZONE_R_LEG)
picked_part = pick(ANOMALY_DELIMBER_ZONE_R_LEG)
var/obj/item/bodypart/new_part = new picked_part()
new_part.replace_limb(target, TRUE, is_creating = TRUE)
qdel(picked_user_part)
target.update_body(TRUE)
target.balloon_alert(target, "something has changed about you")

if(message_admins)
message_admins("[ADMIN_LOOKUPFLW(owner)] has caused a delimber pulse affecting [english_list(affected)].")
log_game("[key_name(owner)] has caused a delimber pulse affecting [english_list(affected)].")

#undef ANOMALY_MOVECHANCE
#undef ANOMALY_DELIMBER_ZONES
#undef ANOMALY_DELIMBER_ZONE_CHEST
#undef ANOMALY_DELIMBER_ZONE_HEAD
#undef ANOMALY_DELIMBER_ZONE_L_LEG
#undef ANOMALY_DELIMBER_ZONE_R_LEG
#undef ANOMALY_DELIMBER_ZONE_L_ARM
#undef ANOMALY_DELIMBER_ZONE_R_ARM
#undef ANOMALY_DELIMBER_ZONE_ORGANS
12 changes: 12 additions & 0 deletions code/modules/assembly/signaler.dm
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,18 @@
icon_state = "vortex core"
anomaly_type = /obj/effect/anomaly/bhole

/obj/item/assembly/signaler/anomaly/delimber
name = "\improper delimber anomaly core"
desc = "The neutralized core of a delimber anomaly. It's squirming, as if moving. It'd probably be valuable for research."
icon_state = "delimber core"
anomaly_type = /obj/effect/anomaly/delimber

/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/attack_self()
return

Expand Down
9 changes: 9 additions & 0 deletions code/modules/clothing/glasses/_glasses.dm
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE
glass_colour_type = /datum/client_colour/glass_colour/lightgreen

/obj/item/clothing/glasses/meson/equipped(mob/user, slot)
. = ..()
if(ishuman(user) && slot == ITEM_SLOT_EYES)
ADD_TRAIT(user, TRAIT_MADNESS_IMMUNE, CLOTHING_TRAIT)

/obj/item/clothing/glasses/meson/dropped(mob/user)
. = ..()
REMOVE_TRAIT(user, TRAIT_MADNESS_IMMUNE, CLOTHING_TRAIT)

/obj/item/clothing/glasses/meson/suicide_act(mob/living/carbon/user)
user.visible_message("<span class='suicide'>[user] is putting \the [src] to [user.p_their()] eyes and overloading the brightness! It looks like [user.p_theyre()] trying to commit suicide!</span>")
return BRUTELOSS
Expand Down
Loading

0 comments on commit 2f45a1b

Please sign in to comment.