AbilityActivationReplicateData - jimdroberts/FishMMO GitHub Wiki
Replicate data for ability activation, used for network prediction. Encapsulates activation flags, queued ability ID, held key, and network tick for synchronizing ability activations across the network in FishMMO.
-
public int ActivationFlags
Flags representing the activation state.
-
public long QueuedAbilityID
The ID of the queued ability.
-
public KeyCode HeldKey
The key held during activation.
-
private uint _tick
Internal network tick value for prediction synchronization.
-
public AbilityActivationReplicateData(int activationFlags, long queuedAbilityID, KeyCode heldKey)
Initializes a new instance of the AbilityActivationReplicateData struct. activationFlags: int - Activation flags. queuedAbilityID: long - Queued ability ID. heldKey: KeyCode - Held key.
-
public void Dispose()
Disposes the replicate data (no-op).
-
public uint GetTick()
Gets the network tick value. Returns: uint - The tick value.
-
public void SetTick(uint value)
Sets the network tick value. value: uint - Tick value.
- Use
AbilityActivationReplicateData
as the data structure for network-predicted ability activations. - Populate the struct with activation flags, queued ability ID, and held key when sending activation data.
- Use
GetTick
andSetTick
to synchronize network prediction ticks as required by FishNet's prediction system.
// Example 1: Creating and using AbilityActivationReplicateData
var replicateData = new AbilityActivationReplicateData(activationFlags, queuedAbilityID, KeyCode.Space);
replicateData.SetTick(currentTick);
// Example 2: Accessing replicate data fields
int flags = replicateData.ActivationFlags;
long abilityId = replicateData.QueuedAbilityID;
KeyCode key = replicateData.HeldKey;
- Always set the network tick value when using replicate data for prediction to ensure synchronization.
- Use clear and consistent flag values for ActivationFlags to avoid ambiguity in activation state.
- Dispose is a no-op but should be called if required by interface contracts.
- Integrate with FishNet's prediction and replication systems for robust networked ability handling.