QSBMessage: remove variants since tuples work now, rename Value -> Data

This commit is contained in:
JohnCorby 2022-03-02 19:34:18 -08:00
parent 2ce2fdde38
commit 20eaa8adfc
52 changed files with 143 additions and 186 deletions

View File

@ -16,7 +16,7 @@ namespace QSB.Anglerfish.Messages
public AnglerDataMessage(QSBAngler qsbAngler) public AnglerDataMessage(QSBAngler qsbAngler)
{ {
Value = qsbAngler.AttachedObject._currentState; Data = qsbAngler.AttachedObject._currentState;
TargetId = TargetToId(qsbAngler.TargetTransform); TargetId = TargetToId(qsbAngler.TargetTransform);
LocalDisturbancePos = qsbAngler.AttachedObject._localDisturbancePos; LocalDisturbancePos = qsbAngler.AttachedObject._localDisturbancePos;
} }
@ -39,7 +39,7 @@ namespace QSB.Anglerfish.Messages
{ {
WorldObject.TargetTransform = IdToTarget(TargetId); WorldObject.TargetTransform = IdToTarget(TargetId);
WorldObject.AttachedObject._localDisturbancePos = LocalDisturbancePos; WorldObject.AttachedObject._localDisturbancePos = LocalDisturbancePos;
WorldObject.AttachedObject.ChangeState(Value); WorldObject.AttachedObject.ChangeState(Data);
} }
private static uint TargetToId(Transform transform) private static uint TargetToId(Transform transform)

View File

@ -5,11 +5,11 @@ namespace QSB.Animation.NPC.Messages
{ {
internal class NpcAnimationMessage : QSBWorldObjectMessage<INpcAnimController, bool> internal class NpcAnimationMessage : QSBWorldObjectMessage<INpcAnimController, bool>
{ {
public NpcAnimationMessage(bool start) => Value = start; public NpcAnimationMessage(bool start) => Data = start;
public override void OnReceiveRemote() public override void OnReceiveRemote()
{ {
if (Value) if (Data)
{ {
WorldObject.StartConversation(); WorldObject.StartConversation();
} }

View File

@ -6,7 +6,7 @@ namespace QSB.Animation.Player.Messages
{ {
internal class AnimationTriggerMessage : QSBMessage<string> internal class AnimationTriggerMessage : QSBMessage<string>
{ {
public AnimationTriggerMessage(string name) => Value = name; public AnimationTriggerMessage(string name) => Data = name;
public override bool ShouldReceive => QSBWorldSync.AllObjectsReady; public override bool ShouldReceive => QSBWorldSync.AllObjectsReady;
@ -23,7 +23,7 @@ namespace QSB.Animation.Player.Messages
return; return;
} }
animationSync.VisibleAnimator.SetTrigger(Value); animationSync.VisibleAnimator.SetTrigger(Data);
} }
} }
} }

View File

@ -21,14 +21,14 @@ namespace QSB.Animation.Player.Messages
} }
} }
public PlayerSuitMessage(bool on) => Value = on; public PlayerSuitMessage(bool on) => Data = on;
public override bool ShouldReceive => QSBWorldSync.AllObjectsReady; public override bool ShouldReceive => QSBWorldSync.AllObjectsReady;
public override void OnReceiveRemote() public override void OnReceiveRemote()
{ {
var player = QSBPlayerManager.GetPlayer(From); var player = QSBPlayerManager.GetPlayer(From);
player.SuitedUp = Value; player.SuitedUp = Data;
if (!player.IsReady) if (!player.IsReady)
{ {
@ -36,14 +36,14 @@ namespace QSB.Animation.Player.Messages
} }
var animator = player.AnimationSync; var animator = player.AnimationSync;
animator.SetSuitState(Value); animator.SetSuitState(Data);
} }
public override void OnReceiveLocal() public override void OnReceiveLocal()
{ {
QSBPlayerManager.LocalPlayer.SuitedUp = Value; QSBPlayerManager.LocalPlayer.SuitedUp = Data;
var animator = QSBPlayerManager.LocalPlayer.AnimationSync; var animator = QSBPlayerManager.LocalPlayer.AnimationSync;
animator.InSuitedUpState = Value; animator.InSuitedUpState = Data;
} }
} }
} }

View File

@ -5,8 +5,8 @@ namespace QSB.CampfireSync.Messages
{ {
internal class CampfireStateMessage : QSBWorldObjectMessage<QSBCampfire, Campfire.State> internal class CampfireStateMessage : QSBWorldObjectMessage<QSBCampfire, Campfire.State>
{ {
public CampfireStateMessage(Campfire.State state) => Value = state; public CampfireStateMessage(Campfire.State state) => Data = state;
public override void OnReceiveRemote() => WorldObject.SetState(Value); public override void OnReceiveRemote() => WorldObject.SetState(Data);
} }
} }

View File

@ -10,10 +10,10 @@ namespace QSB.ClientServerStateSync.Messages
/// </summary> /// </summary>
internal class ClientStateMessage : QSBMessage<ClientState> internal class ClientStateMessage : QSBMessage<ClientState>
{ {
public ClientStateMessage(ClientState state) => Value = state; public ClientStateMessage(ClientState state) => Data = state;
public override void OnReceiveLocal() public override void OnReceiveLocal()
=> ClientStateManager.Instance.ChangeClientState(Value); => ClientStateManager.Instance.ChangeClientState(Data);
public override void OnReceiveRemote() public override void OnReceiveRemote()
{ {
@ -24,7 +24,7 @@ namespace QSB.ClientServerStateSync.Messages
} }
var player = QSBPlayerManager.GetPlayer(From); var player = QSBPlayerManager.GetPlayer(From);
player.State = Value; player.State = Data;
} }
} }
} }

View File

