Skip to content

Sync fishing zone settings and allow fishing gizmo #607

Merged
notfood merged 4 commits intorwmt:devfrom
Tick-git:Fish-Zone-Sync
Aug 15, 2025
Merged

Sync fishing zone settings and allow fishing gizmo #607
notfood merged 4 commits intorwmt:devfrom
Tick-git:Fish-Zone-Sync

Conversation

@Tick-git
Copy link
Copy Markdown
Contributor

@Tick-git Tick-git commented Aug 5, 2025

Label: 1.6, desync

PR:

Syncs fishing zone settings and allow fishing gizmo

Implementation:

The biggest challenge was synchronizing the repeat mode toggle triggered through the FloatMenu. To achieve this, I implemented a transpiler that locates the FloatMenu construction and injects a sync call just before the WindowStack.Add invocation.

I based the approach on the existing sync implementation for Bill repeat mode (BillConfigFloatMenuTranspiler), adapting it to correctly identify and inject at the relevant IL pattern.

Additional safeguards ensure the patch fails gracefully if the underlying code structure changes.

I thought it would be an easy task to do while on vacation... It wasn't :D

Add sync for FishingZone settings, including repeat mode via FloatMenu

The biggest challenge was synchronizing the repeat mode toggle triggered through the FloatMenu. To achieve this, I implemented a transpiler that locates the FloatMenu construction and injects a sync call just before the WindowStack.Add invocation.

I based the approach on the existing sync implementation for Bill repeat mode (BillConfigFloatMenuTranspiler), adapting it to correctly identify and inject at the relevant IL pattern.

Additional safeguards ensure the patch fails gracefully if the underlying code structure changes.
@notfood notfood added fix Fixes for a bug or desync. 1.6 Fixes or bugs relating to 1.6 (Not Odyssey). labels Aug 7, 2025
@notfood notfood moved this to In review in 1.6 and Odyssey Aug 7, 2025
@notfood
Copy link
Copy Markdown
Member

notfood commented Aug 7, 2025

This looks nightmareish, let me check further.

@Tick-git
Copy link
Copy Markdown
Contributor Author

Tick-git commented Aug 8, 2025

I can strip it down more if you want. Most of the nightmarish stuff you probably mean are pattern-matching safeguards against IL changes. But I must say, it's my first "large" transpiler - so maybe those aren't even necessary. Maybe it's enough to just check whether the patch was inserted twice, like in the bill example I mentioned.

I did learn everything on the fly and I'm always open to better solutions :)

@SokyranTheDragon
Copy link
Copy Markdown
Member

Is this transpiler here necessary? Can't this be done with a SyncDelegate?

SyncDelegate.Lambda(typeof(ITab_Fishing), nameof(ITab_Fishing.FillTab), 0);

If this was inspired by the patch for BillRepeatModeUtility.MakeConfigFloatMenu, then I should expand on that one - I believe this was specifically done this way as a way to be compatible with mods adding their own patches there. Before that, we specifically synced the 3 lambdas it called.

@Tick-git
Copy link
Copy Markdown
Contributor Author

:D :D

Yeah… you could say this is a cleaner solution. Thanks :))

I’ve started splitting the fishing zone into a partial class. If you’d rather not go that route, I can merge it back into one class tomorrow.

@Tick-git
Copy link
Copy Markdown
Contributor Author

Tick-git commented Aug 14, 2025

... and good to know why the bill repeat mode is synced this way. I directly thought the bill had a repeat mode as well and didn’t even consider another solution.

Copy link
Copy Markdown
Member

@notfood notfood left a comment

Choose a reason for hiding this comment

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

I'm fine with partial. Syncfields is an already huge file.

@notfood notfood merged commit b2e9cdf into rwmt:dev Aug 15, 2025
1 check passed
@github-project-automation github-project-automation bot moved this from In review to Done in 1.6 and Odyssey Aug 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.6 Fixes or bugs relating to 1.6 (Not Odyssey). fix Fixes for a bug or desync.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants