Refactors throw events, makes cream pies ECS (#4500)

This commit is contained in:
Vera Aguilera Puerto
2021-08-21 09:18:23 +02:00
committed by GitHub
parent 140682f92b
commit ea4ce1c6fc
19 changed files with 287 additions and 260 deletions

View File

@@ -0,0 +1,55 @@
using System;
using JetBrains.Annotations;
using Robust.Shared.Analyzers;
using Robust.Shared.GameObjects;
namespace Content.Shared.Throwing
{
/// <summary>
/// Base class for all throw events.
/// </summary>
public abstract class ThrowEvent : HandledEntityEventArgs
{
/// <summary>
/// The entity that threw <see cref="Thrown"/>.
/// </summary>
public IEntity? User { get; }
/// <summary>
/// The entity thrown by <see cref="User"/> that hit <see cref="Target"/>
/// </summary>
public IEntity Thrown { get; }
/// <summary>
/// The entity hit with <see cref="Thrown"/> by <see cref="User"/>
/// </summary>
public IEntity Target { get; }
public ThrowEvent(IEntity? user, IEntity thrown, IEntity target)
{
User = user;
Thrown = thrown;
Target = target;
}
}
/// <summary>
/// Raised directed on the target entity being hit by the thrown entity.
/// </summary>
public class ThrowHitByEvent : ThrowEvent
{
public ThrowHitByEvent(IEntity? user, IEntity thrown, IEntity target) : base(user, thrown, target)
{
}
}
/// <summary>
/// Raised directed on the thrown entity that hits another.
/// </summary>
public class ThrowDoHitEvent : ThrowEvent
{
public ThrowDoHitEvent(IEntity? user, IEntity thrown, IEntity target) : base(user, thrown, target)
{
}
}
}