Disable climbing when buckled (#2488)

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
metalgearsloth
2020-11-06 01:08:24 +11:00
committed by GitHub
parent 8fa6f2c3de
commit 51d8d5dd9d

View File

@@ -1,6 +1,9 @@
using Content.Shared.GameObjects.Components.Movement;
#nullable enable
using Content.Shared.GameObjects.Components.Buckle;
using Content.Shared.GameObjects.Components.Movement;
using Content.Shared.Physics;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Maths;
namespace Content.Server.GameObjects.Components.Movement
@@ -8,8 +11,8 @@ namespace Content.Server.GameObjects.Components.Movement
[RegisterComponent]
public class ClimbingComponent : SharedClimbingComponent
{
private bool _isClimbing = false;
private ClimbController _climbController = default;
private bool _isClimbing;
private ClimbController? _climbController;
public override bool IsClimbing
{
@@ -29,6 +32,19 @@ namespace Content.Server.GameObjects.Components.Movement
}
}
public override void HandleMessage(ComponentMessage message, IComponent? component)
{
base.HandleMessage(message, component);
switch (message)
{
case BuckleMessage msg:
if (msg.Buckled)
IsClimbing = false;
break;
}
}
/// <summary>
/// Make the owner climb from one point to another
/// </summary>