Skip to content

Commit

Permalink
Renamed NitroxModel's TechType to NitroxTechType
Browse files Browse the repository at this point in the history
  • Loading branch information
Measurity committed May 17, 2020
1 parent ac02417 commit 5c28359
Show file tree
Hide file tree
Showing 45 changed files with 106 additions and 100 deletions.
9 changes: 4 additions & 5 deletions NitroxClient/GameLogic/InitialSync/PdaInitialSyncProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using NitroxModel.Logger;
using NitroxModel.Packets;
using NitroxModel.Helper;
using TechTypeModel = NitroxModel.DataStructures.TechType;
using NitroxModel_Subnautica.Helper;
using System.Collections;
using NitroxModel_Subnautica.DataStructures;
Expand Down Expand Up @@ -58,11 +57,11 @@ private void SetEncyclopediaEntry(List<string> entries)
}
}

private void SetPDAEntryComplete(List<TechTypeModel> pdaEntryComplete)
private void SetPDAEntryComplete(List<NitroxTechType> pdaEntryComplete)
{
HashSet<TechType> complete = (HashSet<TechType>)(typeof(PDAScanner).GetField("complete", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null));

foreach (TechTypeModel item in pdaEntryComplete)
foreach (NitroxTechType item in pdaEntryComplete)
{
complete.Add(item.ToUnity());
}
Expand All @@ -83,13 +82,13 @@ private void SetPDAEntryPartial(List<PDAEntry> entries)
Log.Info("PDAEntryPartial Save :" + entries.Count + " Read Partial Client Final Count:" + partial.Count);
}

