How to get the world object on "OnOperatingChange" event


  • I already asked this on eco-mods – I hope this kind of "double-post" is not frowned upon.

    So basically I want to create a mod which notifies the player when a crafting component goes "out of operation", i.e. because the fuel is empty. I can subscribe to the OnOperatingChange event of a WorldObject (which has a CraftinComponent) like this:

    
    
    public void Initialize(TimedTask timer) {
        craftingComponent.Parent.OnOperatingChange.Add(this.HandleOperatingChange);
    }
    
    private void HandleOperatingChange()
    {
        ChatManager.ServerMessageToAllLoc("oh hello there", false);
    }
    

    How can I get the WorldObject instance which triggered this event inside the HandleOperatingChange function?

    For other events like the OnActionPerformed there is a payload which has this instance, or at least the GUID of it (see EcoModKit wiki). Is there something similar for my use case?


  • 1
    Posts
    46
    Views
    Log in to reply

Internal error.

Oops! Looks like something went wrong!