Fixes admin logs and tests to not depend on IEntity caching (#5657)
Co-authored-by: Paul Ritter <ritter.paul1@googlemail.com>
This commit is contained in:
committed by
GitHub
parent
c4c139041c
commit
3f8f4c818e
@@ -91,14 +91,15 @@ namespace Content.Server.AI.EntitySystems
|
||||
|
||||
foreach (var npc in _awakeAi)
|
||||
{
|
||||
if (npc.Paused) continue;
|
||||
|
||||
if (npc.Deleted)
|
||||
{
|
||||
toRemove.Add(npc);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (npc.Paused)
|
||||
continue;
|
||||
|
||||
if (count >= maxUpdates)
|
||||
{
|
||||
break;
|
||||
|
||||
@@ -68,8 +68,8 @@ public partial class AdminLogSystem
|
||||
continue;
|
||||
}
|
||||
|
||||
var entityName = _entityManager.TryGetEntity(uid, out var resolvedEntity)
|
||||
? resolvedEntity.Name
|
||||
var entityName = _entityManager.TryGetComponent(uid, out MetaDataComponent? metadata)
|
||||
? metadata.EntityName
|
||||
: null;
|
||||
|
||||
if (entities.Any(e => e.id == (int) uid)) continue;
|
||||
|
||||
@@ -16,9 +16,9 @@ public class EntityUidConverter : AdminLogConverter<EntityUid>
|
||||
|
||||
writer.WriteNumber("id", (int) value);
|
||||
|
||||
if (entities.TryGetEntity(value, out var entity))
|
||||
if (entities.TryGetComponent(value, out MetaDataComponent metaData))
|
||||
{
|
||||
writer.WriteString("name", entity.Name);
|
||||
writer.WriteString("name", metaData.EntityName);
|
||||
}
|
||||
|
||||
if (entities.TryGetComponent(value, out ActorComponent? actor))
|
||||
|
||||
@@ -347,7 +347,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
{
|
||||
var atmosphere = _currentRunAtmosphere[_currentRunAtmosphereIndex];
|
||||
|
||||
if (atmosphere.Paused || !atmosphere.Simulated || atmosphere.LifeStage >= ComponentLifeStage.Stopping)
|
||||
if (atmosphere.LifeStage >= ComponentLifeStage.Stopping || atmosphere.Paused || !atmosphere.Simulated)
|
||||
continue;
|
||||
|
||||
atmosphere.Timer += frameTime;
|
||||
|
||||
@@ -262,6 +262,9 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
|
||||
private void HandlePowerChange(EntityUid uid, DisposalUnitComponent component, PowerChangedEvent args)
|
||||
{
|
||||
if (!component.Running)
|
||||
return;
|
||||
|
||||
// TODO: Need to check the other stuff.
|
||||
if (!args.Powered)
|
||||
{
|
||||
|
||||
@@ -30,7 +30,12 @@ public class SpreaderSystem : EntitySystem
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<SpreaderComponent, ComponentAdd>(SpreaderAddHandler);
|
||||
SubscribeLocalEvent<AirtightChanged>(e => UpdateNearbySpreaders(e.Airtight.OwnerUid, e.Airtight));
|
||||
SubscribeLocalEvent<AirtightChanged>(OnAirtightChanged);
|
||||
}
|
||||
|
||||
private void OnAirtightChanged(AirtightChanged e)
|
||||
{
|
||||
UpdateNearbySpreaders(e.Airtight.OwnerUid, e.Airtight);
|
||||
}
|
||||
|
||||
private void SpreaderAddHandler(EntityUid uid, SpreaderComponent component, ComponentAdd args)
|
||||
|
||||
@@ -240,9 +240,12 @@ namespace Content.Server.Light.EntitySystems
|
||||
ApcPowerReceiverComponent? powerReceiver = null,
|
||||
AppearanceComponent? appearance = null)
|
||||
{
|
||||
if (!Resolve(uid, ref light, ref powerReceiver, ref appearance))
|
||||
if (!Resolve(uid, ref light, ref powerReceiver))
|
||||
return;
|
||||
|
||||
// Optional component.
|
||||
Resolve(uid, ref appearance, false);
|
||||
|
||||
// check if light has bulb
|
||||
var bulbUid = GetBulb(uid, light);
|
||||
if (bulbUid == null || !EntityManager.TryGetComponent(bulbUid.Value, out LightBulbComponent? lightBulb))
|
||||
|
||||
Reference in New Issue
Block a user