Multiplayer icon indicating copy to clipboard operation
Multiplayer copied to clipboard

Sync rename dialogs (sync IRenameable.RenamableLabel setter)

Open SokyranTheDragon opened this issue 1 year ago • 0 comments

Synced all implementations of IRenameable.RenamableLabel setter for types that can be synced.

I've decided to only apply the sync worker for types that can be synced for safety, as the rename dialogs are of low enough importance that encountering errors or other issues because of them would not be desirable. After all, if rename dialog is not synced then it should not cause any issues besides a minor visual desync (unless there's a mod that does something special with the name, which I've not really encountered).

I've wrapped the portion of the code registering it in a double call to LongEventHandler.ExecuteWhenFinished to ensure it runs after MP Compat's late patches, ensuring all Sync Workers will be registered by it at this point.

Because of no logging when there's IRenameable that can't be synced, I've included a debug action which will list all types implementing IRenameable.RenamableLabel setter, separated into synced and unsynced ones. This will allow us to easily check if we need to create a sync worker for any of the IRenameable implementations.

On top of that, I've also synced Dialog_RenameBuildingStorage_CreateNew:OnRenamed. It creates a storage group, which requires syncing on top of renaming. No other vanilla dialog needs syncing dialogs like those, but some mods may require it as well.

SokyranTheDragon avatar Apr 15 '24 14:04 SokyranTheDragon