Fix climbing and bonking simultaneously (#27268)
* Properly network ClumsyComponent * Fix being able to climb and bonk at the same time. Also properly subscribe to AttemptClimbEvent by-ref. * Update Content.Shared/Interaction/Components/ClumsyComponent.cs
This commit is contained in:
@@ -107,17 +107,16 @@ public sealed partial class BonkSystem : EntitySystem
|
|||||||
var doAfterArgs = new DoAfterArgs(EntityManager, user, bonkableComponent.BonkDelay, new BonkDoAfterEvent(), uid, target: uid, used: climber)
|
var doAfterArgs = new DoAfterArgs(EntityManager, user, bonkableComponent.BonkDelay, new BonkDoAfterEvent(), uid, target: uid, used: climber)
|
||||||
{
|
{
|
||||||
BreakOnMove = true,
|
BreakOnMove = true,
|
||||||
BreakOnDamage = true
|
BreakOnDamage = true,
|
||||||
|
DuplicateCondition = DuplicateConditions.SameTool | DuplicateConditions.SameTarget
|
||||||
};
|
};
|
||||||
|
|
||||||
_doAfter.TryStartDoAfter(doAfterArgs);
|
return _doAfter.TryStartDoAfter(doAfterArgs);
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAttemptClimb(EntityUid uid, BonkableComponent component, AttemptClimbEvent args)
|
private void OnAttemptClimb(EntityUid uid, BonkableComponent component, ref AttemptClimbEvent args)
|
||||||
{
|
{
|
||||||
if (args.Cancelled || !HasComp<ClumsyComponent>(args.Climber) || !HasComp<HandsComponent>(args.User))
|
if (args.Cancelled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (TryStartBonk(uid, args.User, args.Climber, component))
|
if (TryStartBonk(uid, args.User, args.Climber, component))
|
||||||
|
|||||||
@@ -222,7 +222,8 @@ public sealed partial class ClimbSystem : VirtualController
|
|||||||
used: entityToMove)
|
used: entityToMove)
|
||||||
{
|
{
|
||||||
BreakOnMove = true,
|
BreakOnMove = true,
|
||||||
BreakOnDamage = true
|
BreakOnDamage = true,
|
||||||
|
DuplicateCondition = DuplicateConditions.SameTool | DuplicateConditions.SameTarget
|
||||||
};
|
};
|
||||||
|
|
||||||
_audio.PlayPredicted(comp.StartClimbSound, climbable, user);
|
_audio.PlayPredicted(comp.StartClimbSound, climbable, user);
|
||||||
|
|||||||
@@ -1,22 +1,24 @@
|
|||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.GameStates;
|
||||||
|
|
||||||
|
namespace Content.Shared.Interaction.Components;
|
||||||
|
|
||||||
namespace Content.Shared.Interaction.Components
|
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A simple clumsy tag-component.
|
/// A simple clumsy tag-component.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[RegisterComponent]
|
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||||
public sealed partial class ClumsyComponent : Component
|
public sealed partial class ClumsyComponent : Component
|
||||||
{
|
{
|
||||||
[DataField("clumsyDamage", required: true)]
|
/// <summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
/// Damage dealt to a clumsy character when they try to fire a gun.
|
||||||
|
/// </summary>
|
||||||
|
[DataField(required: true), AutoNetworkedField]
|
||||||
public DamageSpecifier ClumsyDamage = default!;
|
public DamageSpecifier ClumsyDamage = default!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sound to play when clumsy interactions fail
|
/// Sound to play when clumsy interactions fail.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("clumsySound")]
|
[DataField]
|
||||||
public SoundSpecifier ClumsySound = new SoundPathSpecifier("/Audio/Items/bikehorn.ogg");
|
public SoundSpecifier ClumsySound = new SoundPathSpecifier("/Audio/Items/bikehorn.ogg");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user