Remove ScalingEngine.Setup() and add object ID to dict
This commit is contained in:
parent
58cfba443e
commit
92965404ce
3 changed files with 4 additions and 12 deletions
|
@ -120,6 +120,7 @@ namespace GamecraftModdingAPI
|
||||||
{typeof(LogicGate), new [] {CommonExclusiveGroups.BUILD_LOGIC_BLOCK_GROUP}},
|
{typeof(LogicGate), new [] {CommonExclusiveGroups.BUILD_LOGIC_BLOCK_GROUP}},
|
||||||
{typeof(Motor), new[] {CommonExclusiveGroups.BUILD_MOTOR_BLOCK_GROUP}},
|
{typeof(Motor), new[] {CommonExclusiveGroups.BUILD_MOTOR_BLOCK_GROUP}},
|
||||||
{typeof(MusicBlock), new[] {CommonExclusiveGroups.BUILD_MUSIC_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(Piston), new[] {CommonExclusiveGroups.BUILD_PISTON_BLOCK_GROUP}},
|
||||||
{typeof(Servo), new[] {CommonExclusiveGroups.BUILD_SERVO_BLOCK_GROUP}},
|
{typeof(Servo), new[] {CommonExclusiveGroups.BUILD_SERVO_BLOCK_GROUP}},
|
||||||
{
|
{
|
||||||
|
@ -460,9 +461,5 @@ namespace GamecraftModdingAPI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
internal static void Setup(World physicsWorld)
|
|
||||||
{
|
|
||||||
ScalingEngine.Setup(physicsWorld.EntityManager);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -27,10 +27,12 @@ namespace GamecraftModdingAPI.Blocks
|
||||||
public string Name { get; } = "GamecraftModdingAPIScalingEngine";
|
public string Name { get; } = "GamecraftModdingAPIScalingEngine";
|
||||||
public bool isRemovable { get; } = false;
|
public bool isRemovable { get; } = false;
|
||||||
|
|
||||||
private static EntityManager _entityManager; //Unity entity manager
|
private EntityManager _entityManager; //Unity entity manager
|
||||||
|
|
||||||
public void UpdateCollision(EGID egid)
|
public void UpdateCollision(EGID egid)
|
||||||
{
|
{
|
||||||
|
if (_entityManager == default)
|
||||||
|
_entityManager = FullGameFields._physicsWorld.EntityManager;
|
||||||
//Assuming the block exists
|
//Assuming the block exists
|
||||||
var entity = entitiesDB.QueryEntity<UECSPhysicsEntityStruct>(egid).uecsEntity;
|
var entity = entitiesDB.QueryEntity<UECSPhysicsEntityStruct>(egid).uecsEntity;
|
||||||
var pes = new UECSPhysicsEntityCreationStruct();
|
var pes = new UECSPhysicsEntityCreationStruct();
|
||||||
|
@ -38,11 +40,6 @@ namespace GamecraftModdingAPI.Blocks
|
||||||
_entityManager.DestroyEntity(entity);
|
_entityManager.DestroyEntity(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Setup(EntityManager entityManager)
|
|
||||||
{
|
|
||||||
_entityManager = entityManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
[HarmonyPatch]
|
[HarmonyPatch]
|
||||||
public class PhysicsEnginePatch
|
public class PhysicsEnginePatch
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,8 +31,6 @@ namespace GamecraftModdingAPI.Events
|
||||||
GameEngineManager.RegisterEngines(enginesRoot);
|
GameEngineManager.RegisterEngines(enginesRoot);
|
||||||
// initialize AsyncUtils
|
// initialize AsyncUtils
|
||||||
AsyncUtils.Setup(enginesRoot);
|
AsyncUtils.Setup(enginesRoot);
|
||||||
// initialize Block
|
|
||||||
Block.Setup(physicsWorld);
|
|
||||||
// A new EnginesRoot is always created when ActivateGame is called
|
// A new EnginesRoot is always created when ActivateGame is called
|
||||||
// so all event emitters and handlers must be re-registered.
|
// so all event emitters and handlers must be re-registered.
|
||||||
EventManager.RegisterEngines(enginesRoot);
|
EventManager.RegisterEngines(enginesRoot);
|
||||||
|
|
Loading…
Reference in a new issue