ExAct for lockers (#1931)
* ExAct for lockers * ToArray Co-authored-by: py01 <pyronetics01@gmail.com>
This commit is contained in:
@@ -33,7 +33,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
[ComponentReference(typeof(IActivate))]
|
[ComponentReference(typeof(IActivate))]
|
||||||
[ComponentReference(typeof(IStorageComponent))]
|
[ComponentReference(typeof(IStorageComponent))]
|
||||||
public class EntityStorageComponent : Component, IActivate, IStorageComponent, IInteractUsing, IDestroyAct, IActionBlocker
|
public class EntityStorageComponent : Component, IActivate, IStorageComponent, IInteractUsing, IDestroyAct, IActionBlocker, IExAct
|
||||||
{
|
{
|
||||||
public override string Name => "EntityStorage";
|
public override string Name => "EntityStorage";
|
||||||
|
|
||||||
@@ -430,5 +430,22 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
|||||||
|
|
||||||
data.Text = component.Open ? "Close" : "Open";
|
data.Text = component.Open ? "Close" : "Open";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IExAct.OnExplosion(ExplosionEventArgs eventArgs)
|
||||||
|
{
|
||||||
|
if (eventArgs.Severity < ExplosionSeverity.Heavy)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var entity in Contents.ContainedEntities)
|
||||||
|
{
|
||||||
|
var exActs = entity.GetAllComponents<IExAct>().ToArray();
|
||||||
|
foreach (var exAct in exActs)
|
||||||
|
{
|
||||||
|
exAct.OnExplosion(eventArgs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user