Class GameController

java.lang.Object
tech.underoaks.coldcase.game.GameController

public class GameController extends Object
Central manager responsible for handling interactions within the game.
  • Field Details

    • uuid

      public final UUID uuid
      UUID of this GameController instance
  • Method Details

    • getInstance

      public static GameController getInstance()
      Retrieves the singleton instance of the GameController.
      Returns:
      The singleton GameController instance.
    • destroy

      public static void destroy()
      Removes the currently running instance
    • triggerAction

      public boolean triggerAction(Interaction interaction)
      Triggers an action at the specified position in the given direction.
      Parameters:
      interaction - The interaction to trigger.
      Returns:
      True if the action was successfully triggered, false otherwise.
    • triggerAction

      public static boolean triggerAction(InteractionChain testChain, Interaction interaction)
      Triggers an action using the provided interaction chain, target position, and direction.
      Parameters:
      testChain - The interaction chain to use.
      interaction - The interaction to trigger.
      Returns:
      True if the action was successfully triggered, false otherwise.
    • triggerAction

      public static boolean triggerAction(InteractionChain testChain, Interaction interaction, boolean suppressTranscendentFollowUp)
      Triggers an action using the provided interaction chain, target position, and direction, with an option to suppress transcendent follow-up actions.
      Parameters:
      testChain - The interaction chain to use.
      interaction - The interaction to trigger.
      suppressTranscendentFollowUp - If true, suppresses triggering of transcendent follow-up actions.
      Returns:
      True if the action was successfully triggered, false otherwise.
    • triggerLocalAction

      public static TileContent triggerLocalAction(InteractionChain chain, Interaction interaction)
      Initiates a local action at a specified position and direction.
      Parameters:
      chain - The interaction chain to use.
      interaction - The interaction to trigger.
      Returns:
      The TileContent handler if the action was handled, null otherwise.
    • triggerRemoteAction

      public static void triggerRemoteAction(InteractionChain chain, Interaction interaction) throws TimeoutException
      Triggers a remote action at the specified position and direction.
      Parameters:
      chain - The interaction chain to use.
      interaction - The interaction to trigger.
      Throws:
      TimeoutException - When the remote client is not responding
    • applyNextPendingGSU

      public void applyNextPendingGSU()
      Applies the next pending GameStateUpdate to the current map.
    • isPendingGSUQueueEmpty

      public boolean isPendingGSUQueueEmpty()
      Checks if there are any pending GameStateUpdates to be applied.
      Returns:
      True if there are no pending updates, false otherwise.
    • getCurrentMap

      public Map getCurrentMap()
      Gets the current 'live'-Map
      Returns:
      Map
    • setCurrentMap

      public void setCurrentMap(Map map)
      Sets the current 'live'-Map
      Parameters:
      map - Map
    • handleTriggerRemoteInteraction

      public Queue<Interaction> handleTriggerRemoteInteraction(Interaction interaction, boolean suppressTranscendentFollowUp)
      Handles triggering of a remote interaction.
      Parameters:
      interaction - The interaction to trigger.
      suppressTranscendentFollowUp - If true, suppresses triggering of transcendent follow-up actions.
      Returns:
      A queue of pending actions, or null if the action was unsuccessful.
    • handleCreateRemoteInteractionChain

      public void handleCreateRemoteInteractionChain()
      Handles the creation of a remote interaction chain.
      Throws:
      RuntimeException - if another interaction is currently running.
    • handleApplyRemoteGSUsMessage

      public void handleApplyRemoteGSUsMessage()
      Applies the remote GameStateUpdates.
      Throws:
      RuntimeException - if there is not exactly one chain in the interaction stack.
    • handleAbortRemoteGSUsMessage

      public void handleAbortRemoteGSUsMessage()
      Aborts the remote GameStateUpdates.