@ -7,10 +7,10 @@ namespace QSB.ClientServerStateSync.Messages
/// </summary> /// </summary>
internal class ServerStateMessage : QSBMessage<ServerState> internal class ServerStateMessage : QSBMessage<ServerState>
{ {
public ServerStateMessage(ServerState state) => Value = state; public ServerStateMessage(ServerState state) => Data = state;
public override void OnReceiveLocal() => OnReceiveRemote(); public override void OnReceiveLocal() => OnReceiveRemote();
public override void OnReceiveRemote() public override void OnReceiveRemote()
=> ServerStateManager.Instance.ChangeServerState(Value); => ServerStateManager.Instance.ChangeServerState(Data);
} }
} }

View File

@ -6,9 +6,9 @@ namespace QSB.ConversationSync.Messages
internal class EnterRemoteDialogueMessage : QSBWorldObjectMessage<QSBRemoteDialogueTrigger, int> internal class EnterRemoteDialogueMessage : QSBWorldObjectMessage<QSBRemoteDialogueTrigger, int>
{ {
public EnterRemoteDialogueMessage(int dialogueIndex) public EnterRemoteDialogueMessage(int dialogueIndex)
=> Value = dialogueIndex; => Data = dialogueIndex;
public override void OnReceiveRemote() public override void OnReceiveRemote()
=> WorldObject.RemoteEnterDialogue(Value); => WorldObject.RemoteEnterDialogue(Data);
} }
} }

View File

@ -13,7 +13,7 @@ namespace QSB.DeathSync.Messages
public PlayerDeathMessage(DeathType type) public PlayerDeathMessage(DeathType type)
{ {
Value = type; Data = type;
NecronomiconIndex = Necronomicon.GetRandomIndex(type); NecronomiconIndex = Necronomicon.GetRandomIndex(type);
} }
@ -40,7 +40,7 @@ namespace QSB.DeathSync.Messages
{ {
var player = QSBPlayerManager.GetPlayer(From); var player = QSBPlayerManager.GetPlayer(From);
var playerName = player.Name; var playerName = player.Name;
var deathMessage = Necronomicon.GetPhrase(Value, NecronomiconIndex); var deathMessage = Necronomicon.GetPhrase(Data, NecronomiconIndex);
if (deathMessage != null) if (deathMessage != null)
{ {
DebugLog.ToAll(string.Format(deathMessage, playerName)); DebugLog.ToAll(string.Format(deathMessage, playerName));

View File

@ -5,8 +5,8 @@ namespace QSB.ElevatorSync.Messages
{ {
public class ElevatorMessage : QSBWorldObjectMessage<QSBElevator, bool> public class ElevatorMessage : QSBWorldObjectMessage<QSBElevator, bool>
{ {
public ElevatorMessage(bool isGoingUp) => Value = isGoingUp; public ElevatorMessage(bool isGoingUp) => Data = isGoingUp;
public override void OnReceiveRemote() => WorldObject.RemoteCall(Value); public override void OnReceiveRemote() => WorldObject.RemoteCall(Data);
} }
} }

View File

@ -20,16 +20,16 @@ namespace QSB.EyeOfTheUniverse.EyeStateSync.Messages
} }
} }
private EyeStateMessage(EyeState state) => Value = state; private EyeStateMessage(EyeState state) => Data = state;
public override bool ShouldReceive => QSBWorldSync.AllObjectsReady; public override bool ShouldReceive => QSBWorldSync.AllObjectsReady;
public override void OnReceiveLocal() => QSBPlayerManager.LocalPlayer.EyeState = Value; public override void OnReceiveLocal() => QSBPlayerManager.LocalPlayer.EyeState = Data;
public override void OnReceiveRemote() public override void OnReceiveRemote()
{ {
var player = QSBPlayerManager.GetPlayer(From); var player = QSBPlayerManager.GetPlayer(From);
player.EyeState = Value; player.EyeState = Data;
} }
} }
} }

View File

@ -5,8 +5,8 @@ namespace QSB.GeyserSync.Messages
{ {
public class GeyserMessage : QSBWorldObjectMessage<QSBGeyser, bool> public class GeyserMessage : QSBWorldObjectMessage<QSBGeyser, bool>
{ {
public GeyserMessage(bool state) => Value = state; public GeyserMessage(bool state) => Data = state;
public override void OnReceiveRemote() => WorldObject.SetState(Value); public override void OnReceiveRemote() => WorldObject.SetState(Data);
} }
} }

View File

@ -5,8 +5,8 @@ namespace QSB.JellyfishSync.Messages
{ {
public class JellyfishRisingMessage : QSBWorldObjectMessage<QSBJellyfish, bool> public class JellyfishRisingMessage : QSBWorldObjectMessage<QSBJellyfish, bool>
{ {
public JellyfishRisingMessage(bool isRising) => Value = isRising; public JellyfishRisingMessage(bool isRising) => Data = isRising;
public override void OnReceiveRemote() => WorldObject.SetIsRising(Value); public override void OnReceiveRemote() => WorldObject.SetIsRising(Data);
} }
} }

View File

@ -45,63 +45,20 @@ namespace QSB.Messaging
public override string ToString() => GetType().Name; public override string ToString() => GetType().Name;
} }
public abstract class QSBMessage<T> : QSBMessage public abstract class QSBMessage<D> : QSBMessage
{ {
protected T Value; protected D Data;
public override void Serialize(NetworkWriter writer) public override void Serialize(NetworkWriter writer)
{ {
base.Serialize(writer); base.Serialize(writer);
writer.Write(Value); writer.Write(Data);
} }
public override void Deserialize(NetworkReader reader) public override void Deserialize(NetworkReader reader)
{ {
base.Deserialize(reader); base.Deserialize(reader);
Value = reader.Read<T>(); Data = reader.Read<D>();
} }
} }
}
public abstract class QSBMessage<T, U> : QSBMessage
{
protected T Value1;
protected U Value2;
public override void Serialize(NetworkWriter writer)
{
base.Serialize(writer);
writer.Write(Value1);
writer.Write(Value2);
}
public override void Deserialize(NetworkReader reader)
{
base.Deserialize(reader);
Value1 = reader.Read<T>();
Value2 = reader.Read<U>();
}
}
public abstract class QSBMessage<T, U, V> : QSBMessage
{
protected T Value1;
protected U Value2;
protected V Value3;
public override void Serialize(NetworkWriter writer)
{
base.Serialize(writer);
writer.Write(Value1);
writer.Write(Value2);
writer.Write(Value3);
}
public override void Deserialize(NetworkReader reader)
{
base.Deserialize(reader);
Value1 = reader.Read<T>();
Value2 = reader.Read<U>();
Value3 = reader.Read<V>();
}
}
}

