first commit
This commit is contained in:
21
NitroxModel/Packets/AggressiveWhenSeeTargetChanged.cs
Normal file
21
NitroxModel/Packets/AggressiveWhenSeeTargetChanged.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class AggressiveWhenSeeTargetChanged : Packet
|
||||
{
|
||||
public NitroxId CreatureId { get; }
|
||||
public NitroxId TargetId { get; }
|
||||
public bool Locked { get; }
|
||||
public float AggressionAmount { get; }
|
||||
|
||||
public AggressiveWhenSeeTargetChanged(NitroxId creatureId, NitroxId targetId, bool locked, float aggressionAmount)
|
||||
{
|
||||
CreatureId = creatureId;
|
||||
TargetId = targetId;
|
||||
Locked = locked;
|
||||
AggressionAmount = aggressionAmount;
|
||||
}
|
||||
}
|
19
NitroxModel/Packets/AnimationChangeEvent.cs
Normal file
19
NitroxModel/Packets/AnimationChangeEvent.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
[Serializable]
|
||||
public class AnimationChangeEvent : Packet
|
||||
{
|
||||
public ushort PlayerId { get; }
|
||||
public int Type { get; }
|
||||
public int State { get; }
|
||||
|
||||
public AnimationChangeEvent(ushort playerId, int type, int state)
|
||||
{
|
||||
PlayerId = playerId;
|
||||
Type = type;
|
||||
State = state;
|
||||
}
|
||||
}
|
||||
}
|
19
NitroxModel/Packets/AttackCyclopsTargetChanged.cs
Normal file
19
NitroxModel/Packets/AttackCyclopsTargetChanged.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class AttackCyclopsTargetChanged : Packet
|
||||
{
|
||||
public NitroxId CreatureId { get; }
|
||||
public NitroxId TargetId { get; }
|
||||
public float AggressiveToNoiseAmount { get; }
|
||||
|
||||
public AttackCyclopsTargetChanged(NitroxId creatureId, NitroxId targetId, float aggressiveToNoiseAmount)
|
||||
{
|
||||
CreatureId = creatureId;
|
||||
TargetId = targetId;
|
||||
AggressiveToNoiseAmount = aggressiveToNoiseAmount;
|
||||
}
|
||||
}
|
17
NitroxModel/Packets/AuroraAndTimeUpdate.cs
Normal file
17
NitroxModel/Packets/AuroraAndTimeUpdate.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures.GameLogic;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class AuroraAndTimeUpdate : Packet
|
||||
{
|
||||
public TimeData TimeData { get; }
|
||||
public bool Restore { get; }
|
||||
|
||||
public AuroraAndTimeUpdate(TimeData timeData, bool restore)
|
||||
{
|
||||
TimeData = timeData;
|
||||
Restore = restore;
|
||||
}
|
||||
}
|
18
NitroxModel/Packets/BaseDeconstructed.cs
Normal file
18
NitroxModel/Packets/BaseDeconstructed.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Bases;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public sealed class BaseDeconstructed : Packet
|
||||
{
|
||||
public NitroxId FormerBaseId { get; }
|
||||
public GhostEntity ReplacerGhost { get; }
|
||||
|
||||
public BaseDeconstructed(NitroxId formerBaseId, GhostEntity replacerGhost)
|
||||
{
|
||||
FormerBaseId = formerBaseId;
|
||||
ReplacerGhost = replacerGhost;
|
||||
}
|
||||
}
|
9
NitroxModel/Packets/BedEnter.cs
Normal file
9
NitroxModel/Packets/BedEnter.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
[Serializable]
|
||||
public class BedEnter : Packet
|
||||
{
|
||||
}
|
||||
}
|
16
NitroxModel/Packets/BuildingDesyncWarning.cs
Normal file
16
NitroxModel/Packets/BuildingDesyncWarning.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public sealed class BuildingDesyncWarning : Packet
|
||||
{
|
||||
public Dictionary<NitroxId, int> Operations { get; }
|
||||
|
||||
public BuildingDesyncWarning(Dictionary<NitroxId, int> operations)
|
||||
{
|
||||
Operations = operations;
|
||||
}
|
||||
}
|
18
NitroxModel/Packets/BuildingResync.cs
Normal file
18
NitroxModel/Packets/BuildingResync.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Bases;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public sealed class BuildingResync : Packet
|
||||
{
|
||||
public Dictionary<BuildEntity, int> BuildEntities { get; }
|
||||
public Dictionary<ModuleEntity, int> ModuleEntities { get; }
|
||||
|
||||
public BuildingResync(Dictionary<BuildEntity, int> buildEntities, Dictionary<ModuleEntity, int> moduleEntities)
|
||||
{
|
||||
BuildEntities = buildEntities;
|
||||
ModuleEntities = moduleEntities;
|
||||
}
|
||||
}
|
17
NitroxModel/Packets/BuildingResyncRequest.cs
Normal file
17
NitroxModel/Packets/BuildingResyncRequest.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public sealed class BuildingResyncRequest : Packet
|
||||
{
|
||||
public NitroxId EntityId { get; }
|
||||
public bool ResyncEverything { get; }
|
||||
|
||||
public BuildingResyncRequest(NitroxId entityId = null, bool resyncEverything = true)
|
||||
{
|
||||
EntityId = entityId;
|
||||
ResyncEverything = resyncEverything;
|
||||
}
|
||||
}
|
20
NitroxModel/Packets/CellVisibilityChanged.cs
Normal file
20
NitroxModel/Packets/CellVisibilityChanged.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures.GameLogic;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
[Serializable]
|
||||
public class CellVisibilityChanged : Packet
|
||||
{
|
||||
public ushort PlayerId { get; }
|
||||
public AbsoluteEntityCell[] Added { get; }
|
||||
public AbsoluteEntityCell[] Removed { get; }
|
||||
|
||||
public CellVisibilityChanged(ushort playerId, AbsoluteEntityCell[] added, AbsoluteEntityCell[] removed)
|
||||
{
|
||||
PlayerId = playerId;
|
||||
Added = added;
|
||||
Removed = removed;
|
||||
}
|
||||
}
|
||||
}
|
18
NitroxModel/Packets/ChatMessage.cs
Normal file
18
NitroxModel/Packets/ChatMessage.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
[Serializable]
|
||||
public class ChatMessage : Packet
|
||||
{
|
||||
public ushort PlayerId { get; }
|
||||
public string Text { get; }
|
||||
public const ushort SERVER_ID = ushort.MaxValue;
|
||||
|
||||
public ChatMessage(ushort playerId, string text)
|
||||
{
|
||||
PlayerId = playerId;
|
||||
Text = text;
|
||||
}
|
||||
}
|
||||
}
|
15
NitroxModel/Packets/ClearPlanter.cs
Normal file
15
NitroxModel/Packets/ClearPlanter.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class ClearPlanter : Packet
|
||||
{
|
||||
public NitroxId PlanterId { get; }
|
||||
|
||||
public ClearPlanter(NitroxId planterId)
|
||||
{
|
||||
PlanterId = planterId;
|
||||
}
|
||||
}
|
15
NitroxModel/Packets/CorrelatedPacket.cs
Normal file
15
NitroxModel/Packets/CorrelatedPacket.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
[Serializable]
|
||||
public abstract class CorrelatedPacket : Packet
|
||||
{
|
||||
public string CorrelationId { get; protected set; }
|
||||
|
||||
protected CorrelatedPacket(string correlationId)
|
||||
{
|
||||
CorrelationId = correlationId;
|
||||
}
|
||||
}
|
||||
}
|
17
NitroxModel/Packets/CreatureActionChanged.cs
Normal file
17
NitroxModel/Packets/CreatureActionChanged.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public sealed class CreatureActionChanged : Packet
|
||||
{
|
||||
public NitroxId CreatureId { get; }
|
||||
public string CreatureActionType { get; }
|
||||
|
||||
public CreatureActionChanged(NitroxId creatureId, string creatureActionType)
|
||||
{
|
||||
CreatureId = creatureId;
|
||||
CreatureActionType = creatureActionType;
|
||||
}
|
||||
}
|
15
NitroxModel/Packets/CreaturePoopPerformed.cs
Normal file
15
NitroxModel/Packets/CreaturePoopPerformed.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class CreaturePoopPerformed : Packet
|
||||
{
|
||||
public NitroxId CreatureId { get; }
|
||||
|
||||
public CreaturePoopPerformed(NitroxId creatureId)
|
||||
{
|
||||
CreatureId = creatureId;
|
||||
}
|
||||
}
|
17
NitroxModel/Packets/DebugStartMapPacket.cs
Normal file
17
NitroxModel/Packets/DebugStartMapPacket.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
[Serializable]
|
||||
public class DebugStartMapPacket : Packet
|
||||
{
|
||||
public List<NitroxVector3> StartPositions { get; }
|
||||
|
||||
public DebugStartMapPacket(List<NitroxVector3> startPositions)
|
||||
{
|
||||
StartPositions = startPositions;
|
||||
}
|
||||
}
|
||||
}
|
16
NitroxModel/Packets/DeconstructionBegin.cs
Normal file
16
NitroxModel/Packets/DeconstructionBegin.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
[Serializable]
|
||||
public class DeconstructionBegin : Packet
|
||||
{
|
||||
public NitroxId Id { get; }
|
||||
|
||||
public DeconstructionBegin(NitroxId id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
}
|
||||
}
|
15
NitroxModel/Packets/Disconnect.cs
Normal file
15
NitroxModel/Packets/Disconnect.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
[Serializable]
|
||||
public class Disconnect : Packet
|
||||
{
|
||||
public ushort PlayerId { get; }
|
||||
|
||||
public Disconnect(ushort playerId)
|
||||
{
|
||||
PlayerId = playerId;
|
||||
}
|
||||
}
|
||||
}
|
14
NitroxModel/Packets/DiscordRequestIP.cs
Normal file
14
NitroxModel/Packets/DiscordRequestIP.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class DiscordRequestIP : Packet
|
||||
{
|
||||
public string IpPort { get; set; }
|
||||
|
||||
public DiscordRequestIP(string ipPort)
|
||||
{
|
||||
IpPort = ipPort;
|
||||
}
|
||||
}
|
15
NitroxModel/Packets/DropSimulationOwnership.cs
Normal file
15
NitroxModel/Packets/DropSimulationOwnership.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class DropSimulationOwnership : Packet
|
||||
{
|
||||
public NitroxId EntityId { get; set; }
|
||||
|
||||
public DropSimulationOwnership(NitroxId entityId)
|
||||
{
|
||||
EntityId = entityId;
|
||||
}
|
||||
}
|
15
NitroxModel/Packets/EntityDestroyed.cs
Normal file
15
NitroxModel/Packets/EntityDestroyed.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class EntityDestroyed : Packet
|
||||
{
|
||||
public NitroxId Id { get; }
|
||||
|
||||
public EntityDestroyed(NitroxId id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
}
|
20
NitroxModel/Packets/EntityMetadataUpdate.cs
Normal file
20
NitroxModel/Packets/EntityMetadataUpdate.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
[Serializable]
|
||||
public class EntityMetadataUpdate : Packet
|
||||
{
|
||||
public NitroxId Id { get; }
|
||||
|
||||
public EntityMetadata NewValue { get; }
|
||||
|
||||
public EntityMetadataUpdate(NitroxId id, EntityMetadata newValue)
|
||||
{
|
||||
Id = id;
|
||||
NewValue = newValue;
|
||||
}
|
||||
}
|
||||
}
|
18
NitroxModel/Packets/EntityReparented.cs
Normal file
18
NitroxModel/Packets/EntityReparented.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class EntityReparented : Packet
|
||||
{
|
||||
public NitroxId Id { get; }
|
||||
|
||||
public NitroxId NewParentId { get; }
|
||||
|
||||
public EntityReparented(NitroxId id, NitroxId newParentId)
|
||||
{
|
||||
Id = id;
|
||||
NewParentId = newParentId;
|
||||
}
|
||||
}
|
19
NitroxModel/Packets/EntitySpawnedByClient.cs
Normal file
19
NitroxModel/Packets/EntitySpawnedByClient.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures.GameLogic;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class EntitySpawnedByClient : Packet
|
||||
{
|
||||
public Entity Entity { get; }
|
||||
public bool RequireRespawn { get; }
|
||||
public bool RequireSimulation { get; }
|
||||
|
||||
public EntitySpawnedByClient(Entity entity, bool requireRespawn = false, bool requireSimulation = true)
|
||||
{
|
||||
Entity = entity;
|
||||
RequireRespawn = requireRespawn;
|
||||
RequireSimulation = requireSimulation;
|
||||
}
|
||||
}
|
71
NitroxModel/Packets/EntityTransformUpdates.cs
Normal file
71
NitroxModel/Packets/EntityTransformUpdates.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NitroxModel.DataStructures;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class EntityTransformUpdates : Packet
|
||||
{
|
||||
public List<EntityTransformUpdate> Updates { get; }
|
||||
|
||||
public EntityTransformUpdates(List<EntityTransformUpdate> updates)
|
||||
{
|
||||
Updates = updates;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[EntityTransformUpdates: {String.Join(" ", Updates)} ]";
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public abstract class EntityTransformUpdate
|
||||
{
|
||||
public NitroxId Id { get; }
|
||||
public NitroxVector3 Position { get; }
|
||||
public NitroxQuaternion Rotation { get; }
|
||||
|
||||
public EntityTransformUpdate(NitroxId id, NitroxVector3 position, NitroxQuaternion rotation)
|
||||
{
|
||||
Id = id;
|
||||
Position = position;
|
||||
Rotation = rotation;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class RawTransformUpdate : EntityTransformUpdate
|
||||
{
|
||||
public RawTransformUpdate(NitroxId id, NitroxVector3 position, NitroxQuaternion rotation) : base(id, position, rotation)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[RawTransformUpdate Id:{Id} Position:{Position} Rotation:{Rotation}]";
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class SplineTransformUpdate : EntityTransformUpdate
|
||||
{
|
||||
public NitroxVector3 DestinationPosition { get; }
|
||||
public NitroxVector3 DestinationDirection { get; }
|
||||
public float Velocity { get; }
|
||||
|
||||
public SplineTransformUpdate(NitroxId id, NitroxVector3 position, NitroxQuaternion rotation, NitroxVector3 destinationPosition, NitroxVector3 destinationDirection, float velocity) : base(id, position, rotation)
|
||||
{
|
||||
DestinationPosition = destinationPosition;
|
||||
DestinationDirection = destinationDirection;
|
||||
Velocity = velocity;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[SplineTransformUpdate Id:{Id} Position:{Position} Rotation:{Rotation} DestinationPosition:{DestinationPosition} DestinationDirection:{DestinationDirection} Velocity:{Velocity} ]";
|
||||
}
|
||||
}
|
||||
}
|
20
NitroxModel/Packets/EscapePodChanged.cs
Normal file
20
NitroxModel/Packets/EscapePodChanged.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
using NitroxModel.DataStructures.Util;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
[Serializable]
|
||||
public class EscapePodChanged : Packet
|
||||
{
|
||||
public ushort PlayerId { get; }
|
||||
public Optional<NitroxId> EscapePodId { get; }
|
||||
|
||||
public EscapePodChanged(ushort playerId, Optional<NitroxId> escapePodId)
|
||||
{
|
||||
PlayerId = playerId;
|
||||
EscapePodId = escapePodId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace NitroxModel.Packets.Exceptions
|
||||
{
|
||||
public class UncorrelatedPacketException : Exception
|
||||
{
|
||||
public CorrelatedPacket InvalidPacket { get; }
|
||||
public string ExpectedCorrelationId { get; }
|
||||
|
||||
public UncorrelatedPacketException(CorrelatedPacket invalidPacket, string expectedCorrelationId)
|
||||
{
|
||||
InvalidPacket = invalidPacket;
|
||||
ExpectedCorrelationId = expectedCorrelationId;
|
||||
}
|
||||
|
||||
public UncorrelatedPacketException(string message, CorrelatedPacket invalidPacket, string expectedCorrelationId) : base(message)
|
||||
{
|
||||
InvalidPacket = invalidPacket;
|
||||
ExpectedCorrelationId = expectedCorrelationId;
|
||||
}
|
||||
|
||||
public UncorrelatedPacketException(string message, Exception innerException, CorrelatedPacket invalidPacket, string expectedCorrelationId) : base(message, innerException)
|
||||
{
|
||||
InvalidPacket = invalidPacket;
|
||||
ExpectedCorrelationId = expectedCorrelationId;
|
||||
}
|
||||
}
|
||||
}
|
19
NitroxModel/Packets/FMODAssetPacket.cs
Normal file
19
NitroxModel/Packets/FMODAssetPacket.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class FMODAssetPacket : Packet
|
||||
{
|
||||
public string AssetPath { get; }
|
||||
public NitroxVector3 Position { get; }
|
||||
public float Volume { get; set; }
|
||||
|
||||
public FMODAssetPacket(string assetPath, NitroxVector3 position, float volume)
|
||||
{
|
||||
AssetPath = assetPath;
|
||||
Position = position;
|
||||
Volume = volume;
|
||||
}
|
||||
}
|
19
NitroxModel/Packets/FMODCustomEmitterPacket.cs
Normal file
19
NitroxModel/Packets/FMODCustomEmitterPacket.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class FMODCustomEmitterPacket : Packet
|
||||
{
|
||||
public NitroxId Id { get; }
|
||||
public string AssetPath { get; }
|
||||
public bool Play { get; }
|
||||
|
||||
public FMODCustomEmitterPacket(NitroxId id, string assetPath, bool play)
|
||||
{
|
||||
Id = id;
|
||||
AssetPath = assetPath;
|
||||
Play = play;
|
||||
}
|
||||
}
|
17
NitroxModel/Packets/FMODCustomLoopingEmitterPacket.cs
Normal file
17
NitroxModel/Packets/FMODCustomLoopingEmitterPacket.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class FMODCustomLoopingEmitterPacket : Packet
|
||||
{
|
||||
public NitroxId Id { get; }
|
||||
public string AssetPath { get; }
|
||||
|
||||
public FMODCustomLoopingEmitterPacket(NitroxId id, string assetPath)
|
||||
{
|
||||
Id = id;
|
||||
AssetPath = assetPath;
|
||||
}
|
||||
}
|
18
NitroxModel/Packets/FMODEventInstancePacket.cs
Normal file
18
NitroxModel/Packets/FMODEventInstancePacket.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class FMODEventInstancePacket : FMODAssetPacket
|
||||
{
|
||||
public NitroxId Id { get; }
|
||||
public bool Play { get; }
|
||||
|
||||
public FMODEventInstancePacket(NitroxId id, bool play, string assetPath, NitroxVector3 position, float volume) : base(assetPath, position, volume)
|
||||
{
|
||||
Id = id;
|
||||
Play = play;
|
||||
}
|
||||
}
|
21
NitroxModel/Packets/FMODStudioEmitterPacket.cs
Normal file
21
NitroxModel/Packets/FMODStudioEmitterPacket.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class FMODStudioEmitterPacket : Packet
|
||||
{
|
||||
public NitroxId Id { get; }
|
||||
public string AssetPath { get; }
|
||||
public bool Play { get; }
|
||||
public bool AllowFadeout { get; }
|
||||
|
||||
public FMODStudioEmitterPacket(NitroxId id, string assetPath, bool play, bool allowFadeout)
|
||||
{
|
||||
Id = id;
|
||||
AssetPath = assetPath;
|
||||
Play = play;
|
||||
AllowFadeout = allowFadeout;
|
||||
}
|
||||
}
|
22
NitroxModel/Packets/FastCheatChanged.cs
Normal file
22
NitroxModel/Packets/FastCheatChanged.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class FastCheatChanged : Packet
|
||||
{
|
||||
public FastCheat Cheat{ get; }
|
||||
public bool Value { get; }
|
||||
|
||||
public FastCheatChanged(FastCheat cheat, bool value)
|
||||
{
|
||||
Cheat = cheat;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public enum FastCheat : byte
|
||||
{
|
||||
HATCH,
|
||||
GROW
|
||||
}
|
||||
}
|
24
NitroxModel/Packets/FireDoused.cs
Normal file
24
NitroxModel/Packets/FireDoused.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
/// <summary>
|
||||
/// Triggered when a fire has been doused. Fire growth is a static thing, so we only need to track dousing
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class FireDoused : Packet
|
||||
{
|
||||
public NitroxId Id { get; }
|
||||
public float DouseAmount { get; }
|
||||
|
||||
/// <param name="id">The Fire id</param>
|
||||
/// <param name="douseAmount">The amount to douse the fire by. A large number will extinguish the fire. A large number still calls the same
|
||||
/// method, <see cref="Fire.Douse(float)"/>, which will call <see cref="Fire.Extinguish"/> if the douse amount would extinguish it.</param>
|
||||
public FireDoused(NitroxId id, float douseAmount)
|
||||
{
|
||||
Id = id;
|
||||
DouseAmount = douseAmount;
|
||||
}
|
||||
}
|
||||
}
|
26
NitroxModel/Packets/FootstepPacket.cs
Normal file
26
NitroxModel/Packets/FootstepPacket.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class FootstepPacket : Packet
|
||||
{
|
||||
public ushort PlayerID { get; }
|
||||
public StepSounds AssetIndex { get; }
|
||||
|
||||
public FootstepPacket(ushort playerID, StepSounds assetIndex)
|
||||
{
|
||||
PlayerID = playerID;
|
||||
AssetIndex = assetIndex;
|
||||
|
||||
DeliveryMethod = Networking.NitroxDeliveryMethod.DeliveryMethod.UNRELIABLE_SEQUENCED;
|
||||
UdpChannel = UdpChannelId.MOVEMENTS;
|
||||
}
|
||||
|
||||
public enum StepSounds : byte
|
||||
{
|
||||
PRECURSOR,
|
||||
METAL,
|
||||
LAND
|
||||
}
|
||||
}
|
29
NitroxModel/Packets/GameModeChanged.cs
Normal file
29
NitroxModel/Packets/GameModeChanged.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using NitroxModel.Server;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class GameModeChanged : Packet
|
||||
{
|
||||
public ushort PlayerId { get; }
|
||||
public bool AllPlayers { get; }
|
||||
public NitroxGameMode GameMode { get; }
|
||||
|
||||
public GameModeChanged(ushort playerId, bool allPlayers, NitroxGameMode gameMode)
|
||||
{
|
||||
PlayerId = playerId;
|
||||
AllPlayers = allPlayers;
|
||||
GameMode = gameMode;
|
||||
}
|
||||
|
||||
public static GameModeChanged ForPlayer(ushort playerId, NitroxGameMode gameMode)
|
||||
{
|
||||
return new(playerId, false, gameMode);
|
||||
}
|
||||
|
||||
public static GameModeChanged ForAllPlayers(NitroxGameMode gameMode)
|
||||
{
|
||||
return new(0, true, gameMode);
|
||||
}
|
||||
}
|
16
NitroxModel/Packets/GoalCompleted.cs
Normal file
16
NitroxModel/Packets/GoalCompleted.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class GoalCompleted : Packet
|
||||
{
|
||||
public string CompletedGoal { get; }
|
||||
public float CompletionTime { get; }
|
||||
|
||||
public GoalCompleted(string completedGoal, float completionTime)
|
||||
{
|
||||
CompletedGoal = completedGoal;
|
||||
CompletionTime = completionTime;
|
||||
}
|
||||
}
|
146
NitroxModel/Packets/InitialPlayerSync.cs
Normal file
146
NitroxModel/Packets/InitialPlayerSync.cs
Normal file
@@ -0,0 +1,146 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NitroxModel.DataStructures;
|
||||
using NitroxModel.DataStructures.GameLogic;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
using NitroxModel.DataStructures.Util;
|
||||
using NitroxModel.MultiplayerSession;
|
||||
using NitroxModel.Server;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
[Serializable]
|
||||
public class InitialPlayerSync : Packet
|
||||
{
|
||||
public NitroxId AssignedEscapePodId { get; }
|
||||
public Dictionary<string, NitroxId> EquippedItems { get; }
|
||||
public List<NitroxTechType> UsedItems { get; }
|
||||
public Optional<NitroxId>[] QuickSlotsBindingIds { get; }
|
||||
public NitroxId PlayerGameObjectId { get; }
|
||||
public bool FirstTimeConnecting { get; }
|
||||
public InitialPDAData PDAData { get; }
|
||||
public InitialStoryGoalData StoryGoalData { get; }
|
||||
public NitroxVector3 PlayerSpawnData { get; }
|
||||
public NitroxQuaternion PlayerSpawnRotation { get; }
|
||||
public Optional<NitroxId> PlayerSubRootId { get; }
|
||||
public PlayerStatsData PlayerStatsData { get; }
|
||||
public List<PlayerContext> OtherPlayers { get; }
|
||||
public List<Entity> GlobalRootEntities { get; }
|
||||
public List<SimulatedEntity> InitialSimulationOwnerships { get; }
|
||||
public NitroxGameMode GameMode { get; }
|
||||
public Perms Permissions { get; }
|
||||
public IntroCinematicMode IntroCinematicMode { get; }
|
||||
public SubnauticaPlayerPreferences Preferences { get; }
|
||||
public TimeData TimeData { get; }
|
||||
public bool IsFirstPlayer { get; }
|
||||
public Dictionary<NitroxId, int> BuildOperationIds { get; }
|
||||
|
||||
public bool KeepInventoryOnDeath { get; }
|
||||
public SessionSettings SessionSettings { get; }
|
||||
|
||||
public InitialPlayerSync(NitroxId playerGameObjectId,
|
||||
bool firstTimeConnecting,
|
||||
NitroxId assignedEscapePodId,
|
||||
IDictionary<string, NitroxId> equipment,
|
||||
IEnumerable<NitroxTechType> usedItems,
|
||||
Optional<NitroxId>[] quickSlotsBindingIds,
|
||||
InitialPDAData pdaData,
|
||||
InitialStoryGoalData storyGoalData,
|
||||
NitroxVector3 playerSpawnData,
|
||||
NitroxQuaternion playerSpawnRotation,
|
||||
Optional<NitroxId> playerSubRootId,
|
||||
PlayerStatsData playerStatsData,
|
||||
IEnumerable<PlayerContext> otherPlayers,
|
||||
IEnumerable<Entity> globalRootEntities,
|
||||
IEnumerable<SimulatedEntity> initialSimulationOwnerships,
|
||||
NitroxGameMode gameMode,
|
||||
Perms perms,
|
||||
IntroCinematicMode introCinematicMode,
|
||||
SubnauticaPlayerPreferences preferences,
|
||||
TimeData timeData,
|
||||
bool isFirstPlayer,
|
||||
Dictionary<NitroxId, int> buildOperationIds,
|
||||
bool keepInventoryOnDeath,
|
||||
SessionSettings sessionSettings)
|
||||
{
|
||||
AssignedEscapePodId = assignedEscapePodId;
|
||||
PlayerGameObjectId = playerGameObjectId;
|
||||
FirstTimeConnecting = firstTimeConnecting;
|
||||
EquippedItems = new(equipment);
|
||||
UsedItems = usedItems.ToList();
|
||||
QuickSlotsBindingIds = quickSlotsBindingIds;
|
||||
PDAData = pdaData;
|
||||
StoryGoalData = storyGoalData;
|
||||
PlayerSpawnData = playerSpawnData;
|
||||
PlayerSpawnRotation = playerSpawnRotation;
|
||||
PlayerSubRootId = playerSubRootId;
|
||||
PlayerStatsData = playerStatsData;
|
||||
OtherPlayers = otherPlayers.ToList();
|
||||
GlobalRootEntities = globalRootEntities.ToList();
|
||||
InitialSimulationOwnerships = initialSimulationOwnerships.ToList();
|
||||
GameMode = gameMode;
|
||||
Permissions = perms;
|
||||
IntroCinematicMode = introCinematicMode;
|
||||
Preferences = preferences;
|
||||
TimeData = timeData;
|
||||
IsFirstPlayer = isFirstPlayer;
|
||||
BuildOperationIds = buildOperationIds;
|
||||
KeepInventoryOnDeath = keepInventoryOnDeath;
|
||||
SessionSettings = sessionSettings;
|
||||
}
|
||||
|
||||
/// <remarks>Used for deserialization</remarks>
|
||||
public InitialPlayerSync(
|
||||
NitroxId assignedEscapePodId,
|
||||
Dictionary<string, NitroxId> equippedItems,
|
||||
List<NitroxTechType> usedItems,
|
||||
Optional<NitroxId>[] quickSlotsBindingIds,
|
||||
NitroxId playerGameObjectId,
|
||||
bool firstTimeConnecting,
|
||||
InitialPDAData pdaData,
|
||||
InitialStoryGoalData storyGoalData,
|
||||
NitroxVector3 playerSpawnData,
|
||||
NitroxQuaternion playerSpawnRotation,
|
||||
Optional<NitroxId> playerSubRootId,
|
||||
PlayerStatsData playerStatsData,
|
||||
List<PlayerContext> otherPlayers,
|
||||
List<Entity> globalRootEntities,
|
||||
List<SimulatedEntity> initialSimulationOwnerships,
|
||||
NitroxGameMode gameMode,
|
||||
Perms permissions,
|
||||
IntroCinematicMode introCinematicMode,
|
||||
SubnauticaPlayerPreferences preferences,
|
||||
TimeData timeData,
|
||||
bool isFirstPlayer,
|
||||
Dictionary<NitroxId, int> buildOperationIds,
|
||||
bool keepInventoryOnDeath,
|
||||
SessionSettings sessionSettings)
|
||||
{
|
||||
AssignedEscapePodId = assignedEscapePodId;
|
||||
PlayerGameObjectId = playerGameObjectId;
|
||||
FirstTimeConnecting = firstTimeConnecting;
|
||||
EquippedItems = equippedItems;
|
||||
UsedItems = usedItems;
|
||||
QuickSlotsBindingIds = quickSlotsBindingIds;
|
||||
PDAData = pdaData;
|
||||
StoryGoalData = storyGoalData;
|
||||
PlayerSpawnData = playerSpawnData;
|
||||
PlayerSpawnRotation = playerSpawnRotation;
|
||||
PlayerSubRootId = playerSubRootId;
|
||||
PlayerStatsData = playerStatsData;
|
||||
OtherPlayers = otherPlayers;
|
||||
GlobalRootEntities = globalRootEntities;
|
||||
InitialSimulationOwnerships = initialSimulationOwnerships;
|
||||
GameMode = gameMode;
|
||||
Permissions = permissions;
|
||||
IntroCinematicMode = introCinematicMode;
|
||||
Preferences = preferences;
|
||||
TimeData = timeData;
|
||||
IsFirstPlayer = isFirstPlayer;
|
||||
BuildOperationIds = buildOperationIds;
|
||||
KeepInventoryOnDeath = keepInventoryOnDeath;
|
||||
SessionSettings = sessionSettings;
|
||||
}
|
||||
}
|
||||
}
|
21
NitroxModel/Packets/ItemPosition.cs
Normal file
21
NitroxModel/Packets/ItemPosition.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
[Serializable]
|
||||
public class ItemPosition : Packet
|
||||
{
|
||||
public NitroxId Id { get; }
|
||||
public NitroxVector3 Position { get; }
|
||||
public NitroxQuaternion Rotation { get; }
|
||||
|
||||
public ItemPosition(NitroxId id, NitroxVector3 position, NitroxQuaternion rotation)
|
||||
{
|
||||
Id = id;
|
||||
Position = position;
|
||||
Rotation = rotation;
|
||||
}
|
||||
}
|
||||
}
|
14
NitroxModel/Packets/KeepInventoryChanged.cs
Normal file
14
NitroxModel/Packets/KeepInventoryChanged.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class KeepInventoryChanged : Packet
|
||||
{
|
||||
public bool KeepInventoryOnDeath { get; }
|
||||
|
||||
public KeepInventoryChanged(bool keepInventoryOnDeath)
|
||||
{
|
||||
KeepInventoryOnDeath = keepInventoryOnDeath;
|
||||
}
|
||||
}
|
38
NitroxModel/Packets/KnownTechEntryAdd.cs
Normal file
38
NitroxModel/Packets/KnownTechEntryAdd.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NitroxModel.DataStructures.GameLogic;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
[Serializable]
|
||||
public class KnownTechEntryAdd : Packet
|
||||
{
|
||||
public enum EntryCategory
|
||||
{
|
||||
/// <summary>
|
||||
/// <b>KnownTech.knownTech</b><br/>
|
||||
/// Tech items that you learn about after fulfilling a requirement. Often times, discovering a new KnownTech.analyzedTech item will provide 1 or more KnownTech.knownTech items. (Peeper -> CookedPeeper)
|
||||
/// </summary>
|
||||
KNOWN = 0,
|
||||
/// <summary>
|
||||
/// <b>KnownTech.analyzedTech</b><br/>
|
||||
/// Tech items that you find in the world and acquire. They often show a notification saying you found/learned about them. (Fish, Resources, etc)
|
||||
/// <br/>
|
||||
/// </summary>
|
||||
ANALYZED = 1
|
||||
}
|
||||
|
||||
public NitroxTechType TechType { get; }
|
||||
public bool Verbose { get; }
|
||||
public EntryCategory Category { get; }
|
||||
public List<NitroxTechType> PartialTechTypesToRemove { get; }
|
||||
|
||||
public KnownTechEntryAdd(EntryCategory category, NitroxTechType techType, bool verbose, List<NitroxTechType> partialTechTypesToRemove = null)
|
||||
{
|
||||
Category = category;
|
||||
TechType = techType;
|
||||
Verbose = verbose;
|
||||
PartialTechTypesToRemove = partialTechTypesToRemove;
|
||||
}
|
||||
}
|
||||
}
|
19
NitroxModel/Packets/LargeWaterParkDeconstructed.cs
Normal file
19
NitroxModel/Packets/LargeWaterParkDeconstructed.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NitroxModel.DataStructures;
|
||||
using NitroxModel.DataStructures.GameLogic.Bases;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Bases;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public sealed class LargeWaterParkDeconstructed : PieceDeconstructed
|
||||
{
|
||||
public Dictionary<NitroxId, List<NitroxId>> MovedChildrenIdsByNewHostId;
|
||||
|
||||
public LargeWaterParkDeconstructed(NitroxId baseId, NitroxId pieceId, BuildPieceIdentifier buildPieceIdentifier, GhostEntity replacerGhost, BaseData baseData, Dictionary<NitroxId, List<NitroxId>> movedChildrenIdsByNewHostId, int operationId) :
|
||||
base(baseId, pieceId, buildPieceIdentifier, replacerGhost, baseData, operationId)
|
||||
{
|
||||
MovedChildrenIdsByNewHostId = movedChildrenIdsByNewHostId;
|
||||
}
|
||||
}
|
19
NitroxModel/Packets/LeakRepaired.cs
Normal file
19
NitroxModel/Packets/LeakRepaired.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class LeakRepaired : Packet
|
||||
{
|
||||
public NitroxId BaseId { get; set; }
|
||||
public NitroxId LeakId { get; set; }
|
||||
public NitroxInt3 RelativeCell { get; set; }
|
||||
|
||||
public LeakRepaired(NitroxId baseId, NitroxId leakId, NitroxInt3 relativeCell)
|
||||
{
|
||||
BaseId = baseId;
|
||||
LeakId = leakId;
|
||||
RelativeCell = relativeCell;
|
||||
}
|
||||
}
|
22
NitroxModel/Packets/MedicalCabinetClicked.cs
Normal file
22
NitroxModel/Packets/MedicalCabinetClicked.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
[Serializable]
|
||||
public class MedicalCabinetClicked : Packet
|
||||
{
|
||||
public NitroxId Id { get; }
|
||||
public bool DoorOpen { get; }
|
||||
public bool HasMedKit { get; }
|
||||
public float NextSpawnTime { get; }
|
||||
|
||||
public MedicalCabinetClicked(NitroxId id, bool doorOpen, bool hasMedKit, float nextSpawnTime)
|
||||
{
|
||||
Id = id;
|
||||
DoorOpen = doorOpen;
|
||||
HasMedKit = hasMedKit;
|
||||
NextSpawnTime = nextSpawnTime;
|
||||
}
|
||||
}
|
||||
}
|
17
NitroxModel/Packets/ModifyConstructedAmount.cs
Normal file
17
NitroxModel/Packets/ModifyConstructedAmount.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public sealed class ModifyConstructedAmount : Packet
|
||||
{
|
||||
public NitroxId GhostId { get; }
|
||||
public float ConstructedAmount { get; }
|
||||
|
||||
public ModifyConstructedAmount(NitroxId ghostId, float constructedAmount)
|
||||
{
|
||||
GhostId = ghostId;
|
||||
ConstructedAmount = constructedAmount;
|
||||
}
|
||||
}
|
21
NitroxModel/Packets/ModuleAdded.cs
Normal file
21
NitroxModel/Packets/ModuleAdded.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class ModuleAdded : Packet
|
||||
{
|
||||
public NitroxId Id { get; }
|
||||
|
||||
public NitroxId ParentId { get; }
|
||||
|
||||
public string Slot { get; }
|
||||
|
||||
public ModuleAdded(NitroxId id, NitroxId parentId, string slot)
|
||||
{
|
||||
Id = id;
|
||||
ParentId = parentId;
|
||||
Slot = slot;
|
||||
}
|
||||
}
|
18
NitroxModel/Packets/ModuleRemoved.cs
Normal file
18
NitroxModel/Packets/ModuleRemoved.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class ModuleRemoved : Packet
|
||||
{
|
||||
public NitroxId Id { get; }
|
||||
|
||||
public NitroxId NewParentId { get; }
|
||||
|
||||
public ModuleRemoved(NitroxId id, NitroxId newParentId)
|
||||
{
|
||||
Id = id;
|
||||
NewParentId = newParentId;
|
||||
}
|
||||
}
|
14
NitroxModel/Packets/Movement.cs
Normal file
14
NitroxModel/Packets/Movement.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public abstract class Movement : Packet
|
||||
{
|
||||
public abstract ushort PlayerId { get; }
|
||||
public abstract NitroxVector3 Position { get; }
|
||||
public abstract NitroxVector3 Velocity { get; }
|
||||
public abstract NitroxQuaternion BodyRotation { get; }
|
||||
public abstract NitroxQuaternion AimingRotation { get; }
|
||||
}
|
40
NitroxModel/Packets/MultiplayerSessionPolicy.cs
Normal file
40
NitroxModel/Packets/MultiplayerSessionPolicy.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
using NitroxModel.Helper;
|
||||
using NitroxModel.MultiplayerSession;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
[Serializable]
|
||||
public class MultiplayerSessionPolicy : CorrelatedPacket
|
||||
{
|
||||
public bool RequiresServerPassword { get; }
|
||||
public MultiplayerSessionAuthenticationAuthority AuthenticationAuthority { get; }
|
||||
public bool DisableConsole { get; }
|
||||
public int MaxConnections { get; }
|
||||
public NitroxVersion NitroxVersionAllowed { get; }
|
||||
|
||||
public MultiplayerSessionPolicy(string correlationId, bool disableConsole, int maxConnections, bool requiresServerPassword) : base(correlationId)
|
||||
{
|
||||
RequiresServerPassword = requiresServerPassword;
|
||||
AuthenticationAuthority = MultiplayerSessionAuthenticationAuthority.SERVER;
|
||||
DisableConsole = disableConsole;
|
||||
MaxConnections = maxConnections;
|
||||
|
||||
Version ver = NitroxEnvironment.Version;
|
||||
// only the major and minor version number is required
|
||||
NitroxVersionAllowed = new(ver.Major, ver.Minor);
|
||||
}
|
||||
|
||||
/// <remarks>Used for deserialization</remarks>
|
||||
public MultiplayerSessionPolicy(string correlationId, bool requiresServerPassword, MultiplayerSessionAuthenticationAuthority authenticationAuthority,
|
||||
bool disableConsole, int maxConnections, NitroxVersion nitroxVersionAllowed) : base(correlationId)
|
||||
{
|
||||
RequiresServerPassword = requiresServerPassword;
|
||||
AuthenticationAuthority = authenticationAuthority;
|
||||
DisableConsole = disableConsole;
|
||||
MaxConnections = maxConnections;
|
||||
NitroxVersionAllowed = nitroxVersionAllowed;
|
||||
}
|
||||
}
|
||||
}
|
16
NitroxModel/Packets/MultiplayerSessionPolicyRequest.cs
Normal file
16
NitroxModel/Packets/MultiplayerSessionPolicyRequest.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
/// <summary>
|
||||
/// This is a packet that we use to "ping" a server to let it know that we'd like more information
|
||||
/// on the current requirements to submit a reservation to the ongoing game session.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class MultiplayerSessionPolicyRequest : CorrelatedPacket
|
||||
{
|
||||
public MultiplayerSessionPolicyRequest(string correlationId) : base(correlationId)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
25
NitroxModel/Packets/MultiplayerSessionReservation.cs
Normal file
25
NitroxModel/Packets/MultiplayerSessionReservation.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using NitroxModel.MultiplayerSession;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
[Serializable]
|
||||
public class MultiplayerSessionReservation : CorrelatedPacket
|
||||
{
|
||||
public ushort PlayerId { get; }
|
||||
public string ReservationKey { get; }
|
||||
public MultiplayerSessionReservationState ReservationState { get; }
|
||||
|
||||
public MultiplayerSessionReservation(string correlationId, MultiplayerSessionReservationState reservationState) : base(correlationId)
|
||||
{
|
||||
ReservationState = reservationState;
|
||||
}
|
||||
|
||||
public MultiplayerSessionReservation(string correlationId, ushort playerId, string reservationKey,
|
||||
MultiplayerSessionReservationState reservationState = MultiplayerSessionReservationState.RESERVED) : this(correlationId, reservationState)
|
||||
{
|
||||
PlayerId = playerId;
|
||||
ReservationKey = reservationKey;
|
||||
}
|
||||
}
|
||||
}
|
18
NitroxModel/Packets/MultiplayerSessionReservationRequest.cs
Normal file
18
NitroxModel/Packets/MultiplayerSessionReservationRequest.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using NitroxModel.MultiplayerSession;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
[Serializable]
|
||||
public class MultiplayerSessionReservationRequest : CorrelatedPacket
|
||||
{
|
||||
public PlayerSettings PlayerSettings { get; }
|
||||
public AuthenticationContext AuthenticationContext { get; }
|
||||
|
||||
public MultiplayerSessionReservationRequest(string correlationId, PlayerSettings playerSettings, AuthenticationContext authenticationContext) : base(correlationId)
|
||||
{
|
||||
PlayerSettings = playerSettings;
|
||||
AuthenticationContext = authenticationContext;
|
||||
}
|
||||
}
|
||||
}
|
16
NitroxModel/Packets/MutePlayer.cs
Normal file
16
NitroxModel/Packets/MutePlayer.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class MutePlayer : Packet
|
||||
{
|
||||
public ushort PlayerId;
|
||||
public bool Muted;
|
||||
|
||||
public MutePlayer(ushort playerId, bool muted)
|
||||
{
|
||||
PlayerId = playerId;
|
||||
Muted = muted;
|
||||
}
|
||||
}
|
20
NitroxModel/Packets/OpenableStateChanged.cs
Normal file
20
NitroxModel/Packets/OpenableStateChanged.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
[Serializable]
|
||||
public class OpenableStateChanged : Packet
|
||||
{
|
||||
public NitroxId Id { get; }
|
||||
public bool IsOpen { get; }
|
||||
public float Duration { get; }
|
||||
|
||||
public OpenableStateChanged(NitroxId id, bool isOpen, float duration)
|
||||
{
|
||||
Id = id;
|
||||
IsOpen = isOpen;
|
||||
Duration = duration;
|
||||
}
|
||||
}
|
||||
}
|
14
NitroxModel/Packets/OrderedBuildPacket.cs
Normal file
14
NitroxModel/Packets/OrderedBuildPacket.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public abstract class OrderedBuildPacket : Packet
|
||||
{
|
||||
public int OperationId { get; set; }
|
||||
|
||||
protected OrderedBuildPacket(int operationId)
|
||||
{
|
||||
OperationId = operationId;
|
||||
}
|
||||
}
|
19
NitroxModel/Packets/PDAEncyclopediaEntryAdd.cs
Normal file
19
NitroxModel/Packets/PDAEncyclopediaEntryAdd.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class PDAEncyclopediaEntryAdd : Packet
|
||||
{
|
||||
public string Key { get; }
|
||||
/// <summary>
|
||||
/// If true, shows a notification to the player.
|
||||
/// </summary>
|
||||
public bool Verbose { get; }
|
||||
|
||||
public PDAEncyclopediaEntryAdd(string key, bool verbose)
|
||||
{
|
||||
Key = key;
|
||||
Verbose = verbose;
|
||||
}
|
||||
}
|
16
NitroxModel/Packets/PDALogEntryAdd.cs
Normal file
16
NitroxModel/Packets/PDALogEntryAdd.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class PDALogEntryAdd : Packet
|
||||
{
|
||||
public string Key { get; }
|
||||
public float Timestamp { get; }
|
||||
|
||||
public PDALogEntryAdd(string key, float timestamp)
|
||||
{
|
||||
Key = key;
|
||||
Timestamp = timestamp;
|
||||
}
|
||||
}
|
26
NitroxModel/Packets/PDAScanFinished.cs
Normal file
26
NitroxModel/Packets/PDAScanFinished.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
using NitroxModel.DataStructures.GameLogic;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class PDAScanFinished : Packet
|
||||
{
|
||||
public NitroxId Id { get; }
|
||||
public NitroxTechType TechType { get; }
|
||||
public int UnlockedAmount { get; }
|
||||
public bool FullyResearched { get; }
|
||||
public bool Destroy { get; }
|
||||
public bool WasAlreadyResearched { get; }
|
||||
|
||||
public PDAScanFinished(NitroxId id, NitroxTechType techType, int unlockedAmount, bool fullyResearched, bool destroy, bool wasAlreadyResearched = false)
|
||||
{
|
||||
Id = id;
|
||||
TechType = techType;
|
||||
UnlockedAmount = unlockedAmount;
|
||||
FullyResearched = fullyResearched;
|
||||
Destroy = destroy;
|
||||
WasAlreadyResearched = wasAlreadyResearched;
|
||||
}
|
||||
}
|
144
NitroxModel/Packets/Packet.cs
Normal file
144
NitroxModel/Packets/Packet.cs
Normal file
@@ -0,0 +1,144 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using BinaryPack;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.Networking;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
[Serializable]
|
||||
public abstract class Packet
|
||||
{
|
||||
private static readonly Dictionary<Type, PropertyInfo[]> cachedPropertiesByType = new();
|
||||
private static readonly StringBuilder toStringBuilder = new();
|
||||
private static readonly object lockObject = new();
|
||||
|
||||
public static void InitSerializer()
|
||||
{
|
||||
static IEnumerable<Type> FindTypesInModelAssemblies()
|
||||
{
|
||||
return AppDomain.CurrentDomain.GetAssemblies()
|
||||
.Where(assembly => new[] { nameof(NitroxModel), "NitroxModel-Subnautica" }
|
||||
.Contains(assembly.GetName().Name))
|
||||
.SelectMany(assembly =>
|
||||
{
|
||||
try
|
||||
{
|
||||
return assembly.GetTypes();
|
||||
}
|
||||
catch (ReflectionTypeLoadException e)
|
||||
{
|
||||
return e.Types.Where(t => t != null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static IEnumerable<Type> FindUnionBaseTypes() => FindTypesInModelAssemblies()
|
||||
.Where(t => t.IsAbstract && !t.IsSealed && (!t.BaseType?.IsAbstract ?? true) && !t.ContainsGenericParameters);
|
||||
|
||||
lock (lockObject)
|
||||
{
|
||||
foreach (Type type in FindUnionBaseTypes())
|
||||
{
|
||||
BinaryConverter.RegisterUnion(type, FindTypesInModelAssemblies()
|
||||
.Where(t => type.IsAssignableFrom(t) && !t.IsAbstract && !t.IsInterface)
|
||||
.OrderByDescending(t =>
|
||||
{
|
||||
Type current = t;
|
||||
int levels = 0;
|
||||
|
||||
while (current != type && current != null)
|
||||
{
|
||||
current = current.BaseType;
|
||||
levels++;
|
||||
}
|
||||
|
||||
return levels;
|
||||
})
|
||||
.ThenBy(t => t.FullName, StringComparer.Ordinal)
|
||||
.ToArray());
|
||||
}
|
||||
|
||||
// This will initialize the processor for Wrapper which will initialize all the others
|
||||
_ = BinaryConverter.Serialize(new Wrapper());
|
||||
}
|
||||
}
|
||||
|
||||
[IgnoredMember]
|
||||
public NitroxDeliveryMethod.DeliveryMethod DeliveryMethod { get; protected set; } = NitroxDeliveryMethod.DeliveryMethod.RELIABLE_ORDERED;
|
||||
|
||||
[IgnoredMember]
|
||||
public UdpChannelId UdpChannel { get; protected set; } = UdpChannelId.DEFAULT;
|
||||
|
||||
public enum UdpChannelId : byte
|
||||
{
|
||||
DEFAULT = 0,
|
||||
MOVEMENTS = 1,
|
||||
}
|
||||
|
||||
public byte[] Serialize()
|
||||
{
|
||||
return BinaryConverter.Serialize(new Wrapper(this));
|
||||
}
|
||||
|
||||
public static Packet Deserialize(byte[] data)
|
||||
{
|
||||
return BinaryConverter.Deserialize<Wrapper>(data).Packet;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
Type packetType = GetType();
|
||||
|
||||
if (!cachedPropertiesByType.TryGetValue(packetType, out PropertyInfo[] properties))
|
||||
{
|
||||
properties = packetType.GetProperties(BindingFlags.Public | BindingFlags.Instance)
|
||||
.Where(x => x.Name is not nameof(DeliveryMethod) and not nameof(UdpChannel)).ToArray();
|
||||
cachedPropertiesByType.Add(packetType, properties);
|
||||
}
|
||||
|
||||
toStringBuilder.Clear();
|
||||
toStringBuilder.Append($"[{packetType.Name}: ");
|
||||
foreach (PropertyInfo property in properties)
|
||||
{
|
||||
object propertyValue = property.GetValue(this);
|
||||
if (propertyValue is IList propertyList)
|
||||
{
|
||||
toStringBuilder.Append($"{property.Name}: {propertyList.Count}, ");
|
||||
}
|
||||
else
|
||||
{
|
||||
toStringBuilder.Append($"{property.Name}: {propertyValue}, ");
|
||||
}
|
||||
}
|
||||
|
||||
toStringBuilder.Remove(toStringBuilder.Length - 2, 2);
|
||||
toStringBuilder.Append(']');
|
||||
|
||||
return toStringBuilder.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wrapper which is used to serialize packets in BinaryPack.
|
||||
/// We cannot serialize Packets directly because
|
||||
/// <p>
|
||||
/// 1) We will not know what type to deserialize to and
|
||||
/// 2) The root object must have a callable constructor so it can't be abstract
|
||||
/// </p>
|
||||
/// This type solves both problems and only adds a single byte to the data.
|
||||
/// </summary>
|
||||
public readonly struct Wrapper
|
||||
{
|
||||
public Packet Packet { get; init; } = null;
|
||||
|
||||
public Wrapper(Packet packet)
|
||||
{
|
||||
Packet = packet;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
15
NitroxModel/Packets/PermsChanged.cs
Normal file
15
NitroxModel/Packets/PermsChanged.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures.GameLogic;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class PermsChanged : Packet
|
||||
{
|
||||
public Perms NewPerms;
|
||||
|
||||
public PermsChanged(Perms newPerms)
|
||||
{
|
||||
NewPerms = newPerms;
|
||||
}
|
||||
}
|
15
NitroxModel/Packets/PickupItem.cs
Normal file
15
NitroxModel/Packets/PickupItem.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class PickupItem : Packet
|
||||
{
|
||||
public InventoryItemEntity Item { get; }
|
||||
|
||||
public PickupItem(InventoryItemEntity item)
|
||||
{
|
||||
Item = item;
|
||||
}
|
||||
}
|
25
NitroxModel/Packets/PieceDeconstructed.cs
Normal file
25
NitroxModel/Packets/PieceDeconstructed.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
using NitroxModel.DataStructures.GameLogic.Bases;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Bases;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class PieceDeconstructed : OrderedBuildPacket
|
||||
{
|
||||
public NitroxId BaseId { get; }
|
||||
public NitroxId PieceId { get; }
|
||||
public BuildPieceIdentifier BuildPieceIdentifier { get; }
|
||||
public GhostEntity ReplacerGhost { get; }
|
||||
public BaseData BaseData { get; set; }
|
||||
|
||||
public PieceDeconstructed(NitroxId baseId, NitroxId pieceId, BuildPieceIdentifier buildPieceIdentifier, GhostEntity replacerGhost, BaseData baseData, int operationId) : base(operationId)
|
||||
{
|
||||
BaseId = baseId;
|
||||
PieceId = pieceId;
|
||||
BuildPieceIdentifier = buildPieceIdentifier;
|
||||
ReplacerGhost = replacerGhost;
|
||||
BaseData = baseData;
|
||||
}
|
||||
}
|
15
NitroxModel/Packets/PinMoved.cs
Normal file
15
NitroxModel/Packets/PinMoved.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class PinnedRecipeMoved : Packet
|
||||
{
|
||||
public List<int> RecipePins { get; }
|
||||
|
||||
public PinnedRecipeMoved(List<int> recipePins)
|
||||
{
|
||||
RecipePins = recipePins;
|
||||
}
|
||||
}
|
23
NitroxModel/Packets/PlaceBase.cs
Normal file
23
NitroxModel/Packets/PlaceBase.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Bases;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public sealed class PlaceBase : Packet
|
||||
{
|
||||
public NitroxId FormerGhostId { get; }
|
||||
public BuildEntity BuildEntity { get; set; }
|
||||
|
||||
public PlaceBase(NitroxId formerGhostId, BuildEntity buildEntity)
|
||||
{
|
||||
FormerGhostId = formerGhostId;
|
||||
BuildEntity = buildEntity;
|
||||
}
|
||||
|
||||
public void Deflate()
|
||||
{
|
||||
BuildEntity = null;
|
||||
}
|
||||
}
|
15
NitroxModel/Packets/PlaceGhost.cs
Normal file
15
NitroxModel/Packets/PlaceGhost.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Bases;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public sealed class PlaceGhost : Packet
|
||||
{
|
||||
public GhostEntity GhostEntity { get; }
|
||||
|
||||
public PlaceGhost(GhostEntity ghostEntity)
|
||||
{
|
||||
GhostEntity = ghostEntity;
|
||||
}
|
||||
}
|
15
NitroxModel/Packets/PlaceModule.cs
Normal file
15
NitroxModel/Packets/PlaceModule.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Bases;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public sealed class PlaceModule : Packet
|
||||
{
|
||||
public ModuleEntity ModuleEntity { get; }
|
||||
|
||||
public PlaceModule(ModuleEntity moduleEntity)
|
||||
{
|
||||
ModuleEntity = moduleEntity;
|
||||
}
|
||||
}
|
33
NitroxModel/Packets/PlaySunbeamEvent.cs
Normal file
33
NitroxModel/Packets/PlaySunbeamEvent.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class PlaySunbeamEvent : Packet
|
||||
{
|
||||
public string EventKey { get; }
|
||||
|
||||
public PlaySunbeamEvent(string eventKey)
|
||||
{
|
||||
EventKey = eventKey;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Associates an understandable event name and the associated goal from <see cref="SunbeamGoals" />.
|
||||
/// </summary>
|
||||
public static class SunbeamEvent
|
||||
{
|
||||
public const string STORYSTART = "RadioSunbeamStart";
|
||||
public const string COUNTDOWN = "OnPlayRadioSunbeam4";
|
||||
public const string GUNAIM = "PrecursorGunAimCheck";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An ordered list of the goals forming part of the whole Sunbeam story.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If you modify this list, make sure to accordingly modify <see cref="SunbeamEvent"/>.
|
||||
/// </remarks>
|
||||
[NonSerialized]
|
||||
public static readonly string[] SunbeamGoals = new string[] { SunbeamEvent.STORYSTART, "OnPlayRadioSunbeamStart", "RadioSunbeam1", "OnPlayRadioSunbeam1", "RadioSunbeam2", "OnPlayRadioSunbeam2", "RadioSunbeam3", "OnPlayRadioSunbeam3", "RadioSunbeam4", SunbeamEvent.COUNTDOWN, SunbeamEvent.GUNAIM, "PrecursorGunAim", "SunbeamCheckPlayerRange", "PDASunbeamDestroyEventOutOfRange", "PDASunbeamDestroyEventInRange" };
|
||||
}
|
23
NitroxModel/Packets/PlayerCinematicControllerCall.cs
Normal file
23
NitroxModel/Packets/PlayerCinematicControllerCall.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class PlayerCinematicControllerCall : Packet
|
||||
{
|
||||
public ushort PlayerId { get; }
|
||||
public NitroxId ControllerID { get; }
|
||||
public int ControllerNameHash { get; }
|
||||
public string Key { get; }
|
||||
public bool StartPlaying { get; }
|
||||
|
||||
public PlayerCinematicControllerCall(ushort playerId, NitroxId controllerID, int controllerNameHash, string key, bool startPlaying)
|
||||
{
|
||||
PlayerId = playerId;
|
||||
ControllerID = controllerID;
|
||||
ControllerNameHash = controllerNameHash;
|
||||
Key = key;
|
||||
StartPlaying = startPlaying;
|
||||
}
|
||||
}
|
18
NitroxModel/Packets/PlayerDeathEvent.cs
Normal file
18
NitroxModel/Packets/PlayerDeathEvent.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
[Serializable]
|
||||
public class PlayerDeathEvent : Packet
|
||||
{
|
||||
public ushort PlayerId { get; }
|
||||
public NitroxVector3 DeathPosition { get; }
|
||||
|
||||
public PlayerDeathEvent(ushort playerId, NitroxVector3 deathPosition)
|
||||
{
|
||||
PlayerId = playerId;
|
||||
DeathPosition = deathPosition;
|
||||
}
|
||||
}
|
||||
}
|
31
NitroxModel/Packets/PlayerHeldItemChanged.cs
Normal file
31
NitroxModel/Packets/PlayerHeldItemChanged.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
using NitroxModel.DataStructures.GameLogic;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
[Serializable]
|
||||
public class PlayerHeldItemChanged : Packet
|
||||
{
|
||||
public ushort PlayerId { get; }
|
||||
public NitroxId ItemId { get; }
|
||||
public ChangeType Type { get; }
|
||||
public NitroxTechType IsFirstTime { get; } // If it's the first time the player used that item type it send the techType, if not null.
|
||||
|
||||
public PlayerHeldItemChanged(ushort playerId, NitroxId itemId, ChangeType type, NitroxTechType isFirstTime)
|
||||
{
|
||||
PlayerId = playerId;
|
||||
ItemId = itemId;
|
||||
Type = type;
|
||||
IsFirstTime = isFirstTime;
|
||||
}
|
||||
|
||||
public enum ChangeType
|
||||
{
|
||||
DRAW_AS_TOOL,
|
||||
DRAW_AS_ITEM,
|
||||
HOLSTER_AS_TOOL,
|
||||
HOLSTER_AS_ITEM
|
||||
}
|
||||
}
|
||||
}
|
22
NitroxModel/Packets/PlayerInCyclopsMovement.cs
Normal file
22
NitroxModel/Packets/PlayerInCyclopsMovement.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
using NitroxModel.Networking;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class PlayerInCyclopsMovement : Packet
|
||||
{
|
||||
public ushort PlayerId { get; }
|
||||
public NitroxVector3 LocalPosition { get; }
|
||||
public NitroxQuaternion LocalRotation { get; }
|
||||
|
||||
public PlayerInCyclopsMovement(ushort playerId, NitroxVector3 localPosition, NitroxQuaternion localRotation)
|
||||
{
|
||||
PlayerId = playerId;
|
||||
LocalPosition = localPosition;
|
||||
LocalRotation = localRotation;
|
||||
DeliveryMethod = NitroxDeliveryMethod.DeliveryMethod.UNRELIABLE_SEQUENCED;
|
||||
UdpChannel = UdpChannelId.MOVEMENTS;
|
||||
}
|
||||
}
|
22
NitroxModel/Packets/PlayerJoinedMultiplayerSession.cs
Normal file
22
NitroxModel/Packets/PlayerJoinedMultiplayerSession.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities;
|
||||
using NitroxModel.DataStructures.Util;
|
||||
using NitroxModel.MultiplayerSession;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class PlayerJoinedMultiplayerSession : Packet
|
||||
{
|
||||
public PlayerContext PlayerContext { get; }
|
||||
public Optional<NitroxId> SubRootId { get; }
|
||||
public PlayerWorldEntity PlayerWorldEntity { get; }
|
||||
|
||||
public PlayerJoinedMultiplayerSession(PlayerContext playerContext, Optional<NitroxId> subRootId, PlayerWorldEntity playerWorldEntity)
|
||||
{
|
||||
PlayerContext = playerContext;
|
||||
SubRootId = subRootId;
|
||||
PlayerWorldEntity = playerWorldEntity;
|
||||
}
|
||||
}
|
16
NitroxModel/Packets/PlayerJoiningMultiplayerSession.cs
Normal file
16
NitroxModel/Packets/PlayerJoiningMultiplayerSession.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
[Serializable]
|
||||
public class PlayerJoiningMultiplayerSession : CorrelatedPacket
|
||||
{
|
||||
public string ReservationKey { get; }
|
||||
|
||||
public PlayerJoiningMultiplayerSession(string correlationId, string reservationKey) : base(correlationId)
|
||||
{
|
||||
CorrelationId = correlationId;
|
||||
ReservationKey = reservationKey;
|
||||
}
|
||||
}
|
||||
}
|
15
NitroxModel/Packets/PlayerKicked.cs
Normal file
15
NitroxModel/Packets/PlayerKicked.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
[Serializable]
|
||||
public class PlayerKicked : Packet
|
||||
{
|
||||
public string Reason { get; }
|
||||
|
||||
public PlayerKicked(string reason)
|
||||
{
|
||||
Reason = reason;
|
||||
}
|
||||
}
|
||||
}
|
27
NitroxModel/Packets/PlayerMovement.cs
Normal file
27
NitroxModel/Packets/PlayerMovement.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
using NitroxModel.Networking;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
[Serializable]
|
||||
public class PlayerMovement : Movement
|
||||
{
|
||||
public override ushort PlayerId { get; }
|
||||
public override NitroxVector3 Position { get; }
|
||||
public override NitroxVector3 Velocity { get; }
|
||||
public override NitroxQuaternion BodyRotation { get; }
|
||||
public override NitroxQuaternion AimingRotation { get; }
|
||||
|
||||
public PlayerMovement(ushort playerId, NitroxVector3 position, NitroxVector3 velocity, NitroxQuaternion bodyRotation, NitroxQuaternion aimingRotation)
|
||||
{
|
||||
PlayerId = playerId;
|
||||
Position = position;
|
||||
Velocity = velocity;
|
||||
BodyRotation = bodyRotation;
|
||||
AimingRotation = aimingRotation;
|
||||
DeliveryMethod = NitroxDeliveryMethod.DeliveryMethod.UNRELIABLE_SEQUENCED;
|
||||
UdpChannel = UdpChannelId.MOVEMENTS;
|
||||
}
|
||||
}
|
||||
}
|
16
NitroxModel/Packets/PlayerQuickSlotsBindingChanged.cs
Normal file
16
NitroxModel/Packets/PlayerQuickSlotsBindingChanged.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
using NitroxModel.DataStructures.Util;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class PlayerQuickSlotsBindingChanged : Packet
|
||||
{
|
||||
public Optional<NitroxId>[] SlotItemIds { get; }
|
||||
|
||||
public PlayerQuickSlotsBindingChanged(Optional<NitroxId>[] slotItemIds)
|
||||
{
|
||||
SlotItemIds = slotItemIds;
|
||||
}
|
||||
}
|
15
NitroxModel/Packets/PlayerSeeOutOfCellEntity.cs
Normal file
15
NitroxModel/Packets/PlayerSeeOutOfCellEntity.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class PlayerSeeOutOfCellEntity : Packet
|
||||
{
|
||||
public NitroxId EntityId { get; set; }
|
||||
|
||||
public PlayerSeeOutOfCellEntity(NitroxId entityId)
|
||||
{
|
||||
EntityId = entityId;
|
||||
}
|
||||
}
|
29
NitroxModel/Packets/PlayerStats.cs
Normal file
29
NitroxModel/Packets/PlayerStats.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using NitroxModel.Networking;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class PlayerStats : Packet
|
||||
{
|
||||
public ushort PlayerId { get; set; }
|
||||
public float Oxygen { get; }
|
||||
public float MaxOxygen { get; }
|
||||
public float Health { get; }
|
||||
public float Food { get; }
|
||||
public float Water { get; }
|
||||
public float InfectionAmount { get; }
|
||||
|
||||
public PlayerStats(ushort playerId, float oxygen, float maxOxygen, float health, float food, float water, float infectionAmount)
|
||||
{
|
||||
PlayerId = playerId;
|
||||
Oxygen = oxygen;
|
||||
MaxOxygen = maxOxygen;
|
||||
Health = health;
|
||||
Food = food;
|
||||
Water = water;
|
||||
InfectionAmount = infectionAmount;
|
||||
|
||||
DeliveryMethod = NitroxDeliveryMethod.DeliveryMethod.RELIABLE_ORDERED_LAST;
|
||||
}
|
||||
}
|
13
NitroxModel/Packets/PlayerSyncFinished.cs
Normal file
13
NitroxModel/Packets/PlayerSyncFinished.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
[Serializable]
|
||||
public class PlayerSyncFinished : Packet
|
||||
{
|
||||
public PlayerSyncFinished()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
24
NitroxModel/Packets/PlayerTeleported.cs
Normal file
24
NitroxModel/Packets/PlayerTeleported.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
using NitroxModel.DataStructures.Util;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
[Serializable]
|
||||
public class PlayerTeleported : Packet
|
||||
{
|
||||
public string PlayerName { get; }
|
||||
public NitroxVector3 DestinationFrom { get; }
|
||||
public NitroxVector3 DestinationTo { get; }
|
||||
public Optional<NitroxId> SubRootID { get; }
|
||||
|
||||
public PlayerTeleported(string playerName, NitroxVector3 destinationFrom, NitroxVector3 destinationTo, Optional<NitroxId> subRootID)
|
||||
{
|
||||
PlayerName = playerName;
|
||||
DestinationFrom = destinationFrom;
|
||||
DestinationTo = destinationTo;
|
||||
SubRootID = subRootID;
|
||||
}
|
||||
}
|
||||
}
|
15
NitroxModel/Packets/PlayerUnseeOutOfCellEntity.cs
Normal file
15
NitroxModel/Packets/PlayerUnseeOutOfCellEntity.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class PlayerUnseeOutOfCellEntity : Packet
|
||||
{
|
||||
public NitroxId EntityId { get; set; }
|
||||
|
||||
public PlayerUnseeOutOfCellEntity(NitroxId entityId)
|
||||
{
|
||||
EntityId = entityId;
|
||||
}
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
namespace NitroxModel.Packets.Processors.Abstract
|
||||
{
|
||||
public interface IProcessorContext
|
||||
{
|
||||
}
|
||||
}
|
43
NitroxModel/Packets/Processors/Abstract/PacketProcessor.cs
Normal file
43
NitroxModel/Packets/Processors/Abstract/PacketProcessor.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace NitroxModel.Packets.Processors.Abstract
|
||||
{
|
||||
public abstract class PacketProcessor
|
||||
{
|
||||
public abstract void ProcessPacket(Packet packet, IProcessorContext context);
|
||||
|
||||
public static Dictionary<Type, PacketProcessor> GetProcessors(Dictionary<Type, object> processorArguments, Func<Type, bool> additionalConstraints)
|
||||
{
|
||||
return Assembly.GetCallingAssembly()
|
||||
.GetTypes()
|
||||
.Where(p => typeof(PacketProcessor).IsAssignableFrom(p) && p.IsClass && !p.IsAbstract)
|
||||
.Where(additionalConstraints)
|
||||
.ToDictionary(proc => proc.BaseType.GetGenericArguments()[0], proc =>
|
||||
{
|
||||
ConstructorInfo[] ctors = proc.GetConstructors();
|
||||
if (ctors.Length > 1)
|
||||
{
|
||||
throw new NotSupportedException($"{proc.Name} has more than one constructor!");
|
||||
}
|
||||
|
||||
ConstructorInfo ctor = ctors.First();
|
||||
|
||||
// Prepare arguments for constructor (if applicable):
|
||||
object[] args = ctor.GetParameters().Select(pi =>
|
||||
{
|
||||
if (processorArguments.TryGetValue(pi.ParameterType, out object v))
|
||||
{
|
||||
return v;
|
||||
}
|
||||
|
||||
throw new ArgumentException($"Argument value not defined for type {pi.ParameterType}! Used in {proc}");
|
||||
}).ToArray();
|
||||
|
||||
return (PacketProcessor)ctor.Invoke(args);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
24
NitroxModel/Packets/PvPAttack.cs
Normal file
24
NitroxModel/Packets/PvPAttack.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class PvPAttack : Packet
|
||||
{
|
||||
public ushort TargetPlayerId { get; }
|
||||
public float Damage { get; set; }
|
||||
public AttackType Type { get; }
|
||||
|
||||
public PvPAttack(ushort targetPlayerId, float damage, AttackType type)
|
||||
{
|
||||
TargetPlayerId = targetPlayerId;
|
||||
Damage = damage;
|
||||
Type = type;
|
||||
}
|
||||
|
||||
public enum AttackType : byte
|
||||
{
|
||||
KnifeHit,
|
||||
HeatbladeHit
|
||||
}
|
||||
}
|
9
NitroxModel/Packets/RadioPlayPendingMessage.cs
Normal file
9
NitroxModel/Packets/RadioPlayPendingMessage.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
[Serializable]
|
||||
public class RadioPlayPendingMessage : Packet
|
||||
{
|
||||
}
|
||||
}
|
27
NitroxModel/Packets/RangedAttackLastTargetUpdate.cs
Normal file
27
NitroxModel/Packets/RangedAttackLastTargetUpdate.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class RangedAttackLastTargetUpdate : Packet
|
||||
{
|
||||
public NitroxId CreatureId { get; }
|
||||
public NitroxId TargetId { get; }
|
||||
public int AttackTypeIndex { get; }
|
||||
public ActionState State { get; }
|
||||
|
||||
public RangedAttackLastTargetUpdate(NitroxId creatureId, NitroxId targetId, int attackTypeIndex, ActionState state)
|
||||
{
|
||||
CreatureId = creatureId;
|
||||
TargetId = targetId;
|
||||
AttackTypeIndex = attackTypeIndex;
|
||||
State = state;
|
||||
}
|
||||
|
||||
public enum ActionState
|
||||
{
|
||||
CHARGING,
|
||||
CASTING
|
||||
}
|
||||
}
|
16
NitroxModel/Packets/RecipePinned.cs
Normal file
16
NitroxModel/Packets/RecipePinned.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class RecipePinned : Packet
|
||||
{
|
||||
public int TechType { get; }
|
||||
public bool Pinned { get; }
|
||||
|
||||
public RecipePinned(int techType, bool pinned)
|
||||
{
|
||||
TechType = techType;
|
||||
Pinned = pinned;
|
||||
}
|
||||
}
|
20
NitroxModel/Packets/RemoveCreatureCorpse.cs
Normal file
20
NitroxModel/Packets/RemoveCreatureCorpse.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class RemoveCreatureCorpse : Packet
|
||||
{
|
||||
public NitroxId CreatureId { get; }
|
||||
public NitroxVector3 DeathPosition { get; }
|
||||
public NitroxQuaternion DeathRotation { get; }
|
||||
|
||||
public RemoveCreatureCorpse(NitroxId creatureId, NitroxVector3 deathPosition, NitroxQuaternion deathRotation)
|
||||
{
|
||||
CreatureId = creatureId;
|
||||
DeathPosition = deathPosition;
|
||||
DeathRotation = deathRotation;
|
||||
}
|
||||
}
|
18
NitroxModel/Packets/Schedule.cs
Normal file
18
NitroxModel/Packets/Schedule.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class Schedule : Packet
|
||||
{
|
||||
public float TimeExecute { get; }
|
||||
public string Key { get; }
|
||||
public int Type { get; }
|
||||
|
||||
public Schedule(float timeExecute, string key, int type)
|
||||
{
|
||||
TimeExecute = timeExecute;
|
||||
Key = key;
|
||||
Type = type;
|
||||
}
|
||||
}
|
19
NitroxModel/Packets/SeaDragonAttackTarget.cs
Normal file
19
NitroxModel/Packets/SeaDragonAttackTarget.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class SeaDragonAttackTarget : Packet
|
||||
{
|
||||
public NitroxId SeaDragonId { get; }
|
||||
public NitroxId TargetId { get; }
|
||||
public float Aggression { get; }
|
||||
|
||||
public SeaDragonAttackTarget(NitroxId seaDragonId, NitroxId targetId, float aggression)
|
||||
{
|
||||
SeaDragonId = seaDragonId;
|
||||
TargetId = targetId;
|
||||
Aggression = aggression;
|
||||
}
|
||||
}
|
17
NitroxModel/Packets/SeaDragonGrabExosuit.cs
Normal file
17
NitroxModel/Packets/SeaDragonGrabExosuit.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class SeaDragonGrabExosuit : Packet
|
||||
{
|
||||
public NitroxId SeaDragonId { get; }
|
||||
public NitroxId TargetId { get; }
|
||||
|
||||
public SeaDragonGrabExosuit(NitroxId seaDragonId, NitroxId targetId)
|
||||
{
|
||||
SeaDragonId = seaDragonId;
|
||||
TargetId = targetId;
|
||||
}
|
||||
}
|
21
NitroxModel/Packets/SeaDragonSwatAttack.cs
Normal file
21
NitroxModel/Packets/SeaDragonSwatAttack.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class SeaDragonSwatAttack : Packet
|
||||
{
|
||||
public NitroxId SeaDragonId { get; }
|
||||
public NitroxId TargetId { get; }
|
||||
public bool IsRightHand { get; }
|
||||
public float Aggression { get; }
|
||||
|
||||
public SeaDragonSwatAttack(NitroxId seaDragonId, NitroxId targetId, bool isRightHand, float aggression)
|
||||
{
|
||||
SeaDragonId = seaDragonId;
|
||||
TargetId = targetId;
|
||||
IsRightHand = isRightHand;
|
||||
Aggression = aggression;
|
||||
}
|
||||
}
|
15
NitroxModel/Packets/SeaTreaderChunkPickedUp.cs
Normal file
15
NitroxModel/Packets/SeaTreaderChunkPickedUp.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class SeaTreaderChunkPickedUp : Packet
|
||||
{
|
||||
public NitroxId ChunkId { get; }
|
||||
|
||||
public SeaTreaderChunkPickedUp(NitroxId chunkId)
|
||||
{
|
||||
ChunkId = chunkId;
|
||||
}
|
||||
}
|
22
NitroxModel/Packets/SeaTreaderSpawnedChunk.cs
Normal file
22
NitroxModel/Packets/SeaTreaderSpawnedChunk.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class SeaTreaderSpawnedChunk : Packet
|
||||
{
|
||||
public NitroxId CreatureId { get; }
|
||||
public NitroxId ChunkId { get; }
|
||||
public NitroxVector3 Position { get; }
|
||||
public NitroxQuaternion Rotation { get; }
|
||||
|
||||
public SeaTreaderSpawnedChunk(NitroxId creatureId, NitroxId chunkId, NitroxVector3 position, NitroxQuaternion rotation)
|
||||
{
|
||||
CreatureId = creatureId;
|
||||
ChunkId = chunkId;
|
||||
Position = position;
|
||||
Rotation = rotation;
|
||||
}
|
||||
}
|
26
NitroxModel/Packets/SeamothModulesAction.cs
Normal file
26
NitroxModel/Packets/SeamothModulesAction.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures;
|
||||
using NitroxModel.DataStructures.GameLogic;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
[Serializable]
|
||||
public class SeamothModulesAction : Packet
|
||||
{
|
||||
public NitroxTechType TechType { get; }
|
||||
public int SlotID { get; }
|
||||
public NitroxId Id { get; }
|
||||
public NitroxVector3 Forward { get; }
|
||||
public NitroxQuaternion Rotation { get; }
|
||||
|
||||
public SeamothModulesAction(NitroxTechType techType, int slotID, NitroxId id, NitroxVector3 forward, NitroxQuaternion rotation)
|
||||
{
|
||||
TechType = techType;
|
||||
SlotID = slotID;
|
||||
Id = id;
|
||||
Forward = forward;
|
||||
Rotation = rotation;
|
||||
}
|
||||
}
|
||||
}
|
20
NitroxModel/Packets/ServerCommand.cs
Normal file
20
NitroxModel/Packets/ServerCommand.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
[Serializable]
|
||||
public class ServerCommand : Packet
|
||||
{
|
||||
public string Cmd { get; }
|
||||
|
||||
public ServerCommand(string cmd)
|
||||
{
|
||||
Cmd = cmd;
|
||||
}
|
||||
|
||||
public ServerCommand(string[] cmdArgs)
|
||||
{
|
||||
Cmd = string.Join(" ", cmdArgs);
|
||||
}
|
||||
}
|
||||
}
|
9
NitroxModel/Packets/ServerStopped.cs
Normal file
9
NitroxModel/Packets/ServerStopped.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class ServerStopped : Packet
|
||||
{
|
||||
|
||||
}
|
26
NitroxModel/Packets/SetIntroCinematicMode.cs
Normal file
26
NitroxModel/Packets/SetIntroCinematicMode.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures.GameLogic;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class SetIntroCinematicMode : Packet
|
||||
{
|
||||
public ushort PlayerId { get; }
|
||||
public IntroCinematicMode Mode { get; }
|
||||
public ushort? PartnerId { get; set; }
|
||||
|
||||
public SetIntroCinematicMode(ushort playerId, IntroCinematicMode mode)
|
||||
{
|
||||
PlayerId = playerId;
|
||||
Mode = mode;
|
||||
PartnerId = null;
|
||||
}
|
||||
|
||||
public SetIntroCinematicMode(ushort playerId, IntroCinematicMode mode, ushort? partnerId)
|
||||
{
|
||||
PlayerId = playerId;
|
||||
Mode = mode;
|
||||
PartnerId = partnerId;
|
||||
}
|
||||
}
|
18
NitroxModel/Packets/SignalPingVisibilityChanged.cs
Normal file
18
NitroxModel/Packets/SignalPingVisibilityChanged.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
|
||||
namespace NitroxModel.Packets;
|
||||
|
||||
[Serializable]
|
||||
public class SignalPingPreferenceChanged : Packet
|
||||
{
|
||||
public string PingKey { get; }
|
||||
public bool Visible { get; }
|
||||
public int Color { get; }
|
||||
|
||||
public SignalPingPreferenceChanged(string pingKey, bool visible, int color)
|
||||
{
|
||||
PingKey = pingKey;
|
||||
Visible = visible;
|
||||
Color = color;
|
||||
}
|
||||
}
|
33
NitroxModel/Packets/SimulationOwnershipChange.cs
Normal file
33
NitroxModel/Packets/SimulationOwnershipChange.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NitroxModel.DataStructures;
|
||||
|
||||
namespace NitroxModel.Packets
|
||||
{
|
||||
[Serializable]
|
||||
public class SimulationOwnershipChange : Packet
|
||||
{
|
||||
public List<SimulatedEntity> Entities { get; }
|
||||
|
||||
public SimulationOwnershipChange(NitroxId id, ushort owningPlayerId, SimulationLockType lockType, bool changesPosition = false)
|
||||
{
|
||||
Entities = new List<SimulatedEntity>
|
||||
{
|
||||
new(id, owningPlayerId, changesPosition, lockType)
|
||||
};
|
||||
}
|
||||
|
||||
public SimulationOwnershipChange(SimulatedEntity entity)
|
||||
{
|
||||
Entities = new List<SimulatedEntity>
|
||||
{
|
||||
entity
|
||||
};
|
||||
}
|
||||
|
||||
public SimulationOwnershipChange(List<SimulatedEntity> entities)
|
||||
{
|
||||
Entities = entities;
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user