first commit
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Bases;
|
||||
|
||||
[Serializable, DataContract]
|
||||
public class BaseLeakEntity : Entity
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public float Health { get; set; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public NitroxInt3 RelativeCell { get; set; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected BaseLeakEntity()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public BaseLeakEntity(float health, NitroxInt3 relativeCell, NitroxId leakId, NitroxId parentId)
|
||||
{
|
||||
Health = health;
|
||||
RelativeCell = relativeCell;
|
||||
Id = leakId;
|
||||
ParentId = parentId;
|
||||
}
|
||||
|
||||
/// <remarks>Used for deserialization</remarks>
|
||||
public BaseLeakEntity(float health, NitroxInt3 relativeCell, NitroxId id, NitroxTechType techType, EntityMetadata metadata, NitroxId parentId, List<Entity> childEntities)
|
||||
{
|
||||
Health = health;
|
||||
RelativeCell = relativeCell;
|
||||
Id = id;
|
||||
TechType = techType;
|
||||
Metadata = metadata;
|
||||
ParentId = parentId;
|
||||
ChildEntities = childEntities;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[BaseLeakEntity Health: {Health}, RelativeCell: {RelativeCell}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.GameLogic.Bases;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Bases;
|
||||
|
||||
[Serializable, DataContract]
|
||||
public class BuildEntity : GlobalRootEntity
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public BaseData BaseData { get; set; }
|
||||
|
||||
[IgnoredMember]
|
||||
public int OperationId;
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected BuildEntity()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public static BuildEntity MakeEmpty()
|
||||
{
|
||||
return new BuildEntity();
|
||||
}
|
||||
|
||||
/// <remarks>
|
||||
/// Used for deserialization.
|
||||
/// <see cref="WorldEntity.SpawnedByServer"/> is set to true because this entity is meant to receive simulation locks
|
||||
/// </remarks>
|
||||
public BuildEntity(BaseData baseData, NitroxTransform transform, int level, string classId, bool spawnedByServer, NitroxId id, NitroxTechType techType, EntityMetadata metadata, NitroxId parentId, List<Entity> childEntities) :
|
||||
base(transform, level, classId, true, id, techType, metadata, parentId, childEntities)
|
||||
{
|
||||
BaseData = baseData;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[BuildEntity Id: {Id}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.GameLogic.Bases;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Bases;
|
||||
|
||||
[Serializable, DataContract]
|
||||
public class GhostEntity : ModuleEntity
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public NitroxBaseFace BaseFace { get; set; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public BaseData BaseData { get; set; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected GhostEntity()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public new static GhostEntity MakeEmpty()
|
||||
{
|
||||
return new GhostEntity();
|
||||
}
|
||||
|
||||
/// <remarks>Used for deserialization</remarks>
|
||||
public GhostEntity(NitroxBaseFace baseFace, BaseData baseData, float constructedAmount, bool isInside, NitroxTransform transform, int level, string classId, bool spawnedByServer, NitroxId id, NitroxTechType techType, EntityMetadata metadata, NitroxId parentId, List<Entity> childEntities) :
|
||||
base(constructedAmount, isInside, transform, level, classId, spawnedByServer, id, techType, metadata, parentId, childEntities)
|
||||
{
|
||||
BaseFace = baseFace;
|
||||
BaseData = baseData;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[GhostEntity Id: {Id}, ParentId: {ParentId}, ClassId: {ClassId}, Metadata: {Metadata}, ConstructedAmount: {ConstructedAmount}, IsInside: {IsInside}, BaseFace: [{BaseFace}], BaseData: {BaseData}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.GameLogic.Bases;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Bases;
|
||||
|
||||
[Serializable, DataContract]
|
||||
public class InteriorPieceEntity : GlobalRootEntity
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public NitroxBaseFace BaseFace;
|
||||
|
||||
[IgnoreDataMember]
|
||||
public bool IsWaterPark => ClassId is "31662630-7cba-4583-8456-2fa1c4cc31aa" or "c2a91864-0f0f-4d8a-99b8-9867571763dd"; // classIds for WaterPark.prefab and WaterParkLarge.prefab
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected InteriorPieceEntity()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public static InteriorPieceEntity MakeEmpty()
|
||||
{
|
||||
return new InteriorPieceEntity();
|
||||
}
|
||||
|
||||
/// <remarks>
|
||||
/// Used for deserialization.
|
||||
/// <see cref="WorldEntity.SpawnedByServer"/> is set to true because this entity is meant to receive simulation locks
|
||||
/// </remarks>
|
||||
public InteriorPieceEntity(NitroxBaseFace baseFace, NitroxTransform transform, int level, string classId, bool spawnedByServer, NitroxId id, NitroxTechType techType, EntityMetadata metadata, NitroxId parentId, List<Entity> childEntities) :
|
||||
base(transform, level, classId, true, id, techType, metadata, parentId, childEntities)
|
||||
{
|
||||
BaseFace = baseFace;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[InteriorPieceEntity Id: {Id}, ParentId: {ParentId}, BaseFace: {BaseFace}, {base.ToString()}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Bases;
|
||||
|
||||
[Serializable, DataContract]
|
||||
public class MapRoomEntity : GlobalRootEntity
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public NitroxInt3 Cell { get; set; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected MapRoomEntity()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public MapRoomEntity(NitroxId id, NitroxId parentId, NitroxInt3 cell)
|
||||
{
|
||||
Id = id;
|
||||
ParentId = parentId;
|
||||
Cell = cell;
|
||||
|
||||
Transform = new();
|
||||
}
|
||||
|
||||
/// <remarks>
|
||||
/// Used for deserialization.
|
||||
/// <see cref="WorldEntity.SpawnedByServer"/> is set to true because this entity is meant to receive simulation locks
|
||||
/// </remarks>
|
||||
public MapRoomEntity(NitroxInt3 cell, NitroxTransform transform, int level, string classId, bool spawnedByServer, NitroxId id, NitroxTechType techType, EntityMetadata metadata, NitroxId parentId, List<Entity> childEntities) :
|
||||
base(transform, level, classId, true, id, techType, metadata, parentId, childEntities)
|
||||
{
|
||||
Cell = cell;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[MapRoomEntity Id: {Id}, Cell: {Cell}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
using ProtoBufNet;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Bases;
|
||||
|
||||
[Serializable, DataContract]
|
||||
[ProtoInclude(50, typeof(GhostEntity))]
|
||||
public class ModuleEntity : GlobalRootEntity
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public float ConstructedAmount { get; set; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public bool IsInside { get; set; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected ModuleEntity()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public static ModuleEntity MakeEmpty()
|
||||
{
|
||||
return new ModuleEntity();
|
||||
}
|
||||
|
||||
/// <remarks>
|
||||
/// Used for deserialization.
|
||||
/// <see cref="WorldEntity.SpawnedByServer"/> is set to true because this entity is meant to receive simulation locks
|
||||
/// </remarks>
|
||||
public ModuleEntity(float constructedAmount, bool isInside, NitroxTransform transform, int level, string classId, bool spawnedByServer, NitroxId id, NitroxTechType techType, EntityMetadata metadata, NitroxId parentId, List<Entity> childEntities) :
|
||||
base(transform, level, classId, true, id, techType, metadata, parentId, childEntities)
|
||||
{
|
||||
ConstructedAmount = constructedAmount;
|
||||
IsInside = isInside;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[ModuleEntity Id: {Id}, ParentId: {ParentId}, ClassId: {ClassId}, ConstructedAmount: {ConstructedAmount}, IsInside: {IsInside}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Bases;
|
||||
|
||||
[Serializable, DataContract]
|
||||
public class MoonpoolEntity : GlobalRootEntity
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public NitroxInt3 Cell { get; set; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected MoonpoolEntity()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public MoonpoolEntity(NitroxId id, NitroxId parentId, NitroxInt3 cell)
|
||||
{
|
||||
Id = id;
|
||||
ParentId = parentId;
|
||||
Cell = cell;
|
||||
}
|
||||
|
||||
/// <remarks>
|
||||
/// Used for deserialization.
|
||||
/// <see cref="WorldEntity.SpawnedByServer"/> is set to true because this entity is meant to receive simulation locks
|
||||
/// </remarks>
|
||||
public MoonpoolEntity(NitroxInt3 cell, NitroxTransform transform, int level, string classId, bool spawnedByServer, NitroxId id, NitroxTechType techType, EntityMetadata metadata, NitroxId parentId, List<Entity> childEntities) :
|
||||
base(transform, level, classId, true, id, techType, metadata, parentId, childEntities)
|
||||
{
|
||||
Cell = cell;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[MoonpoolEntity Id: {Id}, Cell: {Cell}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities;
|
||||
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class CellRootEntity : WorldEntity
|
||||
{
|
||||
public static readonly string CLASS_ID = "55d7ab35-de97-4d95-af6c-ac8d03bb54ca";
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected CellRootEntity()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public CellRootEntity(NitroxVector3 localPosition, NitroxQuaternion localRotation, NitroxVector3 scale, NitroxTechType techType, int level, string classId, bool spawnedByServer, NitroxId id)
|
||||
{
|
||||
Transform = new NitroxTransform(localPosition, localRotation, scale);
|
||||
TechType = techType;
|
||||
Id = id;
|
||||
Level = level;
|
||||
ClassId = classId;
|
||||
SpawnedByServer = spawnedByServer;
|
||||
}
|
||||
|
||||
/// <remarks>Used for deserialization</remarks>
|
||||
public CellRootEntity(NitroxTransform transform, int level, string classId, bool spawnedByServer, NitroxId id, NitroxTechType techType, EntityMetadata metadata, NitroxId parentId, List<Entity> childEntities)
|
||||
{
|
||||
Id = id;
|
||||
TechType = techType;
|
||||
Metadata = metadata;
|
||||
ParentId = parentId;
|
||||
Transform = transform;
|
||||
ChildEntities = childEntities;
|
||||
Level = level;
|
||||
ClassId = classId;
|
||||
SpawnedByServer = spawnedByServer;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[CellRootEntity {base.ToString()}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using System.Collections.Generic;
|
||||
using BinaryPack.Attributes;
|
||||
using System.Runtime.Serialization;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities;
|
||||
|
||||
[Serializable, DataContract]
|
||||
public class CreatureRespawnEntity : WorldEntity
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public float SpawnTime { get; set; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public NitroxTechType RespawnTechType { get; set; }
|
||||
|
||||
[DataMember(Order = 3)]
|
||||
public List<string> AddComponents { get; set; } = [];
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected CreatureRespawnEntity()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
/// <remarks>Used for deserialization</remarks>
|
||||
public CreatureRespawnEntity(NitroxTransform transform, int level, string classId, bool spawnedByServer, NitroxId id, NitroxTechType techType, EntityMetadata metadata, NitroxId parentId, List<Entity> childEntities, float spawnTime, NitroxTechType respawnTechType, List<string> addComponents) :
|
||||
base(transform, level, classId, spawnedByServer, id, techType, metadata, parentId, childEntities)
|
||||
{
|
||||
SpawnTime = spawnTime;
|
||||
RespawnTechType = respawnTechType;
|
||||
AddComponents = addComponents;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[{nameof(CreatureRespawnEntity)} SpawnTime: {SpawnTime}, RespawnTechType: {RespawnTechType}, AddComponents: [{string.Join(", ", AddComponents)}] {base.ToString()}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities;
|
||||
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class EscapePodWorldEntity : GlobalRootEntity
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public List<ushort> Players { get; set; } = [];
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected EscapePodWorldEntity()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public EscapePodWorldEntity(NitroxVector3 position, NitroxId id, EntityMetadata metadata)
|
||||
{
|
||||
Transform = new NitroxTransform(position, NitroxQuaternion.Identity, NitroxVector3.One);
|
||||
Id = id;
|
||||
Metadata = metadata;
|
||||
Players = [];
|
||||
Level = 0;
|
||||
TechType = new NitroxTechType("EscapePod");
|
||||
SpawnedByServer = true;
|
||||
ChildEntities = [];
|
||||
}
|
||||
|
||||
/// <remarks>Used for deserialization</remarks>
|
||||
public EscapePodWorldEntity(List<ushort> players, NitroxTransform transform, int level, string classId, bool spawnedByServer, NitroxId id, NitroxTechType techType, EntityMetadata metadata, NitroxId parentId, List<Entity> childEntities) :
|
||||
base(transform, level, classId, spawnedByServer, id, techType, metadata, parentId, childEntities)
|
||||
{
|
||||
Players = players;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[EscapePodWorldEntity Players: [{string.Join(", ", Players)}] {base.ToString()}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities;
|
||||
|
||||
[Serializable, DataContract]
|
||||
public class GeyserWorldEntity : WorldEntity
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public float RandomIntervalVarianceMultiplier { get; set; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public float StartEruptTime { get; set; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected GeyserWorldEntity()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
/// <remarks>Used for deserialization</remarks>
|
||||
public GeyserWorldEntity(NitroxTransform transform, int level, string classId, bool spawnedByServer, NitroxId id, NitroxTechType techType, EntityMetadata metadata, NitroxId parentId, List<Entity> childEntities, float randomIntervalVarianceMultiplier, float startEruptTime) :
|
||||
base(transform, level, classId, spawnedByServer, id, techType, metadata, parentId, childEntities)
|
||||
{
|
||||
RandomIntervalVarianceMultiplier = randomIntervalVarianceMultiplier;
|
||||
StartEruptTime = startEruptTime;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[{nameof(GeyserWorldEntity)} RandomIntervalVarianceMultiplier: {RandomIntervalVarianceMultiplier}, StartEruptTime: {StartEruptTime} {base.ToString()}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Bases;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
using ProtoBufNet;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities;
|
||||
|
||||
[Serializable, DataContract]
|
||||
[ProtoInclude(50, typeof(BuildEntity))]
|
||||
[ProtoInclude(51, typeof(EscapePodWorldEntity))]
|
||||
[ProtoInclude(52, typeof(InteriorPieceEntity))]
|
||||
[ProtoInclude(53, typeof(MapRoomEntity))]
|
||||
[ProtoInclude(54, typeof(ModuleEntity))]
|
||||
[ProtoInclude(55, typeof(MoonpoolEntity))]
|
||||
[ProtoInclude(56, typeof(PlanterEntity))]
|
||||
[ProtoInclude(57, typeof(PlayerWorldEntity))]
|
||||
[ProtoInclude(58, typeof(VehicleWorldEntity))]
|
||||
[ProtoInclude(59, typeof(RadiationLeakEntity))]
|
||||
public class GlobalRootEntity : WorldEntity
|
||||
{
|
||||
[IgnoreConstructor]
|
||||
protected GlobalRootEntity()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
/// <remarks>Used for deserialization</remarks>
|
||||
public GlobalRootEntity(NitroxTransform transform, int level, string classId, bool spawnedByServer, NitroxId id, NitroxTechType techType, EntityMetadata metadata, NitroxId parentId, List<Entity> childEntities) :
|
||||
base(transform, level, classId, spawnedByServer, id, techType, metadata, parentId, childEntities)
|
||||
{ }
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities;
|
||||
|
||||
public interface IUwePrefabFactory
|
||||
{
|
||||
public bool TryGetPossiblePrefabs(string biomeType, out List<UwePrefab> prefabs);
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities;
|
||||
|
||||
public interface IUweWorldEntityFactory
|
||||
{
|
||||
public bool TryFind(string classId, out UweWorldEntity uweWorldEntity);
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities;
|
||||
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class InstalledBatteryEntity : Entity
|
||||
{
|
||||
[IgnoreConstructor]
|
||||
protected InstalledBatteryEntity()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
/// <remarks>Used for deserialization</remarks>
|
||||
public InstalledBatteryEntity(NitroxId id, NitroxTechType techType, EntityMetadata metadata, NitroxId parentId, List<Entity> childEntities)
|
||||
{
|
||||
Id = id;
|
||||
TechType = techType;
|
||||
Metadata = metadata;
|
||||
ParentId = parentId;
|
||||
ChildEntities = childEntities;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[InstalledBatteryEntity {base.ToString()}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using System.Collections.Generic;
|
||||
using BinaryPack.Attributes;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities;
|
||||
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class InstalledModuleEntity : Entity
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public string Slot { get; set; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public string ClassId { get; set; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected InstalledModuleEntity()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
/// <remarks>Used for deserialization</remarks>
|
||||
public InstalledModuleEntity(string slot, string classId, NitroxId id, NitroxTechType techType, EntityMetadata metadata, NitroxId parentId, List<Entity> childEntities)
|
||||
{
|
||||
Slot = slot;
|
||||
ClassId = classId;
|
||||
Id = id;
|
||||
TechType = techType;
|
||||
Metadata = metadata;
|
||||
ParentId = parentId;
|
||||
ChildEntities = childEntities;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[InstalledModuleEntity Slot: {Slot} ClassId: {ClassId} {base.ToString()}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using System.Collections.Generic;
|
||||
using BinaryPack.Attributes;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Represents an object that can hold InventoryItemEntity, such as the locker in the escape pod.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class InventoryEntity : Entity
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public int ComponentIndex { get; set; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected InventoryEntity()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
/// <remarks>Used for deserialization</remarks>
|
||||
public InventoryEntity(int componentIndex, NitroxId id, NitroxTechType techType, EntityMetadata metadata, NitroxId parentId, List<Entity> childEntities)
|
||||
{
|
||||
ComponentIndex = componentIndex;
|
||||
Id = id;
|
||||
TechType = techType;
|
||||
Metadata = metadata;
|
||||
ParentId = parentId;
|
||||
ChildEntities = childEntities;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[InventoryEntity {base.ToString()}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using System.Collections.Generic;
|
||||
using BinaryPack.Attributes;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities;
|
||||
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class InventoryItemEntity : Entity
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public string ClassId { get; set; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected InventoryItemEntity()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
/// <remarks>Used for deserialization</remarks>
|
||||
public InventoryItemEntity(NitroxId id, string classId, NitroxTechType techType, EntityMetadata metadata, NitroxId parentId, List<Entity> childEntities)
|
||||
{
|
||||
ClassId = classId;
|
||||
Id = id;
|
||||
TechType = techType;
|
||||
Metadata = metadata;
|
||||
ParentId = parentId;
|
||||
ChildEntities = childEntities;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[InventoryItemEntity ClassId: {ClassId} {base.ToString()}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata.Bases;
|
||||
|
||||
[Serializable, DataContract]
|
||||
public class BaseAnchoredCellGhostMetadata : GhostMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public NitroxInt3? AnchoredCell { get; set; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
public BaseAnchoredCellGhostMetadata()
|
||||
{
|
||||
// Constructor for ProtoBuf deserialization.
|
||||
}
|
||||
|
||||
/// <remarks>Used for json deserialization</remarks>
|
||||
public BaseAnchoredCellGhostMetadata(NitroxInt3? anchoredCell, NitroxInt3 targetOffset) : base(targetOffset)
|
||||
{
|
||||
AnchoredCell = anchoredCell;
|
||||
}
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.GameLogic.Bases;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata.Bases;
|
||||
|
||||
[Serializable, DataContract]
|
||||
public class BaseAnchoredFaceGhostMetadata : GhostMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public NitroxBaseFace? AnchoredFace { get; set; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
public BaseAnchoredFaceGhostMetadata()
|
||||
{
|
||||
// Constructor for ProtoBuf deserialization.
|
||||
}
|
||||
|
||||
/// <remarks>Used for json deserialization</remarks>
|
||||
public BaseAnchoredFaceGhostMetadata(NitroxBaseFace? anchoredFace, NitroxInt3 targetOffset) : base(targetOffset)
|
||||
{
|
||||
AnchoredFace = anchoredFace;
|
||||
}
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.GameLogic.Bases;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata.Bases;
|
||||
|
||||
[Serializable, DataContract]
|
||||
public class BaseDeconstructableGhostMetadata : GhostMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public NitroxBaseFace? ModuleFace { get; set; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public string ClassId { get; set; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
public BaseDeconstructableGhostMetadata()
|
||||
{
|
||||
// Constructor for ProtoBuf deserialization.
|
||||
}
|
||||
|
||||
/// <remarks>Used for json deserialization</remarks>
|
||||
public BaseDeconstructableGhostMetadata(NitroxBaseFace? moduleFace, string classId, NitroxInt3 targetOffset) : base(targetOffset)
|
||||
{
|
||||
ModuleFace = moduleFace;
|
||||
ClassId = classId;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[BaseDeconstructableGhostMetadata TargetOffset: {TargetOffset}, ModuleFace: {ModuleFace}, ClassId: {ClassId}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using ProtoBufNet;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata.Bases;
|
||||
|
||||
[Serializable, DataContract]
|
||||
[ProtoInclude(50, typeof(BaseDeconstructableGhostMetadata))]
|
||||
[ProtoInclude(51, typeof(BaseAnchoredFaceGhostMetadata))]
|
||||
[ProtoInclude(52, typeof(BaseAnchoredCellGhostMetadata))]
|
||||
public class GhostMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public NitroxInt3 TargetOffset { get; set; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
public GhostMetadata()
|
||||
{
|
||||
// Constructor for ProtoBuf deserialization.
|
||||
}
|
||||
|
||||
/// <remarks>Used for json deserialization</remarks>
|
||||
public GhostMetadata(NitroxInt3 targetOffset)
|
||||
{
|
||||
TargetOffset = targetOffset;
|
||||
}
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class BatteryMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public float Charge { get; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected BatteryMetadata()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public BatteryMetadata(float charge)
|
||||
{
|
||||
Charge = charge;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[BatteryMetadata Charge: {Charge}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class BeaconMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public string Label { get; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected BeaconMetadata()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public BeaconMetadata(string label)
|
||||
{
|
||||
Label = label;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[BeaconMetadata Label: {Label}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class ConstructorMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public bool Deployed { get; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected ConstructorMetadata()
|
||||
{
|
||||
//Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
public ConstructorMetadata(bool deployed)
|
||||
{
|
||||
Deployed = deployed;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[ConstructorMetadata Deployed: {Deployed}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class CrafterMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public NitroxTechType TechType { get; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public float StartTime { get; }
|
||||
|
||||
[DataMember(Order = 3)]
|
||||
public float Duration { get; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected CrafterMetadata()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public CrafterMetadata(NitroxTechType techType, float startTime, float duration)
|
||||
{
|
||||
TechType = techType;
|
||||
StartTime = startTime;
|
||||
Duration = duration;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[CrafterMetadata TechType: {TechType} StartTime: {StartTime} Duration: {Duration} {base.ToString()}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
|
||||
[Serializable, DataContract]
|
||||
public class CrashHomeMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public float SpawnTime { get; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected CrashHomeMetadata()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public CrashHomeMetadata(float spawnTime)
|
||||
{
|
||||
SpawnTime = spawnTime;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[CrashHomeMetadata SpawnTime: {SpawnTime}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class CyclopsLightingMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public bool FloodLightsOn { get; set; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public bool InternalLightsOn { get; set; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected CyclopsLightingMetadata()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public CyclopsLightingMetadata(bool floodLightsOn, bool internalLightsOn)
|
||||
{
|
||||
FloodLightsOn = floodLightsOn;
|
||||
InternalLightsOn = internalLightsOn;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[CyclopsLightningMetadata FloodLightsOn: {FloodLightsOn}, InternalLightsOn: {InternalLightsOn}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class CyclopsMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public bool SilentRunningOn { get; set; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public bool ShieldOn { get; set; }
|
||||
|
||||
[DataMember(Order = 3)]
|
||||
public bool SonarOn { get; set; }
|
||||
|
||||
[DataMember(Order = 4)]
|
||||
public bool EngineOn { get; set; }
|
||||
|
||||
[DataMember(Order = 5)]
|
||||
public int EngineMode { get; set; }
|
||||
|
||||
[DataMember(Order = 6)]
|
||||
public float Health { get; set; }
|
||||
|
||||
[DataMember(Order = 7)]
|
||||
public bool IsDestroyed { get; set; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected CyclopsMetadata()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public CyclopsMetadata(bool silentRunningOn, bool shieldOn, bool sonarOn, bool engineOn, int engineMode, float health, bool isDestroyed)
|
||||
{
|
||||
SilentRunningOn = silentRunningOn;
|
||||
ShieldOn = shieldOn;
|
||||
SonarOn = sonarOn;
|
||||
EngineOn = engineOn;
|
||||
EngineMode = engineMode;
|
||||
Health = health;
|
||||
IsDestroyed = isDestroyed;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[CyclopsMetadata SilentRunningOn: {SilentRunningOn}, ShieldOn: {ShieldOn}, SonarOn: {SonarOn}, EngineOn: {EngineOn}, EngineMode: {EngineMode}, Health: {Health}, IsDestroyed: {IsDestroyed}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class EatableMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public float TimeDecayStart { get; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected EatableMetadata()
|
||||
{
|
||||
//Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
public EatableMetadata(float timeDecayStart)
|
||||
{
|
||||
TimeDecayStart = timeDecayStart;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[{nameof(EatableMetadata)} TimeDecayStart: {TimeDecayStart}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class EggMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public float TimeStartHatching { get; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public float Progress { get; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected EggMetadata()
|
||||
{
|
||||
//Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public EggMetadata(float timeStartHatching, float progress)
|
||||
{
|
||||
TimeStartHatching = timeStartHatching;
|
||||
Progress = progress;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[{nameof(EggMetadata)} TimeStartHatching: {TimeStartHatching}, Progress: {Progress}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata.Bases;
|
||||
using ProtoBufNet;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata
|
||||
{
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
[ProtoInclude(50, typeof(KeypadMetadata))]
|
||||
[ProtoInclude(51, typeof(SealedDoorMetadata))]
|
||||
[ProtoInclude(52, typeof(PrecursorDoorwayMetadata))]
|
||||
[ProtoInclude(53, typeof(PrecursorTeleporterMetadata))]
|
||||
[ProtoInclude(54, typeof(PrecursorKeyTerminalMetadata))]
|
||||
[ProtoInclude(55, typeof(PrecursorTeleporterActivationTerminalMetadata))]
|
||||
[ProtoInclude(56, typeof(StarshipDoorMetadata))]
|
||||
[ProtoInclude(57, typeof(WeldableWallPanelGenericMetadata))]
|
||||
[ProtoInclude(58, typeof(IncubatorMetadata))]
|
||||
[ProtoInclude(59, typeof(EntitySignMetadata))]
|
||||
[ProtoInclude(60, typeof(ConstructorMetadata))]
|
||||
[ProtoInclude(61, typeof(FlashlightMetadata))]
|
||||
[ProtoInclude(62, typeof(BatteryMetadata))]
|
||||
[ProtoInclude(63, typeof(EscapePodMetadata))]
|
||||
[ProtoInclude(64, typeof(CrafterMetadata))]
|
||||
[ProtoInclude(65, typeof(PlantableMetadata))]
|
||||
[ProtoInclude(66, typeof(CyclopsMetadata))]
|
||||
[ProtoInclude(67, typeof(RocketMetadata))]
|
||||
[ProtoInclude(68, typeof(CyclopsLightingMetadata))]
|
||||
[ProtoInclude(69, typeof(FireExtinguisherHolderMetadata))]
|
||||
[ProtoInclude(70, typeof(PlayerMetadata))]
|
||||
[ProtoInclude(71, typeof(GhostMetadata))]
|
||||
[ProtoInclude(72, typeof(WaterParkCreatureMetadata))]
|
||||
[ProtoInclude(73, typeof(NamedColoredMetadata))]
|
||||
[ProtoInclude(74, typeof(BeaconMetadata))]
|
||||
[ProtoInclude(75, typeof(FlareMetadata))]
|
||||
[ProtoInclude(76, typeof(RadiationMetadata))]
|
||||
[ProtoInclude(77, typeof(CrashHomeMetadata))]
|
||||
[ProtoInclude(78, typeof(EatableMetadata))]
|
||||
[ProtoInclude(79, typeof(SeaTreaderMetadata))]
|
||||
[ProtoInclude(80, typeof(StayAtLeashPositionMetadata))]
|
||||
[ProtoInclude(81, typeof(EggMetadata))]
|
||||
[ProtoInclude(82, typeof(PlantableMetadata))]
|
||||
[ProtoInclude(83, typeof(FruitPlantMetadata))]
|
||||
public abstract class EntityMetadata
|
||||
{
|
||||
}
|
||||
}
|
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class EntitySignMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public string Text { get; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public int ColorIndex { get; }
|
||||
|
||||
[DataMember(Order = 3)]
|
||||
public int ScaleIndex { get; }
|
||||
|
||||
[DataMember(Order = 4)]
|
||||
public bool[] Elements { get; } = [];
|
||||
|
||||
[DataMember(Order = 5)]
|
||||
public bool Background { get; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected EntitySignMetadata()
|
||||
{
|
||||
//Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public EntitySignMetadata(string text, int colorIndex, int scaleIndex, bool[] elements, bool background)
|
||||
{
|
||||
Text = text;
|
||||
ColorIndex = colorIndex;
|
||||
ScaleIndex = scaleIndex;
|
||||
Elements = elements;
|
||||
Background = background;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[EntitySignMetadata - Text: {Text}, ColorIndex: {ColorIndex}, ScaleIndex: {ScaleIndex}, Elements: {Elements}, Background: {Background}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class EscapePodMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public bool PodRepaired { get; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public bool RadioRepaired { get; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected EscapePodMetadata()
|
||||
{
|
||||
//Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public EscapePodMetadata(bool podRepaired, bool radioRepaired)
|
||||
{
|
||||
PodRepaired = podRepaired;
|
||||
RadioRepaired = radioRepaired;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[{nameof(EscapePodMetadata)} - PodRepaired: {PodRepaired}, RadioRepaired: {RadioRepaired}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
|
||||
[Serializable, DataContract]
|
||||
public class ExosuitMetadata : VehicleMetadata
|
||||
{
|
||||
[IgnoreConstructor]
|
||||
protected ExosuitMetadata()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public ExosuitMetadata(float health, string name, NitroxVector3[] colors) : base(health, name, colors)
|
||||
{ }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[{nameof(ExosuitMetadata)} {base.ToString()}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class FireExtinguisherHolderMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public bool HasExtinguisher { get; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public float Fuel { get; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected FireExtinguisherHolderMetadata()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public FireExtinguisherHolderMetadata(bool hasExtinguisher, float fuel)
|
||||
{
|
||||
HasExtinguisher = hasExtinguisher;
|
||||
Fuel = fuel;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[FireExtinguisherHolderMetadata HasExtinguisher: {HasExtinguisher}, Fuel: {Fuel}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
|
||||
[Serializable, DataContract]
|
||||
public class FlareMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public float EnergyLeft { get; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public bool HasBeenThrown { get; }
|
||||
|
||||
[DataMember(Order = 3)]
|
||||
public float? FlareActivateTime { get; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected FlareMetadata()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public FlareMetadata(float energyLeft, bool hasBeenThrown, float? flareActivateTime)
|
||||
{
|
||||
EnergyLeft = energyLeft;
|
||||
HasBeenThrown = hasBeenThrown;
|
||||
FlareActivateTime = flareActivateTime;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[FlareMetadata EnergyLeft: {EnergyLeft}, HasBeenThrown: {HasBeenThrown}, FlareActivateTime: {FlareActivateTime}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class FlashlightMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public bool On { get; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected FlashlightMetadata()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public FlashlightMetadata(bool on)
|
||||
{
|
||||
On = on;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[FlashlightMetadata On: {On}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class FruitPlantMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public bool[] PickedStates { get; } = [];
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public float TimeNextFruit { get; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected FruitPlantMetadata()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public FruitPlantMetadata(bool[] pickedStates, float timeNextFruit)
|
||||
{
|
||||
PickedStates = pickedStates;
|
||||
TimeNextFruit = timeNextFruit;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[{nameof(FruitPlantMetadata)} PickedStates: [{string.Join(", ", PickedStates)}], TimeNextFruit: {TimeNextFruit}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata
|
||||
{
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class IncubatorMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public bool Powered { get; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public bool Hatched { get; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected IncubatorMetadata()
|
||||
{
|
||||
//Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public IncubatorMetadata(bool powered, bool hatched)
|
||||
{
|
||||
Powered = powered;
|
||||
Hatched = hatched;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[IncubatorMetadata Powered: {Powered} Hatched: {Hatched}]";
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata
|
||||
{
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class KeypadMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public bool Unlocked { get; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected KeypadMetadata()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public KeypadMetadata(bool unlocked)
|
||||
{
|
||||
Unlocked = unlocked;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[KeypadMetadata isOpen: {Unlocked}]";
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
using ProtoBufNet;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
|
||||
[Serializable, DataContract]
|
||||
[ProtoInclude(50, typeof(VehicleMetadata))]
|
||||
[ProtoInclude(51, typeof(SubNameInputMetadata))]
|
||||
public abstract class NamedColoredMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public string Name { get; init; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public NitroxVector3[] Colors { get; init; } = [];
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected NamedColoredMetadata()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public NamedColoredMetadata(string name, NitroxVector3[] colors) : base()
|
||||
{
|
||||
Name = name;
|
||||
Colors = colors;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[{nameof(NamedColoredMetadata)} Name: {Name}, Colors: {string.Join(";", Colors)} {base.ToString()}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class PlantableMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public float TimeStartGrowth { get; set; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public int SlotID { get; set; }
|
||||
|
||||
// TODO: When the metadata system is reworked and we can have multiple metadatas on one entity, this won't be required anymore
|
||||
[DataMember(Order = 3)]
|
||||
public FruitPlantMetadata FruitPlantMetadata { get; set; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected PlantableMetadata()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public PlantableMetadata(float timeStartGrowth, int slotID)
|
||||
{
|
||||
TimeStartGrowth = timeStartGrowth;
|
||||
SlotID = slotID;
|
||||
}
|
||||
|
||||
public PlantableMetadata(float timeStartGrowth, int slotID, FruitPlantMetadata fruitPlantMetadata)
|
||||
{
|
||||
TimeStartGrowth = timeStartGrowth;
|
||||
SlotID = slotID;
|
||||
FruitPlantMetadata = fruitPlantMetadata;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[{nameof(PlantableMetadata)} TimeStartGrowth: {TimeStartGrowth}, SlotID: {SlotID}, FruitPlantMetadata: {FruitPlantMetadata}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class PlayerMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public List<EquippedItem> EquippedItems { get; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected PlayerMetadata()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public PlayerMetadata(List<EquippedItem> equippedItems)
|
||||
{
|
||||
EquippedItems = equippedItems;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[PlayerMetadata EquippedItems: {string.Join(",", EquippedItems)}]";
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class EquippedItem
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public NitroxId Id { get; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public string Slot { get; }
|
||||
|
||||
[DataMember(Order = 3)]
|
||||
public NitroxTechType TechType { get; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected EquippedItem()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public EquippedItem(NitroxId id, string slot, NitroxTechType techType)
|
||||
{
|
||||
Id = id;
|
||||
Slot = slot;
|
||||
TechType = techType;
|
||||
}
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[EquippedItem Id: {Id} Slot: {Slot} TechType: {TechType}]";
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata
|
||||
{
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class PrecursorDoorwayMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public bool IsOpen { get; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected PrecursorDoorwayMetadata()
|
||||
{
|
||||
//Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public PrecursorDoorwayMetadata(bool isOpen)
|
||||
{
|
||||
IsOpen = isOpen;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[PrecursorDoorwayMetadata isOpen: {IsOpen}]";
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata
|
||||
{
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class PrecursorKeyTerminalMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public bool Slotted { get; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected PrecursorKeyTerminalMetadata()
|
||||
{
|
||||
//Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public PrecursorKeyTerminalMetadata(bool slotted)
|
||||
{
|
||||
Slotted = slotted;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[PrecursorKeyTerminalMetadata Slotted: {Slotted}]";
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata
|
||||
{
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class PrecursorTeleporterActivationTerminalMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public bool Unlocked { get; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected PrecursorTeleporterActivationTerminalMetadata()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public PrecursorTeleporterActivationTerminalMetadata(bool unlocked)
|
||||
{
|
||||
Unlocked = unlocked;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[PrecursorTeleporterActivationTerminalMetadata Unlocked: {Unlocked}]";
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata
|
||||
{
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class PrecursorTeleporterMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public bool IsOpen { get; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected PrecursorTeleporterMetadata()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public PrecursorTeleporterMetadata(bool isOpen)
|
||||
{
|
||||
IsOpen = isOpen;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[PrecursorTeleporterMetadata isOpen: {IsOpen}]";
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
|
||||
[Serializable, DataContract]
|
||||
public class RadiationMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public float Health { get; set; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public float FixRealTime { get; set; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected RadiationMetadata()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public RadiationMetadata(float health, float fixRealTime = -1)
|
||||
{
|
||||
Health = health;
|
||||
FixRealTime = fixRealTime;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[{nameof(RadiationMetadata)} Health: {Health}, FixRealTime: {FixRealTime}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class RocketMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public int CurrentStage { get; set; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public float LastStageTransitionTime { get; set; }
|
||||
|
||||
[DataMember(Order = 3)]
|
||||
public int ElevatorState { get; set; }
|
||||
|
||||
[DataMember(Order = 4)]
|
||||
public float ElevatorPosition { get; set; }
|
||||
|
||||
[DataMember(Order = 5)]
|
||||
public List<int> PreflightChecks { get; set; } = [];
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected RocketMetadata()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public RocketMetadata(int currentStage, float lastStageTransitionTime, int elevatorState, float elevatorPosition, List<int> preflightChecks)
|
||||
{
|
||||
CurrentStage = currentStage;
|
||||
LastStageTransitionTime = lastStageTransitionTime;
|
||||
ElevatorState = elevatorState;
|
||||
ElevatorPosition = elevatorPosition;
|
||||
PreflightChecks = preflightChecks;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[{nameof(RocketMetadata)} CurrentStage: {CurrentStage}, LastStageTransitionTime: {LastStageTransitionTime}, ElevatorState: {ElevatorState}, ElevatorPosition: {ElevatorPosition}, PreflightChecks: {string.Join(",", PreflightChecks)}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class SeaTreaderMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public bool ReverseDirection { get; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public float GrazingEndTime { get; }
|
||||
|
||||
[DataMember(Order = 3)]
|
||||
public NitroxVector3 LeashPosition { get; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected SeaTreaderMetadata()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public SeaTreaderMetadata(bool reverseDirection, float grazingEndTime, NitroxVector3 leashPosition)
|
||||
{
|
||||
ReverseDirection = reverseDirection;
|
||||
GrazingEndTime = grazingEndTime;
|
||||
LeashPosition = leashPosition;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[{nameof(SeaTreaderMetadata)} ReverseDirection: {ReverseDirection}, GrazingEndTime: {GrazingEndTime}, LeashPosition: {LeashPosition}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata
|
||||
{
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class SealedDoorMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public bool Sealed { get; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public float OpenedAmount { get; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected SealedDoorMetadata()
|
||||
{
|
||||
//Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public SealedDoorMetadata(bool Sealed, float OpenedAmount)
|
||||
{
|
||||
this.Sealed = Sealed;
|
||||
this.OpenedAmount = OpenedAmount;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class SeamothMetadata : VehicleMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public bool LightsOn { get; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected SeamothMetadata()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public SeamothMetadata(bool lightsOn, float health, string name, NitroxVector3[] colors) : base(health, name, colors)
|
||||
{
|
||||
LightsOn = lightsOn;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[{nameof(SeamothMetadata)} LightsOn: {LightsOn} {base.ToString()}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata
|
||||
{
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class StarshipDoorMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public bool DoorLocked { get; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public bool DoorOpen { get; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected StarshipDoorMetadata()
|
||||
{
|
||||
//Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public StarshipDoorMetadata(bool doorLocked, bool doorOpen)
|
||||
{
|
||||
DoorLocked = doorLocked;
|
||||
DoorOpen = doorOpen;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[StarshipDoorMetadata DoorLocked: {DoorLocked} DoorOpen: {DoorOpen}]";
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
|
||||
[Serializable, DataContract]
|
||||
public class StayAtLeashPositionMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public NitroxVector3 LeashPosition { get; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected StayAtLeashPositionMetadata()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public StayAtLeashPositionMetadata(NitroxVector3 leashPosition)
|
||||
{
|
||||
LeashPosition = leashPosition;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[{nameof(StayAtLeashPositionMetadata)} LeashPosition: {LeashPosition}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class SubNameInputMetadata : NamedColoredMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public int SelectedColorIndex { get; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected SubNameInputMetadata()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public SubNameInputMetadata(int selectedColorIndex, string name, NitroxVector3[] colors) : base(name, colors)
|
||||
{
|
||||
SelectedColorIndex = selectedColorIndex;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[{nameof(SubNameInputMetadata)} SelectedColorIndex: {SelectedColorIndex} {base.ToString()}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
using ProtoBufNet;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
|
||||
[Serializable, DataContract]
|
||||
[ProtoInclude(50, typeof(SeamothMetadata))]
|
||||
[ProtoInclude(60, typeof(ExosuitMetadata))]
|
||||
public abstract class VehicleMetadata : NamedColoredMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public float Health { get; init; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected VehicleMetadata()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public VehicleMetadata(float health, string name, NitroxVector3[] colors) : base(name, colors)
|
||||
{
|
||||
Health = health;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[{nameof(VehicleMetadata)} Health: {Health} {base.ToString()}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
|
||||
[Serializable, DataContract]
|
||||
public class WaterParkCreatureMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public float Age { get; init; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public double MatureTime { get; init; }
|
||||
|
||||
[DataMember(Order = 3)]
|
||||
public float TimeNextBreed { get; init; }
|
||||
|
||||
[DataMember(Order = 4)]
|
||||
public bool BornInside { get; init; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected WaterParkCreatureMetadata()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public WaterParkCreatureMetadata(float age, double matureTime, float timeNextBreed, bool bornInside)
|
||||
{
|
||||
Age = age;
|
||||
MatureTime = matureTime;
|
||||
TimeNextBreed = timeNextBreed;
|
||||
BornInside = bornInside;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[WaterParkCreatureMetadata Age: {Age}, MatureTime: {MatureTime}, TimeNextBreed: {TimeNextBreed}, BornInside: {BornInside}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities.Metadata
|
||||
{
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class WeldableWallPanelGenericMetadata : EntityMetadata
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public float LiveMixInHealth { get; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected WeldableWallPanelGenericMetadata()
|
||||
{
|
||||
//Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public WeldableWallPanelGenericMetadata(float liveMixInHealth)
|
||||
{
|
||||
LiveMixInHealth = liveMixInHealth;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[WeldableWallPanelGenericMetadata LiveMixInHealth: {LiveMixInHealth}]";
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities;
|
||||
|
||||
[Serializable, DataContract]
|
||||
public class OxygenPipeEntity : WorldEntity
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public NitroxId ParentPipeId { get; set; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public NitroxId RootPipeId { get; set; }
|
||||
|
||||
[DataMember(Order = 3)]
|
||||
public NitroxVector3 ParentPosition { get; set; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected OxygenPipeEntity()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
/// <remarks>Used for deserialization</remarks>
|
||||
public OxygenPipeEntity(NitroxTransform transform, int level, string classId, bool spawnedByServer, NitroxId id, NitroxTechType techType, EntityMetadata metadata, NitroxId parentId, List<Entity> childEntities, NitroxId parentPipeId, NitroxId rootPipeId, NitroxVector3 parentPosition) :
|
||||
base(transform, level, classId, spawnedByServer, id, techType, metadata, parentId, childEntities)
|
||||
{
|
||||
ParentPipeId = parentPipeId;
|
||||
RootPipeId = rootPipeId;
|
||||
ParentPosition = parentPosition;
|
||||
}
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities;
|
||||
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class PathBasedChildEntity : Entity
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public string Path { get; set; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected PathBasedChildEntity()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
/// <remarks>Used for deserialization</remarks>
|
||||
public PathBasedChildEntity(string path, NitroxId id, NitroxTechType techType, EntityMetadata metadata, NitroxId parentId, List<Entity> childEntities)
|
||||
{
|
||||
Path = path;
|
||||
Id = id;
|
||||
TechType = techType;
|
||||
Metadata = metadata;
|
||||
ParentId = parentId;
|
||||
ChildEntities = childEntities;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[PathBasedChildEntity Path: {Path} {base.ToString()}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities;
|
||||
|
||||
[Serializable, DataContract]
|
||||
public class PlacedWorldEntity : WorldEntity
|
||||
{
|
||||
[IgnoreConstructor]
|
||||
protected PlacedWorldEntity()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
/// <remarks>Used for deserialization</remarks>
|
||||
public PlacedWorldEntity(NitroxTransform transform, int level, string classId, bool spawnedByServer, NitroxId id, NitroxTechType techType, EntityMetadata metadata, NitroxId parentId, List<Entity> childEntities) :
|
||||
base(transform, level, classId, spawnedByServer, id, techType, metadata, parentId, childEntities) { }
|
||||
}
|
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities;
|
||||
|
||||
[Serializable, DataContract]
|
||||
public class PlaceholderGroupWorldEntity : WorldEntity
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public int ComponentIndex { get; set; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected PlaceholderGroupWorldEntity()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public PlaceholderGroupWorldEntity(WorldEntity worldEntity, int componentIndex = 0)
|
||||
{
|
||||
Id = worldEntity.Id;
|
||||
TechType = worldEntity.TechType;
|
||||
Metadata = worldEntity.Metadata;
|
||||
ParentId = worldEntity.ParentId;
|
||||
Transform = worldEntity.Transform;
|
||||
Level = worldEntity.Level;
|
||||
ClassId = worldEntity.ClassId;
|
||||
SpawnedByServer = worldEntity.SpawnedByServer;
|
||||
ChildEntities = worldEntity.ChildEntities;
|
||||
ComponentIndex = componentIndex;
|
||||
}
|
||||
|
||||
/// <remarks>Used for deserialization</remarks>
|
||||
public PlaceholderGroupWorldEntity(NitroxTransform transform, int level, string classId, bool spawnedByServer, NitroxId id, NitroxTechType techType, EntityMetadata metadata, NitroxId parentId, List<Entity> childEntities, int componentIndex) :
|
||||
base(transform, level, classId, spawnedByServer, id, techType, metadata, parentId, childEntities)
|
||||
{
|
||||
ComponentIndex = componentIndex;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[PlaceholderGroupWorldEntity ComponentIndex: {ComponentIndex} {base.ToString()}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities;
|
||||
|
||||
[Serializable, DataContract]
|
||||
public class PlanterEntity : GlobalRootEntity
|
||||
{
|
||||
[IgnoreConstructor]
|
||||
protected PlanterEntity()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public PlanterEntity(NitroxId id, NitroxId parentId)
|
||||
{
|
||||
Id = id;
|
||||
ParentId = parentId;
|
||||
}
|
||||
|
||||
/// <remarks>
|
||||
/// Used for deserialization.
|
||||
/// <see cref="WorldEntity.SpawnedByServer"/> is set to true because this entity is meant to receive simulation locks
|
||||
/// </remarks>
|
||||
public PlanterEntity(NitroxTransform transform, int level, string classId, bool spawnedByServer, NitroxId id, NitroxTechType techType, EntityMetadata metadata, NitroxId parentId, List<Entity> childEntities) :
|
||||
base(transform, level, classId, true, id, techType, metadata, parentId, childEntities) {}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[PlanterEntity {base.ToString()}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using System.Collections.Generic;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities;
|
||||
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class PlayerWorldEntity : GlobalRootEntity
|
||||
{
|
||||
[IgnoreConstructor]
|
||||
protected PlayerWorldEntity()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
/// <remarks>
|
||||
/// Used for deserialization.
|
||||
/// <see cref="WorldEntity.SpawnedByServer"/> is set to true because this entity is meant to receive simulation locks
|
||||
/// </remarks>
|
||||
public PlayerWorldEntity(NitroxTransform transform, int level, string classId, bool spawnedByServer, NitroxId id, NitroxTechType techType, EntityMetadata metadata, NitroxId parentId, List<Entity> childEntities) :
|
||||
base(transform, level, classId, true, id, techType, metadata, parentId, childEntities) {}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[PlayerEntity {base.ToString()}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities
|
||||
{
|
||||
/*
|
||||
* A PrefabChildEntity is a gameobject that resides inside of a spawned prefab. Although the server knows about these,
|
||||
* it is too cost prohibitive for it to send spawn data for all of these. Instead, we let the game spawn them and tag
|
||||
* the entity after the fact. An example of this is a keypad in the aurora; there is an overarching Door prefab with
|
||||
* the keypad baked in - we simply update the id of the keypad on spawn. Each PrefabChildEntity will always bubble up
|
||||
* to a root WorldEntity.
|
||||
*/
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class PrefabChildEntity : Entity
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public int ComponentIndex { get; set; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public string ClassId { get; set; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected PrefabChildEntity()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public PrefabChildEntity(NitroxId id, string classId, NitroxTechType techType, int componentIndex, EntityMetadata metadata, NitroxId parentId)
|
||||
{
|
||||
Id = id;
|
||||
TechType = techType;
|
||||
ComponentIndex = componentIndex;
|
||||
ParentId = parentId;
|
||||
ClassId = classId;
|
||||
Metadata = metadata;
|
||||
}
|
||||
|
||||
/// <remarks>Used for deserialization</remarks>
|
||||
public PrefabChildEntity(int componentIndex, string classId, NitroxId id, NitroxTechType techType, EntityMetadata metadata, NitroxId parentId, List<Entity> childEntities)
|
||||
{
|
||||
ComponentIndex = componentIndex;
|
||||
ClassId = classId;
|
||||
Id = id;
|
||||
TechType = techType;
|
||||
Metadata = metadata;
|
||||
ParentId = parentId;
|
||||
ChildEntities = childEntities;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[PrefabChildEntity ComponentIndex: {ComponentIndex} ClassId: {ClassId} {base.ToString()}]";
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a Placeholder GameObject located under a PrefabPlaceholdersGroup
|
||||
/// </summary>
|
||||
[Serializable, DataContract]
|
||||
public class PrefabPlaceholderEntity : WorldEntity
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public int ComponentIndex { get; set; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected PrefabPlaceholderEntity()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public PrefabPlaceholderEntity(WorldEntity worldEntity, int componentIndex = 0)
|
||||
{
|
||||
Id = worldEntity.Id;
|
||||
TechType = worldEntity.TechType;
|
||||
Metadata = worldEntity.Metadata;
|
||||
ParentId = worldEntity.ParentId;
|
||||
Transform = worldEntity.Transform;
|
||||
Level = worldEntity.Level;
|
||||
ClassId = worldEntity.ClassId;
|
||||
SpawnedByServer = worldEntity.SpawnedByServer;
|
||||
ChildEntities = worldEntity.ChildEntities;
|
||||
ComponentIndex = componentIndex;
|
||||
}
|
||||
|
||||
|
||||
/// <remarks>Used for deserialization</remarks>
|
||||
public PrefabPlaceholderEntity(NitroxTransform transform, int level, string classId, bool spawnedByServer, NitroxId id, NitroxTechType techType, EntityMetadata metadata, NitroxId parentId, List<Entity> childEntities, int componentIndex) :
|
||||
base(transform, level, classId, spawnedByServer, id, techType, metadata, parentId, childEntities)
|
||||
{
|
||||
ComponentIndex = componentIndex;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[PrefabPlaceholderEntity ComponentIndex: {ComponentIndex} {base.ToString()}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities;
|
||||
|
||||
[Serializable, DataContract]
|
||||
public class RadiationLeakEntity : GlobalRootEntity
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public int ObjectIndex { get; set; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected RadiationLeakEntity()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public RadiationLeakEntity(NitroxId id, int objectIndex, RadiationMetadata metadata)
|
||||
{
|
||||
Id = id;
|
||||
ObjectIndex = objectIndex;
|
||||
Metadata = metadata;
|
||||
Transform = new();
|
||||
}
|
||||
|
||||
/// <remarks>Used for deserialization</remarks>
|
||||
public RadiationLeakEntity(int objectIndex, NitroxTransform transform, int level, string classId, bool spawnedByServer, NitroxId id, NitroxTechType techType, EntityMetadata metadata, NitroxId parentId, List<Entity> childEntities) :
|
||||
base(transform, level, classId, spawnedByServer, id, techType, metadata, parentId, childEntities)
|
||||
{
|
||||
ObjectIndex = objectIndex;
|
||||
}
|
||||
}
|
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities;
|
||||
|
||||
[Serializable, DataContract]
|
||||
public class ReefbackChildEntity : WorldEntity
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public ReefbackChildType Type { get; set; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected ReefbackChildEntity()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public ReefbackChildEntity(NitroxVector3 localPosition, NitroxQuaternion localRotation, NitroxVector3 scale, NitroxTechType techType, int level, string classId, bool spawnedByServer, NitroxId id, ReefbackEntity parentEntity, ReefbackChildType type) :
|
||||
base(localPosition, localRotation, scale, techType, level, classId, spawnedByServer, id, null)
|
||||
{
|
||||
Type = type;
|
||||
// Manually set ParentId instead of providing parentEntity to the base constructor to avoid having the Transform being parented
|
||||
ParentId = parentEntity.Id;
|
||||
}
|
||||
|
||||
/// <remarks>Used for deserialization</remarks>
|
||||
public ReefbackChildEntity(NitroxTransform transform, int level, string classId, bool spawnedByServer, NitroxId id, NitroxTechType techType, EntityMetadata metadata, NitroxId parentId, List<Entity> childEntities, ReefbackChildType type) :
|
||||
base(transform, level, classId, spawnedByServer, id, techType, metadata, parentId, childEntities)
|
||||
{
|
||||
Type = type;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[{nameof(ReefbackChildEntity)} Type: {Type} {base.ToString()}]";
|
||||
}
|
||||
|
||||
public enum ReefbackChildType
|
||||
{
|
||||
CREATURE,
|
||||
PLANT
|
||||
}
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities;
|
||||
|
||||
[Serializable, DataContract]
|
||||
public class ReefbackEntity : WorldEntity
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public int GrassIndex { get; set; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public NitroxVector3 OriginalPosition { get; set; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected ReefbackEntity()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
/// <remarks>Used for deserialization</remarks>
|
||||
public ReefbackEntity(NitroxTransform transform, int level, string classId, bool spawnedByServer, NitroxId id, NitroxTechType techType, EntityMetadata metadata, NitroxId parentId, List<Entity> childEntities, int grassIndex, NitroxVector3 originalPosition) :
|
||||
base(transform, level, classId, spawnedByServer, id, techType, metadata, parentId, childEntities)
|
||||
{
|
||||
GrassIndex = grassIndex;
|
||||
OriginalPosition = originalPosition;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[{nameof(ReefbackEntity)} GrassIndex: {GrassIndex}, OriginalPosition: {OriginalPosition} {base.ToString()}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// An implementation for GameObjects marked as CreateEmptyObject in the protobuf serializer.
|
||||
/// They seem to represent unique (which is why they don't exist as a prefab) statically created objects which are part of the decor but can't be interacted with.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The associated GameObjects are mostly alone in their own EntityCell.
|
||||
/// To avoid creating an EntityCell entity for each of them we give it a global position and its actual cell reference.
|
||||
/// It is safe to give a static cell because those objects don't move.
|
||||
/// </remarks>
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class SerializedWorldEntity : WorldEntity
|
||||
{
|
||||
public override AbsoluteEntityCell AbsoluteEntityCell => new(BatchId, CellId, Level);
|
||||
|
||||
[DataMember(Order = 1)]
|
||||
public List<SerializedComponent> Components { get; set; } = [];
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public int Layer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// This entity is not parented so it doesn't have info for the cell containing it,
|
||||
/// therefore we need to serialize it instead of generating it from a local position (which would make no sense)
|
||||
/// </summary>
|
||||
[DataMember(Order = 3)]
|
||||
public NitroxInt3 BatchId { get; set; }
|
||||
|
||||
/// <inheritdoc cref="BatchId"/>
|
||||
[DataMember(Order = 4)]
|
||||
public NitroxInt3 CellId { get; set; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected SerializedWorldEntity()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public SerializedWorldEntity(List<SerializedComponent> components, int layer, NitroxTransform transform, NitroxId id, NitroxId parentId, AbsoluteEntityCell cell)
|
||||
{
|
||||
Components = components;
|
||||
Layer = layer;
|
||||
Transform = transform;
|
||||
Id = id;
|
||||
ParentId = parentId;
|
||||
Level = cell.Level;
|
||||
BatchId = cell.BatchId;
|
||||
CellId = cell.CellId;
|
||||
}
|
||||
|
||||
/// <remarks>Used for deserialization</remarks>
|
||||
public SerializedWorldEntity(List<SerializedComponent> components, int layer, NitroxInt3 batchId, NitroxInt3 cellId, NitroxTransform transform, int level, string classId, bool spawnedByServer, NitroxId id, NitroxTechType techType, EntityMetadata metadata, NitroxId parentId, List<Entity> childEntities) :
|
||||
base(transform, level, classId, spawnedByServer, id, techType, metadata, parentId, childEntities)
|
||||
{
|
||||
Components = components;
|
||||
Layer = layer;
|
||||
BatchId = batchId;
|
||||
CellId = cellId;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[{nameof(SerializedWorldEntity)} Components: {Components.Count}, Layer: {Layer}, BatchId: {BatchId}, CellId: {CellId} {base.ToString()}]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities;
|
||||
|
||||
public readonly record struct UwePrefab(string ClassId, int Count, float Probability, bool IsFragment);
|
@@ -0,0 +1,23 @@
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities;
|
||||
|
||||
public class UweWorldEntity
|
||||
{
|
||||
public string ClassId { get; }
|
||||
public NitroxTechType TechType { get; }
|
||||
public string SlotType { get; }
|
||||
public bool PrefabZUp { get; }
|
||||
public int CellLevel { get; }
|
||||
public NitroxVector3 LocalScale { get; }
|
||||
|
||||
public UweWorldEntity(string classId, NitroxTechType techType, string slotType, bool prefabZUp, int cellLevel, NitroxVector3 localScale)
|
||||
{
|
||||
ClassId = classId;
|
||||
TechType = techType;
|
||||
SlotType = slotType;
|
||||
PrefabZUp = prefabZUp;
|
||||
CellLevel = cellLevel;
|
||||
LocalScale = localScale;
|
||||
}
|
||||
}
|
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using BinaryPack.Attributes;
|
||||
using System.Runtime.Serialization;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities;
|
||||
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
public class VehicleWorldEntity : GlobalRootEntity
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public NitroxId SpawnerId { get; set; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public float ConstructionTime { get; set; }
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected VehicleWorldEntity()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public VehicleWorldEntity(NitroxId spawnerId, float constructionTime, NitroxTransform transform, string classId, bool spawnedByServer, NitroxId id, NitroxTechType techType, EntityMetadata metadata) :
|
||||
base(transform, 0, classId, spawnedByServer, id, techType, metadata, null, new List<Entity>())
|
||||
{
|
||||
SpawnerId = spawnerId;
|
||||
ConstructionTime = constructionTime;
|
||||
}
|
||||
|
||||
/// <remarks>Used for deserialization</remarks>
|
||||
public VehicleWorldEntity(NitroxId spawnerId, float constructionTime, NitroxTransform transform, int level, string classId, bool spawnedByServer, NitroxId id, NitroxTechType techType, EntityMetadata metadata, NitroxId parentId, List<Entity> childEntities) :
|
||||
base(transform, level, classId, spawnedByServer, id, techType, metadata, parentId, childEntities)
|
||||
{
|
||||
SpawnerId = spawnerId;
|
||||
ConstructionTime = constructionTime;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[VehicleEntity SpawnerId:{SpawnerId} ConstructionTime:{ConstructionTime} {base.ToString()}]";
|
||||
}
|
||||
}
|
99
NitroxModel/DataStructures/GameLogic/Entities/WorldEntity.cs
Normal file
99
NitroxModel/DataStructures/GameLogic/Entities/WorldEntity.cs
Normal file
@@ -0,0 +1,99 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using BinaryPack.Attributes;
|
||||
using NitroxModel.DataStructures.GameLogic.Entities.Metadata;
|
||||
using NitroxModel.DataStructures.Unity;
|
||||
using ProtoBufNet;
|
||||
|
||||
namespace NitroxModel.DataStructures.GameLogic.Entities
|
||||
{
|
||||
/*
|
||||
* A world entity is an object physically in the world with a transform. It is either a global root entity
|
||||
* or something that phases out with the clip map manager.
|
||||
*/
|
||||
[Serializable]
|
||||
[DataContract]
|
||||
[ProtoInclude(50, typeof(PlaceholderGroupWorldEntity))]
|
||||
[ProtoInclude(51, typeof(CellRootEntity))]
|
||||
[ProtoInclude(52, typeof(GlobalRootEntity))]
|
||||
[ProtoInclude(53, typeof(OxygenPipeEntity))]
|
||||
[ProtoInclude(54, typeof(PlacedWorldEntity))]
|
||||
[ProtoInclude(55, typeof(SerializedWorldEntity))]
|
||||
[ProtoInclude(56, typeof(PrefabPlaceholderEntity))]
|
||||
[ProtoInclude(57, typeof(GeyserWorldEntity))]
|
||||
[ProtoInclude(58, typeof(ReefbackEntity))]
|
||||
[ProtoInclude(59, typeof(ReefbackChildEntity))]
|
||||
[ProtoInclude(60, typeof(CreatureRespawnEntity))]
|
||||
public class WorldEntity : Entity
|
||||
{
|
||||
public virtual AbsoluteEntityCell AbsoluteEntityCell => new(Transform.Position, Level);
|
||||
|
||||
[DataMember(Order = 1)]
|
||||
public NitroxTransform Transform { get; set; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public int Level { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the prefab class id assigned by Unity Engine. This is a unique <see cref="Guid"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <a href="https://docs.unity3d.com/Manual/Prefabs.html">What is a prefab?</a>
|
||||
/// </remarks>
|
||||
[DataMember(Order = 3)]
|
||||
public string ClassId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Keeps track if an entity was spawned by the server or a player
|
||||
/// Server-spawned entities need to be techType white-listed to be simulated
|
||||
/// </summary>
|
||||
[DataMember(Order = 4)]
|
||||
public bool SpawnedByServer;
|
||||
|
||||
[IgnoreConstructor]
|
||||
protected WorldEntity()
|
||||
{
|
||||
// Constructor for serialization. Has to be "protected" for json serialization.
|
||||
}
|
||||
|
||||
public WorldEntity(NitroxVector3 localPosition, NitroxQuaternion localRotation, NitroxVector3 scale, NitroxTechType techType, int level, string classId, bool spawnedByServer, NitroxId id, Entity parentEntity)
|
||||
{
|
||||
Transform = new NitroxTransform(localPosition, localRotation, scale);
|
||||
TechType = techType;
|
||||
Id = id;
|
||||
Level = level;
|
||||
ClassId = classId;
|
||||
SpawnedByServer = spawnedByServer;
|
||||
|
||||
if (parentEntity != null)
|
||||
{
|
||||
ParentId = parentEntity.Id;
|
||||
|
||||
if (parentEntity is WorldEntity weParent)
|
||||
{
|
||||
Transform.SetParent(weParent.Transform, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks>Used for deserialization</remarks>
|
||||
public WorldEntity(NitroxTransform transform, int level, string classId, bool spawnedByServer, NitroxId id, NitroxTechType techType, EntityMetadata metadata, NitroxId parentId, List<Entity> childEntities)
|
||||
{
|
||||
Id = id;
|
||||
TechType = techType;
|
||||
Metadata = metadata;
|
||||
ParentId = parentId;
|
||||
Transform = transform;
|
||||
ChildEntities = childEntities;
|
||||
Level = level;
|
||||
ClassId = classId;
|
||||
SpawnedByServer = spawnedByServer;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[{GetType().Name} Transform: {Transform} Level: {Level} ClassId: {ClassId} SpawnedByServer: {SpawnedByServer} {base.ToString()}]";
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user