[fixed] Wrong sprite frame on components and devices after rejoining server #2007
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Status
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 repeatcanBePickedUp()
andthis.Tag("builder always hit")
a quadrillion times.However, I didn't seek a solution for the repeated
onReceiveCreateData()
andUpdateSprite()
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
andGenericSpike.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.