Files
crystall-punk-14/Content.Server/GameObjects/Components/Movement/PlayerInputMoverComponent.cs

39 lines
1.3 KiB
C#
Raw Normal View History

2020-06-24 02:21:20 +02:00
using Content.Shared.GameObjects.Components.Movement;
using Robust.Shared.GameObjects;
2020-02-07 23:15:06 +00:00
using Robust.Shared.GameObjects.Components;
using Robust.Shared.Map;
2020-02-07 23:15:06 +00:00
using Robust.Shared.Physics;
using Robust.Shared.ViewVariables;
2020-06-24 02:21:20 +02:00
#nullable enable
2019-04-04 16:18:43 +02:00
namespace Content.Server.GameObjects.Components.Movement
{
/// <summary>
/// Moves the entity based on input from a KeyBindingInputComponent.
/// </summary>
2019-07-31 15:02:36 +02:00
[RegisterComponent]
[ComponentReference(typeof(IMoverComponent))]
2020-06-24 02:21:20 +02:00
public class PlayerInputMoverComponent : SharedPlayerInputMoverComponent, IMoverComponent, ICollideSpecial
2019-04-04 16:18:43 +02:00
{
2020-06-24 02:21:20 +02:00
public override GridCoordinates LastPosition { get; set; }
2019-04-04 16:18:43 +02:00
2020-06-24 02:21:20 +02:00
public override float StepSoundDistance { get; set; }
2020-02-07 23:15:06 +00:00
/// <summary>
/// Special collision override, can be used to give custom behaviors deciding when to collide
/// </summary>
/// <param name="collidedwith"></param>
/// <returns></returns>
bool ICollideSpecial.PreventCollide(IPhysBody collidedwith)
{
// Don't collide with other mobs
2020-02-07 23:15:06 +00:00
if (collidedwith.Owner.TryGetComponent<SpeciesComponent>(out var collidedSpeciesComponent))
{
return true;
}
return false;
}
2019-04-04 16:18:43 +02:00
}
}