Files
Bubberstation/code/modules/research/ordnance/doppler_array.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

314 lines
12 KiB
Plaintext

/obj/machinery/doppler_array
SET_BASE_VISUAL_PIXEL(0, DEPTH_OFFSET)
name = "tachyon-doppler array"
desc = "A highly precise directional sensor array which measures the release of quants from decaying tachyons. The doppler shifting of the mirror-image formed by these quants can reveal the size, location and temporal affects of energetic disturbances within a large radius ahead of the array.\n"
circuit = /obj/item/circuitboard/machine/doppler_array
icon = 'icons/obj/machines/research.dmi'
icon_state = "tdoppler"
base_icon_state = "tdoppler"
density = TRUE
verb_say = "states coldly"
var/cooldown = 10
var/next_announce = 0
var/max_dist = 150
/// Number which will be part of the name of the next record, increased by one for each already created record
var/record_number = 1
/// List of all explosion records in the form of /datum/data/tachyon_record
var/list/records = list()
/// Reference to a disk we are going to print to.
var/obj/item/computer_disk/inserted_disk
// Lighting system to better communicate the directions.
light_system = OVERLAY_LIGHT_DIRECTIONAL
light_range = 4
light_power = 1.5
light_color = COLOR_RED
/obj/machinery/doppler_array/Initialize(mapload)
. = ..()
RegisterSignal(SSdcs, COMSIG_GLOB_EXPLOSION, PROC_REF(sense_explosion))
RegisterSignal(src, COMSIG_MACHINERY_POWER_LOST, PROC_REF(update_doppler_light))
RegisterSignal(src, COMSIG_MACHINERY_POWER_RESTORED, PROC_REF(update_doppler_light))
update_doppler_light()
// Rotation determines the detectable direction.
AddComponent(/datum/component/simple_rotation)
/datum/data/tachyon_record
name = "Log Recording"
var/timestamp
var/coordinates = ""
var/displacement = 0
var/factual_radius = list()
var/theory_radius = list()
/// Indexed to length 3 if filled properly. Should be an empty list otherwise.
var/reaction_results = list()
var/explosion_identifier
/obj/machinery/doppler_array/examine(mob/user)
. = ..()
. += span_notice("It is currently facing [dir2text(dir)]")
/obj/machinery/doppler_array/attackby(obj/item/item, mob/user, params)
if(istype(item, /obj/item/computer_disk))
var/obj/item/computer_disk/disk = item
eject_disk(user)
if(user.transferItemToLoc(disk, src))
inserted_disk = disk
return
else
balloon_alert(user, "it's stuck to your hand!")
return ..()
return ..()
/obj/machinery/doppler_array/wrench_act(mob/living/user, obj/item/tool)
default_unfasten_wrench(user, tool)
return ITEM_INTERACT_SUCCESS
/obj/machinery/doppler_array/screwdriver_act(mob/living/user, obj/item/tool)
if(!default_deconstruction_screwdriver(user, "[base_icon_state]", "[base_icon_state]", tool))
return FALSE
power_change()
update_appearance()
return TRUE
/obj/machinery/doppler_array/crowbar_act(mob/living/user, obj/item/tool)
if(!default_deconstruction_crowbar(tool))
return FALSE
return TRUE
/// Printing of a record into a disk.
/obj/machinery/doppler_array/proc/print(mob/user, datum/data/tachyon_record/record)
if(!record || !inserted_disk)
return
var/datum/computer_file/data/ordnance/explosive/record_data = new
record_data.filename = "Doppler Array " + record.name //Doppler Array Log Recording #x
record_data.explosion_record = record
record_data.possible_experiments = apply_experiments(record)
if(inserted_disk.add_file(record_data))
playsound(src, 'sound/machines/ping.ogg', 25)
else
playsound(src, 'sound/machines/terminal_error.ogg', 25)
/**
* Checks a specified tachyon record for fitting reactions, then returns a list with
* the experiment typepath as key and score as value.
* The score is the same for all explosive experiments (light radius).
*/
/obj/machinery/doppler_array/proc/apply_experiments(datum/data/tachyon_record/record)
var/list/passed_experiments = list()
var/list/record_reactions = record.reaction_results
var/list/radius_used = length(record.theory_radius) ? record.theory_radius : record.factual_radius
var/explosion_score = radius_used["shockwave_radius"]
if(!explosion_score) // Dont even bother.
return passed_experiments
/// Early return for explosions without proper reaction_results. We will append experiments that are always fair game.
if(!record_reactions.len)
for (var/datum/experiment/ordnance/explosive/experiment in SSresearch.ordnance_experiments)
if(experiment.allow_any_source)
passed_experiments += list(experiment.type = explosion_score)
return passed_experiments
for (var/datum/experiment/ordnance/explosive/experiment in SSresearch.ordnance_experiments)
var/list/experiment_reactions = experiment.required_reactions
/// The reactions in record.reaction_results that corresponds to the required_reactions list.
var/list/fitting_reactions = list()
/// The reactions in required_reactions list that are missing in record.reaction_results.
var/list/missing_reactions = list()
/// The reactions in record.reaction_results that are not present in required_reactions list.
var/list/extra_reactions = list()
for(var/reaction in experiment_reactions)
if(reaction in record_reactions[TANK_RESULTS_REACTION])
fitting_reactions += reaction
else
missing_reactions += reaction
for(var/reaction in record_reactions[TANK_RESULTS_REACTION])
if(!(reaction in fitting_reactions))
extra_reactions += reaction
// Check for extra reactions.
if(experiment.sanitized_reactions && extra_reactions.len)
continue
// Check for misc properties
if(experiment.sanitized_misc && length(record_reactions[TANK_RESULTS_MISC]))
continue
// Check for missing reactions for those who require all.
if(experiment.require_all && missing_reactions.len)
continue
// For those who only need one, check if there is actually one.
if(!experiment.require_all && experiment_reactions.len)
if(!fitting_reactions.len)
continue
// Suceeded all check, append to the returned list.
passed_experiments += list(experiment.type = explosion_score)
return passed_experiments
/// Sensing, recording, and broadcasting of explosion
/obj/machinery/doppler_array/proc/sense_explosion(datum/source, turf/epicenter, devastation_range, heavy_impact_range, light_impact_range,
took, orig_dev_range, orig_heavy_range, orig_light_range, explosion_cause, explosion_index)
SIGNAL_HANDLER
var/list/fetched_reaction_results = list()
if(istype(explosion_cause, /obj/item/tank))
var/obj/item/tank/exploding_tank = explosion_cause
fetched_reaction_results = exploding_tank.explosion_information()
if(machine_stat & NOPOWER)
return FALSE
var/turf/zone = get_turf(src)
if(!is_valid_z_level(zone, epicenter))
return FALSE
if(next_announce > world.time)
return FALSE
next_announce = world.time + cooldown
if((get_dist(epicenter, zone) > max_dist) || !(get_dir(zone, epicenter) & dir))
return FALSE
var/datum/data/tachyon_record/new_record = new /datum/data/tachyon_record()
new_record.name = "Log Recording #[record_number]"
new_record.timestamp = station_time_timestamp()
new_record.coordinates = "[epicenter.x], [epicenter.y]"
new_record.displacement = took
new_record.factual_radius["epicenter_radius"] = devastation_range
new_record.factual_radius["outer_radius"] = heavy_impact_range
new_record.factual_radius["shockwave_radius"] = light_impact_range
new_record.reaction_results = fetched_reaction_results
new_record.explosion_identifier = explosion_index
var/list/messages = list("Explosive disturbance detected.",
"Epicenter at: grid ([epicenter.x], [epicenter.y]). Temporal displacement of tachyons: [took] seconds.",
"Factual: Epicenter radius: [devastation_range]. Outer radius: [heavy_impact_range]. Shockwave radius: [light_impact_range].",
)
// If the bomb was capped, say its theoretical size.
if(devastation_range < orig_dev_range || heavy_impact_range < orig_heavy_range || light_impact_range < orig_light_range)
messages += "Theoretical: Epicenter radius: [orig_dev_range]. Outer radius: [orig_heavy_range]. Shockwave radius: [orig_light_range]."
new_record.theory_radius["epicenter_radius"] = orig_dev_range
new_record.theory_radius["outer_radius"] = orig_heavy_range
new_record.theory_radius["shockwave_radius"] = orig_light_range
for(var/message in messages)
say(message)
record_number++
records += new_record
return TRUE
/obj/machinery/doppler_array/proc/eject_disk(mob/user)
if(!inserted_disk)
return FALSE
if(user)
user.put_in_hands(inserted_disk)
else
inserted_disk.forceMove(drop_location())
playsound(src, 'sound/machines/card_slide.ogg', 50)
return TRUE
/// We rely on exited to clear references.
/obj/machinery/doppler_array/Exited(atom/movable/gone, direction)
if(gone == inserted_disk)
inserted_disk = null
return ..()
/obj/machinery/doppler_array/powered()
if(panel_open)
return FALSE
return ..()
/obj/machinery/doppler_array/update_overlays()
. = ..()
if(panel_open)
. += mutable_appearance(icon, "[base_icon_state]_open")
else
. += mutable_appearance(icon,"[base_icon_state]_cable")
if(machine_stat & BROKEN) // Probably meant to be used on an indestructible doppler, but this is not implemented.
. += mutable_appearance(icon, "[base_icon_state]_screen-broken")
else if (machine_stat & NOPOWER)
. += mutable_appearance(icon, "[base_icon_state]_screen-off")
/obj/machinery/doppler_array/on_deconstruction(disassembled)
eject_disk()
. = ..()
/obj/machinery/doppler_array/Destroy()
inserted_disk = null
QDEL_NULL(records) //We only want the list nuked, not the contents.
. = ..()
/obj/machinery/doppler_array/proc/update_doppler_light()
SIGNAL_HANDLER
set_light_on(!(machine_stat & NOPOWER))
/obj/machinery/doppler_array/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "DopplerArray", name)
ui.open()
/obj/machinery/doppler_array/ui_data(mob/user)
var/list/data = list()
data["records"] = list()
data["disk"] = inserted_disk?.name
data["storage"] = "[inserted_disk?.used_capacity] / [inserted_disk?.max_capacity] GQ"
for(var/datum/data/tachyon_record/singular_record in records)
var/list/record_data = list(
"name" = singular_record.name,
"timestamp" = singular_record.timestamp,
"coordinates" = singular_record.coordinates,
"displacement" = singular_record.displacement,
"factual_epicenter_radius" = singular_record.factual_radius["epicenter_radius"],
"factual_outer_radius" = singular_record.factual_radius["outer_radius"],
"factual_shockwave_radius" = singular_record.factual_radius["shockwave_radius"],
"theory_epicenter_radius" = singular_record.theory_radius["epicenter_radius"],
"theory_outer_radius" = singular_record.theory_radius["outer_radius"],
"theory_shockwave_radius" = singular_record.theory_radius["shockwave_radius"],
"reaction_results" = list(),
"ref" = REF(singular_record)
)
var/list/reaction_data = singular_record.reaction_results
// Make sure the list is indexed first.
if(reaction_data.len)
for (var/path in reaction_data[TANK_RESULTS_REACTION])
var/datum/gas_reaction/reaction_path = path
record_data["reaction_results"] += initial(reaction_path.name)
if(TANK_MERGE_OVERPRESSURE in reaction_data[TANK_RESULTS_MISC])
record_data["reaction_results"] += "Tank overpressurized before reaction"
data["records"] += list(record_data)
return data
/obj/machinery/doppler_array/ui_act(action, list/params)
. = ..()
if(.)
return
switch(action)
if("delete_record")
var/datum/data/tachyon_record/record = locate(params["ref"]) in records
if(!records || !(record in records))
return
records -= record
return TRUE
if("save_record")
var/datum/data/tachyon_record/record = locate(params["ref"]) in records
if(!records || !(record in records))
return
print(usr, record)
return TRUE
if("eject_disk")
eject_disk(usr)