Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
`DynDelegate` was required to handle 2 possible signatures for the sync worker delegate: - Explicit sync worker delegates would have no return type - Implicit sync worker delegates would return `bool` - Those rules only apply to sync workers registered by using `SyncWorkerAttribute`, not `MP.RegisterSyncWorker` calls - which would treat all as having no return type (and handled in a different location than the one being changed here) `DynDelegate` was used here as when it changed it took a method with no return type - it would return true (`il.Emit(OpCodes.Ldc_I4_1)`). My solution here is to have 2 delegates - one of which has no return type. I then create the appropriate delegate with a call to `Delegate.CreateDelegate`. For delegates that already return a boolean - I pass it further. However, delegates with no return value are first wrapped with a delegate that will then return true (matching `DynDelegate` behaviour. From my initial testing everything seems to work fine as-is. However, I believe some extra testing should be done before applying those changes - specifically with existing mods using `SyncWorkerAttribute`.
- Loading branch information