Files
Bubberstation/code/modules/asset_cache
SkyratBot 69ea3c81ad [MIRROR] Mafia can be played on your PDA [MDB IGNORE] (#24485)
* Mafia can be played on your PDA (#78576)

## About The Pull Request

Mafia is now friggin playable from the PDA, I also changed other stuff
too

- You can't use abilities on dead people if you're not supposed to (cant
kill the same person over and over)
- Changelings cant kill other Changelings
- Changelings can now only talk to eachother at night, rather than using
:j
- Everyone starts spawned in the center of the map, since people playing
on PDA can't move their characters. This is so everyone can hear PDA
users in person, as I don't want the chat log to be mandatory.

To do this, all messages you are meant to be able to see, is now logged
for you to see in your Mafia panel. This essentially means that people
playing through the PDA get a downgraded version of it, but I don't know
how much larger I want this UI to be.

Playing Mafia through the PDA will not tell you of other players ahead
of time when signing up (as it shows ckeys + pdas), but they can see the
names in-game. Unfortunately this means we'll have to remove your
customization coming with you, to prevent using it to tell who is dead
in round.

Things I am missing
- Program overlays on PDA/Laptop/Computer
- Icon for the app's header while a game is active

I'm not a spriter and can't make either of these

This is the new UI

![image](https://github.com/tgstation/tgstation/assets/53777086/7cf503d9-b2e2-4127-874a-acad6425d649)

I also fixed alert calls for PDAs and stuff

![image](https://github.com/tgstation/tgstation/assets/53777086/e09b2e5e-b9e7-43ae-9273-c168e9c8e642)

and removed the X at the top on computers since they had no battery

![image](https://github.com/tgstation/tgstation/assets/53777086/d3dd8307-805c-4aba-be5e-4c24a0bdcb91)

Looks a little better now hopefully 👍

## Why It's Good For The Game

- The current Arcade app sucks, and is a solo game. This is much more
entertaining and you can talk to others in it, which is swag as fuck.
- There's a larger potential playerbase for the Minigame making it more
likely to be played.
- Sets groundwork for a better version of
https://github.com/tgstation/tgstation/pull/75879
- Adds more suspense and teamwork in the minigame.

## Changelog

🆑 JohnFulpWillard, sprites by CoiledLamb
add: You can now play Mafia on your PDA.
balance: Mafia changelings can now only talk to eachother during the
night.
fix: Mafia abilities can't be repeatedly used on people.
/🆑

* Mafia can be played on your PDA

---------

Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
2023-10-21 14:25:33 -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.