Files
RobustToolbox/Robust.Shared/Physics/Systems/SharedPhysicsSystem.Map.cs
T
metalgearslothandGitHub ee8ea4ec3b Purge PhysicsMapComponent (#5766)
* Replace PhysicsMapComponent

- Dumb idea
- Lots of book-keeping and perf overhead.
- Much saner this way.

* stuff

* More work

* Purge

* Fixes

* Eh?

* Fixes

* Also this

* weh

* Fixes

* ice-cream

* Fix

* Fix stacking / gravity

* Gravity query

* MoveBuffer optimisations

* Fixes for test

* World gravity

* Fix build

* Avoid some transform resolves for contactless ents

* Less getcomps

* Fix contact caching

* Possibly less copies

* reh

* bulldoze

* Test "fix"

* seikrets

* a

* I saw this but now I decideded against it

* true
2025-05-28 19:18:36 +10:00

45 lines
1.2 KiB
C#

using Robust.Shared.GameObjects;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Utility;
namespace Robust.Shared.Physics.Systems;
public partial class SharedPhysicsSystem
{
#region AddRemove
internal void AddAwakeBody(Entity<PhysicsComponent, TransformComponent> ent)
{
var body = ent.Comp1;
if (!body.CanCollide)
{
Log.Error($"Tried to add non-colliding {ToPrettyString(ent)} as an awake body to map!");
DebugTools.Assert(false);
return;
}
if (body.BodyType == BodyType.Static)
{
Log.Error($"Tried to add static body {ToPrettyString(ent)} as an awake body to map!");
DebugTools.Assert(false);
return;
}
DebugTools.Assert(body.Awake);
DebugTools.Assert(!AwakeBodies.Contains(ent));
AwakeBodies.Add(ent);
}
internal void RemoveSleepBody(Entity<PhysicsComponent, TransformComponent> ent)
{
DebugTools.Assert(!ent.Comp1.Awake);
DebugTools.Assert(AwakeBodies.Contains(ent));
AwakeBodies.Remove(ent);
}
#endregion
}