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

This commit is contained in:
Norbi Peti 2020-10-02 01:54:59 +02:00
parent 58cfba443e
commit 92965404ce
3 changed files with 4 additions and 12 deletions

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);
}
}
}

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
{

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