View File

@ -41,20 +41,20 @@ namespace QSB.Messaging
} }
} }
public abstract class QSBWorldObjectMessage<T, V> : QSBWorldObjectMessage<T> where T : IWorldObject public abstract class QSBWorldObjectMessage<T, D> : QSBWorldObjectMessage<T> where T : IWorldObject
{ {
protected V Value; protected D Data;
public override void Serialize(NetworkWriter writer) public override void Serialize(NetworkWriter writer)
{ {
base.Serialize(writer); base.Serialize(writer);
writer.Write(Value); writer.Write(Data);
} }
public override void Deserialize(NetworkReader reader) public override void Deserialize(NetworkReader reader)
{ {
base.Deserialize(reader); base.Deserialize(reader);
Value = reader.Read<V>(); Data = reader.Read<D>();
} }
} }
} }

View File

@ -5,8 +5,8 @@ namespace QSB.MeteorSync.Messages
{ {
public class FragmentDamageMessage : QSBWorldObjectMessage<QSBFragment, float> public class FragmentDamageMessage : QSBWorldObjectMessage<QSBFragment, float>
{ {
public FragmentDamageMessage(float damage) => Value = damage; public FragmentDamageMessage(float damage) => Data = damage;
public override void OnReceiveRemote() => WorldObject.AddDamage(Value); public override void OnReceiveRemote() => WorldObject.AddDamage(Data);
} }
} }

View File

@ -5,8 +5,8 @@ namespace QSB.OrbSync.Messages
{ {
public class OrbDragMessage : QSBWorldObjectMessage<QSBOrb, bool> public class OrbDragMessage : QSBWorldObjectMessage<QSBOrb, bool>
{ {
public OrbDragMessage(bool isDragging) => Value = isDragging; public OrbDragMessage(bool isDragging) => Data = isDragging;
public override void OnReceiveRemote() => WorldObject.SetDragging(Value); public override void OnReceiveRemote() => WorldObject.SetDragging(Data);
} }
} }

View File

@ -10,7 +10,7 @@ namespace QSB.OrbSync.Messages
public OrbSlotMessage(int slotIndex, bool playAudio) public OrbSlotMessage(int slotIndex, bool playAudio)
{ {
Value = slotIndex; Data = slotIndex;
_playAudio = playAudio; _playAudio = playAudio;
} }
@ -26,6 +26,6 @@ namespace QSB.OrbSync.Messages
_playAudio = reader.Read<bool>(); _playAudio = reader.Read<bool>();
} }
public override void OnReceiveRemote() => WorldObject.SetSlot(Value, _playAudio); public override void OnReceiveRemote() => WorldObject.SetSlot(Data, _playAudio);
} }
} }

View File

@ -34,7 +34,7 @@ namespace QSB.Player.Messages
public EnterLeaveMessage(EnterLeaveType type, int objectId = -1) public EnterLeaveMessage(EnterLeaveType type, int objectId = -1)
{ {
Value = type; Data = type;
ObjectId = objectId; ObjectId = objectId;
} }
@ -57,7 +57,7 @@ namespace QSB.Player.Messages
public override void OnReceiveRemote() public override void OnReceiveRemote()
{ {
var player = QSBPlayerManager.GetPlayer(From); var player = QSBPlayerManager.GetPlayer(From);
switch (Value) switch (Data)
{ {
case EnterLeaveType.EnterMoon: case EnterLeaveType.EnterMoon:
player.IsInMoon = true; player.IsInMoon = true;
@ -80,7 +80,7 @@ namespace QSB.Player.Messages
ShipManager.Instance.RemovePlayerFromShip(player); ShipManager.Instance.RemovePlayerFromShip(player);
break; break;
default: default:
DebugLog.ToConsole($"Warning - Unknown EnterLeaveType : {Value}", MessageType.Warning); DebugLog.ToConsole($"Warning - Unknown EnterLeaveType : {Data}", MessageType.Warning);
break; break;
} }
} }

View File

@ -8,46 +8,46 @@ namespace QSB.Player.Messages
// almost a world object message, but supports null (-1) as well // almost a world object message, but supports null (-1) as well
internal class PlayerEntangledMessage : QSBMessage<int> internal class PlayerEntangledMessage : QSBMessage<int>
{ {
public PlayerEntangledMessage(int objectId) => Value = objectId; public PlayerEntangledMessage(int objectId) => Data = objectId;
public override bool ShouldReceive => QSBWorldSync.AllObjectsReady; public override bool ShouldReceive => QSBWorldSync.AllObjectsReady;
public override void OnReceiveLocal() public override void OnReceiveLocal()
{ {
var player = QSBPlayerManager.LocalPlayer; var player = QSBPlayerManager.LocalPlayer;
if (Value == -1) if (Data == -1)
{ {
player.EntangledObject = null; player.EntangledObject = null;
return; return;
} }
var quantumObject = Value.GetWorldObject<IQSBQuantumObject>(); var quantumObject = Data.GetWorldObject<IQSBQuantumObject>();
player.EntangledObject = quantumObject; player.EntangledObject = quantumObject;
} }
public override void OnReceiveRemote() public override void OnReceiveRemote()
{ {
var player = QSBPlayerManager.GetPlayer(From); var player = QSBPlayerManager.GetPlayer(From);
if (Value == -1) if (Data == -1)
{ {
player.EntangledObject = null; player.EntangledObject = null;
return; return;
} }
var quantumObject = Value.GetWorldObject<IQSBQuantumObject>(); var quantumObject = Data.GetWorldObject<IQSBQuantumObject>();
player.EntangledObject = quantumObject; player.EntangledObject = quantumObject;
} }
public override void Serialize(NetworkWriter writer) public override void Serialize(NetworkWriter writer)
{ {
base.Serialize(writer); base.Serialize(writer);
writer.Write(Value); writer.Write(Data);
} }
public override void Deserialize(NetworkReader reader) public override void Deserialize(NetworkReader reader)
{ {
base.Deserialize(reader); base.Deserialize(reader);
Value = reader.Read<int>(); Data = reader.Read<int>();
} }
} }
} }

