* Fixes complex lights not handling moving well, renames lighting defines (#81423)
## About The Pull Request
[Fixes static lights not
moving](ffef43c05a)
Worked fine when the owner moved, but if the owner was inside something
else, it would try and trigger an update on the PARENT's lights, which
are obviously not us.
[Renames MOVABLE_LIGHT and STATIC_LIGHT to better describe what they
do](de73a63bd4)
People keep trying to change the lighting system of lamps and it makes
me mad.
I choose OVERLAY_LIGHT and COMPLEX_LIGHT here, I couldn't figure out a
better name for turf matrix lighting. Suggestions welcome
## Why It's Good For The Game
Closes#80005
Hopefully improves understanding of lighting at a glance
## Changelog
🆑
fix: Fixes fancy lights not updating their source location when picked
up and moved
/🆑
* Oh well
---------
Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: Useroth <37159550+Useroth@users.noreply.github.com>
* Adds lighting height control (space color consistency) (#79046)
## About The Pull Request
Adds support for modifying a light's "height"
You can think of this as the distance it is from the ground below it
(Really it's the distance to the corners around it + 0.5 but yaknow) We
use it to keep wall lights from looking weird, but well, not everything
is a wall light
Floors tend to not be, and space in particular does not want to be
treated as such.
In fact, it wants a NEGATIVE height, so it acts as if it in on top of
all of its corners. This allows us to ensure that the starlight from
space and the starlight from starlight overlays always have the same
intensity and color, preventing weird lines from where the two
intersect, or starlight feeling not very present in cases with only one
turf
I've also bumped starlight's intensity form 0.75 to 1, this should help
with the lines thing discussed above.
## Why It's Good For The Game

## Changelog
🆑
add: Starlight should be a bit more intense, and flow better onto non
space tiles
/🆑
---------
Co-authored-by: Zephyr <12817816+ZephyrTFA@ users.noreply.github.com>
Co-authored-by: san7890 <the@ san7890.com>
* Adds lighting height control (space color consistency)
---------
Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: Zephyr <12817816+ZephyrTFA@ users.noreply.github.com>
Co-authored-by: san7890 <the@ san7890.com>
* Starlight Control (Aurora works now, space gas doesn't touch starlight, narsie ending effects) (#78877)
## About The Pull Request
[Implements a setter for starlight
variables](af34f06b41)
I want to start to modify starlight more, and that means I need a way to
hook into everything that uses it and update it, so we can modify it on
the fly.
This does that, alongside removing space overlays from nearspace (too
many false positives) and making the aurora modify all turfs projecting
starlight, rather then all turfs in an area.
Do still need to figure out handling for the starlight color usage in
turf underlays tho (I gave up, we just keep it static. I'll fix it
someday but the render_relay strategy just doesn't work with its masking
setup)
[Reworks how starlight overlays
work](9da4bc38e2)
Instead of setting color on the overlays directly, we instead store an
object with our current settings in every mob's screen, and
render_target it down onto our overlays.
This lets us update overlay colors VERY trivially. Just need to set
color on the overlay var. Makes modifying starlight a lot cheaper.
It doesn't work on area overlays, because suffering, and it MIGHT induce
extra cost on clients. if it does we can do something about that, we'll
play it by ear
[Removes parallax starlight
coloring.](5f701a1b13)
I'm sorta iffy on the color, the effect can be real oppressive in some
cases, and I'd like to use starlight color for more events in world, and
having it vary can make that looking nice hard.
[Adds some visual effects to narsie being
summoned](a423cfcb2b)
As the rune drawing progresses space (starlight and parallax) go from
normal to greyscale. Then, right about when narsie shows up, starlight
becomes vibrant red.
It's a nice effect. I wanna do more shit like this, I think it'll
improve vibes significantly.
## Why It's Good For The Game
Can't embed it because of github's upload limit, can show a
[link](https://cdn.discordapp.com/attachments/458452245256601615/1160821856358645860/2023-10-08_22-31-22.mp4?ex=65360e99&is=65239999&hm=680e33e4e0026b89e132afc50c04a648a24f869eb662f274a381a5de5c5a36f2&)
for the narsie stuff
Here's
[one](https://cdn.discordapp.com/attachments/326831214667235328/1160813747196141568/2023-10-08_22-34-10.mp4?ex=6536070c&is=6523920c&hm=f8d571d1013da89887f49f3fec99f632251eeeac83085aa7dde97009aee3922f&)
for the aurora too.
This gives us more pretty starlight shit, and the ABILITY to do more
pretty starlight shit. I'm pretty jazzed, and I hope people use this
proc more (keeping in mind that it's pretty hard on the lighting system,
and needs significant delay between changes)
## Changelog
🆑
add: Narsie summoning has had some effects added to space and starlight
del: Removes the link between spacegas color and starlight. It was a
slight bit too vibrant and I think impacted the vibe too wildly to be
incidental.
fix: The aurora event actually... works now. Space lights up and all
that
/🆑
* Starlight Control (Aurora works now, space gas doesn't touch starlight, narsie ending effects)
* Update space.dm
* Update shuttles.dm
---------
Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>
* [MDB IGNORE] Angled Lights & Lighting Prototyping Tool (#74365)
## About The Pull Request
Hello friends, I've been on a bit of a lighting kick recently, and I
decided I clearly do not have enough things to work on as it is.
This pr adds angle support to static lights, and a concepting/debug tool
for playing with lights on a map.
Let's start from first principles yeah?
### Why Angled Lights?
Mappers, since they can't actually see a light's effect in editor, tend
to go off gut.
That gut is based more off what "makes sense" then how things actually
work
This means they'll overplace light sources, and also they tend to treat
lights, particularly light "bars" (the bigger ones) as directional.
So you'll have two lights on either sides of a pillar, lights inside a
room with lights outside pointing out, etc.

This has annoying side effects. A lot of our map is overlit, to the
point that knocking out a light does.... pretty much nothing.
I find this sad, and would like to work to prevent it. I think dark and
dim, while it does not suit the normal game, is amazing for vibes, and I
want it to be easier to see that.
Angled lights bring how lights work more in line with how mappers expect
lights work, and avoids bleedover into rooms that shouldn't be bled
into, working towards that goal of mine.
### How Angled Lights?
This is more complex then you'd first think so we'll go step by step

Oh before we start, some catchup from the last time I touched lighting
code.
Instead of doing a lighting falloff calculation for each lighting corner
(a block that represents the resolution of our lights) in view we
instead generate cached lightsheets. These precalculate and store all
possible falloffs for x and y distances from a source.
This is very useful for angle work, since it makes it almost totally
free.
Atoms get 2 new values. light_angle and light_dir
Light angle is the angle the light uses, and light_dir is a cardinal
direction it displays in
We take these values, and inside sheetbuilding do some optional angle
work. getting the center angle, the angle of a pair of coords, and then
the delta between them.
This is then multiplied against the standard falloff formula, and job
done.
We do need some extra fenangling to make this all work nicely tho.
We currently use a pixel turf var stored on the light source to do
distance calculations.
This is the turf we pretend the light source is on for visuals, most
often used to make wall lights work nice.
The trouble is it's not very granular, and doesn't always have the
effect you might want.
So, instead of generating and storing a pixel turf to do our distance
calculations against, we store x and y offset variables.
We use them to expand our working range and sheet size to ensure things
visually make sense, and then offset any positions by them.
I've added a way for sources to have opinions on their offsets too, and
am using them for wall lights.
This ensures the angle calculations don't make the wall behind a light
fulldark, which would be silly.
### Debug Tool?
In the interest of helping with that core problem, lights being complex
to display, I've added a prototyping tool to the game.
It's locked behind mapping verbs, and works about like this.
Once the verb is activated, it iterates over all the sources in the
world (except turfs because those are kinda silly), outlining and
"freezing" them, preventing any future changes.
Then, it adds 3 buttons to the owners of a light source.

The first button toggles the light on and off, as desired.
The third allows you to move the source around, with a little targeting
icon replacing your mouse
The second tho, that's more interesting.
The second button opens a debug menu for that light

There's a lot here, let's go through it.
Bit on the left is a list of templates, which allow you to sample
existing light types (No I have no idea why the background is fullwhite,
need to work on that pre merge)
You can choose one by clicking it, and hitting the upload button.
This replaces your existing lighting values with the template's,
alongside replacing its icon and icon state so it looks right.
There are three types as of now, mostly for categorization. Bar, which
are the larger typically stronger lights, Bulb, which are well, bulbs,
and Misc which could be expanded, but currently just contains floor
lights.
Alongside that you can manually edit the power, range, color and angle
of the focused light.
I also have support for changing the direction of the light source,
since anything that uses directional lighting would also tie light dir
to it.
This isn't *always* done tho, so I should maybe find a way to edit light
dir too.
My hope is this tool will allow for better concepting of a room's
lights, and easier changing of individual object's light values to suit
the right visuals.
### Lemon No Why What
Ok so I applied angle lights to bars and bulbs, which means I am
changing the lighting of pretty much every map in the codebase.
I'm gonna uh, go check my work.
Alongside this I intend to give lighting some depth. So if there's room
to make a space warmer, or highlight light colors from other sources, I
will do that.
(Images as examples)

I also want to work on that other goal of mine, making breaking lights
matter. So I'll be doing what I can to ensure you only need to break one
light to make a meaningful change in the scene.
This is semi complicated by one light source not ever actually reaching
fullbright on its own, but we do what we must because we can.

I'm as I hope you know biased towards darker spaces, I think contrast
has vibes.
In particular I do not think strong lights really suit maintenance.
Most of what is used there are bulbs, so I'm planning on replacing most
uses with low power bulbs, to keep light impacts to rooms, alongside
reducing the amount of lights placed in the main tunnels

**If you take issue with this methodology please do so NOW**, I don't
want to have to do another pass over things.
Oh also I'm saving station maps for last since ruins are less likely to
get touched in mapping march and all.
### Misc + Finishing Thoughts
Light templates support mirroring vars off typepaths using a subtype,
which means all the templates added here do not require updating if the
source type changes somehow. I'd like to expand the template list at
some point, perhaps in future.
I've opened this as a draft to make my intentions to make my changes to
lights known, and to serve as motivation for all the map changes I need
to do.
### Farish Future
I'm unhappy with how we currently configure lights. I would like a
system that more directly matches the idea of drawing falloff curves,
along with allowing for different falloffs for different colors,
alongside extending the idea to angle falloff.
This would make out of engine lighting easier, allow for nicer looking
lights (red to pink, blue to purple, etc), and improve accessibility by
artists.
This is slightly far off, because I have other obligations and it's
kinda complicated, but I'd like to mention it cause it's one of my many
pipedreams.
## Changelog
🆑
add: Added angle lighting, applies it to most wall lights!
add: Adds a lighting prototyping tool, mappers go try it out (it's
locked behind the mapping verb)
/🆑
---------
Co-authored-by: MMMiracles <lolaccount1@ hotmail.com>
* [MDB IGNORE] Angled Lights & Lighting Prototyping Tool
* Update north_star.dmm
* Revert "Update north_star.dmm"
This reverts commit bb5b8b5a549f7edc3e23a369a147ed96bab41991.
* Updatepaths
* Update nukie_base.dmm
* Newer version of northstar with the penguins
* Update northstar_cryo.dmm
---------
Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: MMMiracles <lolaccount1@ hotmail.com>
Co-authored-by: lessthanthree <83487515+lessthnthree@users.noreply.github.com>
Co-authored-by: Giz <13398309+vinylspiders@users.noreply.github.com>
* Macros multi-z code, removes the false premise of manual offsets (#76248)
## About The Pull Request
[Removes the pretense of relative multiz
levels](0293fdc2bd)
Our multiz system does not support having a z level that is only
connected one way, or which goes down backwards or anything like that.
That's a fiction of the trait system, the actual backend has never
really supported this.
This pr removes the assumptions we were making backend around this, and
uses that to save cpu time.
I am also converting multiz_levels from an assoc list to a pure one,
which saves significantly on access times and cleans up the code
somewhat.
Also I'm making the get_below/get_above procs into macros, for the sake
of cpu time.
[Converts the starlight disease to use BYOND's directional defines
instead of our
own](7d698f02d9)
To some extent spurred on by
https://github.com/DaedalusDock/daedalusdock/pull/298, tho it was known
before
## Why It's Good For The Game
Faster multiz code, faster init, etc etc etc
* modular files how very dare you
---------
Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
* Lighting source refactor (Tiny) (#73284)
## About The Pull Request
I'm doing two things here. Let's get the boring bit out of the way.
Lighting source updates do three distinct things, and those things were
all in one proc.
I've split that one proc into three, with the first two feeding into the
third.
Second, more interesting thing.
An annoying aspect of our lighting system is the math we use for
calculating luminosity is hardcoded.
This means that we can't have subtypes that are angled, or that have
squared falloff, etc. All has to look the same.
This sucks, and it shows.
It has to be, goes the thinking, because we need very fast lookups that
OOP cannot provide.
We can't bog down the main equation with fluff, because the main
equation needs to be really speedy.
The thing about this equation is the only variants on a turf to turf
basis is exactly how far turfs are from the center.
So what if, instead of doing the math in our corner worker loop, we
build lookup tables to match our current source's state.
The tables, like a heatmap, could encode the lighting of any point along
the line.
This is actually faster then doing the math each time, because the list
generation can be cached.
It also means we've pulled the part we want to override out of hotcode.
It's cheap to override now, and a complex subtype, with angles and such
would have no impact on the typical usage.
So the code's faster, easier to read, and more extensible.
And we can do stuff like squared falloff for some lights in future
without breaking others.
Winning!
## Why It's Good For The Game
Winning
* Lighting source refactor (Tiny)
---------
Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
* addresses reviews on the tram pr made after merge, fixes diagonal movement bugs (#68033)
* addresses reviews on the tram pr made after merge, fixes diagonal movement bugs
* wew
Co-authored-by: Kylerace <kylerlumpkin1@gmail.com>
Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
* (code bounty) The tram is now unstoppably powerful. it cannot be stopped, it cannot be slowed, it cannot be reasoned with. YOU HAVE NO IDEA HOW READY YOU ARE
* fex
* fex
Co-authored-by: Kylerace <kylerlumpkin1@gmail.com>
Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
* removes double spaces before symbols (#62397)
This can apparently cause some bugs on occasions, so I thought I might as well try to kill them all.
* removes double spaces before symbols
Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
* Turns lighting objects into a datum, makes all lighting be performed with an underlay. big maptick fix very good!
* Mirror!
Co-authored-by: Kylerace <kylerlumpkin1@gmail.com>
Co-authored-by: Funce <funce.973@gmail.com>
* [READY] Lighting list cleanup. (#59002)
Removed a bunch of back reference lists that were either entirely unused, or contained references that could be found within the datums contained in other lists.
lighting corner datums now get deleted with unused.
light sources no longer track lighting corners where the appiled light rounds to 0.
Fix lighting on turfs that gained dynamic lighting mid round. lazy init corner datums.
these two are related. by decoupling corner datums from the turfs dynamic lighting state, we can use them to know what level of light a non-dynamic light turf should have once it gains dynamic light.
Also should free up some memory not storing these datums in maint. Corner datums only exist on a turf that has light cast upon it by the dynamic lighting system.
Lighting corners are now lazy inited and deleted. they should always (and only exist) if there is a light source shining on it within range (even if the turf has no dynamic lighting). This is needed to support turfs that become lighting enabled mid round. On the plus side, they will no longer be generated on full dark turfs.
* [READY] Lighting list cleanup.
Co-authored-by: Kyle Spier-Swenson <kyleshome@gmail.com>
* Opacity refactor (#52881)
Moves all opacity var manipulation to a proc which sends a signal.
light_blocker element for movable opaque atoms made, which tracks its movement and updates the affected turfs for proper lighting updates.
has_opaque_atom boolean replaced by the opacity_sources lazylist to keep track of the sources, and a directional_opacity which serves a similar function but also allows for future expansion with on-border opaque objects (not yet implemented).
Some opacity-related sight procs optimized as a result of this.
Some variables moved to the object's definition.
A define or two added into the mix for clarity.
Some code cleaning, like turning booleans into their defines.
One file renamed for clarity.
Changelog
cl
balance: Mechs no longer block sight. It's a non-trivial cost for the lighting system with little to no gain.
/cl
* Opacity refactor
Co-authored-by: Rohesie <rohesie@gmail.com>
* Cleanup up all instances of using var/ definitions in proc parameters. (#52728)
* var/list cleanup
* The rest of the owl
* plushvar bad
* Can't follow my own advice.
* Cleanup up all instances of using var/ definitions in proc parameters.
Co-authored-by: Timberpoes <silent_insomnia_pp@hotmail.co.uk>
About The Pull Request
Just moving /turf/proc/get_corners() into its only caller, slightly shuffled.
Also #defining /proc/GetRedPart() etc, which should flatten down to a copytext+text2num operation with #51005. Also defining parse_light_color() since it has two callers and does something trivial (splits #ff0000 into three luminance vars).
cl Naksu
code: Lighting corner updates are ever so slightly faster.
/cl
* Revert "all this wrapping and it's not even christmas (#33035)"
This reverts commit faaf151580.
* Revert "fuck me for forgetting to graph this one"
This reverts commit 45d7acea2f.
* Revert "defines math"
This reverts commit 2817a1737b.
These weren't needed, and ran thousands of times per second during high lighting activity, and were pretty high up in the line by line profile of lighting for what was basically a noop.
This *seems* to be a decent speed up just in the appearent time it takes break all lights to process, and dview wasn't really needed here.
Minor oddies can occur on bigger lights near their edges, but not enough to justify the extra cost.
Rather then remove the light from all tiles, then re-add the light to all tiles, we just go thru each tile and diff the light level from the last value we added to it. (since this is tracked)
This cut the proc calls for updating lights in half.
Lighting objects now default to full brite rather then full dark so shuttles aren't as immersion breaking when they transit.
Made lighting more agressive about clearing empty lists.
* Add the system for managed global variables
* Travis ban old globals
* So you CAN inline proccall, that's neat
* Fix that
* master.dm
* Remove the hack procs
* Move InitGlobals to the proper spot
* configuration.dm
* Fix the missing pre-slash
* clockcult.dm
* This is probably for the best
* Doy
* Fix shit
* Rest of the DEFINES tree
* Fix
* Use global. for access
* Update find_references_in_globals
Always hated that proc
Whoever made it must've bee a r e a l idiot...
* __HELPERS tree
* Move global initialization to master.
Fix the declaration
* database.dm
* Dat newline
* I said DECLARATIVE order!
* Here's something you can chew on @Iamgoofball
* game_modes.dm
* Fix this
* genetics.dm
* flavor_misc.dm
* More stuff
* Do it mso's way. Keep the controllers as global
* Make master actually see it
* Fix
* Finish _globalvars/lists
* Finish the rest of the _globalvars tree
* This is weird
* Migrate the controllers
* SLOTH -> GLOB
* Lighting globals
* round_start_time -> ticker
* PAI card list -> pai SS
* record_id_num -> static
* Diseases list -> SSdisease
* More disease globals to the SS
* More disease stuff
* Emote list
* Better and better
* Bluh
* So much stuff
* Ahh
* Wires
* dview
* station_areas
* Teleportlocs
* blood_splatter_icons
* Stuff and such
* More stuff
* RAD IO
* More stuff and such
* Blob shit
* Changeling stuff
* Add "Balance" to changelogs
* Balance for changelog compiler + Auto Tagging
* Update the PR template
* hivemind_bank
* Bip
* sacrificed
* Good shit
* Better define
* More cult shit
* Devil shit
* Gang shit
* > borers
Fix shit
* Rename the define
* Nuke
* Objectives
* Sandbox
* Multiverse sword
* Announce systems
* Stuff and such
* TC con
* Airlock
* doppllllerrrrrr
* holopads
* Shut up byond you inconsistent fuck
* Sneaky fuck
* Burp
* Bip
* Fixnshit
* Port without regard
* askdlfjs;
* asdfjasoidojfi
* Protected globals and more
* SO MANY
* ajsimkvahsaoisd
* akfdsiaopwimfeoiwafaw
* gsdfigjosidjfgiosdg
* AHHHHHHHHHHHHHHHHHHHHHHH!!!!!
* facerolll
* ASDFASDFASDF
* Removes the unused parts of dmm_suite
* WIP
* Fix quote
* asdfjauwfnkjs
* afwlunhskjfda
* asfjlaiwuefhaf
* SO CLOSE
* wwwweeeeeewwwww
* agdgmoewranwg
* HOLY MOTHER OF FUCK AND THATS JUST HALF THE JOB?!?
* Fix syntax errors
* 100 errors
* Another 100
* So many...
* Ugh
* More shit
* kilme
* Stuuuuuufffff
* ajrgmrlshio;djfa;sdkl
* jkbhkhjbmjvjmh
* soi soi soi
* butt
* TODAY WE LEARNED THAT GLOBAL AND STATIC ARE THE EXACT SAME FUCKING THING
* lllllllllllllllllllllllllllllllllllllllllll
* afsdijfiawhnflnjhnwsdfs
* yugykihlugk,kj
* time to go
* STUFFF!!!
* AAAAAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!!!!
* ngoaijdjlfkamsdlkf
* Break time
* aufjsdklfalsjfi
* CONTROL KAY AND PRAY
* IT COMPILEELEELELAKLJFKLDAFJLKFDJLADKJHFLJKAJGAHIEJALDFJ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* Goteem
* Fix testing mode
* This does not belong in this PR
* Convert it to a controller
* Eh, fuck this option
* Revert controllerization Ill do it some other time
* Fix
* Working controllerization
* FOR THE LOVE OF CHRIST PROTECT THE LOGS
* Protect admins and deadmins
* Use the inbuilt proc
* Revert "Lighting micro optimizations and fixes (#24939)"
This reverts commit 78bbbfe20a.
* vg refactor stage 1
* Fix runtime in get_turf_pixel
* fix lighting on turfs
* Fix certain things reading light levels wrong.
* Made SS faster/better by making it split its tick allotment up between it's 3 tasks
* istypeless loops @pjb3005
/proc/typed_loop 6.826 6.830 6.858 190761
/proc/typeless_loop 5.582 5.586 5.620 190435
* lazy init lists