* Conveyor optimisations - Optimise movement for moving stuff. Better flags + less resolves + slapped parallelrobustjob on it. - Sleeping for entities getting conveyed into walls. * Blocker version * Finish * Final * Mob collisions * impulses * Collision smoothing * Locked in * 30tps working * r * fixes * Best * Fixes + CVars * CVars in place * Pushies * Opt attempt 1 * Revert "Opt attempt 1" This reverts commit 5ccd72dcbea09261a992aa1f7f05df169a1ce676. * Fix mispredicts * Ready-ish * better * Cleanup * Fix conveyor power mispredict * Forgetting to actually do deltas * Fix buckle pushes * Bagel save * Revert "Bagel save" This reverts commit 1b93fda81fb852d89b89b0beae0b80f8a61165f2. * Conveyor resave * Fix prediction * Mob movement rewrite * Bandaid * Working version * Tentatively working * Friction to fix cornering * More fixes * Revert bagel * Revert this * Bad parity * Working * Fixes * Woops * Doc comments * Pen cap cvar * StandingState cleanup and sub * Fix downed mobs * fish * client * Disable pushing on tests * More variables * Movement mods * Mass diff * 1 more tweak * Cvar
52 lines
1.5 KiB
C#
52 lines
1.5 KiB
C#
using System.Numerics;
|
|
using Content.Shared.CCVar;
|
|
using Content.Shared.Movement.Components;
|
|
using Content.Shared.Movement.Systems;
|
|
using Robust.Shared.Player;
|
|
|
|
namespace Content.Server.Movement.Systems;
|
|
|
|
public sealed class MobCollisionSystem : SharedMobCollisionSystem
|
|
{
|
|
private EntityQuery<ActorComponent> _actorQuery;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
_actorQuery = GetEntityQuery<ActorComponent>();
|
|
SubscribeLocalEvent<MobCollisionComponent, MobCollisionMessage>(OnServerMobCollision);
|
|
}
|
|
|
|
private void OnServerMobCollision(Entity<MobCollisionComponent> ent, ref MobCollisionMessage args)
|
|
{
|
|
MoveMob((ent.Owner, ent.Comp, Transform(ent.Owner)), args.Direction, args.SpeedModifier);
|
|
}
|
|
|
|
public override void Update(float frameTime)
|
|
{
|
|
if (!CfgManager.GetCVar(CCVars.MovementMobPushing))
|
|
return;
|
|
|
|
var query = EntityQueryEnumerator<MobCollisionComponent>();
|
|
|
|
while (query.MoveNext(out var uid, out var comp))
|
|
{
|
|
if (_actorQuery.HasComp(uid) || !PhysicsQuery.TryComp(uid, out var physics))
|
|
continue;
|
|
|
|
HandleCollisions((uid, comp, physics), frameTime);
|
|
}
|
|
|
|
base.Update(frameTime);
|
|
}
|
|
|
|
protected override void RaiseCollisionEvent(EntityUid uid, Vector2 direction, float speedMod)
|
|
{
|
|
RaiseLocalEvent(uid, new MobCollisionMessage()
|
|
{
|
|
Direction = direction,
|
|
SpeedModifier = speedMod,
|
|
});
|
|
}
|
|
}
|