Changed verb syncing to work closer like IThingHolder
One of the changes I've proposed in #411, but without any API implementation.
List of changes:
VerbOwnerTypeenum was removed and replaced bysupportedVerbOwnerTypesarray- The array includes
typeof(Thing)instead oftypeof(Pawn)for increased compatibility IVerbOwnersync worker entry was addedVerbsync worker entry was modified to sync the owner asIVerbOwner
Those changes should result in greater compatibility, as new supported IVerbOwner types can now be added to the array and synced using their own sync workers.
This should also end up simplifying Verb sync worker going forward, as we won't have to expand it anymore in the future - only the array of supported types.
Things that I did not include, but we may want to potentially consider:
- Add more vanilla types to the list of supported verb owners, which could include:
HediffComp(specifically due toHediffComp_VerbGiver) - in vanilla RW they don't have gizmos, but a mod could add a custom hediff comp that adds themPawn_MeleeVerbs_TerrainSource- likely will never get gizmos, probably will be completely pointless to includePawn_NativeVerbs- same as above
- Automatically including all subtypes of
IVerbOwnerwhich have a(n explicit) sync worker- Would simplify mod compat, as mods would (likely) never need to modify the list of supported verb owners
- Could have potentially unintended consequences?
I think IVerbOwner and ISelectable can just be handled like the other interfaces. The worst that can happen is an error message when syncing an unsupported implementation.
I've attempted to sync IVerbOwner like other interfaces, but sadly - it doesn't look like it'll work without other changes. I thought I managed to fix it, but seems like it's not the case, so I reverted the commit.
The issue is trying to sync (for example) a Pawn, which causes it to be synced as IVerbOwner. IVerbOwner then tries to sync the Pawn as IVerbOwner, which tries to... You get the idea. It tries to recursively sync Pawn as IVerbOwner over and over until the game crashes.
This should be entirely addressed by b5a01c3