Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Appearance Weakrefs #1815

Open
wants to merge 64 commits into
base: master
Choose a base branch
from

Conversation

amylizzle
Copy link
Contributor

@amylizzle amylizzle commented May 28, 2024

Fairly substantial rewrite of appearance handling.

There are now two appearance classes: MutableIconAppearance and ImmutableIconAppearance

MutableIconAppearance is the class you use for mutable appearance stuff. They are not sent to the client. To send them to the client, you must either use AtomManager.SetAppearance() or if you have a really really good reason use ServerAppearanceSystem.AddAppearance().

ImmutableIconAppearance is the class that is sent to the client. It cannot be edited. If you want to edit it, you need to create a mutable copy (which is a MutableIconAppearance). These are held only as weakrefs in the ServerAppearanceSystem, and are removed from connected clients when they are garbage collected. This means that if you want to keep it alive you must have a hard ref to it somewhere. Any appearance (mutable or no) which has an overlay/underlay counts as a hard ref for that overlay/underlay.

The client has copies of the ImmutableIconAppearance and can use ToMutable() to edit them locally for animations and such.

Appearance ID is now just the ImmutableIconAppearance's hash as generated on the server and stored in the ImmutableIconAppearance.

KNOWN BUG: /turf animations don't apply, it just sets the final state of the turf appearance. Turf animations can go in another PR.

@boring-cyborg boring-cyborg bot added Client Involves the OpenDream client Runtime Involves the OpenDream server/runtime labels May 28, 2024
@amylizzle amylizzle marked this pull request as ready for review May 29, 2024 12:31
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@amylizzle amylizzle changed the title Appearance ref counts Appearance Weakrefs Oct 13, 2024
@boring-cyborg boring-cyborg bot added the Compiler Involves the OpenDream compiler label Oct 13, 2024
@github-actions github-actions bot added size/XXL and removed size/XL labels Oct 13, 2024
@amylizzle amylizzle marked this pull request as ready for review October 20, 2024 18:35
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client Involves the OpenDream client Compiler Involves the OpenDream compiler Runtime Involves the OpenDream server/runtime size/XXL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant