BindstoneHandler - jimdroberts/FishMMO GitHub Wiki
BindstoneHandler
handles interactions with bindstone objects on the server in FishMMO. It allows players to set their respawn location to the current scene and position.
-
public void HandleInteraction(IInteractable interactable, IPlayerCharacter character, ISceneObject sceneObject, InteractableSystem serverInstance)
Handles the interaction between a player character and a bindstone. Validates character and scene, then sets the character's bind position and scene for respawn. Parameters: - IInteractable interactable: The interactable object (should be a bindstone). - IPlayerCharacter character: The player character interacting with the bindstone. - ISceneObject sceneObject: The scene object associated with the interaction. - InteractableSystem serverInstance: The server instance managing interactables.
- Register
BindstoneHandler
as the handler for bindstone interactables on the server. - The handler will automatically process player interactions and update the character's respawn location.
// Example 1: Handling a bindstone interaction
bindstoneHandler.HandleInteraction(interactable, character, sceneObject, serverInstance);
- Ensure the handler is registered for the correct interactable types.
- Validate that the character and scene are correct before updating respawn data.
- Log and handle errors gracefully to aid in debugging and player support.