View File

@ -15,7 +15,7 @@ namespace QSB.Player.Messages
public PlayerKickMessage(uint playerId, KickReason reason) public PlayerKickMessage(uint playerId, KickReason reason)
{ {
PlayerId = playerId; PlayerId = playerId;
Value = reason; Data = reason;
} }
public override void Serialize(NetworkWriter writer) public override void Serialize(NetworkWriter writer)
@ -57,8 +57,8 @@ namespace QSB.Player.Messages
return; return;
} }
DebugLog.ToAll($"Kicked from server. Reason : {Value}"); DebugLog.ToAll($"Kicked from server. Reason : {Data}");
MenuManager.Instance.OnKicked(Value); MenuManager.Instance.OnKicked(Data);
} }
} }
} }

View File

@ -6,7 +6,7 @@ namespace QSB.Player.Messages
{ {
public class PlayerReadyMessage : QSBMessage<bool> public class PlayerReadyMessage : QSBMessage<bool>
{ {
public PlayerReadyMessage(bool ready) => Value = ready; public PlayerReadyMessage(bool ready) => Data = ready;
public override void OnReceiveRemote() public override void OnReceiveRemote()
{ {
@ -22,14 +22,14 @@ namespace QSB.Player.Messages
private void HandleServer() private void HandleServer()
{ {
DebugLog.DebugWrite($"[SERVER] Get ready event from {From} (ready = {Value})", MessageType.Success); DebugLog.DebugWrite($"[SERVER] Get ready event from {From} (ready = {Data})", MessageType.Success);
QSBPlayerManager.GetPlayer(From).IsReady = Value; QSBPlayerManager.GetPlayer(From).IsReady = Data;
new PlayerInformationMessage().Send(); new PlayerInformationMessage().Send();
} }
private void HandleClient() private void HandleClient()
{ {
DebugLog.DebugWrite($"[CLIENT] Get ready event from {From} (ready = {Value})", MessageType.Success); DebugLog.DebugWrite($"[CLIENT] Get ready event from {From} (ready = {Data})", MessageType.Success);
if (!QSBPlayerManager.PlayerExists(From)) if (!QSBPlayerManager.PlayerExists(From))
{ {
DebugLog.ToConsole( DebugLog.ToConsole(
@ -38,7 +38,7 @@ namespace QSB.Player.Messages
return; return;
} }
QSBPlayerManager.GetPlayer(From).IsReady = Value; QSBPlayerManager.GetPlayer(From).IsReady = Data;
} }
} }
} }

View File

@ -5,8 +5,8 @@ namespace QSB.QuantumSync.Messages
{ {
internal class MoveSkeletonMessage : QSBWorldObjectMessage<QSBQuantumSkeletonTower, int> internal class MoveSkeletonMessage : QSBWorldObjectMessage<QSBQuantumSkeletonTower, int>
{ {
public MoveSkeletonMessage(int index) => Value = index; public MoveSkeletonMessage(int index) => Data = index;
public override void OnReceiveRemote() => WorldObject.MoveSkeleton(Value); public override void OnReceiveRemote() => WorldObject.MoveSkeleton(Data);
} }
} }

View File

@ -7,7 +7,7 @@ namespace QSB.QuantumSync.Messages
{ {
internal class MultiStateChangeMessage : QSBWorldObjectMessage<QSBMultiStateQuantumObject, int> internal class MultiStateChangeMessage : QSBWorldObjectMessage<QSBMultiStateQuantumObject, int>
{ {
public MultiStateChangeMessage(int stateIndex) => Value = stateIndex; public MultiStateChangeMessage(int stateIndex) => Data = stateIndex;
public override void OnReceiveRemote() public override void OnReceiveRemote()
{ {
@ -17,7 +17,7 @@ namespace QSB.QuantumSync.Messages
return; return;
} }
WorldObject.ChangeState(Value); WorldObject.ChangeState(Data);
} }
} }
} }

View File

@ -6,7 +6,7 @@ namespace QSB.QuantumSync.Messages
{ {
public class QuantumAuthorityMessage : QSBWorldObjectMessage<IQSBQuantumObject, uint> public class QuantumAuthorityMessage : QSBWorldObjectMessage<IQSBQuantumObject, uint>
{ {
public QuantumAuthorityMessage(uint authorityOwner) => Value = authorityOwner; public QuantumAuthorityMessage(uint authorityOwner) => Data = authorityOwner;
public override bool ShouldReceive public override bool ShouldReceive
{ {
@ -25,16 +25,16 @@ namespace QSB.QuantumSync.Messages
// if Obj==Message then No // if Obj==Message then No
// Obj // Obj
return (WorldObject.ControllingPlayer == 0 || Value == 0) return (WorldObject.ControllingPlayer == 0 || Data == 0)
&& WorldObject.ControllingPlayer != Value; && WorldObject.ControllingPlayer != Data;
} }
} }
public override void OnReceiveLocal() => WorldObject.ControllingPlayer = Value; public override void OnReceiveLocal() => WorldObject.ControllingPlayer = Data;
public override void OnReceiveRemote() public override void OnReceiveRemote()
{ {
WorldObject.ControllingPlayer = Value; WorldObject.ControllingPlayer = Data;
if (WorldObject.ControllingPlayer == 00 && WorldObject.IsEnabled) if (WorldObject.ControllingPlayer == 00 && WorldObject.IsEnabled)
{ {
// object has no owner, but is still active for this player. request ownership // object has no owner, but is still active for this player. request ownership

View File

@ -5,8 +5,8 @@ namespace QSB.QuantumSync.Messages
{ {
internal class QuantumShuffleMessage : QSBWorldObjectMessage<QSBQuantumShuffleObject, int[]> internal class QuantumShuffleMessage : QSBWorldObjectMessage<QSBQuantumShuffleObject, int[]>
{ {
public QuantumShuffleMessage(int[] indexArray) => Value = indexArray; public QuantumShuffleMessage(int[] indexArray) => Data = indexArray;
public override void OnReceiveRemote() => WorldObject.ShuffleObjects(Value); public override void OnReceiveRemote() => WorldObject.ShuffleObjects(Data);
} }
} }

View File

@ -5,8 +5,8 @@ namespace QSB.QuantumSync.Messages
{ {
public class SetIsQuantumMessage : QSBWorldObjectMessage<IQSBQuantumObject, bool> public class SetIsQuantumMessage : QSBWorldObjectMessage<IQSBQuantumObject, bool>
{ {
public SetIsQuantumMessage(bool isQuantum) => Value = isQuantum; public SetIsQuantumMessage(bool isQuantum) => Data = isQuantum;
public override void OnReceiveRemote() => WorldObject.SetIsQuantum(Value); public override void OnReceiveRemote() => WorldObject.SetIsQuantum(Data);
} }
} }

View File

@ -6,19 +6,19 @@ namespace QSB.RespawnSync.Messages
{ {
internal class PlayerRespawnMessage : QSBMessage<uint> internal class PlayerRespawnMessage : QSBMessage<uint>
{ {
public PlayerRespawnMessage(uint playerId) => Value = playerId; public PlayerRespawnMessage(uint playerId) => Data = playerId;
public override void OnReceiveLocal() => OnReceiveRemote(); public override void OnReceiveLocal() => OnReceiveRemote();
public override void OnReceiveRemote() public override void OnReceiveRemote()
{ {
if (Value == QSBPlayerManager.LocalPlayerId) if (Data == QSBPlayerManager.LocalPlayerId)
{ {
RespawnManager.Instance.Respawn(); RespawnManager.Instance.Respawn();
ClientStateManager.Instance.OnRespawn(); ClientStateManager.Instance.OnRespawn();
} }
RespawnManager.Instance.OnPlayerRespawn(QSBPlayerManager.GetPlayer(Value)); RespawnManager.Instance.OnPlayerRespawn(QSBPlayerManager.GetPlayer(Data));
} }
} }
} }

View File

@ -37,7 +37,7 @@ namespace QSB.RoastingSync.Messages
private EnterExitRoastingMessage(int objectId, bool roasting) private EnterExitRoastingMessage(int objectId, bool roasting)
{ {
ObjectId = objectId; ObjectId = objectId;
Value = roasting; Data = roasting;
} }
public override void Serialize(NetworkWriter writer) public override void Serialize(NetworkWriter writer)
@ -56,15 +56,15 @@ namespace QSB.RoastingSync.Messages
public override void OnReceiveRemote() public override void OnReceiveRemote()
{ {
if (Value && ObjectId == -1) if (Data && ObjectId == -1)
{ {
DebugLog.ToConsole($"Error - Null campfire supplied for start roasting event!", MessageType.Error); DebugLog.ToConsole($"Error - Null campfire supplied for start roasting event!", MessageType.Error);
return; return;
} }
var player = QSBPlayerManager.GetPlayer(From); var player = QSBPlayerManager.GetPlayer(From);
player.RoastingStick.SetActive(Value); player.RoastingStick.SetActive(Data);
player.Campfire = Value player.Campfire = Data
? ObjectId.GetWorldObject<QSBCampfire>() ? ObjectId.GetWorldObject<QSBCampfire>()
: null; : null;
} }

View File

@ -10,7 +10,7 @@ namespace QSB.RoastingSync.Messages
{ {
internal class MarshmallowEventMessage : QSBMessage<MarshmallowMessageType> internal class MarshmallowEventMessage : QSBMessage<MarshmallowMessageType>
{ {
public MarshmallowEventMessage(MarshmallowMessageType type) => Value = type; public MarshmallowEventMessage(MarshmallowMessageType type) => Data = type;
public override bool ShouldReceive => QSBWorldSync.AllObjectsReady; public override bool ShouldReceive => QSBWorldSync.AllObjectsReady;
@ -23,7 +23,7 @@ namespace QSB.RoastingSync.Messages
return; return;
} }
switch (Value) switch (Data)
{ {
case MarshmallowMessageType.Burn: case MarshmallowMessageType.Burn:
player.Marshmallow.Burn(); player.Marshmallow.Burn();

View File

@ -4,11 +4,11 @@ namespace QSB.SatelliteSync.Messages
{ {
internal class SatelliteProjectorMessage : QSBMessage<bool> internal class SatelliteProjectorMessage : QSBMessage<bool>
{ {
public SatelliteProjectorMessage(bool usingProjector) => Value = usingProjector; public SatelliteProjectorMessage(bool usingProjector) => Data = usingProjector;
public override void OnReceiveRemote() public override void OnReceiveRemote()
{ {
if (Value) if (Data)
{ {
SatelliteProjectorManager.Instance.RemoteEnter(); SatelliteProjectorManager.Instance.RemoteEnter();
} }

View File

@ -4,8 +4,8 @@ namespace QSB.SatelliteSync.Messages
{ {
internal class SatelliteProjectorSnapshotMessage : QSBMessage<bool> internal class SatelliteProjectorSnapshotMessage : QSBMessage<bool>
{ {
public SatelliteProjectorSnapshotMessage(bool forward) => Value = forward; public SatelliteProjectorSnapshotMessage(bool forward) => Data = forward;
public override void OnReceiveRemote() => SatelliteProjectorManager.Instance.RemoteTakeSnapshot(Value); public override void OnReceiveRemote() => SatelliteProjectorManager.Instance.RemoteTakeSnapshot(Data);
} }
} }

View File

@ -5,8 +5,8 @@ namespace QSB.ShipSync.Messages.Component
{ {
internal class ComponentRepairTickMessage : QSBWorldObjectMessage<QSBShipComponent, float> internal class ComponentRepairTickMessage : QSBWorldObjectMessage<QSBShipComponent, float>
{ {
public ComponentRepairTickMessage(float repairFraction) => Value = repairFraction; public ComponentRepairTickMessage(float repairFraction) => Data = repairFraction;
public override void OnReceiveRemote() => WorldObject.RepairTick(Value); public override void OnReceiveRemote() => WorldObject.RepairTick(Data);
} }
} }

View File

@ -24,17 +24,17 @@ namespace QSB.ShipSync.Messages
} }
} }
private FlyShipMessage(bool flying) => Value = flying; private FlyShipMessage(bool flying) => Data = flying;
public override bool ShouldReceive => QSBWorldSync.AllObjectsReady; public override bool ShouldReceive => QSBWorldSync.AllObjectsReady;
public override void OnReceiveLocal() => SetCurrentFlyer(From, Value); public override void OnReceiveLocal() => SetCurrentFlyer(From, Data);
public override void OnReceiveRemote() public override void OnReceiveRemote()
{ {
SetCurrentFlyer(From, Value); SetCurrentFlyer(From, Data);
var shipCockpitController = GameObject.Find("ShipCockpitController").GetComponent<ShipCockpitController>(); var shipCockpitController = GameObject.Find("ShipCockpitController").GetComponent<ShipCockpitController>();
if (Value) if (Data)
{ {
shipCockpitController._interactVolume.DisableInteraction(); shipCockpitController._interactVolume.DisableInteraction();
} }

View File

@ -5,13 +5,13 @@ namespace QSB.ShipSync.Messages
{ {
internal class HatchMessage : QSBMessage<bool> internal class HatchMessage : QSBMessage<bool>
{ {
public HatchMessage(bool open) => Value = open; public HatchMessage(bool open) => Data = open;
public override bool ShouldReceive => QSBWorldSync.AllObjectsReady; public override bool ShouldReceive => QSBWorldSync.AllObjectsReady;
public override void OnReceiveRemote() public override void OnReceiveRemote()
{ {
if (Value) if (Data)
{ {
ShipManager.Instance.HatchController.OpenHatch(); ShipManager.Instance.HatchController.OpenHatch();
} }

View File

@ -5,8 +5,8 @@ namespace QSB.ShipSync.Messages.Hull
{ {
internal class HullChangeIntegrityMessage : QSBWorldObjectMessage<QSBShipHull, float> internal class HullChangeIntegrityMessage : QSBWorldObjectMessage<QSBShipHull, float>
{ {
public HullChangeIntegrityMessage(float integrity) => Value = integrity; public HullChangeIntegrityMessage(float integrity) => Data = integrity;
public override void OnReceiveRemote() => WorldObject.ChangeIntegrity(Value); public override void OnReceiveRemote() => WorldObject.ChangeIntegrity(Data);
} }
} }

View File

@ -20,16 +20,16 @@ namespace QSB.Tools.FlashlightTool.Messages
} }
} }
private PlayerFlashlightMessage(bool on) => Value = on; private PlayerFlashlightMessage(bool on) => Data = on;
public override void OnReceiveRemote() public override void OnReceiveRemote()
{ {
var player = QSBPlayerManager.GetPlayer(From); var player = QSBPlayerManager.GetPlayer(From);
player.FlashlightActive = Value; player.FlashlightActive = Data;
player.FlashLight?.UpdateState(Value); player.FlashLight?.UpdateState(Data);
} }
public override void OnReceiveLocal() => public override void OnReceiveLocal() =>
QSBPlayerManager.LocalPlayer.FlashlightActive = Value; QSBPlayerManager.LocalPlayer.FlashlightActive = Data;
} }
} }

View File

@ -36,16 +36,16 @@ namespace QSB.Tools.ProbeLauncherTool.Messages
} }
} }
private EquipProbeLauncherMessage(bool equipped) => Value = equipped; private EquipProbeLauncherMessage(bool equipped) => Data = equipped;
public override void OnReceiveRemote() public override void OnReceiveRemote()
{ {
var player = QSBPlayerManager.GetPlayer(From); var player = QSBPlayerManager.GetPlayer(From);
player.ProbeLauncherEquipped = Value; player.ProbeLauncherEquipped = Data;
player.ProbeLauncher?.ChangeEquipState(Value); player.ProbeLauncher?.ChangeEquipState(Data);
} }
public override void OnReceiveLocal() => public override void OnReceiveLocal() =>
QSBPlayerManager.LocalPlayer.ProbeLauncherEquipped = Value; QSBPlayerManager.LocalPlayer.ProbeLauncherEquipped = Data;
} }
} }

View File

@ -5,8 +5,8 @@ namespace QSB.Tools.ProbeLauncherTool.Messages
{ {
internal class LaunchProbeMessage : QSBWorldObjectMessage<QSBProbeLauncher, bool> internal class LaunchProbeMessage : QSBWorldObjectMessage<QSBProbeLauncher, bool>
{ {
public LaunchProbeMessage(bool playEffects) => Value = playEffects; public LaunchProbeMessage(bool playEffects) => Data = playEffects;
public override void OnReceiveRemote() => WorldObject.LaunchProbe(Value); public override void OnReceiveRemote() => WorldObject.LaunchProbe(Data);
} }
} }

View File

@ -6,14 +6,14 @@ namespace QSB.Tools.ProbeLauncherTool.Messages
{ {
internal class PlayerRetrieveProbeMessage : QSBMessage<bool> internal class PlayerRetrieveProbeMessage : QSBMessage<bool>
{ {
public PlayerRetrieveProbeMessage(bool playEffects) => Value = playEffects; public PlayerRetrieveProbeMessage(bool playEffects) => Data = playEffects;
public override bool ShouldReceive => QSBWorldSync.AllObjectsReady; public override bool ShouldReceive => QSBWorldSync.AllObjectsReady;
public override void OnReceiveRemote() public override void OnReceiveRemote()
{ {
var player = QSBPlayerManager.GetPlayer(From); var player = QSBPlayerManager.GetPlayer(From);
player.ProbeLauncher.RetrieveProbe(Value); player.ProbeLauncher.RetrieveProbe(Data);
} }
} }
} }

View File

@ -5,8 +5,8 @@ namespace QSB.Tools.ProbeLauncherTool.Messages
{ {
internal class RetrieveProbeMessage : QSBWorldObjectMessage<QSBProbeLauncher, bool> internal class RetrieveProbeMessage : QSBWorldObjectMessage<QSBProbeLauncher, bool>
{ {
public RetrieveProbeMessage(bool playEffects) => Value = playEffects; public RetrieveProbeMessage(bool playEffects) => Data = playEffects;
public override void OnReceiveRemote() => WorldObject.RetrieveProbe(Value); public override void OnReceiveRemote() => WorldObject.RetrieveProbe(Data);
} }
} }

View File

@ -6,7 +6,7 @@ namespace QSB.Tools.ProbeTool.Messages
{ {
internal class PlayerProbeEventMessage : QSBMessage<ProbeEvent> internal class PlayerProbeEventMessage : QSBMessage<ProbeEvent>
{ {
public PlayerProbeEventMessage(ProbeEvent probeEvent) => Value = probeEvent; public PlayerProbeEventMessage(ProbeEvent probeEvent) => Data = probeEvent;
public override bool ShouldReceive => QSBWorldSync.AllObjectsReady; public override bool ShouldReceive => QSBWorldSync.AllObjectsReady;
@ -19,7 +19,7 @@ namespace QSB.Tools.ProbeTool.Messages
} }
var probe = player.Probe; var probe = player.Probe;
probe.HandleEvent(Value); probe.HandleEvent(Data);
} }
} }
} }

View File

@ -6,7 +6,7 @@ namespace QSB.Tools.ProbeTool.Messages
{ {
internal class ProbeStartRetrieveMessage : QSBMessage<float> internal class ProbeStartRetrieveMessage : QSBMessage<float>
{ {
public ProbeStartRetrieveMessage(float duration) => Value = duration; public ProbeStartRetrieveMessage(float duration) => Data = duration;
public override bool ShouldReceive => QSBWorldSync.AllObjectsReady; public override bool ShouldReceive => QSBWorldSync.AllObjectsReady;
@ -19,7 +19,7 @@ namespace QSB.Tools.ProbeTool.Messages
} }
var probe = player.Probe; var probe = player.Probe;
probe.OnStartRetrieve(Value); probe.OnStartRetrieve(Data);
} }
} }
} }

