From bf08b617884b7760b423d89afc0aab13f0797655 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Sun, 8 Oct 2023 01:55:50 +0200 Subject: [PATCH] Fix an issue with the new generator, switch to using entity references --- CodeGenerator/CodeGenerator.csproj | 2 +- CodeGenerator/ECSAnalyzer.cs | 8 +- CodeGenerator/Program.cs | 3 +- .../App/GameBuildSimEventEngine.cs | 2 +- TechbloxModdingAPI/Block.cs | 2 +- TechbloxModdingAPI/BlockGroup.cs | 2 +- .../Blocks/Engines/BlockCloneEngine.cs | 4 +- .../Blocks/Engines/BlockEngine.cs | 3 +- .../Blocks/Engines/MovementEngine.cs | 2 +- .../Blocks/Engines/PlacementEngine.cs | 2 +- .../Blocks/Engines/RemovalEngine.cs | 4 +- .../Blocks/Engines/RotationEngine.cs | 4 +- .../Blocks/Engines/ScalingEngine.cs | 4 +- TechbloxModdingAPI/Blocks/Wire.cs | 6 +- TechbloxModdingAPI/Client/App/ClientEngine.cs | 2 +- .../Client/Game/ClientMachine.cs | 2 +- TechbloxModdingAPI/Cluster.cs | 1 + .../Commands/ICustomCommandEngine.cs | 2 +- TechbloxModdingAPI/Common/EcsObjectBase.cs | 128 ++++++++++-------- .../Common/EcsObjectBaseEngine.cs | 26 ++++ .../Common/{ => Engines}/IApiEngine.cs | 2 +- .../Common/{ => Engines}/INamedApiEngine.cs | 2 +- .../Common/Engines/IReactionaryEngine.cs | 2 +- .../Common/Utils/AsyncUtilsEngine.cs | 2 +- TechbloxModdingAPI/Input/FakeInputEngine.cs | 2 +- TechbloxModdingAPI/Player.cs | 2 +- .../Players/PlayerEventsEngine.cs | 2 +- TechbloxModdingAPI/SimBody.cs | 3 +- .../Utility/DebugInterfaceEngine.cs | 2 +- .../Utility/ECS/ManagedApiExtensions.cs | 1 + .../Utility/ECS/NativeApiExtensions.cs | 2 +- TechbloxModdingAPI/Utility/GameStateEngine.cs | 2 +- TechbloxModdingAPI/Utility/OptionalRef.cs | 1 + 33 files changed, 133 insertions(+), 101 deletions(-) create mode 100644 TechbloxModdingAPI/Common/EcsObjectBaseEngine.cs rename TechbloxModdingAPI/Common/{ => Engines}/IApiEngine.cs (81%) rename TechbloxModdingAPI/Common/{ => Engines}/INamedApiEngine.cs (75%) diff --git a/CodeGenerator/CodeGenerator.csproj b/CodeGenerator/CodeGenerator.csproj index 6952a6f..a0b928d 100644 --- a/CodeGenerator/CodeGenerator.csproj +++ b/CodeGenerator/CodeGenerator.csproj @@ -8,7 +8,7 @@ https://git.exmods.org/modtainers/GamecraftModdingAPI en-CA true - 9 + latest Exe diff --git a/CodeGenerator/ECSAnalyzer.cs b/CodeGenerator/ECSAnalyzer.cs index b1de381..f513792 100644 --- a/CodeGenerator/ECSAnalyzer.cs +++ b/CodeGenerator/ECSAnalyzer.cs @@ -5,21 +5,23 @@ using System.Linq; using System.Linq.Expressions; using System.Reflection; using Gamecraft.Tweaks; +using HarmonyLib; using Svelto.ECS; namespace CodeGenerator { - public class ECSAnalyzer + public static class ECSAnalyzer { public static ECSClassInfo AnalyzeEntityDescriptor(Type entityDescriptorType) { // TODO: Add support for creating/deleting entities (getting an up to date server/client engines root) var templateType = typeof(EntityDescriptorTemplate<>).MakeGenericType(entityDescriptorType); - var getTemplateClass = Expression.Constant(templateType); - var getDescriptorExpr = Expression.PropertyOrField(getTemplateClass, "descriptor"); + var templateDescriptor = AccessTools.Property(templateType, "descriptor"); + var getDescriptorExpr = Expression.MakeMemberAccess(null, templateDescriptor ?? throw new InvalidOperationException()); var getTemplateDescriptorExpr = Expression.Lambda>(getDescriptorExpr); var getTemplateDescriptor = getTemplateDescriptorExpr.Compile(); + // TODO: Crashes on constructing the descriptor type. Maybe move the analysis part to a mod. var builders = getTemplateDescriptor().componentsToBuild; return new ECSClassInfo { diff --git a/CodeGenerator/Program.cs b/CodeGenerator/Program.cs index 8d870e3..ae3bc4d 100644 --- a/CodeGenerator/Program.cs +++ b/CodeGenerator/Program.cs @@ -15,7 +15,8 @@ namespace CodeGenerator { public static void Main(string[] args) { - GenerateBlockClasses(); + //GenerateBlockClasses(); + ECSClassGenerator.Generate(typeof(EngineBlockEntityDescriptor)); } private static void GenerateBlockClasses() diff --git a/TechbloxModdingAPI/App/GameBuildSimEventEngine.cs b/TechbloxModdingAPI/App/GameBuildSimEventEngine.cs index 86deed2..a7ceeda 100644 --- a/TechbloxModdingAPI/App/GameBuildSimEventEngine.cs +++ b/TechbloxModdingAPI/App/GameBuildSimEventEngine.cs @@ -1,6 +1,6 @@ using RobocraftX.StateSync; using Svelto.ECS; -using TechbloxModdingAPI.Common; +using TechbloxModdingAPI.Common.Engines; using Unity.Jobs; using TechbloxModdingAPI.Utility; diff --git a/TechbloxModdingAPI/Block.cs b/TechbloxModdingAPI/Block.cs index 291f8d6..7bfb6a9 100644 --- a/TechbloxModdingAPI/Block.cs +++ b/TechbloxModdingAPI/Block.cs @@ -8,13 +8,13 @@ using Svelto.ECS.EntityStructs; using RobocraftX.Common; using RobocraftX.Blocks; using Unity.Mathematics; -using HarmonyLib; using RobocraftX.PilotSeat; using RobocraftX.Rendering; using Techblox.BlockLabelsServer; using TechbloxModdingAPI.Blocks; using TechbloxModdingAPI.Blocks.Engines; using TechbloxModdingAPI.Client.App; +using TechbloxModdingAPI.Common; using TechbloxModdingAPI.Common.Engines; using TechbloxModdingAPI.Tests; using TechbloxModdingAPI.Utility; diff --git a/TechbloxModdingAPI/BlockGroup.cs b/TechbloxModdingAPI/BlockGroup.cs index 0629c6b..5ed1662 100644 --- a/TechbloxModdingAPI/BlockGroup.cs +++ b/TechbloxModdingAPI/BlockGroup.cs @@ -9,8 +9,8 @@ using UnityEngine; using TechbloxModdingAPI.Blocks; using TechbloxModdingAPI.Blocks.Engines; +using TechbloxModdingAPI.Common; using TechbloxModdingAPI.Common.Engines; -using TechbloxModdingAPI.Utility; namespace TechbloxModdingAPI { diff --git a/TechbloxModdingAPI/Blocks/Engines/BlockCloneEngine.cs b/TechbloxModdingAPI/Blocks/Engines/BlockCloneEngine.cs index 35acd2a..86ccc96 100644 --- a/TechbloxModdingAPI/Blocks/Engines/BlockCloneEngine.cs +++ b/TechbloxModdingAPI/Blocks/Engines/BlockCloneEngine.cs @@ -5,11 +5,9 @@ using Gamecraft.Wires; using HarmonyLib; using RobocraftX.Blocks; using RobocraftX.Character; -using RobocraftX.Common; using Svelto.DataStructures; using Svelto.ECS; -using TechbloxModdingAPI.Common; -using TechbloxModdingAPI.Engines; +using TechbloxModdingAPI.Common.Engines; namespace TechbloxModdingAPI.Blocks.Engines { diff --git a/TechbloxModdingAPI/Blocks/Engines/BlockEngine.cs b/TechbloxModdingAPI/Blocks/Engines/BlockEngine.cs index c98e69c..c784fc2 100644 --- a/TechbloxModdingAPI/Blocks/Engines/BlockEngine.cs +++ b/TechbloxModdingAPI/Blocks/Engines/BlockEngine.cs @@ -18,9 +18,8 @@ using Svelto.ECS.Hybrid; using Techblox.BuildingDrone; using Techblox.ObjectIDBlockServer; using TechbloxModdingAPI.Common; +using TechbloxModdingAPI.Common.Engines; using Unity.Mathematics; - -using TechbloxModdingAPI.Engines; using TechbloxModdingAPI.Utility; using TechbloxModdingAPI.Utility.ECS; using PrefabsID = RobocraftX.Common.PrefabsID; diff --git a/TechbloxModdingAPI/Blocks/Engines/MovementEngine.cs b/TechbloxModdingAPI/Blocks/Engines/MovementEngine.cs index c60b2d5..24bcd7d 100644 --- a/TechbloxModdingAPI/Blocks/Engines/MovementEngine.cs +++ b/TechbloxModdingAPI/Blocks/Engines/MovementEngine.cs @@ -2,7 +2,7 @@ using RobocraftX.DOTS; using Svelto.ECS; using Svelto.ECS.EntityStructs; -using TechbloxModdingAPI.Common; +using TechbloxModdingAPI.Common.Engines; using Unity.Mathematics; using Unity.Transforms; using TechbloxModdingAPI.Utility; diff --git a/TechbloxModdingAPI/Blocks/Engines/PlacementEngine.cs b/TechbloxModdingAPI/Blocks/Engines/PlacementEngine.cs index 6dbcdbb..b340b63 100644 --- a/TechbloxModdingAPI/Blocks/Engines/PlacementEngine.cs +++ b/TechbloxModdingAPI/Blocks/Engines/PlacementEngine.cs @@ -12,7 +12,7 @@ using RobocraftX.Rendering; using RobocraftX.Rendering.GPUI; using Svelto.ECS; using Svelto.ECS.EntityStructs; -using TechbloxModdingAPI.Common; +using TechbloxModdingAPI.Common.Engines; using Unity.Mathematics; using TechbloxModdingAPI.Utility; using TechbloxModdingAPI.Utility.ECS; diff --git a/TechbloxModdingAPI/Blocks/Engines/RemovalEngine.cs b/TechbloxModdingAPI/Blocks/Engines/RemovalEngine.cs index bdb705b..fa14e9b 100644 --- a/TechbloxModdingAPI/Blocks/Engines/RemovalEngine.cs +++ b/TechbloxModdingAPI/Blocks/Engines/RemovalEngine.cs @@ -9,12 +9,10 @@ using RobocraftX.StateSync; using Svelto.ECS; using Svelto.ECS.Native; using Techblox.Blocks.Connections; -using TechbloxModdingAPI.Common; +using TechbloxModdingAPI.Common.Engines; using Unity.Collections; using Unity.Jobs; using Allocator = Unity.Collections.Allocator; - -using TechbloxModdingAPI.Engines; using TechbloxModdingAPI.Utility; namespace TechbloxModdingAPI.Blocks.Engines diff --git a/TechbloxModdingAPI/Blocks/Engines/RotationEngine.cs b/TechbloxModdingAPI/Blocks/Engines/RotationEngine.cs index c079394..8fae547 100644 --- a/TechbloxModdingAPI/Blocks/Engines/RotationEngine.cs +++ b/TechbloxModdingAPI/Blocks/Engines/RotationEngine.cs @@ -2,11 +2,9 @@ using RobocraftX.DOTS; using Svelto.ECS; using Svelto.ECS.EntityStructs; -using TechbloxModdingAPI.Common; +using TechbloxModdingAPI.Common.Engines; using Unity.Mathematics; using UnityEngine; - -using TechbloxModdingAPI.Engines; using TechbloxModdingAPI.Utility; using TechbloxModdingAPI.Utility.ECS; diff --git a/TechbloxModdingAPI/Blocks/Engines/ScalingEngine.cs b/TechbloxModdingAPI/Blocks/Engines/ScalingEngine.cs index 45e5f62..41a96a6 100644 --- a/TechbloxModdingAPI/Blocks/Engines/ScalingEngine.cs +++ b/TechbloxModdingAPI/Blocks/Engines/ScalingEngine.cs @@ -4,10 +4,8 @@ using HarmonyLib; using RobocraftX.Common; using RobocraftX.DOTS; using Svelto.ECS; -using TechbloxModdingAPI.Common; +using TechbloxModdingAPI.Common.Engines; using Unity.Entities; - -using TechbloxModdingAPI.Engines; using TechbloxModdingAPI.Utility; namespace TechbloxModdingAPI.Blocks.Engines diff --git a/TechbloxModdingAPI/Blocks/Wire.cs b/TechbloxModdingAPI/Blocks/Wire.cs index 9be1cc7..740883d 100644 --- a/TechbloxModdingAPI/Blocks/Wire.cs +++ b/TechbloxModdingAPI/Blocks/Wire.cs @@ -1,11 +1,7 @@ -using System; - using Gamecraft.Wires; using Svelto.ECS; -using Svelto.ECS.Experimental; - using TechbloxModdingAPI.Blocks.Engines; -using TechbloxModdingAPI.Utility; +using TechbloxModdingAPI.Common; namespace TechbloxModdingAPI.Blocks { diff --git a/TechbloxModdingAPI/Client/App/ClientEngine.cs b/TechbloxModdingAPI/Client/App/ClientEngine.cs index 68989f7..0c173cb 100644 --- a/TechbloxModdingAPI/Client/App/ClientEngine.cs +++ b/TechbloxModdingAPI/Client/App/ClientEngine.cs @@ -3,7 +3,7 @@ using RobocraftX.Multiplayer; using Svelto.ECS; using Techblox.GameSelection; using TechbloxModdingAPI.Client.Game; -using TechbloxModdingAPI.Common; +using TechbloxModdingAPI.Common.Engines; using TechbloxModdingAPI.Utility; namespace TechbloxModdingAPI.Client.App; diff --git a/TechbloxModdingAPI/Client/Game/ClientMachine.cs b/TechbloxModdingAPI/Client/Game/ClientMachine.cs index a546dce..ea36dfe 100644 --- a/TechbloxModdingAPI/Client/Game/ClientMachine.cs +++ b/TechbloxModdingAPI/Client/Game/ClientMachine.cs @@ -1,6 +1,6 @@ -using System; using RobocraftX.GUI.MyGamesScreen; using Svelto.ECS; +using TechbloxModdingAPI.Common; namespace TechbloxModdingAPI.Client.Game; diff --git a/TechbloxModdingAPI/Cluster.cs b/TechbloxModdingAPI/Cluster.cs index f6d9745..f784878 100644 --- a/TechbloxModdingAPI/Cluster.cs +++ b/TechbloxModdingAPI/Cluster.cs @@ -1,6 +1,7 @@ using Svelto.ECS; using Techblox.Destruction; using Techblox.TimeRunning.Clusters; +using TechbloxModdingAPI.Common; namespace TechbloxModdingAPI { diff --git a/TechbloxModdingAPI/Commands/ICustomCommandEngine.cs b/TechbloxModdingAPI/Commands/ICustomCommandEngine.cs index 4f71923..a682a8b 100644 --- a/TechbloxModdingAPI/Commands/ICustomCommandEngine.cs +++ b/TechbloxModdingAPI/Commands/ICustomCommandEngine.cs @@ -1,4 +1,4 @@ -using TechbloxModdingAPI.Common; +using TechbloxModdingAPI.Common.Engines; namespace TechbloxModdingAPI.Commands { diff --git a/TechbloxModdingAPI/Common/EcsObjectBase.cs b/TechbloxModdingAPI/Common/EcsObjectBase.cs index c0f8c80..1ee545c 100644 --- a/TechbloxModdingAPI/Common/EcsObjectBase.cs +++ b/TechbloxModdingAPI/Common/EcsObjectBase.cs @@ -1,81 +1,95 @@ using System; using System.Collections.Generic; -using System.Linq.Expressions; using Svelto.DataStructures; using Svelto.ECS; using Svelto.ECS.Internal; +using TechbloxModdingAPI.Common.Engines; using TechbloxModdingAPI.Common.Utils; using TechbloxModdingAPI.Utility; -namespace TechbloxModdingAPI +namespace TechbloxModdingAPI.Common; + +public abstract class EcsObjectBase { - public abstract class EcsObjectBase - { - public EGID Id { get; } + public EGID Id => _engine.GetEgid(Reference); + /// + /// A reference to a specific entity that persists through group swaps and such. + /// May be an invalid reference, in that case operations do not have any effect. + /// + public EntityReference Reference { get; } - private static readonly Dictionary> _instances = new(); + private static readonly Dictionary> _instances = new(); + private static readonly EcsObjectBaseEngine _engine = new(); - internal static WeakDictionary GetInstances(Type type) + private static WeakDictionary GetInstances(Type type) + { + return _instances.TryGetValue(type, out var dict) ? dict : null; + } + + /// + /// Returns a cached instance if there's an actively used instance of the object already. + /// Objects still get garbage collected and then they will be removed from the cache. + /// + /// The EGID of the entity + /// The constructor to construct the object + /// The object type + /// + internal static T GetInstance(EGID egid, Func constructor, Type type = null) where T : EcsObjectBase + { + var instances = GetInstances(type ?? typeof(T)); + if (instances == null || !instances.TryGetValue(_engine.GetEntityReference(egid), out var instance)) + return constructor(egid); // It will be added by the constructor + return (T)instance; + } + + protected EcsObjectBase(EGID id, Type entityDescriptorType) : this(_engine.GetEntityReference(id), entityDescriptorType) + { + } + + protected EcsObjectBase(EntityReference reference, Type entityDescriptorType) + { + if (!_instances.TryGetValue(GetType(), out var dict)) { - return _instances.TryGetValue(type, out var dict) ? dict : null; + dict = new(); + _instances.Add(GetType(), dict); } + if (!dict.ContainsKey(reference)) // Multiple instances may be created + dict.Add(reference, this); + Reference = reference; + } - /// - /// Returns a cached instance if there's an actively used instance of the object already. - /// Objects still get garbage collected and then they will be removed from the cache. - /// - /// The EGID of the entity - /// The constructor to construct the object - /// The object type - /// - internal static T GetInstance(EGID egid, Func constructor, Type type = null) where T : EcsObjectBase - { - var instances = GetInstances(type ?? typeof(T)); - if (instances == null || !instances.TryGetValue(egid, out var instance)) - return constructor(egid); // It will be added by the constructor - return (T)instance; - } + #region ECS initializer stuff - protected EcsObjectBase(EGID id, Type entityDescriptorType) - { - if (!_instances.TryGetValue(GetType(), out var dict)) - { - dict = new WeakDictionary(); - _instances.Add(GetType(), dict); - } - if (!dict.ContainsKey(id)) // Multiple instances may be created - dict.Add(id, this); - Id = id; - } + protected internal EcsInitData InitData; - #region ECS initializer stuff + /// + /// Holds information needed to construct a component initializer. + /// Necessary because the initializer is a ref struct which cannot be assigned to a field. + /// + protected internal struct EcsInitData + { + private FasterDictionary group; + private EntityReference reference; - protected internal EcsInitData InitData; + public static implicit operator EcsInitData(EntityInitializer initializer) => new() + { group = GetInitGroup(initializer), reference = initializer.reference }; - /// - /// Holds information needed to construct a component initializer. - /// Necessary because the initializer is a ref struct which cannot be assigned to a field. - /// - protected internal struct EcsInitData - { - private FasterDictionary group; - private EntityReference reference; + public EntityInitializer Initializer(EGID id) => new(id, group, reference); + public bool Valid => group != null; + } - public static implicit operator EcsInitData(EntityInitializer initializer) => new() - { group = GetInitGroup(initializer), reference = initializer.reference }; + private delegate FasterDictionary GetInitGroupFunc( + EntityInitializer initializer); - public EntityInitializer Initializer(EGID id) => new(id, group, reference); - public bool Valid => group != null; - } + /// + /// Accesses the group field of the initializer + /// + private static readonly GetInitGroupFunc GetInitGroup = Reflections.CreateAccessor("_group"); - private delegate FasterDictionary GetInitGroupFunc( - EntityInitializer initializer); + #endregion - /// - /// Accesses the group field of the initializer - /// - private static readonly GetInitGroupFunc GetInitGroup = Reflections.CreateAccessor("_group"); - - #endregion + public static void Init() + { + EngineManager.AddEngine(_engine, ApiEngineType.Build, ApiEngineType.Menu, ApiEngineType.PlayClient, ApiEngineType.PlayServer); } } \ No newline at end of file diff --git a/TechbloxModdingAPI/Common/EcsObjectBaseEngine.cs b/TechbloxModdingAPI/Common/EcsObjectBaseEngine.cs new file mode 100644 index 0000000..9e8667b --- /dev/null +++ b/TechbloxModdingAPI/Common/EcsObjectBaseEngine.cs @@ -0,0 +1,26 @@ +using Svelto.ECS; +using TechbloxModdingAPI.Common.Engines; + +namespace TechbloxModdingAPI.Common; + +public class EcsObjectBaseEngine : IApiEngine +{ + public void Ready() + { + } + + public EntitiesDB entitiesDB { get; set; } + public void Dispose() + { + } + + public EntityReference GetEntityReference(EGID egid) + { + return entitiesDB is not null && egid != default ? egid.ToEntityReference(entitiesDB) : EntityReference.Invalid; + } + + public EGID GetEgid(EntityReference reference) + { + return entitiesDB is not null && reference.ToEGID(entitiesDB, out var egid) ? egid : default; + } +} \ No newline at end of file diff --git a/TechbloxModdingAPI/Common/IApiEngine.cs b/TechbloxModdingAPI/Common/Engines/IApiEngine.cs similarity index 81% rename from TechbloxModdingAPI/Common/IApiEngine.cs rename to TechbloxModdingAPI/Common/Engines/IApiEngine.cs index 2901ea6..708fb52 100644 --- a/TechbloxModdingAPI/Common/IApiEngine.cs +++ b/TechbloxModdingAPI/Common/Engines/IApiEngine.cs @@ -1,7 +1,7 @@ using System; using Svelto.ECS; -namespace TechbloxModdingAPI.Common; +namespace TechbloxModdingAPI.Common.Engines; /// /// Base engine interface used by all TechbloxModdingAPI engines diff --git a/TechbloxModdingAPI/Common/INamedApiEngine.cs b/TechbloxModdingAPI/Common/Engines/INamedApiEngine.cs similarity index 75% rename from TechbloxModdingAPI/Common/INamedApiEngine.cs rename to TechbloxModdingAPI/Common/Engines/INamedApiEngine.cs index 82a5b1c..86a8f98 100644 --- a/TechbloxModdingAPI/Common/INamedApiEngine.cs +++ b/TechbloxModdingAPI/Common/Engines/INamedApiEngine.cs @@ -1,4 +1,4 @@ -namespace TechbloxModdingAPI.Common; +namespace TechbloxModdingAPI.Common.Engines; public interface INamedApiEngine : IApiEngine { diff --git a/TechbloxModdingAPI/Common/Engines/IReactionaryEngine.cs b/TechbloxModdingAPI/Common/Engines/IReactionaryEngine.cs index 9221b61..cfaeed3 100644 --- a/TechbloxModdingAPI/Common/Engines/IReactionaryEngine.cs +++ b/TechbloxModdingAPI/Common/Engines/IReactionaryEngine.cs @@ -1,5 +1,5 @@ using Svelto.ECS; -using TechbloxModdingAPI.Common; +using TechbloxModdingAPI.Common.Engines; namespace TechbloxModdingAPI.Engines { diff --git a/TechbloxModdingAPI/Common/Utils/AsyncUtilsEngine.cs b/TechbloxModdingAPI/Common/Utils/AsyncUtilsEngine.cs index 2cb685b..2ea8ac0 100644 --- a/TechbloxModdingAPI/Common/Utils/AsyncUtilsEngine.cs +++ b/TechbloxModdingAPI/Common/Utils/AsyncUtilsEngine.cs @@ -1,9 +1,9 @@ using System.Collections; using System.Threading.Tasks; -using RobocraftX.Schedulers; using Svelto.ECS; using Svelto.Tasks; using Svelto.Tasks.ExtraLean; +using TechbloxModdingAPI.Common.Engines; namespace TechbloxModdingAPI.Common.Utils; diff --git a/TechbloxModdingAPI/Input/FakeInputEngine.cs b/TechbloxModdingAPI/Input/FakeInputEngine.cs index b406b2a..7615d49 100644 --- a/TechbloxModdingAPI/Input/FakeInputEngine.cs +++ b/TechbloxModdingAPI/Input/FakeInputEngine.cs @@ -2,7 +2,7 @@ using RobocraftX.Common.Input; using RobocraftX.Players; using Svelto.ECS; -using TechbloxModdingAPI.Common; +using TechbloxModdingAPI.Common.Engines; namespace TechbloxModdingAPI.Input { diff --git a/TechbloxModdingAPI/Player.cs b/TechbloxModdingAPI/Player.cs index c09b8f5..6e645a2 100644 --- a/TechbloxModdingAPI/Player.cs +++ b/TechbloxModdingAPI/Player.cs @@ -13,9 +13,9 @@ using Techblox.Camera; using Techblox.Character; using TechbloxModdingAPI.Blocks; using TechbloxModdingAPI.Client.App; +using TechbloxModdingAPI.Common; using TechbloxModdingAPI.Common.Engines; using TechbloxModdingAPI.Players; -using TechbloxModdingAPI.Utility; using UnityEngine; namespace TechbloxModdingAPI diff --git a/TechbloxModdingAPI/Players/PlayerEventsEngine.cs b/TechbloxModdingAPI/Players/PlayerEventsEngine.cs index 797d7c0..2b62f77 100644 --- a/TechbloxModdingAPI/Players/PlayerEventsEngine.cs +++ b/TechbloxModdingAPI/Players/PlayerEventsEngine.cs @@ -2,7 +2,7 @@ using RobocraftX.Character; using RobocraftX.Character.Movement; using RobocraftX.Common.Input; using Svelto.ECS; -using TechbloxModdingAPI.Common; +using TechbloxModdingAPI.Common.Engines; namespace TechbloxModdingAPI.Players { diff --git a/TechbloxModdingAPI/SimBody.cs b/TechbloxModdingAPI/SimBody.cs index 396d470..31227df 100644 --- a/TechbloxModdingAPI/SimBody.cs +++ b/TechbloxModdingAPI/SimBody.cs @@ -2,11 +2,10 @@ using Svelto.ECS; using Unity.Mathematics; using UnityEngine; - -using Gamecraft.Damage; using RobocraftX.Common; using RobocraftX.Physics; using Techblox.TimeRunning.Clusters; +using TechbloxModdingAPI.Common; namespace TechbloxModdingAPI { diff --git a/TechbloxModdingAPI/Utility/DebugInterfaceEngine.cs b/TechbloxModdingAPI/Utility/DebugInterfaceEngine.cs index 5633bc0..352623c 100644 --- a/TechbloxModdingAPI/Utility/DebugInterfaceEngine.cs +++ b/TechbloxModdingAPI/Utility/DebugInterfaceEngine.cs @@ -5,7 +5,7 @@ using System.Reflection.Emit; using System.Text; using HarmonyLib; using Svelto.ECS; -using TechbloxModdingAPI.Common; +using TechbloxModdingAPI.Common.Engines; namespace TechbloxModdingAPI.Utility { diff --git a/TechbloxModdingAPI/Utility/ECS/ManagedApiExtensions.cs b/TechbloxModdingAPI/Utility/ECS/ManagedApiExtensions.cs index e689666..8ebe6b4 100644 --- a/TechbloxModdingAPI/Utility/ECS/ManagedApiExtensions.cs +++ b/TechbloxModdingAPI/Utility/ECS/ManagedApiExtensions.cs @@ -1,5 +1,6 @@ using Svelto.ECS; using Svelto.ECS.Hybrid; +using TechbloxModdingAPI.Common; namespace TechbloxModdingAPI.Utility.ECS { diff --git a/TechbloxModdingAPI/Utility/ECS/NativeApiExtensions.cs b/TechbloxModdingAPI/Utility/ECS/NativeApiExtensions.cs index 9cd0b64..8b6d9f0 100644 --- a/TechbloxModdingAPI/Utility/ECS/NativeApiExtensions.cs +++ b/TechbloxModdingAPI/Utility/ECS/NativeApiExtensions.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; -using Svelto.DataStructures; using Svelto.ECS; using Svelto.Tasks; using Svelto.Tasks.Lean; +using TechbloxModdingAPI.Common; using TechbloxModdingAPI.Tasks; namespace TechbloxModdingAPI.Utility.ECS diff --git a/TechbloxModdingAPI/Utility/GameStateEngine.cs b/TechbloxModdingAPI/Utility/GameStateEngine.cs index 0f2e385..272785e 100644 --- a/TechbloxModdingAPI/Utility/GameStateEngine.cs +++ b/TechbloxModdingAPI/Utility/GameStateEngine.cs @@ -1,6 +1,6 @@ using Svelto.ECS; using RobocraftX.SimulationModeState; -using TechbloxModdingAPI.Common; +using TechbloxModdingAPI.Common.Engines; namespace TechbloxModdingAPI.Utility { diff --git a/TechbloxModdingAPI/Utility/OptionalRef.cs b/TechbloxModdingAPI/Utility/OptionalRef.cs index 4e3325b..bf4886c 100644 --- a/TechbloxModdingAPI/Utility/OptionalRef.cs +++ b/TechbloxModdingAPI/Utility/OptionalRef.cs @@ -1,6 +1,7 @@ using System; using Svelto.DataStructures; using Svelto.ECS; +using TechbloxModdingAPI.Common; namespace TechbloxModdingAPI.Utility {