Browse Source

Remove ScalingEngine.Setup() and add object ID to dict

tags/v1.6.0
NorbiPeti 4 years ago
parent
commit
64aace3bde
3 changed files with 4 additions and 12 deletions
  1. +1
    -4
      GamecraftModdingAPI/Block.cs
  2. +3
    -6
      GamecraftModdingAPI/Blocks/ScalingEngine.cs
  3. +0
    -2
      GamecraftModdingAPI/Events/GameActivatedComposePatch.cs

+ 1
- 4
GamecraftModdingAPI/Block.cs View File

@@ -120,6 +120,7 @@ namespace GamecraftModdingAPI
{typeof(LogicGate), new [] {CommonExclusiveGroups.BUILD_LOGIC_BLOCK_GROUP}},
{typeof(Motor), new[] {CommonExclusiveGroups.BUILD_MOTOR_BLOCK_GROUP}},
{typeof(MusicBlock), new[] {CommonExclusiveGroups.BUILD_MUSIC_BLOCK_GROUP}},
{typeof(ObjectIdentifier), new[]{CommonExclusiveGroups.BUILD_OBJID_BLOCK_GROUP}},
{typeof(Piston), new[] {CommonExclusiveGroups.BUILD_PISTON_BLOCK_GROUP}},
{typeof(Servo), new[] {CommonExclusiveGroups.BUILD_SERVO_BLOCK_GROUP}},
{
@@ -460,9 +461,5 @@ namespace GamecraftModdingAPI
}
}
#endif
internal static void Setup(World physicsWorld)
{
ScalingEngine.Setup(physicsWorld.EntityManager);
}
}
}

+ 3
- 6
GamecraftModdingAPI/Blocks/ScalingEngine.cs View File

@@ -27,10 +27,12 @@ namespace GamecraftModdingAPI.Blocks
public string Name { get; } = "GamecraftModdingAPIScalingEngine";
public bool isRemovable { get; } = false;
private static EntityManager _entityManager; //Unity entity manager
private EntityManager _entityManager; //Unity entity manager

public void UpdateCollision(EGID egid)
{
if (_entityManager == default)
_entityManager = FullGameFields._physicsWorld.EntityManager;
//Assuming the block exists
var entity = entitiesDB.QueryEntity<UECSPhysicsEntityStruct>(egid).uecsEntity;
var pes = new UECSPhysicsEntityCreationStruct();
@@ -38,11 +40,6 @@ namespace GamecraftModdingAPI.Blocks
_entityManager.DestroyEntity(entity);
}

internal void Setup(EntityManager entityManager)
{
_entityManager = entityManager;
}

[HarmonyPatch]
public class PhysicsEnginePatch
{


+ 0
- 2
GamecraftModdingAPI/Events/GameActivatedComposePatch.cs View File

@@ -31,8 +31,6 @@ namespace GamecraftModdingAPI.Events
GameEngineManager.RegisterEngines(enginesRoot);
// initialize AsyncUtils
AsyncUtils.Setup(enginesRoot);
// initialize Block
Block.Setup(physicsWorld);
// A new EnginesRoot is always created when ActivateGame is called
// so all event emitters and handlers must be re-registered.
EventManager.RegisterEngines(enginesRoot);


Loading…
Cancel
Save