View File

@ -5,14 +5,14 @@ namespace QSB.Tools.SignalscopeTool.FrequencySync.Messages
{ {
public class IdentifyFrequencyMessage : QSBMessage<SignalFrequency> public class IdentifyFrequencyMessage : QSBMessage<SignalFrequency>
{ {
public IdentifyFrequencyMessage(SignalFrequency frequency) => Value = frequency; public IdentifyFrequencyMessage(SignalFrequency frequency) => Data = frequency;
public override bool ShouldReceive => QSBWorldSync.AllObjectsReady; public override bool ShouldReceive => QSBWorldSync.AllObjectsReady;
public override void OnReceiveRemote() public override void OnReceiveRemote()
{ {
PlayerData.LearnFrequency(Value); PlayerData.LearnFrequency(Data);
var displayMsg = $"{UITextLibrary.GetString(UITextType.NotificationNewFreq)} <color=orange>{AudioSignal.FrequencyToString(Value, false)}</color>"; var displayMsg = $"{UITextLibrary.GetString(UITextType.NotificationNewFreq)} <color=orange>{AudioSignal.FrequencyToString(Data, false)}</color>";
var data = new NotificationData(NotificationTarget.All, displayMsg, 10f); var data = new NotificationData(NotificationTarget.All, displayMsg, 10f);
NotificationManager.SharedInstance.PostNotification(data); NotificationManager.SharedInstance.PostNotification(data);
} }

View File

@ -5,15 +5,15 @@ namespace QSB.Tools.SignalscopeTool.FrequencySync.Messages
{ {
public class IdentifySignalMessage : QSBMessage<SignalName> public class IdentifySignalMessage : QSBMessage<SignalName>
{ {
public IdentifySignalMessage(SignalName name) => Value = name; public IdentifySignalMessage(SignalName name) => Data = name;
public override bool ShouldReceive => QSBWorldSync.AllObjectsReady; public override bool ShouldReceive => QSBWorldSync.AllObjectsReady;
public override void OnReceiveRemote() public override void OnReceiveRemote()
{ {
PlayerData.LearnSignal(Value); PlayerData.LearnSignal(Data);
GlobalMessenger.FireEvent("IdentifySignal"); GlobalMessenger.FireEvent("IdentifySignal");
var displayMsg = $"{UITextLibrary.GetString(UITextType.NotificationSignalIdentified)} <color=orange>{AudioSignal.SignalNameToString(Value)}</color>"; var displayMsg = $"{UITextLibrary.GetString(UITextType.NotificationSignalIdentified)} <color=orange>{AudioSignal.SignalNameToString(Data)}</color>";
var data = new NotificationData(NotificationTarget.All, displayMsg, 10f); var data = new NotificationData(NotificationTarget.All, displayMsg, 10f);
NotificationManager.SharedInstance.PostNotification(data); NotificationManager.SharedInstance.PostNotification(data);
} }

View File

@ -20,16 +20,16 @@ namespace QSB.Tools.SignalscopeTool.Messages
} }
} }
private PlayerSignalscopeMessage(bool equipped) => Value = equipped; private PlayerSignalscopeMessage(bool equipped) => Data = equipped;
public override void OnReceiveRemote() public override void OnReceiveRemote()
{ {
var player = QSBPlayerManager.GetPlayer(From); var player = QSBPlayerManager.GetPlayer(From);
player.SignalscopeEquipped = Value; player.SignalscopeEquipped = Data;
player.Signalscope?.ChangeEquipState(Value); player.Signalscope?.ChangeEquipState(Data);
} }
public override void OnReceiveLocal() => public override void OnReceiveLocal() =>
QSBPlayerManager.LocalPlayer.SignalscopeEquipped = Value; QSBPlayerManager.LocalPlayer.SignalscopeEquipped = Data;
} }
} }

