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:
Moony
2022-03-04 13:48:01 -06:00
committed by GitHub
parent 4e203f49d2
commit 4a466f4927
71 changed files with 3958 additions and 760 deletions

View File

@@ -1,10 +1,10 @@
using Content.Server.Chat.Managers;
using Content.Server.Construction.Components;
using Content.Server.Coordinates.Helpers;
using Content.Server.Explosion.EntitySystems;
using Content.Server.Popups;
using Content.Server.UserInterface;
using Content.Shared.Audio;
using Content.Shared.Body.Components;
using Content.Shared.Containers.ItemSlots;
using Content.Shared.Nuke;
using Content.Shared.Sound;
@@ -19,7 +19,7 @@ namespace Content.Server.Nuke
[Dependency] private readonly NukeCodeSystem _codes = default!;
[Dependency] private readonly ItemSlotsSystem _itemSlots = default!;
[Dependency] private readonly PopupSystem _popups = default!;
[Dependency] private readonly EntityLookupSystem _lookup = default!;
[Dependency] private readonly ExplosionSystem _explosions = default!;
[Dependency] private readonly IChatManager _chat = default!;
public override void Initialize()
@@ -397,19 +397,16 @@ namespace Content.Server.Nuke
if (!Resolve(uid, ref component, ref transform))
return;
// gib anyone in a blast radius
// its lame, but will work for now
var pos = transform.Coordinates;
var ents = _lookup.GetEntitiesInRange(pos, component.BlastRadius);
foreach (var ent in ents)
{
var entUid = ent;
if (!EntityManager.EntityExists(entUid))
continue;
if (component.Exploded)
return;
if (EntityManager.TryGetComponent(entUid, out SharedBodyComponent? body))
body.Gib();
}
component.Exploded = true;
_explosions.QueueExplosion(uid,
component.ExplosionType,
component.TotalIntensity,
component.IntensitySlope,
component.MaxIntensity);
EntityManager.DeleteEntity(uid);
}