mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-18 13:43:27 +00:00
* Flattens The Floor Plane (Camera Update Too) (#84350) ## About The Pull Request Ok so like, side map right? It makes things higher up in the world render above things lower down in the world. Most of the time this is what we want, but it is NOT what we want for floors. Floors are allowed to be larger then 32x32, and if they are we want them to render based off JUST their layer. If we don't allow this grass turfs and others get cut off on their bottom edge, which looks WEIRD. In order to make this happen, we can add TOPDOWN_LAYER to every layer on the floor plane and disable sidemap. I've added documentation for this to VISUALS.md, and have also implemented unit test errors to prevent mixing TOPDOWN layers with non topdown planes (or vis versa). This new test adds ~1 second to tests, which is I think a perfectly scrumpulent number. EDIT: I nerd sniped myself and implemented sidemap layering and lighting for cameras (also larger then 32x32 icon support for getflat) The lighting isn't perfect, we don't handle things displaying in the void all that well (I am convinced getflat blending is broken but I have no debugger so I can't fix it properly), but it'll do. This came up cause I had to fix another layering issue in cameras and thought I might as well go all in.  ## Why It's Good For The Game Old:  New:  ## Changelog 🆑 fix: Grass turfs will render properly now. Reworked how floors render, please report any bugs! fix: Cameras now properly capture lighting fix: The layering seen in photos should better match the actual game /🆑 * Flattens The Floor Plane (Camera Update Too) * modular things * Update fluff.dm --------- Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Co-authored-by: SpaceLoveSs13 <68121607+SpaceLoveSs13@users.noreply.github.com>
52 lines
2.7 KiB
Plaintext
52 lines
2.7 KiB
Plaintext
// Mutable appearances are an inbuilt byond datastructure. Read the documentation on them by hitting F1 in DM.
|
|
// Basically use them instead of images for overlays/underlays and when changing an object's appearance if you're doing so with any regularity.
|
|
// Unless you need the overlay/underlay to have a different direction than the base object. Then you have to use an image due to a bug.
|
|
|
|
// Mutable appearances are children of images, just so you know.
|
|
|
|
// Mutable appearances erase template vars on new, because they accept an appearance to copy as an arg
|
|
// If we have nothin to copy, we set the float plane
|
|
/mutable_appearance/New(mutable_appearance/to_copy)
|
|
..()
|
|
if(!to_copy)
|
|
plane = FLOAT_PLANE
|
|
|
|
/** Helper similar to image()
|
|
*
|
|
* icon - Our appearance's icon
|
|
* icon_state - Our appearance's icon state
|
|
* layer - Our appearance's layer
|
|
* atom/offset_spokesman - An atom to use as reference for the z position of this appearance.
|
|
* Only required if a plane is passed in. If this is not passed in we accept offset_const as a substitute
|
|
* plane - The plane to use for the appearance. If this is not FLOAT_PLANE we require context for the offset to use
|
|
* alpha - Our appearance's alpha
|
|
* appearance_flags - Our appearance's appearance_flags
|
|
* offset_const - A constant to offset our plane by, so it renders on the right "z layer"
|
|
**/
|
|
/proc/mutable_appearance(icon, icon_state = "", layer = FLOAT_LAYER, atom/offset_spokesman, plane = FLOAT_PLANE, alpha = 255, appearance_flags = NONE, offset_const)
|
|
var/mutable_appearance/appearance = new()
|
|
appearance.icon = icon
|
|
appearance.icon_state = icon_state
|
|
appearance.layer = layer
|
|
appearance.alpha = alpha
|
|
appearance.appearance_flags |= appearance_flags
|
|
if(plane != FLOAT_PLANE)
|
|
// You need to pass in some non null object to reference
|
|
if(isatom(offset_spokesman))
|
|
// Note, we are ok with null turfs, that's not an error condition we'll just default to 0, the error would be
|
|
// Not passing ANYTHING in, key difference
|
|
SET_PLANE_EXPLICIT(appearance, plane, offset_spokesman)
|
|
// That or I'll let you pass in a static offset. Don't be stupid now
|
|
else if(!isnull(offset_const))
|
|
SET_PLANE_W_SCALAR(appearance, plane, offset_const)
|
|
// otherwise if you're setting plane you better have the guts to back it up
|
|
else
|
|
stack_trace("No plane offset passed in as context for a non floating mutable appearance, things are gonna go to hell on multiz maps")
|
|
else if(!isnull(offset_spokesman) && !isatom(offset_spokesman))
|
|
stack_trace("Why did you pass in offset_spokesman as [offset_spokesman]? We need an atom to properly offset planes")
|
|
|
|
if(PERFORM_ALL_TESTS(focus_only/topdown_filtering))
|
|
check_topdown_validity(appearance)
|
|
|
|
return appearance
|