private void SetKnownTech(List<TechTypeModel> techTypes)
private void SetKnownTech(List<NitroxTechType> techTypes)
{
Log.Info("Received initial sync packet with " + techTypes.Count + " known tech types");

using (packetSender.Suppress<KnownTechEntryAdd>())
{
foreach (TechTypeModel techType in techTypes)
foreach (NitroxTechType techType in techTypes)
{
HashSet<TechType> complete = (HashSet<TechType>)(typeof(PDAScanner).GetField("complete", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null));
KnownTech.Add(techType.ToUnity(), false);
Expand Down
6 changes: 3 additions & 3 deletions NitroxModel-Subnautica/DataStructures/DataExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ public static Vector3 AsVector3(this NitroxModel.DataStructures.Int3 v)
return new Vector3(v.X, v.Y, v.Z);
}

public static NitroxModel.DataStructures.TechType ToDto(this TechType v)
public static NitroxModel.DataStructures.GameLogic.NitroxTechType ToDto(this TechType v)
{
return new NitroxModel.DataStructures.TechType(v.ToString());
return new NitroxModel.DataStructures.GameLogic.NitroxTechType(v.ToString());
}

public static TechType ToUnity(this NitroxModel.DataStructures.TechType v)
public static TechType ToUnity(this NitroxModel.DataStructures.GameLogic.NitroxTechType v)
{
return (TechType)Enum.Parse(typeof(TechType), v.Name);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public CyclopsModel()

}

public CyclopsModel(NitroxModel.DataStructures.TechType techType, NitroxId id, NitroxVector3 position, NitroxQuaternion rotation, List<InteractiveChildObjectIdentifier> interactiveChildIdentifiers, Optional<NitroxId> dockingBayId, string name, NitroxVector3[] hsb, float health) : base(techType, id, position, rotation, interactiveChildIdentifiers, dockingBayId, name, hsb, health)
public CyclopsModel(NitroxModel.DataStructures.GameLogic.NitroxTechType techType, NitroxId id, NitroxVector3 position, NitroxQuaternion rotation, List<InteractiveChildObjectIdentifier> interactiveChildIdentifiers, Optional<NitroxId> dockingBayId, string name, NitroxVector3[] hsb, float health) : base(techType, id, position, rotation, interactiveChildIdentifiers, dockingBayId, name, hsb, health)
{
FloodLightsOn = true;
InternalLightsOn = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public ExosuitMovementData()
// For serialization purposes
}

public ExosuitMovementData(NitroxModel.DataStructures.TechType techType, NitroxId id, NitroxVector3 position, NitroxQuaternion rotation, NitroxVector3 velocity, NitroxVector3 angularVelocity, float steeringWheelYaw, float steeringWheelPitch, bool appliedThrottle,
public ExosuitMovementData(NitroxModel.DataStructures.GameLogic.NitroxTechType techType, NitroxId id, NitroxVector3 position, NitroxQuaternion rotation, NitroxVector3 velocity, NitroxVector3 angularVelocity, float steeringWheelYaw, float steeringWheelPitch, bool appliedThrottle,
NitroxVector3 leftAimTarget, NitroxVector3 rightAimTarget, float health) : base(techType,id,position,rotation,velocity,angularVelocity,steeringWheelYaw,steeringWheelPitch,appliedThrottle,health)
{
LeftAimTarget = leftAimTarget;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public ExosuitModel()

}

public ExosuitModel(NitroxModel.DataStructures.TechType techType, NitroxId id, NitroxVector3 position, NitroxQuaternion rotation, List<InteractiveChildObjectIdentifier> interactiveChildIdentifiers, Optional<NitroxId> dockingBayId, string name, NitroxVector3[] hsb, float health) : base (techType, id, position, rotation, interactiveChildIdentifiers, dockingBayId, name, hsb, health)
public ExosuitModel(NitroxModel.DataStructures.GameLogic.NitroxTechType techType, NitroxId id, NitroxVector3 position, NitroxQuaternion rotation, List<InteractiveChildObjectIdentifier> interactiveChildIdentifiers, Optional<NitroxId> dockingBayId, string name, NitroxVector3[] hsb, float health) : base (techType, id, position, rotation, interactiveChildIdentifiers, dockingBayId, name, hsb, health)
{
LeftArmId = new NitroxId();
RightArmId = new NitroxId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public SeamothModel()

}

public SeamothModel(NitroxModel.DataStructures.TechType techType, NitroxId id, NitroxVector3 position, NitroxQuaternion rotation, List<InteractiveChildObjectIdentifier> interactiveChildIdentifiers, Optional<NitroxId> dockingBayId, string name, NitroxVector3[] hsb, float health) : base(techType, id, position, rotation, interactiveChildIdentifiers, dockingBayId, name, hsb, health)
public SeamothModel(NitroxModel.DataStructures.GameLogic.NitroxTechType techType, NitroxId id, NitroxVector3 position, NitroxQuaternion rotation, List<InteractiveChildObjectIdentifier> interactiveChildIdentifiers, Optional<NitroxId> dockingBayId, string name, NitroxVector3[] hsb, float health) : base(techType, id, position, rotation, interactiveChildIdentifiers, dockingBayId, name, hsb, health)
{
LightOn = true;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
using System.Runtime.Serialization;
using NitroxModel.DataStructures.GameLogic;
using NitroxModel.DataStructures.Surrogates;
using TechTypeModel = NitroxModel.DataStructures.TechType;

namespace NitroxModel_Subnautica.DataStructures.Surrogates
{
public class TechTypeSurrogate : SerializationSurrogate<TechTypeModel>
public class TechTypeSurrogate : SerializationSurrogate<NitroxTechType>
{
protected override void GetObjectData(TechTypeModel techType, SerializationInfo info)
protected override void GetObjectData(NitroxTechType techType, SerializationInfo info)
{
info.AddValue("name", techType.Name);
}

protected override TechTypeModel SetObjectData(TechTypeModel techType, SerializationInfo info)
protected override NitroxTechType SetObjectData(NitroxTechType techType, SerializationInfo info)
{
techType.Name = info.GetString("name");
return techType;
Expand Down
2 changes: 1 addition & 1 deletion NitroxModel-Subnautica/Helper/SubnauticaMap.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;
using NitroxModel.DataStructures.GameLogic;
using NitroxModel.Helper;
using NitroxTechType = NitroxModel.DataStructures.TechType;
using NitroxInt3 = NitroxModel.DataStructures.Int3;

namespace NitroxModel_Subnautica.Helper
Expand Down
2 changes: 0 additions & 2 deletions NitroxModel-Subnautica/Helper/VehicleModelFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
using NitroxModel.Packets;
using NitroxModel_Subnautica.DataStructures;
using NitroxModel_Subnautica.DataStructures.GameLogic;
using UnityEngine;
using NitroxTechType = NitroxModel.DataStructures.TechType;

namespace NitroxModel_Subnautica.Helper
{
Expand Down
4 changes: 2 additions & 2 deletions NitroxModel/DataStructures/GameLogic/BasePiece.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class BasePiece
public NitroxQuaternion Rotation { get; set; }

[ProtoMember(4)]
public TechType TechType { get; set; }
public NitroxTechType TechType { get; set; }

[ProtoMember(5)]
public Optional<NitroxId> ParentId { get; set; }
Expand Down Expand Up @@ -56,7 +56,7 @@ public BasePiece()
Metadata = Optional.Empty;
}

public BasePiece(NitroxId id, NitroxVector3 itemPosition, NitroxQuaternion rotation, NitroxVector3 cameraPosition, NitroxQuaternion cameraRotation, TechType techType, Optional<NitroxId> parentId, bool isFurniture, Optional<RotationMetadata> rotationMetadata)
public BasePiece(NitroxId id, NitroxVector3 itemPosition, NitroxQuaternion rotation, NitroxVector3 cameraPosition, NitroxQuaternion cameraRotation, NitroxTechType techType, Optional<NitroxId> parentId, bool isFurniture, Optional<RotationMetadata> rotationMetadata)
{
Id = id;
ItemPosition = itemPosition;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ namespace NitroxModel.DataStructures.GameLogic.Entities
{
public class UweWorldEntity
{
public TechType TechType { get; }
public NitroxTechType TechType { get; }
public NitroxVector3 Scale { get; }
public string ClassId { get; }
public string SlotType { get; }
public int CellLevel { get; }

public UweWorldEntity(TechType techType, NitroxVector3 scale, string classId, string slotType, int cellLevel)
public UweWorldEntity(NitroxTechType techType, NitroxVector3 scale, string classId, string slotType, int cellLevel)
{
TechType = techType;
Scale = scale;
Expand Down
6 changes: 3 additions & 3 deletions NitroxModel/DataStructures/GameLogic/Entity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class Entity
public NitroxTransform Transform { get; set; }

[ProtoMember(2)]
public TechType TechType { get; set; }
public NitroxTechType TechType { get; set; }

[ProtoMember(3)]
public NitroxId Id { get; set; }
Expand Down Expand Up @@ -66,7 +66,7 @@ public Entity()
// Default Constructor for serialization
}

public Entity(NitroxVector3 localPosition, NitroxQuaternion localRotation, NitroxVector3 scale, TechType techType, int level, string classId, bool spawnedByServer, NitroxId id, int? existingGameObjectChildIndex, Entity parentEntity = null)
public Entity(NitroxVector3 localPosition, NitroxQuaternion localRotation, NitroxVector3 scale, NitroxTechType techType, int level, string classId, bool spawnedByServer, NitroxId id, int? existingGameObjectChildIndex, Entity parentEntity = null)
{
Transform = new NitroxTransform(localPosition, localRotation, scale, this);
TechType = techType;
Expand All @@ -87,7 +87,7 @@ public Entity(NitroxVector3 localPosition, NitroxQuaternion localRotation, Nitro
}
}

public Entity(NitroxVector3 position, NitroxQuaternion rotation, NitroxVector3 scale, TechType techType, int level, string classId, bool spawnedByServer, NitroxId waterParkId, byte[] serializedGameObject, bool existsInGlobalRoot, NitroxId id)
public Entity(NitroxVector3 position, NitroxQuaternion rotation, NitroxVector3 scale, NitroxTechType techType, int level, string classId, bool spawnedByServer, NitroxId waterParkId, byte[] serializedGameObject, bool existsInGlobalRoot, NitroxId id)
{
Transform = new NitroxTransform(position, rotation, scale, this);
TechType = techType;
Expand Down
6 changes: 3 additions & 3 deletions NitroxModel/DataStructures/GameLogic/InitialPdaData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ namespace NitroxModel.DataStructures.GameLogic
[Serializable]
public class InitialPDAData
{
public List<TechType> UnlockedTechTypes { get; set; }
public List<TechType> KnownTechTypes { get; set; }
public List<NitroxTechType> UnlockedTechTypes { get; set; }
public List<NitroxTechType> KnownTechTypes { get; set; }
public List<string> EncyclopediaEntries { get; set; }
public List<PDAEntry> PartiallyUnlockedTechTypes { get; set; }
public List<PDALogEntry> PDALogEntries { get; set; }
Expand All @@ -17,7 +17,7 @@ public InitialPDAData()
// Constructor for serialization
}

public InitialPDAData(List<TechType> unlockedTechTypes, List<TechType> knownTechTypes, List<string> encyclopediaEntries, List<PDAEntry> partiallyUnlockedTechTypes, List<PDALogEntry> pdaLogEntries)
public InitialPDAData(List<NitroxTechType> unlockedTechTypes, List<NitroxTechType> knownTechTypes, List<string> encyclopediaEntries, List<PDAEntry> partiallyUnlockedTechTypes, List<PDALogEntry> pdaLogEntries)
{
UnlockedTechTypes = unlockedTechTypes;
KnownTechTypes = knownTechTypes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ public class InitialRemotePlayerData
public PlayerContext PlayerContext { get; set; }
public NitroxVector3 Position { get; set; }
public Optional<NitroxId> SubRootId { get; }
public List<TechType> EquippedTechTypes { get; }
public List<NitroxTechType> EquippedTechTypes { get; }

public InitialRemotePlayerData()
{
// Constructor for serialization
}

public InitialRemotePlayerData(PlayerContext playerContext, NitroxVector3 position, Optional<NitroxId> subRootId, List<TechType> equippedTechTypes)
public InitialRemotePlayerData(PlayerContext playerContext, NitroxVector3 position, Optional<NitroxId> subRootId, List<NitroxTechType> equippedTechTypes)
{
PlayerContext = playerContext;
Position = position;
Expand Down
4 changes: 2 additions & 2 deletions NitroxModel/DataStructures/GameLogic/ItemEquipment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ public class EquippedItemData : ItemData
public string Slot { get; }

[ProtoMember(2)]
public TechType TechType { get; }
public NitroxTechType TechType { get; }

public EquippedItemData()
{
// For serialization
}

public EquippedItemData(NitroxId containerId, NitroxId itemId, byte[] serializedData, string slot, TechType techType) : base(containerId, itemId, serializedData)
public EquippedItemData(NitroxId containerId, NitroxId itemId, byte[] serializedData, string slot, NitroxTechType techType) : base(containerId, itemId, serializedData)
{
Slot = slot;
TechType = techType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
using System.Collections.Generic;
using ProtoBufNet;

namespace NitroxModel.DataStructures
namespace NitroxModel.DataStructures.GameLogic
{
/*
* Shim tech type model to bridge the gap between original subnautica and BZ
*/
[ProtoContract]
[Serializable]
public class TechType
public class NitroxTechType
{
[ProtoMember(1)]
public string Name { get; set; }

public TechType()
public NitroxTechType()
{
// Serialization Constructor
}

public TechType(string name)
public NitroxTechType(string name)
{
Name = name;
}
Expand All @@ -31,7 +31,7 @@ public override string ToString()

public override bool Equals(object obj)
{
TechType type = obj as TechType;
NitroxTechType type = obj as NitroxTechType;

return !ReferenceEquals(type, null) &&
Name == type.Name;
Expand Down
4 changes: 2 additions & 2 deletions NitroxModel/DataStructures/GameLogic/PDAEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace NitroxModel.DataStructures.GameLogic
public class PDAEntry
{
[ProtoMember(1)]
public TechType TechType { get; set; }
public NitroxTechType TechType { get; set; }

[ProtoMember(2)]
public float Progress { get; set; }
Expand All @@ -21,7 +21,7 @@ public PDAEntry()
// Default Constructor for serialization
}

public PDAEntry(TechType techType, float progress, int unlocked)
public PDAEntry(NitroxTechType techType, float progress, int unlocked)
{
TechType = techType;
Progress = progress;
Expand Down
4 changes: 2 additions & 2 deletions NitroxModel/DataStructures/GameLogic/VehicleModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace NitroxModel.DataStructures.GameLogic
public class VehicleModel
{
[ProtoMember(1)]
public TechType TechType { get; }
public NitroxTechType TechType { get; }

[ProtoMember(2)]
public NitroxId Id { get; set; }
Expand Down Expand Up @@ -44,7 +44,7 @@ public VehicleModel()
DockingBayId = Optional.Empty;
}

public VehicleModel(TechType techType, NitroxId id, NitroxVector3 position, NitroxQuaternion rotation, IEnumerable<InteractiveChildObjectIdentifier> interactiveChildIdentifiers, Optional<NitroxId> dockingBayId, string name, NitroxVector3[] hsb, float health)
public VehicleModel(NitroxTechType techType, NitroxId id, NitroxVector3 position, NitroxQuaternion rotation, IEnumerable<InteractiveChildObjectIdentifier> interactiveChildIdentifiers, Optional<NitroxId> dockingBayId, string name, NitroxVector3[] hsb, float health)
{
TechType = techType;
Id = id;
Expand Down
4 changes: 2 additions & 2 deletions NitroxModel/DataStructures/GameLogic/VehicleMovementData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace NitroxModel.DataStructures.GameLogic
public class VehicleMovementData
{
[ProtoMember(1)]
public TechType TechType { get; }
public NitroxTechType TechType { get; }

[ProtoMember(2)]
public NitroxId Id { get; set; }
Expand Down Expand Up @@ -42,7 +42,7 @@ public VehicleMovementData()
// For serialization purposes
}

public VehicleMovementData(TechType techType, NitroxId id, NitroxVector3 position, NitroxQuaternion rotation, NitroxVector3 velocity, NitroxVector3 angularVelocity, float steeringWheelYaw, float steeringWheelPitch, bool appliedThrottle, float health)
public VehicleMovementData(NitroxTechType techType, NitroxId id, NitroxVector3 position, NitroxQuaternion rotation, NitroxVector3 velocity, NitroxVector3 angularVelocity, float steeringWheelYaw, float steeringWheelPitch, bool appliedThrottle, float health)
{
TechType = techType;
Id = id;
Expand Down
3 changes: 2 additions & 1 deletion NitroxModel/Helper/Map.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using NitroxModel.DataStructures;
using NitroxModel.DataStructures.GameLogic;

namespace NitroxModel.Helper
{
Expand All @@ -12,7 +13,7 @@ public abstract class Map
public abstract Int3 DimensionsInMeters { get; }
public abstract Int3 DimensionsInBatches { get; }
public abstract Int3 BatchDimensionCenter { get; }
public abstract List<TechType> GlobalRootTechTypes { get; }
public abstract List<NitroxTechType> GlobalRootTechTypes { get; }
public abstract int ItemLevelOfDetail { get; }
}
}
2 changes: 1 addition & 1 deletion NitroxModel/NitroxModel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@
<Compile Include="DataStructures\GameLogic\PowerType.cs" />
<Compile Include="DataStructures\GameLogic\NitroxQuaternion.cs" />
<Compile Include="DataStructures\GameLogic\NitroxVector3.cs" />
<Compile Include="DataStructures\GameLogic\NitroxTechType.cs" />
<Compile Include="DataStructures\NitroxId.cs" />
<Compile Include="DataStructures\Int3.cs" />
<Compile Include="DataStructures\Surrogates\SerializationSurrogate.cs" />
<Compile Include="DataStructures\TechType.cs" />
<Compile Include="DataStructures\ThreadSafeCollection.cs" />
<Compile Include="DataStructures\ThreadSafeDictionary.cs" />
<Compile Include="Discovery\InstallationFinders\EpicGamesInstallationFinder.cs" />
Expand Down
4 changes: 2 additions & 2 deletions NitroxModel/Packets/ConstructorBeginCrafting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class ConstructorBeginCrafting : Packet
{
public NitroxId ConstructorId { get; }
public NitroxId ConstructedItemId { get; }
public TechType TechType { get; }
public NitroxTechType TechType { get; }
public float Duration { get; }
public List<InteractiveChildObjectIdentifier> InteractiveChildIdentifiers { get; }
public NitroxVector3 Position { get; }
Expand All @@ -20,7 +20,7 @@ public class ConstructorBeginCrafting : Packet
public NitroxVector3[] HSB { get; }
public float Health { get; }

public ConstructorBeginCrafting(NitroxId constructorId, NitroxId constructeditemId, TechType techType, float duration, List<InteractiveChildObjectIdentifier> interactiveChildIdentifiers, NitroxVector3 position, NitroxQuaternion rotation,
public ConstructorBeginCrafting(NitroxId constructorId, NitroxId constructeditemId, NitroxTechType techType, float duration, List<InteractiveChildObjectIdentifier> interactiveChildIdentifiers, NitroxVector3 position, NitroxQuaternion rotation,
string name, NitroxVector3[] hsb, float health)
{
ConstructorId = constructorId;
Expand Down
Loading

0 comments on commit 5c28359

Please sign in to comment.