Files
Bubberstation/code/modules/power/singularity/singularity.dm
LemonInTheDark 4b4e9dff1d Wallening [IDB IGNORE] [MDB IGNORE] (#85491)
## What's going on here

Kept you waitin huh!

This pr resprites most all walls, windows and other "wall adjacent"
things to a 3/4th perspective, technical term is "tall" walls (we are
very smart).

If you're trying to understand the technical details here, much of the
"rendering tech" is built off the idea of split-vis. Basically, split a
sprite up and render it on adjacent turfs, to prevent seeing "through"
walls/doors, and to support seeing "edges" without actually seeing the
atom itself.

Most of the rest of it is pipelining done to accommodate how icons are
cut.

## Path To Merge

Almost* all sprites and code is done at this point. 
There are some things missing both on and off the bounty list, but that
will be the case forever unless we force upstream (you guys) to stop
adding new shit that doesn't fit the style.
I plan on accepting and integrating prs to the current working repo
<https://github.com/wall-nerds/wallening> up until a merge, to make
contribution simpler and allow things like bounties to close out more
easily

This pr is quite bulky, even stripping away map changes it's maybe 7000
LOC (We have a few maps that were modified with UpdatePaths, I am also
tentatively pring our test map, for future use.)
This may inhibit proper review, although that is part of why I am
willing to make it despite my perfectionism. Apologies in advance.

Due to the perspective shift, a lot of mapping work is going to need to
be done at some point. This comes in varying levels of priority. Many
wallmounts are offset by hand, some are stuck in the wall/basically
cannot be placed on the east/west/north edges of walls (posters), some
just don't look great good in their current position.

Tests are currently a minor bit yorked, I thought it was more important
to get this up then to clean them fully.

## What does it look like?


![dreamseeker_hBsU6wCu91](https://github.com/user-attachments/assets/5392fa3b-60f6-40ea-876f-e686f25f996a)

![dreamseeker_CTiK0Je5iR](https://github.com/user-attachments/assets/1aee23bd-a5ec-4679-b094-d044401b7222)

![dreamseeker_HYkS1Q9GRq](https://github.com/user-attachments/assets/bad8844b-3179-4856-8684-f912e14e844a)

![dreamseeker_Pa18tgyKYp](https://github.com/user-attachments/assets/c2e1d222-9e5c-4500-8829-dd065428644a)

![dreamseeker_BfOBwS2mjH](https://github.com/user-attachments/assets/7dc51153-111d-4b17-93c3-8389daa6b60b)

![dreamseeker_iJazOumiMQ](https://github.com/user-attachments/assets/5837e203-3865-4f60-854e-62b4875c6b99)

## Credits

<details>
<summary>Historical Mumbojumbo</summary>

I am gonna do my best to document how this project came to be. I am
operating off third party info and half remembered details, so if I'm
wrong please yell at me.

This project started sometime in late 2020, as a product of Rohesie
trying to integrate and make easier work from Mojave Sun (A recently
defunct fallout server) with /tg/.

Mojave Sun (Apparently this was LITERALLY JUST infrared baron, that man
is insane) was working with tall walls, IE walls that are 48px tall
instead of the normal 32. This was I THINK done based off a technical
prototype from aao7 proving A it was possible and B it didn't look like
dogwater.

This alongside oranges begging the art team for 3/4th walls (he meant
TGMC style) lead to Rohesie bringing on contributors from general /tg/,
including actionninja who would eventually take over as technical lead
and Kryson, who would define /tg/'s version of the artstyle. Much of the
formative aspects of this project are their work.

The project was coming along pretty well for a few months, but ran into
serious technical issues with `SIDE_MAP`, a byond map_format that allows
for simpler 3/4th rendering.
Due to BULLSHIT I will not detail here, the map format caused issues
both at random with flickering and heavily with multiz.

Concurrent with this, action stepped down after hacking out the
rendering tech and starting work on an icon cutter that would allow for
simpler icon generation, leaving ninjanomnom to manage the project.

Some time passed, and the project stalled out due to the technical
issues. Eventually I built a test case for the issues we had with
`SIDE_MAP` and convinced lummox jr (byond's developer) to explain how
the fuckin thing actually worked. This understanding made the project
theoretically possible, but did not resolve the problems with multi-z.
Resolving those required a full rework of how rendering like, worked. I
(alongside tattle) took over project development from ninjanomnom at
this time, and started work on Plane Cube (#69115), which when finished
would finally make the project technically feasible.

The time between then and now has been slow, progressive work. Many many
artists and technical folks have dumped their time into this (as you can
see from the credits). I will get into this more below but I would like
to explicitly thank (in no particular order) tattle, draco, arcanemusic,
actionninja, imaginos, viro and kylerace for keeping the project alive
in this time period. I would have curled up into a ball and died if I
had to do this all myself, your help has been indispensable.

</details>

<details>
<summary>Detailed Credits</summary>

Deep apologies if I have forgotten someone (I am sure I have, if someone
is you please contact me). I've done my best to collate from the git
log/my memory.

Thanks to (In no particular order):
Raccoff: Being funny to bully, creating threshold decals for airlocks
aa07: (I think) inspiring the project
ActionNinja: Laying the technical rock we build off, supporting me
despite byond trying to kill him, building the icon cutter that makes
this possible
ArcaneMusic: Artistic and technical work spanning from the project's
start to literally today, being a constant of motivation and positivity.
I can't list all the stuff he's done
Armhulen: Key rendering work (he's the reason thindows render right), an
upbeat personality and a kick in the ass. Love you arm
Azlan: Damn cool sprites, consistently
Ben10Omintrix: You know ben showed up just to make basic mobs work, he's
just fuckin like that man
BigBimmer: A large amount of bounty work, alongside just like, throwing
shit around. An absolute joy to work with
Capsandi: Plaques, blastdoors, artistic work early on
CapybaraExtravagante: Rendering work on wall frames
Draco: SO MUCH STUFF. Much of the spritework done over the past two
years is his, constantly engaged and will take on anything. I would have
given up if not for you
Floyd: Early rendering work, so early I don't even know the details.
Enjoy freedom brother
Imaginos16: A guiding hand through the middle years, handled much of the
sprite review and contribution for a good bit there
Iamgoofball: A dedication to detail and aesthetic goals, spends a lot of
effort dissecting feedback with a focus on making things as good as they
can be at the jump
Infrared: Part of the impetus for the project, made all the xenomorph
stuff in the MS style
Jacquerel: A bunch of little upkeep/technical things, has done so much
sprite gruntwork (WHY ARE THERE SO MANY PAINTING TYPES)
Justice12354: Solved a bunch of error sprites (and worked out how to
actually make prs to the project) Thanks bro!
Kryson: Built the artstyle of the project, carrying on for years even
when it was technically dying, only stopping to casually beat cancer. So
much of our style and art is Kryson
KylerAce: Handled annoying technical stuff for me, built window frame
logic and fully got rid of grilles.
LemonInTheDark: Rendering dirtywork, project management and just so much
fucking time in dreammaker editing sprites
Meyhazah: Table buttons, brass windows and alll the old style doors
Mothblocks: Has provided constant support, gave me a deadline and
motivation, erased worries about "it not being done", gave just SO much
money to fill in the critical holes in sprites. Thanks moth
MTandi: Contributed art despite his own blackjack and hookers club
opening right down the road, I'm sorry I rolled over some of your
sprites man I wish we had finished earlier
Ninjanomnomnom: Consulted on gags issues, kept things alive through some
truly shit times
oranges: This is his fault
Rohesie: Organized the effort, did much of the initial like, proof of
concept stuff. I hope you're doin well whatever you're up to.
san7890: Consulting on mapper UX/design problems, being my pet mapper
Senefi: Offsetting items with a focus on detail/the more unused
canidates
SimplyLogan: Detailed map work and mapper feedback, personally very kind
even if we end up talking past each other sometimes. Thank you!
SpaceSmithers: Just like, random mapping support out of nowhere, and
bein a straight up cool dude
Tattle: A bunch of misc project management stuff, organizing the
discord, managing the test server, dealing with all the mapping bullshit
for me, being my backup in case of bus. I know you think you didn't do
much but your presence and work have been a great help
Thunder12345: Came out of nowhere and just so much of the random
bounties, I'm kind of upset about how much we paid him
Time-Green: I hooked him in by fucking with stuff he made and now he's
just doin shit, thanks for helping out man!
Twaticus: Provided artistic feedback and authority for my poor feeble
coder brain, believed in the project for YEARS, was a constant source of
❤️ and affirmation
unit0016: I have no god damn idea who she is, popped out of nowhere on
the github one day and dealt with a bunch of annoying
rendering/refactoring. Godspeed random furry thank you for all your
effort and issue reports
Viro: A bunch of detailed spriting moving towards 3/4ths, both on and
off the wallening fork. If anyone believed this project would be done,
it was viro
Wallem: Artistic review and consultation, was my go-to guy for a long
time when the other two spritetainers were inactive
Waltermeldon: Cracked out a bunch of rendering work, he's the reason
windows look like not dogwater. Alongside floyd and action spent a TON
of time speaking to lummox/unearthing how byond rendering worked trying
to make this thing happen
ZephyrTFA: Added directional airlock helpers, dealt with a big fuckin
bugaboo that was living in my brain like it was nothing. Love you
brother

And finally:
The Mojave Sun development team. They provided a testbed for the idea,
committed hundreds and hundreds of hours to the artstyle, and were a
large reason we caught issues early enough to meaningfully deal with
them. Your work is a testament to what longterm effort and deep detailed
care produce. I hope you're doing well whatever you're up to. Go out
with a bang!
</details>

## Changelog
🆑 Raccoff, aa07, ActionNinja, ArcaneMusic, Armhulen, Azlan,
Ben10Omintrix, BigBimmer, Capsandi, CapybaraExtravagante, Draco, Floyd,
Iamgoofball, Imaginos16, Infrared, Jacquerel, Justice12354, Kryson,
KylerAce, LemonInTheDark, Meyhazah, Mothblocks, MTandi, Ninjanomnom,
oranges, Rohesie, Runi-c, san7890, Senefi, SimplyLogan, SomeAngryMiner,
SpaceSmithers, Tattle, Thunder12345, Time-Green, Twaticus, unit0016,
Viro, Waltermeldon, ZephyrTFA with thanks to the Mojave Sun team!
add: Resprites or offsets almost all "tall" objects in the game to match
a 3/4ths perspective
add: Bunch of rendering mumbo jumbo to make said 3/4ths perspective work
/🆑

---------

Co-authored-by: Jacquerel <hnevard@gmail.com>
Co-authored-by: san7890 <the@san7890.com>
Co-authored-by: = <stewartareid@outlook.com>
Co-authored-by: Capsandi <dansullycc@gmail.com>
Co-authored-by: ArcaneMusic <hero12290@aol.com>
Co-authored-by: tattle <66640614+dragomagol@users.noreply.github.com>
Co-authored-by: SomeAngryMiner <53237389+SomeAngryMiner@users.noreply.github.com>
Co-authored-by: KylerAce <kylerlumpkin1@gmail.com>
Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com>
Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com>
Co-authored-by: lessthanthree <83487515+lessthnthree@users.noreply.github.com>
Co-authored-by: Ben10Omintrix <138636438+Ben10Omintrix@users.noreply.github.com>
Co-authored-by: Runi-c <5150427+Runi-c@users.noreply.github.com>
Co-authored-by: Roryl-c <5150427+Roryl-c@users.noreply.github.com>
Co-authored-by: tattle <article.disaster@gmail.com>
Co-authored-by: Senefi <20830349+Peliex@users.noreply.github.com>
Co-authored-by: Justice <42555530+Justice12354@users.noreply.github.com>
Co-authored-by: BluBerry016 <50649185+unit0016@users.noreply.github.com>
Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com>
Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
Co-authored-by: SimplyLogan <47579821+loganuk@users.noreply.github.com>
Co-authored-by: Emmett Gaines <ninjanomnom@gmail.com>
Co-authored-by: Rob Bailey <github@criticalaction.net>
Co-authored-by: MMMiracles <lolaccount1@hotmail.com>
2024-08-14 09:07:45 +00:00

514 lines
16 KiB
Plaintext

/// The gravitational singularity
/obj/singularity
name = "gravitational singularity"
desc = "A gravitational singularity."
icon = 'icons/obj/machines/engine/singularity.dmi'
icon_state = "singularity_s1"
anchored = TRUE
density = TRUE
move_resist = INFINITY
plane = ABOVE_LIGHTING_PLANE
light_range = 6
appearance_flags = LONG_GLIDE
/// the prepended string to the icon state (singularity_s1, dark_matter_s1, etc)
var/singularity_icon_variant = "singularity"
/// The singularity component itself.
/// A weak ref in case an admin removes the component to preserve the functionality.
var/datum/weakref/singularity_component
/// type of singularity component made
var/singularity_component_type = /datum/component/singularity
///Current singularity size, from 1 to 6
var/current_size = 1
///Current allowed size for the singulo
var/allowed_size = 1
///maximum size this singuloth can get to.
var/maximum_stage = STAGE_SIX
///How strong are we?
var/energy = 100
///Do we lose energy over time?
var/dissipate = TRUE
/// How long should it take for us to dissipate in seconds?
var/dissipate_delay = 20
/// How much energy do we lose every dissipate_delay?
var/dissipate_strength = 1
/// How long its been (in seconds) since the last dissipation
var/time_since_last_dissipiation = 0
///Prob for event each tick
var/event_chance = 10
///Can i move by myself?
var/move_self = TRUE
///If the singularity has eaten a supermatter shard and can go to stage six
var/consumed_supermatter = FALSE
/// Is the black hole collapsing into nothing
var/collapsing = FALSE
/// How long it's been since the singulo last acted, in seconds
var/time_since_act = 0
/// What the game tells ghosts when you make one
var/ghost_notification_message = "IT'S LOOSE"
pass_flags = PASSTABLE | PASSGLASS | PASSGRILLE | PASSCLOSEDTURF | PASSMACHINE | PASSSTRUCTURE | PASSDOORS
flags_1 = SUPERMATTER_IGNORES_1
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF | SHUTTLE_CRUSH_PROOF
obj_flags = CAN_BE_HIT | DANGEROUS_POSSESSION
/obj/singularity/Initialize(mapload, starting_energy = 50)
. = ..()
energy = starting_energy
START_PROCESSING(SSsinguloprocess, src)
SSpoints_of_interest.make_point_of_interest(src)
var/datum/component/singularity/new_component = AddComponent(
singularity_component_type, \
consume_callback = CALLBACK(src, PROC_REF(consume)), \
)
singularity_component = WEAKREF(new_component)
expand(current_size)
for (var/obj/machinery/power/singularity_beacon/singu_beacon as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/power/singularity_beacon))
if (singu_beacon.active)
new_component.target = singu_beacon
break
if (!mapload)
notify_ghosts(
ghost_notification_message,
source = src,
header = ghost_notification_message,
ghost_sound = 'sound/machines/warning-buzzer.ogg',
notify_volume = 75,
)
/obj/singularity/Destroy()
STOP_PROCESSING(SSsinguloprocess, src)
return ..()
/obj/singularity/attack_tk(mob/user)
if(!iscarbon(user))
return
. = COMPONENT_CANCEL_ATTACK_CHAIN
var/mob/living/carbon/jedi = user
jedi.visible_message(
span_danger("[jedi]'s head begins to collapse in on itself!"),
span_userdanger("Your head feels like it's collapsing in on itself! This was really not a good idea!"),
span_hear("You hear something crack and explode in gore.")
)
jedi.Stun(3 SECONDS)
new /obj/effect/gibspawner/generic(get_turf(jedi), jedi)
jedi.apply_damage(30, BRUTE, BODY_ZONE_HEAD)
if(QDELETED(jedi))
return // damage was too much
if(jedi.stat == DEAD)
jedi.ghostize()
var/obj/item/bodypart/head/rip_u = jedi.get_bodypart(BODY_ZONE_HEAD)
rip_u.dismember(BURN) //nice try jedi
qdel(rip_u)
return
addtimer(CALLBACK(src, PROC_REF(carbon_tk_part_two), jedi), 0.1 SECONDS)
/obj/singularity/proc/carbon_tk_part_two(mob/living/carbon/jedi)
if(QDELETED(jedi))
return
new /obj/effect/gibspawner/generic(get_turf(jedi), jedi)
jedi.apply_damage(30, BRUTE, BODY_ZONE_HEAD)
if(QDELETED(jedi))
return // damage was too much
if(jedi.stat == DEAD)
jedi.ghostize()
var/obj/item/bodypart/head/rip_u = jedi.get_bodypart(BODY_ZONE_HEAD)
if(rip_u)
rip_u.dismember(BURN)
qdel(rip_u)
return
addtimer(CALLBACK(src, PROC_REF(carbon_tk_part_three), jedi), 0.1 SECONDS)
/obj/singularity/proc/carbon_tk_part_three(mob/living/carbon/jedi)
if(QDELETED(jedi))
return
new /obj/effect/gibspawner/generic(get_turf(jedi), jedi)
jedi.apply_damage(30, BRUTE, BODY_ZONE_HEAD)
if(QDELETED(jedi))
return // damage was too much
jedi.ghostize()
var/obj/item/bodypart/head/rip_u = jedi.get_bodypart(BODY_ZONE_HEAD)
if(rip_u)
rip_u.dismember(BURN)
qdel(rip_u)
/obj/singularity/ex_act(severity, target)
switch(severity)
if(EXPLODE_DEVASTATE)
if(current_size <= STAGE_TWO)
investigate_log("has been destroyed by a heavy explosion.", INVESTIGATE_ENGINE)
qdel(src)
return
energy -= round(((energy + 1) / 2), 1)
if(EXPLODE_HEAVY)
energy -= round(((energy + 1) / 3), 1)
if(EXPLODE_LIGHT)
energy -= round(((energy + 1) / 4), 1)
return TRUE
/obj/singularity/process(seconds_per_tick)
time_since_act += seconds_per_tick
if(time_since_act < 2)
return
time_since_act = 0
if(current_size >= STAGE_TWO)
if(prob(event_chance))
event()
dissipate(seconds_per_tick)
check_energy()
/obj/singularity/proc/dissipate(seconds_per_tick)
if (!dissipate)
return
time_since_last_dissipiation += seconds_per_tick
// Uses a while in case of especially long delta times
while (time_since_last_dissipiation >= dissipate_delay)
energy -= dissipate_strength
time_since_last_dissipiation -= dissipate_delay
/obj/singularity/proc/expand(force_size)
var/temp_allowed_size = allowed_size
if(force_size)
temp_allowed_size = force_size
if(temp_allowed_size >= STAGE_SIX && !consumed_supermatter)
temp_allowed_size = STAGE_FIVE
//cap it off if the singuloth has a maximum stage
temp_allowed_size = min(temp_allowed_size, maximum_stage)
if(temp_allowed_size == maximum_stage)
//It cant go smaller due to e loss
dissipate = FALSE
var/new_grav_pull
var/new_consume_range
switch(temp_allowed_size)
if(STAGE_ONE)
current_size = STAGE_ONE
icon = 'icons/obj/machines/engine/singularity.dmi'
icon_state = "[singularity_icon_variant]_s1"
pixel_x = 0
pixel_y = 0
new_grav_pull = 4
new_consume_range = 0
dissipate_delay = 10
time_since_last_dissipiation = 0
dissipate_strength = 1
if(STAGE_TWO)
if(check_cardinals_range(1, TRUE))
current_size = STAGE_TWO
icon = 'icons/effects/96x96.dmi'
icon_state = "[singularity_icon_variant]_s3"
pixel_x = -32
pixel_y = -32
new_grav_pull = 6
new_consume_range = 1
dissipate_delay = 5
time_since_last_dissipiation = 0
dissipate_strength = 5
if(STAGE_THREE)
if(check_cardinals_range(2, TRUE))
current_size = STAGE_THREE
icon = 'icons/effects/160x160.dmi'
icon_state = "[singularity_icon_variant]_s5"
pixel_x = -64
pixel_y = -64
new_grav_pull = 8
new_consume_range = 2
dissipate_delay = 4
time_since_last_dissipiation = 0
dissipate_strength = 20
if(STAGE_FOUR)
if(check_cardinals_range(3, TRUE))
current_size = STAGE_FOUR
icon = 'icons/effects/224x224.dmi'
icon_state = "[singularity_icon_variant]_s7"
pixel_x = -96
pixel_y = -96
new_grav_pull = 10
new_consume_range = 3
dissipate_delay = 10
time_since_last_dissipiation = 0
dissipate_strength = 10
if(STAGE_FIVE)//this one also lacks a check for gens because it eats everything
current_size = STAGE_FIVE
icon = 'icons/effects/288x288.dmi'
icon_state = "[singularity_icon_variant]_s9"
pixel_x = -128
pixel_y = -128
new_grav_pull = 10
new_consume_range = 4
dissipate = FALSE //It cant go smaller due to e loss
if(STAGE_SIX) //This only happens if a stage 5 singulo consumes a supermatter shard.
current_size = STAGE_SIX
icon = 'icons/effects/352x352.dmi'
icon_state = "[singularity_icon_variant]_s11"
pixel_x = -160
pixel_y = -160
new_grav_pull = 15
new_consume_range = 5
dissipate = FALSE
if(temp_allowed_size == STAGE_SIX)
AddComponent(/datum/component/vision_hurting)
else
qdel(GetComponent(/datum/component/vision_hurting))
var/datum/component/singularity/resolved_singularity = singularity_component.resolve()
if (!isnull(resolved_singularity))
resolved_singularity.consume_range = new_consume_range
resolved_singularity.grav_pull = new_grav_pull
resolved_singularity.disregard_failed_movements = current_size >= STAGE_FIVE
resolved_singularity.roaming = move_self && current_size >= STAGE_TWO
resolved_singularity.singularity_size = current_size
if(current_size == allowed_size)
investigate_log("grew to size [current_size].", INVESTIGATE_ENGINE)
return TRUE
else if(current_size < (--temp_allowed_size))
expand(temp_allowed_size)
else
return FALSE
/obj/singularity/proc/check_energy()
if(energy <= 0)
investigate_log("collapsed.", INVESTIGATE_ENGINE)
qdel(src)
return FALSE
switch(energy)//Some of these numbers might need to be changed up later -Mport
if(1 to 199)
allowed_size = STAGE_ONE
if(200 to 499)
allowed_size = STAGE_TWO
if(500 to 999)
allowed_size = STAGE_THREE
if(1000 to 1999)
allowed_size = STAGE_FOUR
if(2000 to INFINITY)
if(energy >= 3000 && consumed_supermatter)
allowed_size = STAGE_SIX
else
allowed_size = STAGE_FIVE
if(current_size != allowed_size)
expand()
return TRUE
/obj/singularity/proc/consume(atom/thing)
if(istype(thing, /obj/item/storage/backpack/holding) && !consumed_supermatter && !collapsing)
consume_boh(thing)
return
var/gain = thing.singularity_act(current_size, src)
energy += gain
if(istype(thing, /obj/machinery/power/supermatter_crystal) && !consumed_supermatter)
supermatter_upgrade()
/obj/singularity/proc/supermatter_upgrade()
name = "supermatter-charged [initial(name)]"
desc = "[initial(desc)] It glows fiercely with inner fire."
consumed_supermatter = TRUE
set_light(10)
/obj/singularity/proc/consume_boh(obj/boh)
collapsing = TRUE
name = "unstable [initial(name)]"
desc = "[initial(desc)] It seems to be collapsing in on itself."
visible_message(
message = span_danger("As [src] consumes [boh], it begins to collapse in on itself!"),
blind_message = span_hear("You hear aggressive crackling!"),
vision_distance = 15,
)
playsound(loc, 'sound/effects/clockcult_gateway_disrupted.ogg', 200, vary = TRUE, extrarange = 3, falloff_exponent = 1, frequency = -1, pressure_affected = FALSE, ignore_walls = TRUE, falloff_distance = 7)
addtimer(CALLBACK(src, PROC_REF(consume_boh_sfx)), 4 SECONDS)
animate(src, time = 4 SECONDS, transform = transform.Scale(0.25), flags = ANIMATION_PARALLEL, easing = ELASTIC_EASING)
animate(time = 0.5 SECONDS, alpha = 0)
QDEL_IN(src, 4.1 SECONDS)
qdel(boh)
/obj/singularity/proc/consume_boh_sfx()
playsound(loc, 'sound/effects/supermatter.ogg', 200, vary = TRUE, extrarange = 3, falloff_exponent = 1, frequency = 0.5, pressure_affected = FALSE, ignore_walls = TRUE, falloff_distance = 7)
/obj/singularity/proc/check_cardinals_range(steps, retry_with_move = FALSE)
. = length(GLOB.cardinals) //Should be 4.
for(var/i in GLOB.cardinals)
. -= check_turfs_in(i, steps) //-1 for each working direction
if(. && retry_with_move) //If there's still a positive value it means it didn't pass. Retry with move if applicable
for(var/i in GLOB.cardinals)
if(step(src, i)) //Move in each direction.
if(check_cardinals_range(steps, FALSE)) //New location passes, return true.
return TRUE
return !.
/obj/singularity/proc/check_turfs_in(direction = 0, step = 0)
if(!direction)
return FALSE
var/steps = 0
if(!step)
switch(current_size)
if(STAGE_ONE)
steps = 1
if(STAGE_TWO)
steps = 2
if(STAGE_THREE)
steps = 3
if(STAGE_FOUR)
steps = 4
if(STAGE_FIVE)
steps = 5
else
steps = step
var/list/turfs = list()
var/turf/considered_turf = loc
for(var/i in 1 to steps)
considered_turf = get_step(considered_turf,direction)
if(!isturf(considered_turf))
return FALSE
turfs.Add(considered_turf)
var/dir2 = 0
var/dir3 = 0
switch(direction)
if(NORTH, SOUTH)
dir2 = 4
dir3 = 8
if(EAST, WEST)
dir2 = 1
dir3 = 2
var/turf/other_turf = considered_turf
for(var/j = 1 to steps-1)
other_turf = get_step(other_turf,dir2)
if(!isturf(other_turf))
return FALSE
turfs.Add(other_turf)
for(var/k = 1 to steps-1)
considered_turf = get_step(considered_turf,dir3)
if(!isturf(considered_turf))
return FALSE
turfs.Add(considered_turf)
for(var/turf/check_turf in turfs)
if(isnull(check_turf))
continue
if(!can_move(check_turf))
return FALSE
return TRUE
/obj/singularity/proc/can_move(turf/considered_turf)
if(!considered_turf)
return FALSE
if (HAS_TRAIT(considered_turf, TRAIT_CONTAINMENT_FIELD))
return FALSE
return TRUE
/obj/singularity/proc/event()
var/numb = rand(1,4)
switch(numb)
if(1)//EMP
emp_area()
if(2)//Stun mobs who lack optic scanners
mezzer()
if(3,4) //Sets all nearby mobs on fire
if(current_size < STAGE_SIX)
return FALSE
combust_mobs()
else
return FALSE
return TRUE
/obj/singularity/proc/combust_mobs()
for(var/mob/living/carbon/burned_mob in urange(20, src, 1))
burned_mob.visible_message(
span_warning("[burned_mob]'s skin bursts into flame!"),
span_userdanger("You feel an inner fire as your skin bursts into flames!")
)
burned_mob.adjust_fire_stacks(5)
burned_mob.ignite_mob()
return
/obj/singularity/proc/mezzer()
for(var/mob/living/carbon/stunned_mob in oviewers(8, src))
if(stunned_mob.stat == DEAD || stunned_mob.is_blind())
continue
if(!ishuman(stunned_mob))
apply_stun(stunned_mob)
continue
var/mob/living/carbon/human/stunned_human = stunned_mob
if(istype(stunned_human.glasses, /obj/item/clothing/glasses/meson))
var/obj/item/clothing/glasses/meson/check_meson = stunned_human.glasses
if(check_meson.vision_flags & SEE_TURFS)
to_chat(stunned_human, span_notice("You look directly into the [name], good thing you had your protective eyewear on!"))
continue
apply_stun(stunned_mob)
/obj/singularity/proc/apply_stun(mob/living/carbon/stunned_mob)
stunned_mob.apply_effect(60, EFFECT_STUN)
stunned_mob.visible_message(
span_danger("[stunned_mob] stares blankly at the [name]!"),
span_userdanger("You look directly into the [name] and feel weak.")
)
/obj/singularity/proc/emp_area()
empulse(src, 8, 10)
/obj/singularity/singularity_act()
var/gain = (energy/2)
var/dist = max((current_size - 2),1)
investigate_log("has been destroyed by another singularity.", INVESTIGATE_ENGINE)
explosion(
src,
devastation_range = dist,
heavy_impact_range = dist * 2,
light_impact_range = dist * 4
)
qdel(src)
return gain
/obj/singularity/deadchat_plays(mode = DEMOCRACY_MODE, cooldown = 12 SECONDS)
. = AddComponent(/datum/component/deadchat_control/cardinal_movement, mode, list(), cooldown, CALLBACK(src, PROC_REF(stop_deadchat_plays)))
if(. == COMPONENT_INCOMPATIBLE)
return
move_self = FALSE
/obj/singularity/proc/stop_deadchat_plays()
move_self = TRUE
/obj/singularity/deadchat_controlled/Initialize(mapload, starting_energy)
. = ..()
deadchat_plays(mode = DEMOCRACY_MODE)
/// Special singularity that spawns for shuttle events only
/obj/singularity/shuttle_event
anchored = FALSE
/// Special singularity spawned by being sucked into a black hole during emagged orion trail.
/obj/singularity/orion
move_self = FALSE
/obj/singularity/orion/Initialize(mapload)
. = ..()
var/datum/component/singularity/singularity = singularity_component.resolve()
singularity?.grav_pull = 1
/obj/singularity/orion/process(seconds_per_tick)
if(SPT_PROB(0.5, seconds_per_tick))
mezzer()