Merge branch 'master' of https://git.exmods.org/modtainers/GamecraftModdingAPI
This commit is contained in:
commit
be7d8ba33a
5 changed files with 40 additions and 62 deletions
|
@ -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}},
|
||||||
|
|
|
@ -178,37 +178,43 @@ 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++)
|
||||||
if (oid.objectId != id) continue;
|
{
|
||||||
var rid = connections.Entity(oid.ID.entityID).machineRigidBodyId;
|
ref ObjectIdEntityStruct oid = ref oids[i];
|
||||||
foreach (var rb in ret)
|
if (oid.objectId != id) continue;
|
||||||
{
|
if (!connections.HasValue) //Would need reflection to get the group from the build group otherwise
|
||||||
if (rb.Id.entityID == rid)
|
connections = entitiesDB.QueryMappedEntities<GridConnectionsEntityStruct>(oid.ID.groupID);
|
||||||
goto DUPLICATE; //Multiple Object Identifiers on one rigid body
|
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();
|
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++)
|
||||||
if (sim ? oid.simObjectId == id : oid.objectId == id)
|
{
|
||||||
ret.Add(new ObjectIdentifier(oid.ID));
|
ref ObjectIdEntityStruct oid = ref oids[i];
|
||||||
|
if (sim ? oid.simObjectId == id : oid.objectId == id)
|
||||||
|
ret.Add(new ObjectIdentifier(oid.ID));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret.ToArray();
|
return ret.ToArray();
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -583,34 +583,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>
|
||||||
|
@ -623,9 +595,9 @@
|
||||||
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.Collections.dll</HintPath>
|
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.Collections.dll</HintPath>
|
||||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Collections.dll</HintPath>
|
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Collections.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Unity.DataFlowGraph">
|
<Reference Include="Unity.Collections.LowLevel.ILSupport">
|
||||||
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.DataFlowGraph.dll</HintPath>
|
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.Collections.LowLevel.ILSupport.dll</HintPath>
|
||||||
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.DataFlowGraph.dll</HintPath>
|
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Collections.LowLevel.ILSupport.dll</HintPath>
|
||||||
</Reference>
|
</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>
|
||||||
|
@ -639,9 +611,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>
|
||||||
|
@ -675,10 +647,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>
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue