2020-06-24 02:21:20 +02:00
|
|
|
|
using Content.Shared.GameObjects.Components.Movement;
|
2019-04-15 21:11:38 -06:00
|
|
|
|
using Robust.Shared.GameObjects;
|
2020-02-07 23:15:06 +00:00
|
|
|
|
using Robust.Shared.GameObjects.Components;
|
2019-04-15 21:11:38 -06:00
|
|
|
|
using Robust.Shared.Map;
|
2020-02-07 23:15:06 +00:00
|
|
|
|
using Robust.Shared.Physics;
|
2019-04-15 21:11:38 -06:00
|
|
|
|
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)
|
|
|
|
|
|
{
|
2020-02-22 23:37:56 +00:00
|
|
|
|
// 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
|
|
|
|
}
|
|
|
|
|
|
}
|