Explosion refactor TEST MERG (#6995)
* Explosions * fix yaml typo and prevent silly UI inputs * oop Co-authored-by: ElectroJr <leonsfriedrich@gmail.com>
This commit is contained in:
@@ -29,21 +29,6 @@ namespace Content.Shared.Acts
|
||||
void OnBreak(BreakageEventArgs eventArgs);
|
||||
}
|
||||
|
||||
public interface IExAct
|
||||
{
|
||||
/// <summary>
|
||||
/// Called when explosion reaches the entity
|
||||
/// </summary>
|
||||
void OnExplosion(ExplosionEventArgs eventArgs);
|
||||
}
|
||||
|
||||
public sealed class ExplosionEventArgs : EventArgs
|
||||
{
|
||||
public EntityCoordinates Source { get; set; }
|
||||
public EntityUid Target { get; set; }
|
||||
public ExplosionSeverity Severity { get; set; }
|
||||
}
|
||||
|
||||
[UsedImplicitly]
|
||||
public sealed class ActSystem : EntitySystem
|
||||
{
|
||||
@@ -59,23 +44,7 @@ namespace Content.Shared.Acts
|
||||
destroyAct.OnDestroy(eventArgs);
|
||||
}
|
||||
|
||||
EntityManager.QueueDeleteEntity(owner);
|
||||
}
|
||||
|
||||
public void HandleExplosion(EntityCoordinates source, EntityUid target, ExplosionSeverity severity)
|
||||
{
|
||||
var eventArgs = new ExplosionEventArgs
|
||||
{
|
||||
Source = source,
|
||||
Target = target,
|
||||
Severity = severity
|
||||
};
|
||||
var exActs = EntityManager.GetComponents<IExAct>(target).ToList();
|
||||
|
||||
foreach (var exAct in exActs)
|
||||
{
|
||||
exAct.OnExplosion(eventArgs);
|
||||
}
|
||||
QueueDel(owner);
|
||||
}
|
||||
|
||||
public void HandleBreakage(EntityUid owner)
|
||||
@@ -89,11 +58,4 @@ namespace Content.Shared.Acts
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum ExplosionSeverity
|
||||
{
|
||||
Light,
|
||||
Heavy,
|
||||
Destruction,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user