2021-07-12 01:32:10 -07:00
|
|
|
using Robust.Shared.GameStates;
|
2020-08-09 02:16:13 +10:00
|
|
|
using Robust.Shared.Map;
|
|
|
|
|
using Robust.Shared.Serialization;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Shared.DoAfter
|
2020-08-09 02:16:13 +10:00
|
|
|
{
|
2021-07-12 01:32:10 -07:00
|
|
|
[NetworkedComponent()]
|
2020-08-09 02:16:13 +10:00
|
|
|
public abstract class SharedDoAfterComponent : Component
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-10 22:59:17 +11:00
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
public sealed class DoAfterComponentState : ComponentState
|
|
|
|
|
{
|
|
|
|
|
public List<ClientDoAfter> DoAfters { get; }
|
|
|
|
|
|
2021-07-12 01:32:10 -07:00
|
|
|
public DoAfterComponentState(List<ClientDoAfter> doAfters)
|
2020-10-10 22:59:17 +11:00
|
|
|
{
|
|
|
|
|
DoAfters = doAfters;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-09 02:16:13 +10:00
|
|
|
[Serializable, NetSerializable]
|
2022-02-20 06:15:57 +11:00
|
|
|
public sealed class CancelledDoAfterMessage : EntityEventArgs
|
2020-08-09 02:16:13 +10:00
|
|
|
{
|
2022-02-20 06:15:57 +11:00
|
|
|
public EntityUid Uid;
|
2020-08-09 02:16:13 +10:00
|
|
|
public byte ID { get; }
|
|
|
|
|
|
2022-02-20 06:15:57 +11:00
|
|
|
public CancelledDoAfterMessage(EntityUid uid, byte id)
|
2020-08-09 02:16:13 +10:00
|
|
|
{
|
2022-02-28 00:12:47 +11:00
|
|
|
Uid = uid;
|
2020-08-09 02:16:13 +10:00
|
|
|
ID = id;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// We send a trimmed-down version of the DoAfter for the client for it to use.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Serializable, NetSerializable]
|
2020-10-10 22:59:17 +11:00
|
|
|
public sealed class ClientDoAfter
|
2020-08-09 02:16:13 +10:00
|
|
|
{
|
|
|
|
|
// To see what these do look at DoAfter and DoAfterEventArgs
|
|
|
|
|
public byte ID { get; }
|
2020-09-06 16:11:53 +02:00
|
|
|
|
2020-08-09 02:16:13 +10:00
|
|
|
public TimeSpan StartTime { get; }
|
2020-09-06 16:11:53 +02:00
|
|
|
|
|
|
|
|
public EntityCoordinates UserGrid { get; }
|
|
|
|
|
|
|
|
|
|
public EntityCoordinates TargetGrid { get; }
|
|
|
|
|
|
2021-12-26 15:32:45 +13:00
|
|
|
public EntityUid? Target { get; }
|
2020-08-09 02:16:13 +10:00
|
|
|
|
|
|
|
|
public float Delay { get; }
|
2020-09-06 16:11:53 +02:00
|
|
|
|
2020-08-09 02:16:13 +10:00
|
|
|
// TODO: The other ones need predicting
|
|
|
|
|
public bool BreakOnUserMove { get; }
|
2020-09-06 16:11:53 +02:00
|
|
|
|
2020-08-09 02:16:13 +10:00
|
|
|
public bool BreakOnTargetMove { get; }
|
2020-09-06 16:11:53 +02:00
|
|
|
|
2020-11-22 03:58:31 +01:00
|
|
|
public float MovementThreshold { get; }
|
|
|
|
|
|
2021-12-26 15:32:45 +13:00
|
|
|
public ClientDoAfter(byte id, EntityCoordinates userGrid, EntityCoordinates targetGrid, TimeSpan startTime,
|
|
|
|
|
float delay, bool breakOnUserMove, bool breakOnTargetMove, float movementThreshold, EntityUid? target = null)
|
2020-08-09 02:16:13 +10:00
|
|
|
{
|
|
|
|
|
ID = id;
|
|
|
|
|
UserGrid = userGrid;
|
|
|
|
|
TargetGrid = targetGrid;
|
|
|
|
|
StartTime = startTime;
|
|
|
|
|
Delay = delay;
|
|
|
|
|
BreakOnUserMove = breakOnUserMove;
|
|
|
|
|
BreakOnTargetMove = breakOnTargetMove;
|
2020-11-22 03:58:31 +01:00
|
|
|
MovementThreshold = movementThreshold;
|
2021-12-26 15:32:45 +13:00
|
|
|
Target = target;
|
2020-08-09 02:16:13 +10:00
|
|
|
}
|
|
|
|
|
}
|
2020-09-06 16:11:53 +02:00
|
|
|
}
|