uncategorized streamWatcherRoom - wxyz-abcd/node-haxball GitHub Wiki
This is not an instance of a class, but a custom object generated on the fly, with the following keys:
-
state: RoomState
: An object containing all information about the current room state. Note that this object also has all of the functions explained below in section:sandbox mode functions
. (It only hascopy()
instead oftakeSnapshot()
.) -
gameState: GameState | null
: The original object that holds the game state information. Returns null if game is not active. -
currentPlayerId: int
: This is a read-only property that always returns 0. It is only added for compatibility with renderers. (And it is only used in the initialization code of renderers.) -
speed: number
: The current speed of the simulation. -
currentFrameNo: int
: The current frame number of the room state that you are currently observing. -
maxFrameNo: int
: The original current frame number of the room where the game is actually being played.
-
extrapolate(milliseconds: int): void
Extrapolates the whole room state for
milliseconds
milliseconds, and stores all results in each extrapolated objects'ext
key. NOTE: This function is currently only symbolic.Parameters:
-
milliseconds: int
: The extrapolation time in milliseconds. Default limits:-200
<=milliseconds
<=200
.
Return value: void
-
-
readStream(reader: Impl.Stream.F): void
A callback that reads the data stream for "interval" streaming mode.
Parameters:
-
reader: Impl.Stream.F
: The stream reader instance.
Return value: void.
-
-
readImmediateStream(reader: Impl.Stream.F): void
A callback that reads the data stream for "immediate" streaming mode.
Parameters:
-
reader: Impl.Stream.F
: The stream reader instance.
Return value: void.
-
-
setSimulationSpeed(coefficient: number): void
Changes the speed of the simulation.
Parameters:
-
coefficient: number
: The desired speed coefficient. Must be a real number >=0. Meaning of possible value ranges is as follows:- value = 0 : stop simulation.
- 0 < value < 1 : slow-motion simulation.
- value = 1 : normal speed simulation.
- value > 1 : fast-motion simulation.
Return value: void.
-
-
runSteps(count: int): void
Runs the simulation
count
steps. Simulation should be stopped for this function to work as expected.Parameters:
-
count: int
: Number of steps to run the simulation.
Return value: void.
-
-
takeSnapshot(): RoomState
Returns a snapshot of the current room state. You can load this object directly into sandbox using its
useSnapshot(roomState)
function. Note that the values stored here are the currently active values, not the static and stored ones.Return value: The snapshot copy of the current RoomState object.
-
useSnapshot(newRoomState: RoomState): void
Generates a copy of the given RoomState and sets the current room state reference to the generated RoomState.
Parameters:
-
newRoomState: RoomState
: The RoomState to use. Should be created bytakeSnapshot()
first.
Return value: void.
-
-
destroy(): void
Frees the resources that are used by this object.
Parameters: None.
Return value: void.