Package tech.underoaks.coldcase.game
Class GameController
java.lang.Object
tech.underoaks.coldcase.game.GameController
Central manager responsible for handling interactions within the game.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidApplies the next pending GameStateUpdate to the current map.static voiddestroy()Removes the currently running instanceGets the current 'live'-Mapstatic GameControllerRetrieves the singleton instance of the GameController.voidAborts the remote GameStateUpdates.voidApplies the remote GameStateUpdates.voidHandles the creation of a remote interaction chain.handleTriggerRemoteInteraction(Interaction interaction, boolean suppressTranscendentFollowUp) Handles triggering of a remote interaction.booleanChecks if there are any pending GameStateUpdates to be applied.voidsetCurrentMap(Map map) Sets the current 'live'-MapbooleantriggerAction(Interaction interaction) Triggers an action at the specified position in the given direction.static booleantriggerAction(InteractionChain testChain, Interaction interaction) Triggers an action using the provided interaction chain, target position, and direction.static booleantriggerAction(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.static TileContenttriggerLocalAction(InteractionChain chain, Interaction interaction) Initiates a local action at a specified position and direction.static voidtriggerRemoteAction(InteractionChain chain, Interaction interaction) Triggers a remote action at the specified position and direction.
-
Field Details
-
uuid
UUID of this GameController instance
-
-
Method Details
-
getInstance
Retrieves the singleton instance of the GameController.- Returns:
- The singleton GameController instance.
-
destroy
public static void destroy()Removes the currently running instance -
triggerAction
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
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
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
Gets the current 'live'-Map- Returns:
Map
-
setCurrentMap
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.
-