Browse Source

Update to Gamecraft 2020.11.30.16.02

tags/v1.8.0
NorbiPeti 3 years ago
parent
commit
ab1ae51ece
5 changed files with 37 additions and 63 deletions
  1. +2
    -2
      GamecraftModdingAPI/Block.cs
  2. +27
    -21
      GamecraftModdingAPI/Blocks/BlockEngine.cs
  3. +4
    -0
      GamecraftModdingAPI/Blocks/BlockIDs.cs
  4. +3
    -39
      GamecraftModdingAPI/GamecraftModdingAPI.csproj
  5. +1
    -1
      GamecraftModdingAPI/Utility/FullGameFields.cs

+ 2
- 2
GamecraftModdingAPI/Block.cs 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, ExclusiveGroupStruct[]> typeToGroup =
new Dictionary<Type, ExclusiveGroupStruct[]>
private static Dictionary<Type, ExclusiveBuildGroup[]> typeToGroup =
new Dictionary<Type, ExclusiveBuildGroup[]>
{
{typeof(ConsoleBlock), new[] {CommonExclusiveGroups.CONSOLE_BLOCK_GROUP}},
{typeof(LogicGate), new [] {CommonExclusiveGroups.LOGIC_BLOCK_GROUP}},


+ 27
- 21
GamecraftModdingAPI/Blocks/BlockEngine.cs View File

@@ -178,37 +178,43 @@ namespace GamecraftModdingAPI.Blocks
public SimBody[] GetSimBodiesFromID(byte id)
{
var ret = new FasterList<SimBody>(4);
if (!entitiesDB.HasAny<ObjectIdEntityStruct>(CommonExclusiveGroups.OBJID_BLOCK_GROUP))
return new SimBody[0];
var oids = entitiesDB.QueryEntities<ObjectIdEntityStruct>(CommonExclusiveGroups.OBJID_BLOCK_GROUP).ToBuffer();
var connections = entitiesDB.QueryMappedEntities<GridConnectionsEntityStruct>(CommonExclusiveGroups.OBJID_BLOCK_GROUP);
for (int i = 0; i < oids.count; i++)
var oide = entitiesDB.QueryEntities<ObjectIdEntityStruct>();
EGIDMapper<GridConnectionsEntityStruct>? 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<GridConnectionsEntityStruct>(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<ObjectIdentifier>(4);
if (!entitiesDB.HasAny<ObjectIdEntityStruct>(CommonExclusiveGroups.OBJID_BLOCK_GROUP))
return new ObjectIdentifier[0];
var oids = entitiesDB.QueryEntities<ObjectIdEntityStruct>(CommonExclusiveGroups.OBJID_BLOCK_GROUP).ToBuffer();
for (int i = 0; i < oids.count; i++)
var oide = entitiesDB.QueryEntities<ObjectIdEntityStruct>();
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();


+ 4
- 0
GamecraftModdingAPI/Blocks/BlockIDs.cs View File

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


+ 3
- 39
GamecraftModdingAPI/GamecraftModdingAPI.csproj View File

@@ -618,34 +618,6 @@
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.Addressables.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Addressables.dll</HintPath>
</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">
<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>
</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">
<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>
</Reference>
<Reference Include="Unity.InternalAPIEngineBridge.002">
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.InternalAPIEngineBridge.002.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.InternalAPIEngineBridge.002.dll</HintPath>
<Reference Include="Unity.InternalAPIEngineBridge.012">
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.InternalAPIEngineBridge.012.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.InternalAPIEngineBridge.012.dll</HintPath>
</Reference>
<Reference Include="Unity.Jobs">
<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>
</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">
<HintPath>..\ref\Gamecraft_Data\Managed\Unity.Properties.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Unity.Properties.dll</HintPath>


+ 1
- 1
GamecraftModdingAPI/Utility/FullGameFields.cs View File

@@ -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;


Loading…
Cancel
Save