From ab1ae51ecec21b18d789188b17d78bddb4e321b4 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Fri, 11 Dec 2020 17:11:24 +0100 Subject: [PATCH] Update to Gamecraft 2020.11.30.16.02 --- GamecraftModdingAPI/Block.cs | 4 +- GamecraftModdingAPI/Blocks/BlockEngine.cs | 48 +++++++++++-------- GamecraftModdingAPI/Blocks/BlockIDs.cs | 4 ++ .../GamecraftModdingAPI.csproj | 42 ++-------------- GamecraftModdingAPI/Utility/FullGameFields.cs | 2 +- 5 files changed, 37 insertions(+), 63 deletions(-) diff --git a/GamecraftModdingAPI/Block.cs b/GamecraftModdingAPI/Block.cs index d0ff657..524847d 100644 --- a/GamecraftModdingAPI/Block.cs +++ b/GamecraftModdingAPI/Block.cs @@ -114,8 +114,8 @@ namespace GamecraftModdingAPI private static Dictionary> initializers = new Dictionary>(); - private static Dictionary typeToGroup = - new Dictionary + private static Dictionary typeToGroup = + new Dictionary { {typeof(ConsoleBlock), new[] {CommonExclusiveGroups.CONSOLE_BLOCK_GROUP}}, {typeof(LogicGate), new [] {CommonExclusiveGroups.LOGIC_BLOCK_GROUP}}, diff --git a/GamecraftModdingAPI/Blocks/BlockEngine.cs b/GamecraftModdingAPI/Blocks/BlockEngine.cs index 2da04a3..a365d54 100644 --- a/GamecraftModdingAPI/Blocks/BlockEngine.cs +++ b/GamecraftModdingAPI/Blocks/BlockEngine.cs @@ -178,37 +178,43 @@ namespace GamecraftModdingAPI.Blocks public SimBody[] GetSimBodiesFromID(byte id) { var ret = new FasterList(4); - if (!entitiesDB.HasAny(CommonExclusiveGroups.OBJID_BLOCK_GROUP)) - return new SimBody[0]; - var oids = entitiesDB.QueryEntities(CommonExclusiveGroups.OBJID_BLOCK_GROUP).ToBuffer(); - var connections = entitiesDB.QueryMappedEntities(CommonExclusiveGroups.OBJID_BLOCK_GROUP); - for (int i = 0; i < oids.count; i++) + var oide = entitiesDB.QueryEntities(); + EGIDMapper? connections = null; + foreach (var ((oids, count), _) in oide) { - ref ObjectIdEntityStruct oid = ref oids.buffer[i]; - if (oid.objectId != id) continue; - var rid = connections.Entity(oid.ID.entityID).machineRigidBodyId; - foreach (var rb in ret) - { - if (rb.Id.entityID == rid) - goto DUPLICATE; //Multiple Object Identifiers on one rigid body + for (int i = 0; i < count; i++) + { + ref ObjectIdEntityStruct oid = ref oids[i]; + if (oid.objectId != id) continue; + if (!connections.HasValue) //Would need reflection to get the group from the build group otherwise + connections = entitiesDB.QueryMappedEntities(oid.ID.groupID); + var rid = connections.Value.Entity(oid.ID.entityID).machineRigidBodyId; + foreach (var rb in ret) + { + if (rb.Id.entityID == rid) + goto DUPLICATE; //Multiple Object Identifiers on one rigid body + } + + ret.Add(new SimBody(rid)); + DUPLICATE: ; } - ret.Add(new SimBody(rid)); - DUPLICATE: ; } + return ret.ToArray(); } public ObjectIdentifier[] GetObjectIDsFromID(byte id, bool sim) { var ret = new FasterList(4); - if (!entitiesDB.HasAny(CommonExclusiveGroups.OBJID_BLOCK_GROUP)) - return new ObjectIdentifier[0]; - var oids = entitiesDB.QueryEntities(CommonExclusiveGroups.OBJID_BLOCK_GROUP).ToBuffer(); - for (int i = 0; i < oids.count; i++) + var oide = entitiesDB.QueryEntities(); + foreach (var ((oids, count), _) in oide) { - ref ObjectIdEntityStruct oid = ref oids.buffer[i]; - if (sim ? oid.simObjectId == id : oid.objectId == id) - ret.Add(new ObjectIdentifier(oid.ID)); + for (int i = 0; i < count; i++) + { + ref ObjectIdEntityStruct oid = ref oids[i]; + if (sim ? oid.simObjectId == id : oid.objectId == id) + ret.Add(new ObjectIdentifier(oid.ID)); + } } return ret.ToArray(); diff --git a/GamecraftModdingAPI/Blocks/BlockIDs.cs b/GamecraftModdingAPI/Blocks/BlockIDs.cs index 1d55b29..9591ae2 100644 --- a/GamecraftModdingAPI/Blocks/BlockIDs.cs +++ b/GamecraftModdingAPI/Blocks/BlockIDs.cs @@ -329,6 +329,10 @@ namespace GamecraftModdingAPI.Blocks UnlitGlowSlope, Fog, Sky, + GridCube, + GridSlicedCube, + GridSlope, + GridCorner, MagmaRockCube = 777, MagmaRockCubeSliced, MagmaRockSlope, diff --git a/GamecraftModdingAPI/GamecraftModdingAPI.csproj b/GamecraftModdingAPI/GamecraftModdingAPI.csproj index 3dabe64..c76ebd9 100644 --- a/GamecraftModdingAPI/GamecraftModdingAPI.csproj +++ b/GamecraftModdingAPI/GamecraftModdingAPI.csproj @@ -618,34 +618,6 @@ ..\ref\Gamecraft_Data\Managed\Unity.Addressables.dll ..\..\ref\Gamecraft_Data\Managed\Unity.Addressables.dll - - ..\ref\Gamecraft_Data\Managed\Unity.Animation.Curves.dll - ..\..\ref\Gamecraft_Data\Managed\Unity.Animation.Curves.dll - - - ..\ref\Gamecraft_Data\Managed\Unity.Animation.Curves.Hybrid.dll - ..\..\ref\Gamecraft_Data\Managed\Unity.Animation.Curves.Hybrid.dll - - - ..\ref\Gamecraft_Data\Managed\Unity.Animation.DefaultGraphPipeline.dll - ..\..\ref\Gamecraft_Data\Managed\Unity.Animation.DefaultGraphPipeline.dll - - - ..\ref\Gamecraft_Data\Managed\Unity.Animation.DefaultGraphPipeline.Hybrid.dll - ..\..\ref\Gamecraft_Data\Managed\Unity.Animation.DefaultGraphPipeline.Hybrid.dll - - - ..\ref\Gamecraft_Data\Managed\Unity.Animation.dll - ..\..\ref\Gamecraft_Data\Managed\Unity.Animation.dll - - - ..\ref\Gamecraft_Data\Managed\Unity.Animation.Graph.dll - ..\..\ref\Gamecraft_Data\Managed\Unity.Animation.Graph.dll - - - ..\ref\Gamecraft_Data\Managed\Unity.Animation.Hybrid.dll - ..\..\ref\Gamecraft_Data\Managed\Unity.Animation.Hybrid.dll - ..\ref\Gamecraft_Data\Managed\Unity.Build.SlimPlayerRuntime.dll ..\..\ref\Gamecraft_Data\Managed\Unity.Build.SlimPlayerRuntime.dll @@ -666,10 +638,6 @@ ..\ref\Gamecraft_Data\Managed\Unity.Collections.LowLevel.ILSupport.dll ..\..\ref\Gamecraft_Data\Managed\Unity.Collections.LowLevel.ILSupport.dll - - ..\ref\Gamecraft_Data\Managed\Unity.DataFlowGraph.dll - ..\..\ref\Gamecraft_Data\Managed\Unity.DataFlowGraph.dll - ..\ref\Gamecraft_Data\Managed\Unity.Deformations.dll ..\..\ref\Gamecraft_Data\Managed\Unity.Deformations.dll @@ -682,9 +650,9 @@ ..\ref\Gamecraft_Data\Managed\Unity.Entities.Hybrid.dll ..\..\ref\Gamecraft_Data\Managed\Unity.Entities.Hybrid.dll - - ..\ref\Gamecraft_Data\Managed\Unity.InternalAPIEngineBridge.002.dll - ..\..\ref\Gamecraft_Data\Managed\Unity.InternalAPIEngineBridge.002.dll + + ..\ref\Gamecraft_Data\Managed\Unity.InternalAPIEngineBridge.012.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.InternalAPIEngineBridge.012.dll ..\ref\Gamecraft_Data\Managed\Unity.Jobs.dll @@ -718,10 +686,6 @@ ..\ref\Gamecraft_Data\Managed\Unity.Platforms.Common.dll ..\..\ref\Gamecraft_Data\Managed\Unity.Platforms.Common.dll - - ..\ref\Gamecraft_Data\Managed\Unity.Postprocessing.Runtime.dll - ..\..\ref\Gamecraft_Data\Managed\Unity.Postprocessing.Runtime.dll - ..\ref\Gamecraft_Data\Managed\Unity.Properties.dll ..\..\ref\Gamecraft_Data\Managed\Unity.Properties.dll diff --git a/GamecraftModdingAPI/Utility/FullGameFields.cs b/GamecraftModdingAPI/Utility/FullGameFields.cs index 432103d..ccf80de 100644 --- a/GamecraftModdingAPI/Utility/FullGameFields.cs +++ b/GamecraftModdingAPI/Utility/FullGameFields.cs @@ -14,7 +14,7 @@ using RobocraftX.Rendering; using Svelto.Context; using Svelto.DataStructures; using Svelto.ECS; -using Svelto.ECS.Schedulers.Unity; +using Svelto.ECS.Schedulers; using UnityEngine; using Unity.Entities; using Unity.Physics.Systems;