first commit

This commit is contained in:
2025-07-06 00:23:46 +02:00
commit 38f50c8819
1788 changed files with 112878 additions and 0 deletions

View File

@@ -0,0 +1,84 @@
using System;
using System.Linq;
using System.Runtime.Serialization;
namespace NitroxModel.DataStructures.GameLogic.Bases;
[DataContract]
public class BaseData : IEquatable<BaseData>
{
[DataMember(Order = 1)]
public NitroxInt3 BaseShape;
[DataMember(Order = 2)]
public NitroxInt3 CellOffset;
[DataMember(Order = 3)]
public NitroxInt3 Anchor;
[DataMember(Order = 4)]
public int PreCompressionSize;
[DataMember(Order = 5)]
public byte[] Faces;
[DataMember(Order = 6)]
public byte[] Cells;
[DataMember(Order = 7)]
public byte[] Links;
[DataMember(Order = 8)]
public byte[] Masks;
[DataMember(Order = 9)]
public byte[] IsGlass;
public bool Equals(BaseData other)
{
if (ReferenceEquals(null, other))
{
return false;
}
if (ReferenceEquals(this, other))
{
return true;
}
return BaseShape.Equals(other.BaseShape) &&
CellOffset.Equals(other.CellOffset) &&
Anchor.Equals(other.Anchor) &&
PreCompressionSize == other.PreCompressionSize &&
Faces.SequenceEqual(other.Faces) &&
Cells.SequenceEqual(other.Cells) &&
Links.SequenceEqual(other.Links) &&
Masks.SequenceEqualOrBothNull(other.Masks) &&
IsGlass.SequenceEqual(other.IsGlass);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return Equals((BaseData)obj);
}
public override int GetHashCode()
{
unchecked
{
int hashCode = BaseShape.GetHashCode();
hashCode = (hashCode * 397) ^ CellOffset.GetHashCode();
hashCode = (hashCode * 397) ^ Anchor.GetHashCode();
hashCode = (hashCode * 397) ^ PreCompressionSize;
hashCode = (hashCode * 397) ^ (Faces != null ? Faces.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (Cells != null ? Cells.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (Links != null ? Links.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (Masks != null ? Masks.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (IsGlass != null ? IsGlass.GetHashCode() : 0);
return hashCode;
}
}
}

View File

@@ -0,0 +1,25 @@
using System;
using System.Runtime.Serialization;
namespace NitroxModel.DataStructures.GameLogic.Bases;
[Serializable, DataContract]
public record struct BuildPieceIdentifier(NitroxTechType Recipe, NitroxBaseFace? BaseFace, NitroxInt3 BaseCell, NitroxInt3 PiecePoint)
{
[DataMember(Order = 1)]
public NitroxTechType Recipe = Recipe;
[DataMember(Order = 2)]
public NitroxBaseFace? BaseFace = BaseFace;
[DataMember(Order = 3)]
public NitroxInt3 BaseCell = BaseCell;
[DataMember(Order = 4)]
public NitroxInt3 PiecePoint = PiecePoint;
public override readonly string ToString()
{
return $"BuildPieceIdentifier (Recipe: {Recipe}, BaseFace: {BaseFace}, BaseCell: {BaseCell}, PiecePoint: {PiecePoint})";
}
}

View File

@@ -0,0 +1,19 @@
using System;
using System.Runtime.Serialization;
namespace NitroxModel.DataStructures.GameLogic.Bases;
[Serializable, DataContract]
public record struct NitroxBaseFace(NitroxInt3 Cell, int Direction)
{
[DataMember(Order = 1)]
public NitroxInt3 Cell = Cell;
[DataMember(Order = 2)]
public int Direction = Direction;
public override readonly string ToString()
{
return $"NitroxBaseFace ({Cell}) {Direction}";
}
}