View File

@ -20,16 +20,16 @@ namespace QSB.Tools.TranslatorTool.Messages
} }
} }
private PlayerTranslatorMessage(bool equipped) => Value = equipped; private PlayerTranslatorMessage(bool equipped) => Data = equipped;
public override void OnReceiveRemote() public override void OnReceiveRemote()
{ {
var player = QSBPlayerManager.GetPlayer(From); var player = QSBPlayerManager.GetPlayer(From);
player.TranslatorEquipped = Value; player.TranslatorEquipped = Data;
player.Translator?.ChangeEquipState(Value); player.Translator?.ChangeEquipState(Data);
} }
public override void OnReceiveLocal() => public override void OnReceiveLocal() =>
QSBPlayerManager.LocalPlayer.TranslatorEquipped = Value; QSBPlayerManager.LocalPlayer.TranslatorEquipped = Data;
} }
} }

View File

@ -5,8 +5,8 @@ namespace QSB.Tools.TranslatorTool.TranslationSync.Messages
{ {
internal class SetAsTranslatedMessage : QSBWorldObjectMessage<QSBNomaiText, int> internal class SetAsTranslatedMessage : QSBWorldObjectMessage<QSBNomaiText, int>
{ {
public SetAsTranslatedMessage(int textId) => Value = textId; public SetAsTranslatedMessage(int textId) => Data = textId;
public override void OnReceiveRemote() => WorldObject.SetAsTranslated(Value); public override void OnReceiveRemote() => WorldObject.SetAsTranslated(Data);
} }
} }

