Update to Gamecraft 2020.11.30.16.02

This commit is contained in:
Norbi Peti 2020-12-11 17:11:24 +01:00
parent fad3b5cbf4
commit ab1ae51ece
5 changed files with 37 additions and 63 deletions

View file

@ -114,8 +114,8 @@ namespace GamecraftModdingAPI
private static Dictionary<Type, Func<EGID, Block>> initializers = new Dictionary<Type, Func<EGID, Block>>(); private static Dictionary<Type, Func<EGID, Block>> initializers = new Dictionary<Type, Func<EGID, Block>>();
private static Dictionary<Type, ExclusiveGroupStruct[]> typeToGroup = private static Dictionary<Type, ExclusiveBuildGroup[]> typeToGroup =
new Dictionary<Type, ExclusiveGroupStruct[]> new Dictionary<Type, ExclusiveBuildGroup[]>
{ {
{typeof(ConsoleBlock), new[] {CommonExclusiveGroups.CONSOLE_BLOCK_GROUP}}, {typeof(ConsoleBlock), new[] {CommonExclusiveGroups.CONSOLE_BLOCK_GROUP}},
{typeof(LogicGate), new [] {CommonExclusiveGroups.LOGIC_BLOCK_GROUP}}, {typeof(LogicGate), new [] {CommonExclusiveGroups.LOGIC_BLOCK_GROUP}},

View file

@ -178,38 +178,44 @@ namespace GamecraftModdingAPI.Blocks
public SimBody[] GetSimBodiesFromID(byte id) public SimBody[] GetSimBodiesFromID(byte id)
{ {
var ret = new FasterList<SimBody>(4); var ret = new FasterList<SimBody>(4);
if (!entitiesDB.HasAny<ObjectIdEntityStruct>(CommonExclusiveGroups.OBJID_BLOCK_GROUP)) var oide = entitiesDB.QueryEntities<ObjectIdEntityStruct>();
return new SimBody[0]; EGIDMapper<GridConnectionsEntityStruct>? connections = null;
var oids = entitiesDB.QueryEntities<ObjectIdEntityStruct>(CommonExclusiveGroups.OBJID_BLOCK_GROUP).ToBuffer(); foreach (var ((oids, count), _) in oide)
var connections = entitiesDB.QueryMappedEntities<GridConnectionsEntityStruct>(CommonExclusiveGroups.OBJID_BLOCK_GROUP);
for (int i = 0; i < oids.count; i++)
{ {
ref ObjectIdEntityStruct oid = ref oids.buffer[i]; for (int i = 0; i < count; i++)
{
ref ObjectIdEntityStruct oid = ref oids[i];
if (oid.objectId != id) continue; if (oid.objectId != id) continue;
var rid = connections.Entity(oid.ID.entityID).machineRigidBodyId; if (!connections.HasValue) //Would need reflection to get the group from the build group otherwise
connections = entitiesDB.QueryMappedEntities<GridConnectionsEntityStruct>(oid.ID.groupID);
var rid = connections.Value.Entity(oid.ID.entityID).machineRigidBodyId;
foreach (var rb in ret) foreach (var rb in ret)
{ {
if (rb.Id.entityID == rid) if (rb.Id.entityID == rid)
goto DUPLICATE; //Multiple Object Identifiers on one rigid body goto DUPLICATE; //Multiple Object Identifiers on one rigid body
} }
ret.Add(new SimBody(rid)); ret.Add(new SimBody(rid));
DUPLICATE: ; DUPLICATE: ;
} }
}
return ret.ToArray(); return ret.ToArray();
} }
public ObjectIdentifier[] GetObjectIDsFromID(byte id, bool sim) public ObjectIdentifier[] GetObjectIDsFromID(byte id, bool sim)
{ {
var ret = new FasterList<ObjectIdentifier>(4); var ret = new FasterList<ObjectIdentifier>(4);
if (!entitiesDB.HasAny<ObjectIdEntityStruct>(CommonExclusiveGroups.OBJID_BLOCK_GROUP)) var oide = entitiesDB.QueryEntities<ObjectIdEntityStruct>();
return new ObjectIdentifier[0]; foreach (var ((oids, count), _) in oide)
var oids = entitiesDB.QueryEntities<ObjectIdEntityStruct>(CommonExclusiveGroups.OBJID_BLOCK_GROUP).ToBuffer();
for (int i = 0; i < oids.count; i++)
{ {
ref ObjectIdEntityStruct oid = ref oids.buffer[i]; for (int i = 0; i < count; i++)
{
ref ObjectIdEntityStruct oid = ref oids[i];
if (sim ? oid.simObjectId == id : oid.objectId == id) if (sim ? oid.simObjectId == id : oid.objectId == id)
ret.Add(new ObjectIdentifier(oid.ID)); ret.Add(new ObjectIdentifier(oid.ID));
} }
}
return ret.ToArray(); return ret.ToArray();
} }

View file

@ -329,6 +329,10 @@ namespace GamecraftModdingAPI.Blocks
UnlitGlowSlope, UnlitGlowSlope,
Fog, Fog,
Sky, Sky,
GridCube,
GridSlicedCube,
GridSlope,
GridCorner,
MagmaRockCube = 777, MagmaRockCube = 777,
MagmaRockCubeSliced, MagmaRockCubeSliced,
MagmaRockSlope, MagmaRockSlope,

View file

@ -618,34 +618,6 @@
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.Addressables.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Unity.Addressables.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Addressables.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Addressables.dll</HintPath>
</Reference> </Reference>
<Reference Include="Unity.Animation.Curves">
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.Animation.Curves.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Animation.Curves.dll</HintPath>
</Reference>
<Reference Include="Unity.Animation.Curves.Hybrid">
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.Animation.Curves.Hybrid.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Animation.Curves.Hybrid.dll</HintPath>
</Reference>
<Reference Include="Unity.Animation.DefaultGraphPipeline">
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.Animation.DefaultGraphPipeline.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Animation.DefaultGraphPipeline.dll</HintPath>
</Reference>
<Reference Include="Unity.Animation.DefaultGraphPipeline.Hybrid">
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.Animation.DefaultGraphPipeline.Hybrid.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Animation.DefaultGraphPipeline.Hybrid.dll</HintPath>
</Reference>
<Reference Include="Unity.Animation">
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.Animation.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Animation.dll</HintPath>
</Reference>
<Reference Include="Unity.Animation.Graph">
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.Animation.Graph.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Animation.Graph.dll</HintPath>
</Reference>
<Reference Include="Unity.Animation.Hybrid">
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.Animation.Hybrid.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Animation.Hybrid.dll</HintPath>
</Reference>
<Reference Include="Unity.Build.SlimPlayerRuntime"> <Reference Include="Unity.Build.SlimPlayerRuntime">
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.Build.SlimPlayerRuntime.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Unity.Build.SlimPlayerRuntime.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Build.SlimPlayerRuntime.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Build.SlimPlayerRuntime.dll</HintPath>
@ -666,10 +638,6 @@
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.Collections.LowLevel.ILSupport.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Unity.Collections.LowLevel.ILSupport.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Collections.LowLevel.ILSupport.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Collections.LowLevel.ILSupport.dll</HintPath>
</Reference> </Reference>
<Reference Include="Unity.DataFlowGraph">
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.DataFlowGraph.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.DataFlowGraph.dll</HintPath>
</Reference>
<Reference Include="Unity.Deformations"> <Reference Include="Unity.Deformations">
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.Deformations.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Unity.Deformations.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Deformations.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Deformations.dll</HintPath>
@ -682,9 +650,9 @@
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.Entities.Hybrid.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Unity.Entities.Hybrid.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Entities.Hybrid.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Entities.Hybrid.dll</HintPath>
</Reference> </Reference>
<Reference Include="Unity.InternalAPIEngineBridge.002"> <Reference Include="Unity.InternalAPIEngineBridge.012">
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.InternalAPIEngineBridge.002.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Unity.InternalAPIEngineBridge.012.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.InternalAPIEngineBridge.002.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.InternalAPIEngineBridge.012.dll</HintPath>
</Reference> </Reference>
<Reference Include="Unity.Jobs"> <Reference Include="Unity.Jobs">
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.Jobs.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Unity.Jobs.dll</HintPath>
@ -718,10 +686,6 @@
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.Platforms.Common.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Unity.Platforms.Common.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Platforms.Common.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Platforms.Common.dll</HintPath>
</Reference> </Reference>
<Reference Include="Unity.Postprocessing.Runtime">
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.Postprocessing.Runtime.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Postprocessing.Runtime.dll</HintPath>
</Reference>
<Reference Include="Unity.Properties"> <Reference Include="Unity.Properties">
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.Properties.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Unity.Properties.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Properties.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Properties.dll</HintPath>

View file

@ -14,7 +14,7 @@ using RobocraftX.Rendering;
using Svelto.Context; using Svelto.Context;
using Svelto.DataStructures; using Svelto.DataStructures;
using Svelto.ECS; using Svelto.ECS;
using Svelto.ECS.Schedulers.Unity; using Svelto.ECS.Schedulers;
using UnityEngine; using UnityEngine;
using Unity.Entities; using Unity.Entities;
using Unity.Physics.Systems; using Unity.Physics.Systems;