mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
Force grids to be collidable (#3480)
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
|
||||
namespace Robust.Shared.GameObjects;
|
||||
|
||||
|
||||
@@ -870,6 +870,7 @@ namespace Robust.Shared.Map
|
||||
return;
|
||||
|
||||
// TODO: Move this to the component when we combine.
|
||||
_entityManager.EntitySysManager.GetEntitySystem<SharedPhysicsSystem>().WakeBody(GridEntityId);
|
||||
_mapManager.OnGridBoundsChange(GridEntityId, this);
|
||||
system?.RegenerateCollision(GridEntityId, chunkRectangles, removedChunks);
|
||||
}
|
||||
|
||||
@@ -355,7 +355,7 @@ public partial class SharedPhysicsSystem
|
||||
{
|
||||
if (body._awake == value)
|
||||
return;
|
||||
|
||||
|
||||
if (value && (body.BodyType == BodyType.Static || !body.CanCollide))
|
||||
return;
|
||||
|
||||
@@ -541,6 +541,15 @@ public partial class SharedPhysicsSystem
|
||||
body._sleepTime = value;
|
||||
}
|
||||
|
||||
public bool WakeBody(EntityUid uid, PhysicsComponent? body = null, FixturesComponent? manager = null, bool force = false)
|
||||
{
|
||||
if (!Resolve(uid, ref body, ref manager))
|
||||
return false;
|
||||
|
||||
WakeBody(body, manager, force);
|
||||
return body._awake;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to enable the body and also set it awake.
|
||||
/// </summary>
|
||||
|
||||
@@ -31,8 +31,7 @@ namespace Robust.UnitTesting.Shared.Map
|
||||
EntityUid? gridEnt1;
|
||||
EntityUid? gridEnt2;
|
||||
|
||||
await server.WaitPost(() =>
|
||||
{
|
||||
await server.WaitPost(() => {
|
||||
mapId = mapManager.CreateMap();
|
||||
gridId1 = mapManager.CreateGrid(mapId);
|
||||
gridId2 = mapManager.CreateGrid(mapId);
|
||||
@@ -85,6 +84,9 @@ namespace Robust.UnitTesting.Shared.Map
|
||||
var contact = node.Value;
|
||||
node = node.Next;
|
||||
|
||||
if (!contact.IsTouching)
|
||||
continue;
|
||||
|
||||
var bodyA = contact.FixtureA!.Body;
|
||||
var bodyB = contact.FixtureB!.Body;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user