View File

@ -5,8 +5,8 @@ namespace QSB.TornadoSync.Messages
{ {
public class TornadoFormStateMessage : QSBWorldObjectMessage<QSBTornado, bool> public class TornadoFormStateMessage : QSBWorldObjectMessage<QSBTornado, bool>
{ {
public TornadoFormStateMessage(bool formState) => Value = formState; public TornadoFormStateMessage(bool formState) => Data = formState;
public override void OnReceiveRemote() => WorldObject.FormState = Value; public override void OnReceiveRemote() => WorldObject.FormState = Data;
} }
} }

View File

@ -12,11 +12,11 @@ namespace QSB.TriggerSync.Messages
public class TriggerInitialStateMessage : QSBWorldObjectMessage<IQSBTrigger, uint[]> public class TriggerInitialStateMessage : QSBWorldObjectMessage<IQSBTrigger, uint[]>
{ {
public TriggerInitialStateMessage(IEnumerable<PlayerInfo> occupants) => public TriggerInitialStateMessage(IEnumerable<PlayerInfo> occupants) =>
Value = occupants.Select(x => x.PlayerId).ToArray(); Data = occupants.Select(x => x.PlayerId).ToArray();
public override void OnReceiveRemote() public override void OnReceiveRemote()
{ {
var serverOccupants = Value.Select(QSBPlayerManager.GetPlayer).ToList(); var serverOccupants = Data.Select(QSBPlayerManager.GetPlayer).ToList();
foreach (var added in serverOccupants.Except(WorldObject.Occupants)) foreach (var added in serverOccupants.Except(WorldObject.Occupants))
{ {
WorldObject.Enter(added); WorldObject.Enter(added);

View File

@ -6,14 +6,14 @@ namespace QSB.TriggerSync.Messages
{ {
public class TriggerMessage : QSBWorldObjectMessage<IQSBTrigger, bool> public class TriggerMessage : QSBWorldObjectMessage<IQSBTrigger, bool>
{ {
public TriggerMessage(bool entered) => Value = entered; public TriggerMessage(bool entered) => Data = entered;
public override void OnReceiveLocal() => OnReceiveRemote(); public override void OnReceiveLocal() => OnReceiveRemote();
public override void OnReceiveRemote() public override void OnReceiveRemote()
{ {
var player = QSBPlayerManager.GetPlayer(From); var player = QSBPlayerManager.GetPlayer(From);
if (Value) if (Data)
{ {
WorldObject.Enter(player); WorldObject.Enter(player);
} }

View File

@ -5,8 +5,8 @@ namespace QSB.ZeroGCaveSync.Messages
{ {
internal class SatelliteNodeRepairTickMessage : QSBWorldObjectMessage<QSBSatelliteNode, float> internal class SatelliteNodeRepairTickMessage : QSBWorldObjectMessage<QSBSatelliteNode, float>
{ {
public SatelliteNodeRepairTickMessage(float repairFraction) => Value = repairFraction; public SatelliteNodeRepairTickMessage(float repairFraction) => Data = repairFraction;
public override void OnReceiveRemote() => WorldObject.RepairTick(Value); public override void OnReceiveRemote() => WorldObject.RepairTick(Data);
} }
} }