IFluxRoom

csharp
public interface IFluxRoom

Namespace NodeWorld.SDK.Client.Flux.

The room of the local player, as the FL# scripts of the world see it: the other players, the master, the server clock, the owners of the synchronized objects, the synced states and network events of the scripts. The client is backed by the server; Play mode in a world project has the local player alone.

Properties

LocalPlayerId

csharp
uint LocalPlayerId { get; }

The id of the local player in the room.

LocalAccountId

csharp
string LocalAccountId { get; }

The NodeWorld account of the local player (empty if unknown).

LocalDisplayName

csharp
string LocalDisplayName { get; }

The display name of the local player.

LocalJoinedAt

csharp
double LocalJoinedAt { get; }

When the local player entered the room (server clock): with FluxRoomPlayer.JoinedAt, the order of arrival.

MasterId

csharp
uint MasterId { get; }

The master of the room: the player in it the longest (the local player when alone).

ServerTime

csharp
double ServerTime { get; }

The server clock, in seconds (0 until known).

Players

csharp
IReadOnlyList<FluxRoomPlayer> Players { get; }

The other players of the room, in the order they entered it, with their last pose.

Methods

RequestOwnership

csharp
void RequestOwnership(string objectId)

Asks the server for the ownership of the object.

AnswerOwnership

csharp
void AnswerOwnership(string objectId, uint requesterId, bool accept)

Answers a player who asks for an object the local player owns (OwnershipQueried).

SendObjectState

csharp
void SendObjectState(string objectId, Vector3 position, Quaternion rotation, Vector3 velocity)

Sends the transform of an object the local player owns.

SendScriptState

csharp
void SendScriptState(string objectId, byte slot, byte[] data, bool reliable)

Sends the synced state of a script (slot: its index among the FL# scripts of the object); reliable or the latest wins.

SendScriptEvent

csharp
void SendScriptEvent(string objectId, byte slot, byte target, uint toPlayerId, string name, byte[] data)

target: 1 others, 2 owner, 3 one player, 4 master, 5 the server's scripts (an event to All is sent to the others and run here).

SetVoiceHearing

csharp
void SetVoiceHearing(uint speakerId, float far)

Up to which distance the local player hears that speaker (far below 0: the room's range).

SpawnObject

csharp
void SpawnObject(uint requestId, string templateId, Vector3 position, Quaternion rotation)

Asks the server to spawn a copy of a network template for the room; the answer carries requestId back.

DespawnObject

csharp
void DespawnObject(string networkId)

Asks the server to remove a spawned copy for the room (its owner or the master).

Events

PlayerJoined

csharp
event Action<uint> PlayerJoined

Another player entered the room.

PlayerLeft

csharp
event Action<uint> PlayerLeft

A player left the room.

MasterChanged

csharp
event Action<uint> MasterChanged

The master of the room changed.

ObjectStateReceived

csharp
event Action<FluxObjectState> ObjectStateReceived

The owner of a synced object sent its transform.

OwnershipChanged

csharp
event Action<FluxOwnershipChange> OwnershipChanged

A synced object changed owner.

OwnershipQueried

csharp
event Action<string, uint> OwnershipQueried

A player asks for an object the local player owns: answer with AnswerOwnership.

ScriptStateReceived

csharp
event Action<FluxScriptState> ScriptStateReceived

The owner of an object sent the synced state of one of its scripts (a player who arrives gets the last ones).

ScriptEventReceived

csharp
event Action<FluxScriptEvent> ScriptEventReceived

A network event of a script came from a player.

ObjectSpawned

csharp
event Action<FluxSpawnedObject> ObjectSpawned

A copy of a network template lives in the room: spawned now, or there before the local player came (FL# Networking.Instantiate).

ObjectSpawnRefused

csharp
event Action<uint, byte> ObjectSpawnRefused

The server refused a spawn of the local player: its request id and why (FluxSpawnRefusals).

ObjectDespawned

csharp
event Action<string> ObjectDespawned

A spawned copy was removed from the room (its network id).