mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-27 21:35:51 +00:00
QSBMessage: remove variants since tuples work now, rename Value -> Data
This commit is contained in:
parent
2ce2fdde38
commit
20eaa8adfc
@ -16,7 +16,7 @@ namespace QSB.Anglerfish.Messages
|
||||
|
||||
public AnglerDataMessage(QSBAngler qsbAngler)
|
||||
{
|
||||
Value = qsbAngler.AttachedObject._currentState;
|
||||
Data = qsbAngler.AttachedObject._currentState;
|
||||
TargetId = TargetToId(qsbAngler.TargetTransform);
|
||||
LocalDisturbancePos = qsbAngler.AttachedObject._localDisturbancePos;
|
||||
}
|
||||
@ -39,7 +39,7 @@ namespace QSB.Anglerfish.Messages
|
||||
{
|
||||
WorldObject.TargetTransform = IdToTarget(TargetId);
|
||||
WorldObject.AttachedObject._localDisturbancePos = LocalDisturbancePos;
|
||||
WorldObject.AttachedObject.ChangeState(Value);
|
||||
WorldObject.AttachedObject.ChangeState(Data);
|
||||
}
|
||||
|
||||
private static uint TargetToId(Transform transform)
|
||||
|
@ -5,11 +5,11 @@ namespace QSB.Animation.NPC.Messages
|
||||
{
|
||||
internal class NpcAnimationMessage : QSBWorldObjectMessage<INpcAnimController, bool>
|
||||
{
|
||||
public NpcAnimationMessage(bool start) => Value = start;
|
||||
public NpcAnimationMessage(bool start) => Data = start;
|
||||
|
||||
public override void OnReceiveRemote()
|
||||
{
|
||||
if (Value)
|
||||
if (Data)
|
||||
{
|
||||
WorldObject.StartConversation();
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ namespace QSB.Animation.Player.Messages
|
||||
{
|
||||
internal class AnimationTriggerMessage : QSBMessage<string>
|
||||
{
|
||||
public AnimationTriggerMessage(string name) => Value = name;
|
||||
public AnimationTriggerMessage(string name) => Data = name;
|
||||
|
||||
public override bool ShouldReceive => QSBWorldSync.AllObjectsReady;
|
||||
|
||||
@ -23,7 +23,7 @@ namespace QSB.Animation.Player.Messages
|
||||
return;
|
||||
}
|
||||
|
||||
animationSync.VisibleAnimator.SetTrigger(Value);
|
||||
animationSync.VisibleAnimator.SetTrigger(Data);
|
||||
}
|
||||
}
|
||||
}
|
@ -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 void OnReceiveRemote()
|
||||
{
|
||||
var player = QSBPlayerManager.GetPlayer(From);
|
||||
player.SuitedUp = Value;
|
||||
player.SuitedUp = Data;
|
||||
|
||||
if (!player.IsReady)
|
||||
{
|
||||
@ -36,14 +36,14 @@ namespace QSB.Animation.Player.Messages
|
||||
}
|
||||
|
||||
var animator = player.AnimationSync;
|
||||
animator.SetSuitState(Value);
|
||||
animator.SetSuitState(Data);
|
||||
}
|
||||
|
||||
public override void OnReceiveLocal()
|
||||
{
|
||||
QSBPlayerManager.LocalPlayer.SuitedUp = Value;
|
||||
QSBPlayerManager.LocalPlayer.SuitedUp = Data;
|
||||
var animator = QSBPlayerManager.LocalPlayer.AnimationSync;
|
||||
animator.InSuitedUpState = Value;
|
||||
animator.InSuitedUpState = Data;
|
||||
}
|
||||
}
|
||||
}
|
@ -5,8 +5,8 @@ namespace QSB.CampfireSync.Messages
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
@ -10,10 +10,10 @@ namespace QSB.ClientServerStateSync.Messages
|
||||
/// </summary>
|
||||
internal class ClientStateMessage : QSBMessage<ClientState>
|
||||
{
|
||||
public ClientStateMessage(ClientState state) => Value = state;
|
||||
public ClientStateMessage(ClientState state) => Data = state;
|
||||
|
||||
public override void OnReceiveLocal()
|
||||
=> ClientStateManager.Instance.ChangeClientState(Value);
|
||||
=> ClientStateManager.Instance.ChangeClientState(Data);
|
||||
|
||||
public override void OnReceiveRemote()
|
||||
{
|
||||
@ -24,7 +24,7 @@ namespace QSB.ClientServerStateSync.Messages
|
||||
}
|
||||
|
||||
var player = QSBPlayerManager.GetPlayer(From);
|
||||
player.State = Value;
|
||||
player.State = Data;
|
||||
}
|
||||
}
|
||||
}
|
@ -7,10 +7,10 @@ namespace QSB.ClientServerStateSync.Messages
|
||||
/// </summary>
|
||||
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 OnReceiveRemote()
|
||||
=> ServerStateManager.Instance.ChangeServerState(Value);
|
||||
=> ServerStateManager.Instance.ChangeServerState(Data);
|
||||
}
|
||||
}
|
@ -6,9 +6,9 @@ namespace QSB.ConversationSync.Messages
|
||||
internal class EnterRemoteDialogueMessage : QSBWorldObjectMessage<QSBRemoteDialogueTrigger, int>
|
||||
{
|
||||
public EnterRemoteDialogueMessage(int dialogueIndex)
|
||||
=> Value = dialogueIndex;
|
||||
=> Data = dialogueIndex;
|
||||
|
||||
public override void OnReceiveRemote()
|
||||
=> WorldObject.RemoteEnterDialogue(Value);
|
||||
=> WorldObject.RemoteEnterDialogue(Data);
|
||||
}
|
||||
}
|
@ -13,7 +13,7 @@ namespace QSB.DeathSync.Messages
|
||||
|
||||
public PlayerDeathMessage(DeathType type)
|
||||
{
|
||||
Value = type;
|
||||
Data = type;
|
||||
NecronomiconIndex = Necronomicon.GetRandomIndex(type);
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ namespace QSB.DeathSync.Messages
|
||||
{
|
||||
var player = QSBPlayerManager.GetPlayer(From);
|
||||
var playerName = player.Name;
|
||||
var deathMessage = Necronomicon.GetPhrase(Value, NecronomiconIndex);
|
||||
var deathMessage = Necronomicon.GetPhrase(Data, NecronomiconIndex);
|
||||
if (deathMessage != null)
|
||||
{
|
||||
DebugLog.ToAll(string.Format(deathMessage, playerName));
|
||||
|
@ -5,8 +5,8 @@ namespace QSB.ElevatorSync.Messages
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
@ -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 void OnReceiveLocal() => QSBPlayerManager.LocalPlayer.EyeState = Value;
|
||||
public override void OnReceiveLocal() => QSBPlayerManager.LocalPlayer.EyeState = Data;
|
||||
|
||||
public override void OnReceiveRemote()
|
||||
{
|
||||
var player = QSBPlayerManager.GetPlayer(From);
|
||||
player.EyeState = Value;
|
||||
player.EyeState = Data;
|
||||
}
|
||||
}
|
||||
}
|
@ -5,8 +5,8 @@ namespace QSB.GeyserSync.Messages
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
@ -5,8 +5,8 @@ namespace QSB.JellyfishSync.Messages
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
@ -45,63 +45,20 @@ namespace QSB.Messaging
|
||||
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)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(Value);
|
||||
writer.Write(Data);
|
||||
}
|
||||
|
||||
public override void Deserialize(NetworkReader 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>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(Value);
|
||||
writer.Write(Data);
|
||||
}
|
||||
|
||||
public override void Deserialize(NetworkReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
Value = reader.Read<V>();
|
||||
Data = reader.Read<D>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,8 +5,8 @@ namespace QSB.MeteorSync.Messages
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
@ -5,8 +5,8 @@ namespace QSB.OrbSync.Messages
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ namespace QSB.OrbSync.Messages
|
||||
|
||||
public OrbSlotMessage(int slotIndex, bool playAudio)
|
||||
{
|
||||
Value = slotIndex;
|
||||
Data = slotIndex;
|
||||
_playAudio = playAudio;
|
||||
}
|
||||
|
||||
@ -26,6 +26,6 @@ namespace QSB.OrbSync.Messages
|
||||
_playAudio = reader.Read<bool>();
|
||||
}
|
||||
|
||||
public override void OnReceiveRemote() => WorldObject.SetSlot(Value, _playAudio);
|
||||
public override void OnReceiveRemote() => WorldObject.SetSlot(Data, _playAudio);
|
||||
}
|
||||
}
|
@ -34,7 +34,7 @@ namespace QSB.Player.Messages
|
||||
|
||||
public EnterLeaveMessage(EnterLeaveType type, int objectId = -1)
|
||||
{
|
||||
Value = type;
|
||||
Data = type;
|
||||
ObjectId = objectId;
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ namespace QSB.Player.Messages
|
||||
public override void OnReceiveRemote()
|
||||
{
|
||||
var player = QSBPlayerManager.GetPlayer(From);
|
||||
switch (Value)
|
||||
switch (Data)
|
||||
{
|
||||
case EnterLeaveType.EnterMoon:
|
||||
player.IsInMoon = true;
|
||||
@ -80,7 +80,7 @@ namespace QSB.Player.Messages
|
||||
ShipManager.Instance.RemovePlayerFromShip(player);
|
||||
break;
|
||||
default:
|
||||
DebugLog.ToConsole($"Warning - Unknown EnterLeaveType : {Value}", MessageType.Warning);
|
||||
DebugLog.ToConsole($"Warning - Unknown EnterLeaveType : {Data}", MessageType.Warning);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -8,46 +8,46 @@ namespace QSB.Player.Messages
|
||||
// almost a world object message, but supports null (-1) as well
|
||||
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 void OnReceiveLocal()
|
||||
{
|
||||
var player = QSBPlayerManager.LocalPlayer;
|
||||
if (Value == -1)
|
||||
if (Data == -1)
|
||||
{
|
||||
player.EntangledObject = null;
|
||||
return;
|
||||
}
|
||||
|
||||
var quantumObject = Value.GetWorldObject<IQSBQuantumObject>();
|
||||
var quantumObject = Data.GetWorldObject<IQSBQuantumObject>();
|
||||
player.EntangledObject = quantumObject;
|
||||
}
|
||||
|
||||
public override void OnReceiveRemote()
|
||||
{
|
||||
var player = QSBPlayerManager.GetPlayer(From);
|
||||
if (Value == -1)
|
||||
if (Data == -1)
|
||||
{
|
||||
player.EntangledObject = null;
|
||||
return;
|
||||
}
|
||||
|
||||
var quantumObject = Value.GetWorldObject<IQSBQuantumObject>();
|
||||
var quantumObject = Data.GetWorldObject<IQSBQuantumObject>();
|
||||
player.EntangledObject = quantumObject;
|
||||
}
|
||||
|
||||
public override void Serialize(NetworkWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(Value);
|
||||
writer.Write(Data);
|
||||
}
|
||||
|
||||
public override void Deserialize(NetworkReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
Value = reader.Read<int>();
|
||||
Data = reader.Read<int>();
|
||||
}
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@ namespace QSB.Player.Messages
|
||||
public PlayerKickMessage(uint playerId, KickReason reason)
|
||||
{
|
||||
PlayerId = playerId;
|
||||
Value = reason;
|
||||
Data = reason;
|
||||
}
|
||||
|
||||
public override void Serialize(NetworkWriter writer)
|
||||
@ -57,8 +57,8 @@ namespace QSB.Player.Messages
|
||||
return;
|
||||
}
|
||||
|
||||
DebugLog.ToAll($"Kicked from server. Reason : {Value}");
|
||||
MenuManager.Instance.OnKicked(Value);
|
||||
DebugLog.ToAll($"Kicked from server. Reason : {Data}");
|
||||
MenuManager.Instance.OnKicked(Data);
|
||||
}
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@ namespace QSB.Player.Messages
|
||||
{
|
||||
public class PlayerReadyMessage : QSBMessage<bool>
|
||||
{
|
||||
public PlayerReadyMessage(bool ready) => Value = ready;
|
||||
public PlayerReadyMessage(bool ready) => Data = ready;
|
||||
|
||||
public override void OnReceiveRemote()
|
||||
{
|
||||
@ -22,14 +22,14 @@ namespace QSB.Player.Messages
|
||||
|
||||
private void HandleServer()
|
||||
{
|
||||
DebugLog.DebugWrite($"[SERVER] Get ready event from {From} (ready = {Value})", MessageType.Success);
|
||||
QSBPlayerManager.GetPlayer(From).IsReady = Value;
|
||||
DebugLog.DebugWrite($"[SERVER] Get ready event from {From} (ready = {Data})", MessageType.Success);
|
||||
QSBPlayerManager.GetPlayer(From).IsReady = Data;
|
||||
new PlayerInformationMessage().Send();
|
||||
}
|
||||
|
||||
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))
|
||||
{
|
||||
DebugLog.ToConsole(
|
||||
@ -38,7 +38,7 @@ namespace QSB.Player.Messages
|
||||
return;
|
||||
}
|
||||
|
||||
QSBPlayerManager.GetPlayer(From).IsReady = Value;
|
||||
QSBPlayerManager.GetPlayer(From).IsReady = Data;
|
||||
}
|
||||
}
|
||||
}
|
@ -5,8 +5,8 @@ namespace QSB.QuantumSync.Messages
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
@ -7,7 +7,7 @@ namespace QSB.QuantumSync.Messages
|
||||
{
|
||||
internal class MultiStateChangeMessage : QSBWorldObjectMessage<QSBMultiStateQuantumObject, int>
|
||||
{
|
||||
public MultiStateChangeMessage(int stateIndex) => Value = stateIndex;
|
||||
public MultiStateChangeMessage(int stateIndex) => Data = stateIndex;
|
||||
|
||||
public override void OnReceiveRemote()
|
||||
{
|
||||
@ -17,7 +17,7 @@ namespace QSB.QuantumSync.Messages
|
||||
return;
|
||||
}
|
||||
|
||||
WorldObject.ChangeState(Value);
|
||||
WorldObject.ChangeState(Data);
|
||||
}
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@ namespace QSB.QuantumSync.Messages
|
||||
{
|
||||
public class QuantumAuthorityMessage : QSBWorldObjectMessage<IQSBQuantumObject, uint>
|
||||
{
|
||||
public QuantumAuthorityMessage(uint authorityOwner) => Value = authorityOwner;
|
||||
public QuantumAuthorityMessage(uint authorityOwner) => Data = authorityOwner;
|
||||
|
||||
public override bool ShouldReceive
|
||||
{
|
||||
@ -25,16 +25,16 @@ namespace QSB.QuantumSync.Messages
|
||||
// if Obj==Message then No
|
||||
// Obj
|
||||
|
||||
return (WorldObject.ControllingPlayer == 0 || Value == 0)
|
||||
&& WorldObject.ControllingPlayer != Value;
|
||||
return (WorldObject.ControllingPlayer == 0 || Data == 0)
|
||||
&& WorldObject.ControllingPlayer != Data;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnReceiveLocal() => WorldObject.ControllingPlayer = Value;
|
||||
public override void OnReceiveLocal() => WorldObject.ControllingPlayer = Data;
|
||||
|
||||
public override void OnReceiveRemote()
|
||||
{
|
||||
WorldObject.ControllingPlayer = Value;
|
||||
WorldObject.ControllingPlayer = Data;
|
||||
if (WorldObject.ControllingPlayer == 00 && WorldObject.IsEnabled)
|
||||
{
|
||||
// object has no owner, but is still active for this player. request ownership
|
||||
|
@ -5,8 +5,8 @@ namespace QSB.QuantumSync.Messages
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
@ -5,8 +5,8 @@ namespace QSB.QuantumSync.Messages
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
@ -6,19 +6,19 @@ namespace QSB.RespawnSync.Messages
|
||||
{
|
||||
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 OnReceiveRemote()
|
||||
{
|
||||
if (Value == QSBPlayerManager.LocalPlayerId)
|
||||
if (Data == QSBPlayerManager.LocalPlayerId)
|
||||
{
|
||||
RespawnManager.Instance.Respawn();
|
||||
ClientStateManager.Instance.OnRespawn();
|
||||
}
|
||||
|
||||
RespawnManager.Instance.OnPlayerRespawn(QSBPlayerManager.GetPlayer(Value));
|
||||
RespawnManager.Instance.OnPlayerRespawn(QSBPlayerManager.GetPlayer(Data));
|
||||
}
|
||||
}
|
||||
}
|
@ -37,7 +37,7 @@ namespace QSB.RoastingSync.Messages
|
||||
private EnterExitRoastingMessage(int objectId, bool roasting)
|
||||
{
|
||||
ObjectId = objectId;
|
||||
Value = roasting;
|
||||
Data = roasting;
|
||||
}
|
||||
|
||||
public override void Serialize(NetworkWriter writer)
|
||||
@ -56,15 +56,15 @@ namespace QSB.RoastingSync.Messages
|
||||
|
||||
public override void OnReceiveRemote()
|
||||
{
|
||||
if (Value && ObjectId == -1)
|
||||
if (Data && ObjectId == -1)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Null campfire supplied for start roasting event!", MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
var player = QSBPlayerManager.GetPlayer(From);
|
||||
player.RoastingStick.SetActive(Value);
|
||||
player.Campfire = Value
|
||||
player.RoastingStick.SetActive(Data);
|
||||
player.Campfire = Data
|
||||
? ObjectId.GetWorldObject<QSBCampfire>()
|
||||
: null;
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace QSB.RoastingSync.Messages
|
||||
{
|
||||
internal class MarshmallowEventMessage : QSBMessage<MarshmallowMessageType>
|
||||
{
|
||||
public MarshmallowEventMessage(MarshmallowMessageType type) => Value = type;
|
||||
public MarshmallowEventMessage(MarshmallowMessageType type) => Data = type;
|
||||
|
||||
public override bool ShouldReceive => QSBWorldSync.AllObjectsReady;
|
||||
|
||||
@ -23,7 +23,7 @@ namespace QSB.RoastingSync.Messages
|
||||
return;
|
||||
}
|
||||
|
||||
switch (Value)
|
||||
switch (Data)
|
||||
{
|
||||
case MarshmallowMessageType.Burn:
|
||||
player.Marshmallow.Burn();
|
||||
|
@ -4,11 +4,11 @@ namespace QSB.SatelliteSync.Messages
|
||||
{
|
||||
internal class SatelliteProjectorMessage : QSBMessage<bool>
|
||||
{
|
||||
public SatelliteProjectorMessage(bool usingProjector) => Value = usingProjector;
|
||||
public SatelliteProjectorMessage(bool usingProjector) => Data = usingProjector;
|
||||
|
||||
public override void OnReceiveRemote()
|
||||
{
|
||||
if (Value)
|
||||
if (Data)
|
||||
{
|
||||
SatelliteProjectorManager.Instance.RemoteEnter();
|
||||
}
|
||||
|
@ -4,8 +4,8 @@ namespace QSB.SatelliteSync.Messages
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
@ -5,8 +5,8 @@ namespace QSB.ShipSync.Messages.Component
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
@ -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 void OnReceiveLocal() => SetCurrentFlyer(From, Value);
|
||||
public override void OnReceiveLocal() => SetCurrentFlyer(From, Data);
|
||||
|
||||
public override void OnReceiveRemote()
|
||||
{
|
||||
SetCurrentFlyer(From, Value);
|
||||
SetCurrentFlyer(From, Data);
|
||||
var shipCockpitController = GameObject.Find("ShipCockpitController").GetComponent<ShipCockpitController>();
|
||||
if (Value)
|
||||
if (Data)
|
||||
{
|
||||
shipCockpitController._interactVolume.DisableInteraction();
|
||||
}
|
||||
|
@ -5,13 +5,13 @@ namespace QSB.ShipSync.Messages
|
||||
{
|
||||
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 void OnReceiveRemote()
|
||||
{
|
||||
if (Value)
|
||||
if (Data)
|
||||
{
|
||||
ShipManager.Instance.HatchController.OpenHatch();
|
||||
}
|
||||
|
@ -5,8 +5,8 @@ namespace QSB.ShipSync.Messages.Hull
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
@ -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()
|
||||
{
|
||||
var player = QSBPlayerManager.GetPlayer(From);
|
||||
player.FlashlightActive = Value;
|
||||
player.FlashLight?.UpdateState(Value);
|
||||
player.FlashlightActive = Data;
|
||||
player.FlashLight?.UpdateState(Data);
|
||||
}
|
||||
|
||||
public override void OnReceiveLocal() =>
|
||||
QSBPlayerManager.LocalPlayer.FlashlightActive = Value;
|
||||
QSBPlayerManager.LocalPlayer.FlashlightActive = Data;
|
||||
}
|
||||
}
|
@ -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()
|
||||
{
|
||||
var player = QSBPlayerManager.GetPlayer(From);
|
||||
player.ProbeLauncherEquipped = Value;
|
||||
player.ProbeLauncher?.ChangeEquipState(Value);
|
||||
player.ProbeLauncherEquipped = Data;
|
||||
player.ProbeLauncher?.ChangeEquipState(Data);
|
||||
}
|
||||
|
||||
public override void OnReceiveLocal() =>
|
||||
QSBPlayerManager.LocalPlayer.ProbeLauncherEquipped = Value;
|
||||
QSBPlayerManager.LocalPlayer.ProbeLauncherEquipped = Data;
|
||||
}
|
||||
}
|
@ -5,8 +5,8 @@ namespace QSB.Tools.ProbeLauncherTool.Messages
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
@ -6,14 +6,14 @@ namespace QSB.Tools.ProbeLauncherTool.Messages
|
||||
{
|
||||
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 void OnReceiveRemote()
|
||||
{
|
||||
var player = QSBPlayerManager.GetPlayer(From);
|
||||
player.ProbeLauncher.RetrieveProbe(Value);
|
||||
player.ProbeLauncher.RetrieveProbe(Data);
|
||||
}
|
||||
}
|
||||
}
|
@ -5,8 +5,8 @@ namespace QSB.Tools.ProbeLauncherTool.Messages
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@ namespace QSB.Tools.ProbeTool.Messages
|
||||
{
|
||||
internal class PlayerProbeEventMessage : QSBMessage<ProbeEvent>
|
||||
{
|
||||
public PlayerProbeEventMessage(ProbeEvent probeEvent) => Value = probeEvent;
|
||||
public PlayerProbeEventMessage(ProbeEvent probeEvent) => Data = probeEvent;
|
||||
|
||||
public override bool ShouldReceive => QSBWorldSync.AllObjectsReady;
|
||||
|
||||
@ -19,7 +19,7 @@ namespace QSB.Tools.ProbeTool.Messages
|
||||
}
|
||||
|
||||
var probe = player.Probe;
|
||||
probe.HandleEvent(Value);
|
||||
probe.HandleEvent(Data);
|
||||
}
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@ namespace QSB.Tools.ProbeTool.Messages
|
||||
{
|
||||
internal class ProbeStartRetrieveMessage : QSBMessage<float>
|
||||
{
|
||||
public ProbeStartRetrieveMessage(float duration) => Value = duration;
|
||||
public ProbeStartRetrieveMessage(float duration) => Data = duration;
|
||||
|
||||
public override bool ShouldReceive => QSBWorldSync.AllObjectsReady;
|
||||
|
||||
@ -19,7 +19,7 @@ namespace QSB.Tools.ProbeTool.Messages
|
||||
}
|
||||
|
||||
var probe = player.Probe;
|
||||
probe.OnStartRetrieve(Value);
|
||||
probe.OnStartRetrieve(Data);
|
||||
}
|
||||
}
|
||||
}
|
@ -5,14 +5,14 @@ namespace QSB.Tools.SignalscopeTool.FrequencySync.Messages
|
||||
{
|
||||
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 void OnReceiveRemote()
|
||||
{
|
||||
PlayerData.LearnFrequency(Value);
|
||||
var displayMsg = $"{UITextLibrary.GetString(UITextType.NotificationNewFreq)} <color=orange>{AudioSignal.FrequencyToString(Value, false)}</color>";
|
||||
PlayerData.LearnFrequency(Data);
|
||||
var displayMsg = $"{UITextLibrary.GetString(UITextType.NotificationNewFreq)} <color=orange>{AudioSignal.FrequencyToString(Data, false)}</color>";
|
||||
var data = new NotificationData(NotificationTarget.All, displayMsg, 10f);
|
||||
NotificationManager.SharedInstance.PostNotification(data);
|
||||
}
|
||||
|
@ -5,15 +5,15 @@ namespace QSB.Tools.SignalscopeTool.FrequencySync.Messages
|
||||
{
|
||||
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 void OnReceiveRemote()
|
||||
{
|
||||
PlayerData.LearnSignal(Value);
|
||||
PlayerData.LearnSignal(Data);
|
||||
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);
|
||||
NotificationManager.SharedInstance.PostNotification(data);
|
||||
}
|
||||
|
@ -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()
|
||||
{
|
||||
var player = QSBPlayerManager.GetPlayer(From);
|
||||
player.SignalscopeEquipped = Value;
|
||||
player.Signalscope?.ChangeEquipState(Value);
|
||||
player.SignalscopeEquipped = Data;
|
||||
player.Signalscope?.ChangeEquipState(Data);
|
||||
}
|
||||
|
||||
public override void OnReceiveLocal() =>
|
||||
QSBPlayerManager.LocalPlayer.SignalscopeEquipped = Value;
|
||||
QSBPlayerManager.LocalPlayer.SignalscopeEquipped = Data;
|
||||
}
|
||||
}
|
@ -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()
|
||||
{
|
||||
var player = QSBPlayerManager.GetPlayer(From);
|
||||
player.TranslatorEquipped = Value;
|
||||
player.Translator?.ChangeEquipState(Value);
|
||||
player.TranslatorEquipped = Data;
|
||||
player.Translator?.ChangeEquipState(Data);
|
||||
}
|
||||
|
||||
public override void OnReceiveLocal() =>
|
||||
QSBPlayerManager.LocalPlayer.TranslatorEquipped = Value;
|
||||
QSBPlayerManager.LocalPlayer.TranslatorEquipped = Data;
|
||||
}
|
||||
}
|
@ -5,8 +5,8 @@ namespace QSB.Tools.TranslatorTool.TranslationSync.Messages
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
@ -5,8 +5,8 @@ namespace QSB.TornadoSync.Messages
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
@ -12,11 +12,11 @@ namespace QSB.TriggerSync.Messages
|
||||
public class TriggerInitialStateMessage : QSBWorldObjectMessage<IQSBTrigger, uint[]>
|
||||
{
|
||||
public TriggerInitialStateMessage(IEnumerable<PlayerInfo> occupants) =>
|
||||
Value = occupants.Select(x => x.PlayerId).ToArray();
|
||||
Data = occupants.Select(x => x.PlayerId).ToArray();
|
||||
|
||||
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))
|
||||
{
|
||||
WorldObject.Enter(added);
|
||||
|
@ -6,14 +6,14 @@ namespace QSB.TriggerSync.Messages
|
||||
{
|
||||
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 OnReceiveRemote()
|
||||
{
|
||||
var player = QSBPlayerManager.GetPlayer(From);
|
||||
if (Value)
|
||||
if (Data)
|
||||
{
|
||||
WorldObject.Enter(player);
|
||||
}
|
||||
|
@ -5,8 +5,8 @@ namespace QSB.ZeroGCaveSync.Messages
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user