In a scenario where all InventoryStorageManagers need to handle a certain event or receive an RPC one must copy-paste implementations right now because the base class InventoryStorageManagerComponent is not moddable and the two commonly used derivates SCR_InventoryStorageManagerComponent and SCR_VehicleInventoryStorageManagerComponent share no other base class. If game-modes add their own additional scripted implementations those would become impossible to handle for cross-mod compatibility. Right now code looks like this:
modded class SCR_InventoryStorageManagerComponent { //------------------------------------------------------------------------------------------------ override protected void OnItemAdded(BaseInventoryStorageComponent storageOwner, IEntity item) { if (EL_QuantityHandler.HandleOnItemAdded(this, storageOwner, item)) return; super.OnItemAdded(storageOwner, item); } } modded class SCR_VehicleInventoryStorageManagerComponent { //------------------------------------------------------------------------------------------------ override protected void OnItemAdded(BaseInventoryStorageComponent storageOwner, IEntity item) { if (EL_QuantityHandler.HandleOnItemAdded(this, storageOwner, item)) return; super.OnItemAdded(storageOwner, item); } }
My proposed solution for it is very simple: Add something like class ScriptedInventoryStorageManagerComponent : InventoryStorageManagerComponent {} and make the SCR_ variants inherit from that. This way when modding ScriptedInventoryStorageManagerComponent a change is applied to all possible derived classes.