Flag Dream Block Support #849
Open
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.
This PR aims to add flag support to the dream block.
In this case, activated and deactivated dream block can appears at the same time,
which vanilla Celeste, Everest and some of mods do not support.
What did vanilla do:
playerHasDreamDashfor only visual.Session.Inventory.DreamDashwhich is global.Inventory.DreamDashand assume all dream block is activated or not actoivated, then happily read Tracker[DreamBlock] (mainly used inCollidemethod series).To change this:
DreamBlock.Activatedto represent the dream block's actual state (actually a property to readInventory.DreamDashdirectly)Player.DreamDashCheckPlayer.DashCoroutinePlayer.DreamDashUpdateto use that property.Collidemethod with ours and hope that it can work with all mods.Inventory.DreamDash.What did Everest and mods do:
Inventory.DreamDashso they can't get flag support automatically. (can work as before)Inventory.DreamDash, it should work, asDreamBlock.Activatedis a property that can read it.DreamBlock.Activateseries, it can in wrong visual state.To change this:
DreamBlock.Activateseries is Obsolete.DreamBlock.Activated.DreamBlock.Activateseries still works fine in old map, so we don't need to migrate them all/quickly.Finally, we are prepared to add flag support.
DreamBlock.Flag.DreamBlock.Activated.NoInliningfor hooks.flagStateto save current flag state. only whenflagStateis changed, we can try to update visuals to match state.Update.ActivatedPlusfor extensibility. It's designed for non-visual state.For performance reason, add
Level.HasNewDreamBlock.Inventory.DreamDash. Ignore it when there's flag dream block.Add
DreamBlockPatchto indicate if this patch has been applied.Info
it's actually what did Reverse Helper do.It's designed for the extensibility.It's because of the compatibility.feel free to ask me.
it's impossible to track if an field is changed.
Level.HasNewDreamBlock.What should we do
Tested CelesteTAS
100%.tasChecked 2A Cutscene and it looks good
wrote a test map and it looks good
Tested Mod List is the same as Ja's IL Hook Viewer
- Communal Helper - crashed
- More Lock Block - didn't work (apparently)
Main IL Changes And Mod Compatibility
DreamBlock.Added
Added new method call after
Inventory.DreamDashto replace it with correct stateshould be good in 95% cases
it's not clean tbh
DreamBlock.Update
Update flag state every frame
should be good in 99.9% cases
Player.DreamDashCheck
Replace all
Collides with custom oneRemove
Inventory.DreamDashconditionallyShould be good, because nobody loves to hook it.
More Lock Block was broken.
Tera Helper is not broken, but they should change their hook.
Player.DashCoroutine
Replace one
Collides with custom oneRemove
Inventory.DreamDashconditionallyCommunalhelper was broken.
Player.DreamDashUpdate
Replace one
Collides with custom oneThere's no
Inventory.DreamDash.No mods was broken.