* hack to resolve offset issues while in locker * moved movment cancel from lerp to init * Added DoAfter canceling for buckling and stowing * changed container event & removed inventory check from climb initation * resolved integration test fail * style --------- Co-authored-by: Milon <milonpl.git@proton.me>
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
using Content.Shared.DoAfter;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
||||||
@@ -25,6 +26,12 @@ public sealed partial class ClimbingComponent : Component
|
|||||||
[AutoNetworkedField, DataField]
|
[AutoNetworkedField, DataField]
|
||||||
public bool IsClimbing;
|
public bool IsClimbing;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The Climbing DoAfter.
|
||||||
|
/// </summary>
|
||||||
|
[DataField]
|
||||||
|
public DoAfterId? DoAfter;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the owner is being moved onto the climbed entity.
|
/// Whether the owner is being moved onto the climbed entity.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ public sealed partial class ClimbSystem : VirtualController
|
|||||||
SubscribeLocalEvent<ClimbingComponent, ClimbDoAfterEvent>(OnDoAfter);
|
SubscribeLocalEvent<ClimbingComponent, ClimbDoAfterEvent>(OnDoAfter);
|
||||||
SubscribeLocalEvent<ClimbingComponent, EndCollideEvent>(OnClimbEndCollide);
|
SubscribeLocalEvent<ClimbingComponent, EndCollideEvent>(OnClimbEndCollide);
|
||||||
SubscribeLocalEvent<ClimbingComponent, BuckledEvent>(OnBuckled);
|
SubscribeLocalEvent<ClimbingComponent, BuckledEvent>(OnBuckled);
|
||||||
|
SubscribeLocalEvent<ClimbingComponent, EntGotInsertedIntoContainerMessage>(OnStored);
|
||||||
|
|
||||||
SubscribeLocalEvent<ClimbableComponent, CanDropTargetEvent>(OnCanDragDropOn);
|
SubscribeLocalEvent<ClimbableComponent, CanDropTargetEvent>(OnCanDragDropOn);
|
||||||
SubscribeLocalEvent<ClimbableComponent, GetVerbsEvent<AlternativeVerb>>(AddClimbableVerb);
|
SubscribeLocalEvent<ClimbableComponent, GetVerbsEvent<AlternativeVerb>>(AddClimbableVerb);
|
||||||
@@ -234,14 +235,28 @@ public sealed partial class ClimbSystem : VirtualController
|
|||||||
};
|
};
|
||||||
|
|
||||||
_audio.PlayPredicted(comp.StartClimbSound, climbable, user);
|
_audio.PlayPredicted(comp.StartClimbSound, climbable, user);
|
||||||
return _doAfterSystem.TryStartDoAfter(args, out id);
|
var success = _doAfterSystem.TryStartDoAfter(args, out id);
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
climbing.DoAfter = id;
|
||||||
|
|
||||||
|
return success;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDoAfter(EntityUid uid, ClimbingComponent component, ClimbDoAfterEvent args)
|
private void OnDoAfter(EntityUid uid, ClimbingComponent component, ClimbDoAfterEvent args)
|
||||||
{
|
{
|
||||||
|
component.DoAfter = null;
|
||||||
|
|
||||||
if (args.Handled || args.Cancelled || args.Args.Target == null || args.Args.Used == null)
|
if (args.Handled || args.Cancelled || args.Args.Target == null || args.Args.Used == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (_containers.IsEntityInContainer(uid))
|
||||||
|
{
|
||||||
|
args.Handled = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Climb(uid, args.Args.User, args.Args.Target.Value, climbing: component);
|
Climb(uid, args.Args.User, args.Args.Target.Value, climbing: component);
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
}
|
}
|
||||||
@@ -519,8 +534,28 @@ public sealed partial class ClimbSystem : VirtualController
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void OnBuckled(EntityUid uid, ClimbingComponent component, ref BuckledEvent args)
|
private void OnBuckled(EntityUid uid, ClimbingComponent component, ref BuckledEvent args)
|
||||||
|
{
|
||||||
|
StopOrCancelClimb(uid, component);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnStored(EntityUid uid, ClimbingComponent component, ref EntGotInsertedIntoContainerMessage args)
|
||||||
|
{
|
||||||
|
StopOrCancelClimb(uid, component);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StopOrCancelClimb(EntityUid uid, ClimbingComponent component)
|
||||||
|
{
|
||||||
|
if (component.IsClimbing)
|
||||||
{
|
{
|
||||||
StopClimb(uid, component);
|
StopClimb(uid, component);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (component.DoAfter != null)
|
||||||
|
{
|
||||||
|
_doAfterSystem.Cancel(component.DoAfter);
|
||||||
|
component.DoAfter = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnGlassClimbed(EntityUid uid, GlassTableComponent component, ref ClimbedOnEvent args)
|
private void OnGlassClimbed(EntityUid uid, GlassTableComponent component, ref ClimbedOnEvent args)
|
||||||
|
|||||||
Reference in New Issue
Block a user