TeleporterHandler - jimdroberts/FishMMO GitHub Wiki

Description

TeleporterHandler handles interactions with teleporter objects on the server in FishMMO. It allows players to teleport to target locations or named destinations.


API Access

Methods

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

    Handles the interaction between a player character and a teleporter. If a target transform is set, moves the character to the target position and rotation. Otherwise, triggers teleport by name. Parameters: - IInteractable interactable: The interactable object (should be a Teleporter). - IPlayerCharacter character: The player character interacting with the teleporter. - ISceneObject sceneObject: The scene object associated with the interaction. - InteractableSystem serverInstance: The server instance managing interactables.


Basic Usage

Setup

  1. Register TeleporterHandler as the handler for teleporter interactables on the server.
  2. The handler will automatically process player interactions and move or teleport the character as appropriate.

Example

// Example 1: Handling a teleporter interaction
teleporterHandler.HandleInteraction(interactable, character, sceneObject, serverInstance);

Best Practices

  • Ensure the handler is registered for the correct interactable types.
  • Validate that the character is not already teleporting before processing the interaction.
  • Use target transforms for direct movement or named destinations for flexible teleport logic.
⚠️ **GitHub.com Fallback** ⚠️