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

[fixed] Wrong sprite frame on components and devices after rejoining server #2007

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

Conversation

mugg91
Copy link
Contributor

@mugg91 mugg91 commented Apr 11, 2024

Status

  • READY: this PR is (to the best of your knowledge) ready to be incorporated into the game.

Description

[fixed] Some components and devices had the wrong frame after rejoining server
[dev] canBePickedUp() removed from component scripts and added to GenericComponent.as
[dev] this.Tag("builder always hit") removed from component scripts and added to GenericComponent.as
[dev] getNet().isServer() changed to isServer()
[dev] getNet().isClient() changed to isClient()
[changed] Spike and GenericSpike merged, Spike won't have a blood spritelayer but instead changes its frame (similar to #1854 )

Fixes #2004

This PR changes code in components to make their sprite frame update on rejoining the server.

Some code moved from component scripts to GenericComponent.as as a clean-up measure. If there should be any component in the future that needs to be picked up or not be hit by builder, it can all be changed, but for now I think it is better to not repeat canBePickedUp() and this.Tag("builder always hit") a quadrillion times.
However, I didn't seek a solution for the repeated onReceiveCreateData() and UpdateSprite() instances because I didn't want to add a new script and add it to all the component blobs.
Anyway, this PR has more deletions than additions. :)

Please note, this PR - similarly to #1854 - merges Spike.as and GenericSpike.as. The linked PR implements that spike from spiker properly remembers its bloody state but at the time of this writing, it still has an issue that spike will be displayed on top of the spiker frame on rejoining. This PR fixes that.

Tested in online and offline, no problems encountered.

Steps to Test or Reproduce

Join server.
Place a bunch of components and devices such as lamp, toggle, lever, spiker and pressure plate.
Have them in different states (active and inactive), then quit and rejoin server.
Notice they will have the wrong sprite frame (usually inactive, when it should have the active sprite etc.).
After this PR, all components and devices will have the correct sprite frame after rejoining.

Simplified solution. Since we aren't doing "bloody blobs" in this PR we don't need to save any ids to update anything. When merging with "bloody blobs" PR, spiker id will need to get saved to spike, not spike id to spiker (that was nonsense).
Copy link
Member

@Vam-Jam Vam-Jam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM from testing

@Vam-Jam Vam-Jam added the fix Fixes a bug label Sep 3, 2024
@Vam-Jam
Copy link
Member

Vam-Jam commented Sep 3, 2024

Merge conflicts just need to get sorted

@Vam-Jam Vam-Jam added this to the Next Patch milestone Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Components and devices have wrong frame when rejoining server
2 participants