IInteractableHandler - jimdroberts/FishMMO GitHub Wiki

Description

IInteractableHandler is an interface for handling interactions between player characters and interactable objects in the FishMMO server.


API Access

Methods

  • void HandleInteraction(IInteractable interactable, IPlayerCharacter character, ISceneObject sceneObject, InteractableSystem serverInstance)

    Handles the interaction between a player character and an interactable object. Parameters: - IInteractable interactable: The interactable object being interacted with. - IPlayerCharacter character: The player character performing the interaction. - ISceneObject sceneObject: The scene object associated with the interaction. - InteractableSystem serverInstance: The server instance managing interactables.


Basic Usage

Setup

  1. Implement IInteractableHandler for each type of interactable object you want to support on the server.
  2. Register your handler with the interactable system to process player interactions.

Example

// Example 1: Implementing a custom interactable handler
public class CustomHandler : IInteractableHandler
{
    public void HandleInteraction(IInteractable interactable, IPlayerCharacter character, ISceneObject sceneObject, InteractableSystem serverInstance)
    {
        // Custom interaction logic here
    }
}

Best Practices

  • Implement this interface for each unique interactable type to keep logic modular and maintainable.
  • Validate all interaction data before performing actions or broadcasting to clients.
  • Register handlers with the interactable system during server initialization.
⚠️ **GitHub.com Fallback** ⚠️