diff --git a/Content.Shared/Stunnable/SharedStunSystem.cs b/Content.Shared/Stunnable/SharedStunSystem.cs index f904342ef8..afa0a761da 100644 --- a/Content.Shared/Stunnable/SharedStunSystem.cs +++ b/Content.Shared/Stunnable/SharedStunSystem.cs @@ -125,7 +125,7 @@ namespace Content.Shared.Stunnable if (!_standingStateSystem.Down(uid, standingState:standingState, appearance:appearance)) return; - stunnable.KnockdownTimer = (_gameTiming.CurTime, _gameTiming.CurTime + time);; + stunnable.KnockdownTimer = (_gameTiming.CurTime, _gameTiming.CurTime + time); SetAlert(uid, stunnable, alerts); @@ -144,8 +144,8 @@ namespace Content.Shared.Stunnable // Optional component. Resolve(uid, ref alerts, false); - Stun(uid, time, stunnable, alerts); Knockdown(uid, time, stunnable, alerts); + Stun(uid, time, stunnable, alerts); } /// diff --git a/Content.Shared/Throwing/ThrownItemComponent.cs b/Content.Shared/Throwing/ThrownItemComponent.cs index b192afcef9..6a4e49cc28 100644 --- a/Content.Shared/Throwing/ThrownItemComponent.cs +++ b/Content.Shared/Throwing/ThrownItemComponent.cs @@ -1,12 +1,26 @@ +using System; using Robust.Shared.GameObjects; +using Robust.Shared.GameStates; +using Robust.Shared.Serialization; namespace Content.Shared.Throwing { - [RegisterComponent] + [RegisterComponent, NetworkedComponent] public class ThrownItemComponent : Component { public override string Name => "ThrownItem"; public IEntity? Thrower { get; set; } } + + [Serializable, NetSerializable] + public class ThrownItemComponentState : ComponentState + { + public EntityUid? Thrower { get; } + + public ThrownItemComponentState(EntityUid? thrower) + { + Thrower = thrower; + } + } } diff --git a/Content.Shared/Throwing/ThrownItemSystem.cs b/Content.Shared/Throwing/ThrownItemSystem.cs index f1a0e21599..e6ed143342 100644 --- a/Content.Shared/Throwing/ThrownItemSystem.cs +++ b/Content.Shared/Throwing/ThrownItemSystem.cs @@ -7,6 +7,7 @@ using Content.Shared.Physics.Pull; using Robust.Shared.Configuration; using Robust.Shared.Containers; using Robust.Shared.GameObjects; +using Robust.Shared.GameStates; using Robust.Shared.IoC; using Robust.Shared.Log; using Robust.Shared.Maths; @@ -32,9 +33,25 @@ namespace Content.Shared.Throwing SubscribeLocalEvent(HandleCollision); SubscribeLocalEvent(PreventCollision); SubscribeLocalEvent(ThrowItem); + SubscribeLocalEvent(OnGetState); + SubscribeLocalEvent(OnHandleState); SubscribeLocalEvent(HandlePullStarted); } + private void OnGetState(EntityUid uid, ThrownItemComponent component, ref ComponentGetState args) + { + args.State = new ThrownItemComponentState(component.Thrower?.Uid); + } + + private void OnHandleState(EntityUid uid, ThrownItemComponent component, ref ComponentHandleState args) + { + if (args.Current is not ThrownItemComponentState state || state.Thrower == null) + return; + + if(EntityManager.TryGetEntity(state.Thrower.Value, out var entity)) + component.Thrower = entity; + } + private void ThrowItem(EntityUid uid, ThrownItemComponent component, ThrownEvent args) { if (!component.Owner.TryGetComponent(out PhysicsComponent? physicsComponent) || diff --git a/Resources/Changelog/Parts/peel.yml b/Resources/Changelog/Parts/peel.yml new file mode 100644 index 0000000000..2308ece850 --- /dev/null +++ b/Resources/Changelog/Parts/peel.yml @@ -0,0 +1,4 @@ +author: Zumorica +changes: + - type: Fix # One of the following: Add, Remove, Tweak, Fix + message: Fixes thrown slippery items causing the thrower to become horizontal when they shouldn't.