Would (should) it be possible for modders to override core game classes?
Posted: Thu Apr 15, 2021 8:55 pm
Sometimes extensive changes might be required to implement a complex mod, and there might not be adequate delegate hooks in the core game code, or existing game code might interfere with the mod.
My experience with Unity is limited...would it be possible for modders to modify/extend core DFU classes?
For example, let's say I wanted to make changes to the logic of the CanSeeTarget() method of the EnemySenses class and there wasn't an existing hook, or I couldn't use it for some reason.
I might then create my own derived EnemySenses class and create my own CanSeeTarget() method, then call a DFU method to register my class. There might also be an 'isXregistered' method I could call beforehand.
If another mod has already registered a similar change, DFU could inform me of the conflict and possibly supply the name/id of the other mod in case a workaround is possible.
Whenever DFU would attempt to instantiate an EnemySenses object, it would first check to see if a class override is registered and instantiate that one instead.
Would this mechanism be possible? or maybe it would create too many problems?
My experience with Unity is limited...would it be possible for modders to modify/extend core DFU classes?
For example, let's say I wanted to make changes to the logic of the CanSeeTarget() method of the EnemySenses class and there wasn't an existing hook, or I couldn't use it for some reason.
I might then create my own derived EnemySenses class and create my own CanSeeTarget() method, then call a DFU method to register my class. There might also be an 'isXregistered' method I could call beforehand.
If another mod has already registered a similar change, DFU could inform me of the conflict and possibly supply the name/id of the other mod in case a workaround is possible.
Whenever DFU would attempt to instantiate an EnemySenses object, it would first check to see if a class override is registered and instantiate that one instead.
Would this mechanism be possible? or maybe it would create too many problems?