Skip to content

Commit

Permalink
Reapply HighPrecisionPhysics
Browse files Browse the repository at this point in the history
  • Loading branch information
killzoms committed Nov 19, 2023
1 parent 29300a5 commit eaa489a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 76 deletions.
49 changes: 2 additions & 47 deletions NitroxClient/GameLogic/Spawning/WorldEntitySpawner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,54 +22,9 @@ public WorldEntitySpawner(PlayerManager playerManager, ILocalNitroxPlayer localP
{
worldEntitySpawnResolver = new WorldEntitySpawnerResolver(playerManager, localPlayer, simulationOwnership, entities);

if (NitroxEnvironment.IsNormal)
{
batchCellsById = (Dictionary<Int3, BatchCells>)LargeWorldStreamer.main.cellManager.batch2cells;
}
}

public override IEnumerator SpawnAsync(WorldEntity entity, TaskResult<Optional<GameObject>> result)
if (NitroxEnvironment.IsNormal)
{
LargeWorldStreamer.main.cellManager.UnloadBatchCells(entity.AbsoluteEntityCell.CellId.ToUnity()); // Just in case

EntityCell cellRoot = EnsureCell(entity);

Optional<GameObject> parent = (entity.ParentId != null) ? NitroxEntity.GetObjectFrom(entity.ParentId) : Optional.Empty;

IWorldEntitySpawner entitySpawner = worldEntitySpawnResolver.ResolveEntitySpawner(entity);

return entitySpawner.SpawnAsync(entity, parent, cellRoot, result);
}
public override bool SpawnsOwnChildren(WorldEntity entity)
{
IWorldEntitySpawner entitySpawner = worldEntitySpawnResolver.ResolveEntitySpawner(entity);
return entitySpawner.SpawnsOwnChildren();
}

private EntityCell EnsureCell(WorldEntity entity)
{
EntityCell entityCell;

Int3 batchId = entity.AbsoluteEntityCell.BatchId.ToUnity();
Int3 cellId = entity.AbsoluteEntityCell.CellId.ToUnity();

if (!batchCellsById.TryGetValue(batchId, out BatchCells batchCells))
{
batchCells = LargeWorldStreamer.main.cellManager.InitializeBatchCells(batchId);
}

entityCell = batchCells.Get(cellId, entity.AbsoluteEntityCell.Level);

if (entityCell == null)
{
entityCell = batchCells.Add(cellId, entity.AbsoluteEntityCell.Level);
entityCell.Initialize();
}

entityCell.EnsureRoot();

return entityCell;
>>>>>>> ddf37665 (first round of bug fixes)
batchCellsById = (Dictionary<Int3, BatchCells>)LargeWorldStreamer.main.cellManager.batch2cells;
}
}

Expand Down
28 changes: 0 additions & 28 deletions NitroxPatcher/Patches/Dynamic/GroundMotor_UpdateFunction_Patch.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static bool Prefix(ref bool __result)

if (movementController && movementController.Receiving)
{
__result = false;
__result = true;
return false;
}
}
Expand Down

0 comments on commit eaa489a

Please sign in to comment.