explosion minor rework + fix (#21718)
This commit is contained in:
@@ -4,6 +4,7 @@ using Content.Server.Construction;
|
||||
using Content.Server.Construction.Components;
|
||||
using Content.Server.Storage.Components;
|
||||
using Content.Shared.Destructible;
|
||||
using Content.Shared.Explosion;
|
||||
using Content.Shared.Foldable;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Lock;
|
||||
@@ -46,6 +47,7 @@ public sealed class EntityStorageSystem : SharedEntityStorageSystem
|
||||
|
||||
SubscribeLocalEvent<EntityStorageComponent, MapInitEvent>(OnMapInit);
|
||||
SubscribeLocalEvent<EntityStorageComponent, WeldableAttemptEvent>(OnWeldableAttempt);
|
||||
SubscribeLocalEvent<EntityStorageComponent, BeforeExplodeEvent>(OnExploded);
|
||||
|
||||
SubscribeLocalEvent<InsideEntityStorageComponent, InhaleLocationEvent>(OnInsideInhale);
|
||||
SubscribeLocalEvent<InsideEntityStorageComponent, ExhaleLocationEvent>(OnInsideExhale);
|
||||
@@ -98,6 +100,15 @@ public sealed class EntityStorageSystem : SharedEntityStorageSystem
|
||||
}
|
||||
}
|
||||
|
||||
private void OnExploded(Entity<EntityStorageComponent> ent, ref BeforeExplodeEvent args)
|
||||
{
|
||||
if (ent.Comp.ExplosionDamageCoefficient <= 0)
|
||||
return;
|
||||
|
||||
args.Contents.AddRange(ent.Comp.Contents.ContainedEntities);
|
||||
args.DamageCoefficient *= ent.Comp.ExplosionDamageCoefficient;
|
||||
}
|
||||
|
||||
protected override void TakeGas(EntityUid uid, SharedEntityStorageComponent component)
|
||||
{
|
||||
if (!component.Airtight)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Content.Server.Administration.Managers;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Explosion;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Hands;
|
||||
using Content.Shared.Lock;
|
||||
@@ -27,6 +28,7 @@ public sealed partial class StorageSystem : SharedStorageSystem
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<StorageComponent, GetVerbsEvent<ActivationVerb>>(AddUiVerb);
|
||||
SubscribeLocalEvent<StorageComponent, BoundUIClosedEvent>(OnBoundUIClosed);
|
||||
SubscribeLocalEvent<StorageComponent, BeforeExplodeEvent>(OnExploded);
|
||||
|
||||
SubscribeLocalEvent<StorageFillComponent, MapInitEvent>(OnStorageFillMapInit);
|
||||
}
|
||||
@@ -97,6 +99,11 @@ public sealed partial class StorageSystem : SharedStorageSystem
|
||||
}
|
||||
}
|
||||
|
||||
private void OnExploded(Entity<StorageComponent> ent, ref BeforeExplodeEvent args)
|
||||
{
|
||||
args.Contents.AddRange(ent.Comp.Container.ContainedEntities);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens the storage UI for an entity
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user