Content update for ECS physics (#13291)

This commit is contained in:
metalgearsloth
2023-01-15 15:38:59 +11:00
committed by GitHub
parent 46d24bc36b
commit bf79d76666
61 changed files with 431 additions and 379 deletions

View File

@@ -77,12 +77,9 @@ namespace Content.Server.Physics.Controllers
var shape = new PolygonShape();
shape.SetAsBox(0.55f, 0.55f);
_fixtures.TryCreateFixture(body, new Fixture(body, shape)
{
ID = ConveyorFixture,
CollisionLayer = (int) (CollisionGroup.LowImpassable | CollisionGroup.MidImpassable | CollisionGroup.Impassable),
Hard = false,
});
_fixtures.TryCreateFixture(uid, shape, ConveyorFixture, hard: false,
collisionLayer: (int) (CollisionGroup.LowImpassable | CollisionGroup.MidImpassable |
CollisionGroup.Impassable), body: body);
}
}
@@ -160,7 +157,7 @@ namespace Content.Server.Physics.Controllers
continue;
if (physics.BodyType != BodyType.Static)
_physics.WakeBody(physics);
_physics.WakeBody(entity, body: physics);
}
}
}
@@ -180,7 +177,7 @@ namespace Content.Server.Physics.Controllers
if (!TryComp<PhysicsComponent>(uid, out var body))
return;
_fixtures.DestroyFixture(body, ConveyorFixture);
_fixtures.DestroyFixture(uid, ConveyorFixture, body: body);
}
public override void UpdateBeforeSolve(bool prediction, float frameTime)
@@ -237,8 +234,9 @@ namespace Content.Server.Physics.Controllers
transform.LocalPosition = localPos;
// Force it awake for collisionwake reasons.
body.Awake = true;
body.SleepTime = 0f;
// TODO: Just use sleepallowed
_physics.SetAwake(entity, body, true);
_physics.SetSleepTime(body, 0f);
}
}