using Content.Shared.Gravity;
using Content.Shared.Physics;
using Content.Shared.Movement.Pulling.Events;
+using Robust.Shared.Network;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Events;
/// </summary>
public sealed class ThrownItemSystem : EntitySystem
{
- [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
- [Dependency] private readonly SharedBroadphaseSystem _broadphase = default!;
+ [Dependency] private readonly INetManager _netMan = default!;
+ [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly FixtureSystem _fixtures = default!;
+ [Dependency] private readonly SharedBroadphaseSystem _broadphase = default!;
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] private readonly SharedGravitySystem _gravity = default!;
}
}
- EntityManager.EventBus.RaiseLocalEvent(uid, new StopThrowEvent { User = thrownItemComponent.Thrower }, true);
- EntityManager.RemoveComponent<ThrownItemComponent>(uid);
+ var ev = new StopThrowEvent(thrownItemComponent.Thrower);
+ RaiseLocalEvent(uid, ref ev);
+ RemComp<ThrownItemComponent>(uid);
}
public void LandComponent(EntityUid uid, ThrownItemComponent thrownItem, PhysicsComponent physics, bool playSound)
{
base.Update(frameTime);
- // TODO predicted throwing - remove this check
- // We don't want to predict landing or stopping, since throwing isn't actually predicted.
- // If we do, the landing/stop will occur prematurely on the client.
- if (_gameTiming.InPrediction)
- return;
-
var query = EntityQueryEnumerator<ThrownItemComponent, PhysicsComponent>();
while (query.MoveNext(out var uid, out var thrown, out var physics))
{
+ // If you remove this check verify slipping for other entities is networked properly.
+ if (_netMan.IsClient && !physics.Predict)
+ continue;
+
if (thrown.LandTime <= _gameTiming.CurTime)
{
LandComponent(uid, thrown, physics, thrown.PlayLandSound);