Throwing item scaling animation + recoil (#24724)
This commit is contained in:
@@ -36,41 +36,10 @@ namespace Content.Shared.Throwing
|
||||
SubscribeLocalEvent<ThrownItemComponent, PreventCollideEvent>(PreventCollision);
|
||||
SubscribeLocalEvent<ThrownItemComponent, ThrownEvent>(ThrowItem);
|
||||
SubscribeLocalEvent<ThrownItemComponent, EntityUnpausedEvent>(OnThrownUnpaused);
|
||||
SubscribeLocalEvent<ThrownItemComponent, ComponentGetState>(OnThrownGetState);
|
||||
SubscribeLocalEvent<ThrownItemComponent, ComponentHandleState>(OnThrownHandleState);
|
||||
|
||||
SubscribeLocalEvent<PullStartedMessage>(HandlePullStarted);
|
||||
}
|
||||
|
||||
private void OnThrownGetState(EntityUid uid, ThrownItemComponent component, ref ComponentGetState args)
|
||||
{
|
||||
// TODO: Throwing needs to handle this properly I just want the bad asserts to stop getting in my way.
|
||||
TryGetNetEntity(component.Thrower, out var nent);
|
||||
|
||||
args.State = new ThrownItemComponentState()
|
||||
{
|
||||
ThrownTime = component.ThrownTime,
|
||||
LandTime = component.LandTime,
|
||||
Thrower = nent,
|
||||
Landed = component.Landed,
|
||||
PlayLandSound = component.PlayLandSound,
|
||||
};
|
||||
}
|
||||
|
||||
private void OnThrownHandleState(EntityUid uid, ThrownItemComponent component, ref ComponentHandleState args)
|
||||
{
|
||||
if (args.Current is not ThrownItemComponentState state)
|
||||
return;
|
||||
|
||||
TryGetEntity(state.Thrower, out var thrower);
|
||||
|
||||
component.ThrownTime = state.ThrownTime;
|
||||
component.LandTime = state.LandTime;
|
||||
component.Thrower = thrower;
|
||||
component.Landed = state.Landed;
|
||||
component.PlayLandSound = state.PlayLandSound;
|
||||
}
|
||||
|
||||
private void OnMapInit(EntityUid uid, ThrownItemComponent component, MapInitEvent args)
|
||||
{
|
||||
component.ThrownTime ??= _gameTiming.CurTime;
|
||||
|
||||
Reference in New Issue
Block a user