Files
fulpstation/code/datums/mutable_appearance.dm
A miscellaneous Fern 9bd86e85b5 June/July TGU: Loadout menu, flatpackers and... whatever else! (#1230)
* Initial Commit

* Not quite all was staged, apparently.

* Multiline no longer necessary

* For my convenience...

* Forgot an important little tidbit in routes.tsx

* This updated, apparently.

* And now hell breaks loose

* First batch

* Second Batch

* Third batch (Unit Tests)

* Improvised shotgun ammo is gone; Vibebots are refactored

* UpdatePath sweeps in our fulp_modules/_maps folder

* I can't bring myself to do it.

* Map stuff

* Didn't mean to leave this uncommented

* I carpet-bombed them with Find-Replace. Let's see what linters think

* I sure do hope this is comprehensive and doesn't break other things

* This may take a while

* Next Round

* Hopefully the last batch before getting on with actual fixes

* Telescreens

* :/

* Stragglers

* Helio Emergency Shuttle; NearStation adjustments.

* Only one more commit for greenchecks... Shuttle code be dammed.

* Pff, the file was missing

* Same treatment as the other map files.

* Missed a comma :P

* BZ chambers for Xenobiology

* Odd. Most of these got done earlier. Not sure why this one wasn't.

* Mapping sweep. I didn't adjust C_tags in Theia. Another time.

* The balloon alerts overlap

* I hate TGU I hate TGU

* I meant to say "I hate TG" on the last one. Freudian slip.

* Fix Fix

* Nanite research cost rebalance

* TGU-Update: Step 0

* Yeah I figured it'd do this.

* I accidentally undid this

* Failed to catch this one

* I don't trust hundredths not to break or be broken somewhere.

* Little air alarm tweaks

* Ports #1228

* Stuff I missed

* Silly

* TGU so nice we're going to make it thrice

* Yarn

* Should be all? Fixes cult stun too.

* Thermomachine layers

* Free square spellcheck to rerun tests and see if it's consistent

* All credit goes to QLA for reminding me to actually do this

* Update to e40becd742

* github folder
2024-08-06 20:17:51 -04:00

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