You are viewing a potentially older version of this package. View all versions.
Dreadrith-EasySync-0.0.1 icon

EasySync

Configuration syncing made easy, thanks to CSync by Owen3H.

Date uploaded 2 years ago
Version 0.0.1
Download link Dreadrith-EasySync-0.0.1.zip
Downloads 358
Dependency string Dreadrith-EasySync-0.0.1

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2100 icon
BepInEx-BepInExPack

BepInEx pack for Mono Unity games. Preconfigured and ready to use.

Preferred version: 5.4.2100
Owen3H-CSync-1.0.8 icon
Owen3H-CSync

Configuration file syncing library for BepInEx.

Preferred version: 1.0.8

README

If this actually gets some use maybe I'll write some better documentation. I hate documenting :(

What is this

TLDR: Small cursed code that makes config syncing a one liner so that you don't copy paste.

Some cursed code that deals with reflection to be able to handle CSync's requirement for generic types. Static members are not one and the same in generic types and one exists for each generic type. Using reflection, it grabs the members needed for CSync's functionality and handle it the same way so that there isn't the same static code for each different class that uses CSync's SyncedInstance class.

How To Use

How the heck do I even write a wiki?

  • Add CSync and EasySync as references.
  • Follow CSync's wiki for step 1-2.
  • In the constructor, replace InitInstance(this); with EasySync.SyncManager.RegisterForSyncing(this, GUID);.
  • Done. Yep that's all. Your config should now sync whenever someone joins the server.

Extra notes

  • GUID could be your PluginInfo.PLUGIN_GUID. Just any string that is unique enough to not be used by others mistakenly.
  • The new method will return a SyncedInstanceContainer. It's only useful you need to resync the settings with your code using container.RequestSync() for whatever reason.
  • You can stop your config from syncing by using EasySync.SyncManager.UnregisterFromSyncing(GUID) but currently that only stops it from syncing automatically on player joins.

Credits

Owen3H - CSync - Made this possible.
icons8 - Mod icon