Package tech.underoaks.coldcase.remote
Class RemoteGameController
java.lang.Object
tech.underoaks.coldcase.remote.RemoteGameController
- All Implemented Interfaces:
AutoCloseable
Represents a remote game controller responsible for managing remote interactions
and game state updates through WebSocket communication.
This class handles the creation and management of interaction chains and provides functionality to trigger actions remotely and apply or abort updates to the game state.
-
Constructor Summary
ConstructorsConstructorDescriptionInitializes a new remote game controller, establishing a remote interaction chain and retrieving its unique identifier. -
Method Summary
Modifier and TypeMethodDescriptionvoidApplies all pending updates in the game state update (GSU) queue for the remote interaction chain on the other client.voidclose()Closes the remote game controller and aborts any pending updates in the GSU queue.triggerAction(Interaction interaction) Triggers a remote action at the specified position and direction.triggerAction(Interaction interaction, boolean suppressTranscendentFollowUp) Triggers a remote action at the specified position and direction with an option to suppress follow-up actions.
-
Constructor Details
-
RemoteGameController
Initializes a new remote game controller, establishing a remote interaction chain and retrieving its unique identifier.blocks until timeout or responseMessage completes the futureObj.
- Throws:
TimeoutException- if no response is being returned
-
-
Method Details
-
triggerAction
Triggers a remote action at the specified position and direction.- Parameters:
interaction- The interaction to trigger.- Returns:
- a queue of interactions representing the result of the triggered action,
or
nullif the action times out, an error occurs or no Action took place.
-
triggerAction
public Queue<Interaction> triggerAction(Interaction interaction, boolean suppressTranscendentFollowUp) Triggers a remote action at the specified position and direction with an option to suppress follow-up actions.needed to not create an endless loop of creating remote interaction chains.
- Parameters:
interaction- The interaction to trigger.suppressTranscendentFollowUp- whether to suppress follow-up actions.- Returns:
- a queue of interactions representing the result of the triggered action,
or
nullif the action times out or an error occurs.
-
applyGSUQueue
public void applyGSUQueue()Applies all pending updates in the game state update (GSU) queue for the remote interaction chain on the other client. -
close
public void close()Closes the remote game controller and aborts any pending updates in the GSU queue.- Specified by:
closein interfaceAutoCloseable
-