Files
Bubberstation/code/modules/asset_cache
Andrew d278980066 ChemMaster and CondiMaster refactored, prints items over time (#75849)
![ZceBfkJaFG](https://github.com/tgstation/tgstation/assets/3625094/aedf6178-dad7-40b2-a7ea-18da6f56e9e8)

## About The Pull Request

Chem master has been using some hard coded styles for containers, pills
and patches. Some people didn't bother to update styles, and they stayed
outdated.

Now it uses just a list of reagent containers instead, which makes it
easy to add new containers - just one line of code.

Also changed its sprite for better animations, emissive overlay, and to
display buffer reagents on the sprite itself.

Now it plays printing animation when you actually print containers and
servos have a purpose now - they increase the amount of containers
printed at once by up to 100% * part_tier. Pills and patches are always
printed at double amount.

And fixes #59734 

## Why It's Good For The Game

Makes chem master easier to manage in code and easier to use in-game.

Printing delay is added for consistency with other fabrication machines
(like lathes), to give a purpose for the servo motor used in
construction, for visuals (to show the printing animation only when
something is being printed, and not just when you move stuff in and out
of buffer as before) and to prevent people from spamming the world with
unneeded objects with 0 second delay.

## Changelog

🆑
qol: Chemmaster UI tweaked
fix: Fixed chem master showing wrong data during reagent analysis
fix: Fixed chem master not working with fermented drinks
image: Chemmaster resprited, now has an indicator for buffer reagents
refactor: Refactored chemmaster code, it now uses reagent containers
instead of styles
balance: Chemmaster now uses servos and has printing animation of 0.75
second duration. Outputs 1 container or up to 2 pills/patches per cycle
by default. Can be upgraded to output up to 4 and 8 with t4 servos.
/🆑
2023-06-11 13:52:39 -04:00
..

Asset cache system

Framework for managing browser assets (javascript,css,images,etc)

This manages getting the asset to the client without doing unneeded re-sends, as well as utilizing any configured cdns.

There are two frameworks for using this system:

Asset datum:

Make a datum in asset_list_items.dm with your browser assets for your thing.

Checkout asset_list.dm for the helper subclasses

The simple subclass will most likely be of use for most cases.

Call get_asset_datum() with the type of the datum you created to get your asset cache datum

Call .send(client|usr) on that datum to send the asset to the client. Depending on the asset transport this may or may not block.

Call .get_url_mappings() to get an associated list with the urls your assets can be found at.

Manual backend:

See the documentation for /datum/asset_transport for the backend api the asset datums utilize.

The global variable SSassets.transport contains the currently configured transport.

Notes:

Because byond browse() calls use non-blocking queues, if your code uses output() (which bypasses all of these queues) to invoke javascript functions you will need to first have the javascript announce to the server it has loaded before trying to invoke js functions.

To make your code work with any CDNs configured by the server, you must make sure assets are referenced from the url returned by get_url_mappings() or by asset_transport's get_asset_url(). (TGUI also has helpers for this.) If this can not be easily done, you can bypass the cdn using legacy assets, see the simple asset datum for details.

CSS files that use url() can be made to use the CDN without needing to rewrite all url() calls in code by using the namespaced helper datum. See the documentation for /datum/asset/simple/namespaced for details.