AbilityCrafterHandler - jimdroberts/FishMMO GitHub Wiki
AbilityCrafterHandler
handles interactions with ability crafter objects on the server in FishMMO. It allows players to open the ability crafting interface and triggers NPC interaction logic.
-
public void HandleInteraction(IInteractable interactable, IPlayerCharacter character, ISceneObject sceneObject, InteractableSystem serverInstance)
Handles the interaction between a player character and an ability crafter. Broadcasts ability crafter data to the client and triggers NPC look-at logic. Parameters: - IInteractable interactable: The interactable object (should be an ability crafter). - IPlayerCharacter character: The player character interacting with the ability crafter. - ISceneObject sceneObject: The scene object associated with the interaction. - InteractableSystem serverInstance: The server instance managing interactables.
- Register
AbilityCrafterHandler
as the handler for ability crafter interactables on the server. - The handler will automatically process player interactions and broadcast the appropriate data to the client.
// Example 1: Handling an ability crafter interaction
abilityCrafterHandler.HandleInteraction(interactable, character, sceneObject, serverInstance);
- Ensure the handler is registered for the correct interactable types.
- Use the handler to trigger both client UI and NPC logic for a seamless player experience.
- Validate all interaction data before broadcasting to clients.