ECS containmentfieldgeneratorcomponent (#8757)

* ECS containmentfieldgeneratorcomponent

* Fix tests and clean up one line

* check for anchored in a better way

* Fix dependency exception

I'm not really happy with this solution, it's not very good but I'm not
sure how to do it better without refactoring way more than I want to. Maybe
I'm missing something.

* review

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
ScalyChimp
2022-06-16 14:46:21 +01:00
committed by GitHub
parent 63d607f26a
commit 9b54a8a2ae
4 changed files with 185 additions and 164 deletions

View File

@@ -18,7 +18,7 @@ namespace Content.Server.Singularity.EntitySystems
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly SharedContainerSystem _container = default!;
[Dependency] private readonly PVSOverrideSystem _pvs = default!;
[Dependency] private readonly ContainmentFieldGeneratorSystem _fieldGeneratorSystem = default!;
/// <summary>
/// How much energy the singulo gains from destroying a tile.
/// </summary>
@@ -132,7 +132,7 @@ namespace Content.Server.Singularity.EntitySystems
!EntityManager.HasComponent<GhostComponent>(entity) &&
(component.Level > 4 ||
!EntityManager.HasComponent<ContainmentFieldComponent>(entity) &&
!(EntityManager.TryGetComponent<ContainmentFieldGeneratorComponent>(entity, out var containFieldGen) && containFieldGen.CanRepel(component)));
!(EntityManager.TryGetComponent<ContainmentFieldGeneratorComponent>(entity, out var containFieldGen) && _fieldGeneratorSystem.CanRepel(component, containFieldGen)));
}
private void HandleDestroy(ServerSingularityComponent component, EntityUid entity)