Shadow anomaly returns (#24629)

* content

* add cat

* ambient

* I FORGOT HEARTS!

* fix ambient

* some fixes

* canCollide: false

* connect to damageable

* pi

* remove fx

* some fixes

* *sad bruh*

* hazed

* Update base_shadow.yml
This commit is contained in:
Ed
2024-02-14 01:12:32 +03:00
committed by GitHub
parent f8640cf97e
commit ae321151ca
26 changed files with 468 additions and 29 deletions

View File

@@ -31,6 +31,7 @@ namespace Content.Server.Flash
[Dependency] private readonly SharedChargesSystem _charges = default!;
[Dependency] private readonly EntityLookupSystem _entityLookup = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly SharedInteractionSystem _interaction = default!;
[Dependency] private readonly InventorySystem _inventory = default!;
[Dependency] private readonly PopupSystem _popup = default!;
@@ -150,27 +151,23 @@ namespace Content.Server.Flash
public void FlashArea(EntityUid source, EntityUid? user, float range, float duration, float slowTo = 0.8f, bool displayPopup = false, SoundSpecifier? sound = null)
{
var transform = EntityManager.GetComponent<TransformComponent>(source);
var mapPosition = transform.MapPosition;
var flashableEntities = new List<EntityUid>();
var mapPosition = _transform.GetMapCoordinates(transform);
var flashableQuery = GetEntityQuery<FlashableComponent>();
foreach (var entity in _entityLookup.GetEntitiesInRange(transform.Coordinates, range))
{
if (!flashableQuery.HasComponent(entity))
if (!flashableQuery.TryGetComponent(entity, out var flashable))
continue;
flashableEntities.Add(entity);
}
foreach (var entity in flashableEntities)
{
// Check for unobstructed entities while ignoring the mobs with flashable components.
if (!_interaction.InRangeUnobstructed(entity, mapPosition, range, CollisionGroup.Opaque, (e) => flashableEntities.Contains(e) || e == source))
if (!_interaction.InRangeUnobstructed(entity, mapPosition, range, flashable.CollisionGroup, (e) => e == source))
continue;
// They shouldn't have flash removed in between right?
Flash(entity, user, source, duration, slowTo, displayPopup, flashableQuery.GetComponent(entity));
}
if (sound != null)
{
_audio.PlayPvs(sound, source, AudioParams.Default.WithVolume(1f).WithMaxDistance(3f));