Fix various errors/exceptions (#22841)
* Fix entity storage localization * Fix HumanoidAppearanceComponent resolve * Fix null reference exceptions * Fix duplicate key error * Fix artifact error spam * actually maybe this is what its meant to do * Fix entities playing sounds on deletion
This commit is contained in:
@@ -77,7 +77,8 @@ public sealed class DefibrillatorSystem : EntitySystem
|
||||
|
||||
private void OnPowerCellSlotEmpty(EntityUid uid, DefibrillatorComponent component, ref PowerCellSlotEmptyEvent args)
|
||||
{
|
||||
TryDisable(uid, component);
|
||||
if (!TerminatingOrDeleted(uid))
|
||||
TryDisable(uid, component);
|
||||
}
|
||||
|
||||
private void OnAfterInteract(EntityUid uid, DefibrillatorComponent component, AfterInteractEvent args)
|
||||
@@ -139,6 +140,7 @@ public sealed class DefibrillatorSystem : EntitySystem
|
||||
|
||||
component.Enabled = false;
|
||||
_appearance.SetData(uid, ToggleVisuals.Toggled, false);
|
||||
|
||||
_audio.PlayPvs(component.PowerOffSound, uid);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -459,45 +459,24 @@ namespace Content.Server.Shuttles.Systems
|
||||
if (dock.DockedWith == null)
|
||||
return;
|
||||
|
||||
if (TryComp<DoorBoltComponent>(dockUid, out var airlockA))
|
||||
{
|
||||
_bolts.SetBoltsWithAudio(dockUid, airlockA, false);
|
||||
}
|
||||
|
||||
if (TryComp<DoorBoltComponent>(dock.DockedWith, out var airlockB))
|
||||
{
|
||||
_bolts.SetBoltsWithAudio(dock.DockedWith.Value, airlockB, false);
|
||||
}
|
||||
|
||||
if (TryComp(dockUid, out DoorComponent? doorA))
|
||||
{
|
||||
if (_doorSystem.TryClose(dockUid, doorA))
|
||||
{
|
||||
doorA.ChangeAirtight = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (TryComp(dock.DockedWith, out DoorComponent? doorB))
|
||||
{
|
||||
if (_doorSystem.TryClose(dock.DockedWith.Value, doorB))
|
||||
{
|
||||
doorB.ChangeAirtight = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (LifeStage(dockUid) < EntityLifeStage.Terminating)
|
||||
{
|
||||
var recentlyDocked = EnsureComp<RecentlyDockedComponent>(dockUid);
|
||||
recentlyDocked.LastDocked = dock.DockedWith.Value;
|
||||
}
|
||||
|
||||
if (TryComp(dock.DockedWith.Value, out MetaDataComponent? meta) && meta.EntityLifeStage < EntityLifeStage.Terminating)
|
||||
{
|
||||
var recentlyDocked = EnsureComp<RecentlyDockedComponent>(dock.DockedWith.Value);
|
||||
recentlyDocked.LastDocked = dock.DockedWith.Value;
|
||||
}
|
||||
|
||||
OnUndock(dockUid, dock.DockedWith.Value);
|
||||
OnUndock(dock.DockedWith.Value, dockUid);
|
||||
Cleanup(dockUid, dock);
|
||||
}
|
||||
|
||||
private void OnUndock(EntityUid dockUid, EntityUid other)
|
||||
{
|
||||
if (TerminatingOrDeleted(dockUid))
|
||||
return;
|
||||
|
||||
if (TryComp<DoorBoltComponent>(dockUid, out var airlock))
|
||||
_bolts.SetBoltsWithAudio(dockUid, airlock, false);
|
||||
|
||||
if (TryComp(dockUid, out DoorComponent? door) && _doorSystem.TryClose(dockUid, door))
|
||||
door.ChangeAirtight = true;
|
||||
|
||||
var recentlyDocked = EnsureComp<RecentlyDockedComponent>(dockUid);
|
||||
recentlyDocked.LastDocked = other;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.Worldgen.Systems.Debris;
|
||||
|
||||
@@ -162,6 +163,12 @@ public sealed class DebrisFeaturePlacerSystem : BaseWorldSystem
|
||||
var failures = 0; // Avoid severe log spam.
|
||||
foreach (var point in points)
|
||||
{
|
||||
if (component.OwnedDebris.TryGetValue(point, out var existing))
|
||||
{
|
||||
DebugTools.Assert(Exists(existing));
|
||||
continue;
|
||||
}
|
||||
|
||||
var pointDensity = _noiseIndex.Evaluate(uid, densityChannel, WorldGen.WorldToChunkCoords(point));
|
||||
if (pointDensity == 0 && component.DensityClip || _random.Prob(component.RandomCancellationChance))
|
||||
continue;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations;
|
||||
|
||||
namespace Content.Server.Xenoarchaeology.Equipment.Components;
|
||||
|
||||
@@ -19,6 +18,6 @@ public sealed partial class ActiveArtifactAnalyzerComponent : Component
|
||||
/// <summary>
|
||||
/// What is being scanned?
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField]
|
||||
public EntityUid Artifact;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public sealed partial class ArtifactAnalyzerComponent : Component
|
||||
public SoundSpecifier ScanFinishedSound = new SoundPathSpecifier("/Audio/Machines/scan_finish.ogg");
|
||||
|
||||
#region Analysis Data
|
||||
[ViewVariables]
|
||||
[DataField]
|
||||
public EntityUid? LastAnalyzedArtifact;
|
||||
|
||||
[ViewVariables]
|
||||
|
||||
@@ -195,7 +195,7 @@ public sealed class ArtifactAnalyzerSystem : EntitySystem
|
||||
var canScan = false;
|
||||
var canPrint = false;
|
||||
var points = 0;
|
||||
if (component.AnalyzerEntity != null && TryComp<ArtifactAnalyzerComponent>(component.AnalyzerEntity, out var analyzer))
|
||||
if (TryComp<ArtifactAnalyzerComponent>(component.AnalyzerEntity, out var analyzer))
|
||||
{
|
||||
artifact = analyzer.LastAnalyzedArtifact;
|
||||
msg = GetArtifactScanMessage(analyzer);
|
||||
@@ -438,9 +438,14 @@ public sealed class ArtifactAnalyzerSystem : EntitySystem
|
||||
|
||||
private void OnItemRemoved(EntityUid uid, ArtifactAnalyzerComponent component, ref ItemRemovedEvent args)
|
||||
{
|
||||
// Scanners shouldn't give permanent remove vision to an artifact, and the scanned artifact doesn't have any
|
||||
// component to track analyzers that have scanned it for removal if the artifact gets deleted.
|
||||
// So we always clear this on removal.
|
||||
component.LastAnalyzedArtifact = null;
|
||||
|
||||
// cancel the scan if the artifact moves off the analyzer
|
||||
CancelScan(args.OtherEntity);
|
||||
if (component.Console != null && Exists(component.Console))
|
||||
if (Exists(component.Console))
|
||||
UpdateUserInterface(component.Console.Value);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,13 +67,13 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
|
||||
bool permanent = false,
|
||||
HumanoidAppearanceComponent? humanoid = null)
|
||||
{
|
||||
if (!Resolve(uid, ref humanoid))
|
||||
if (!Resolve(uid, ref humanoid, false))
|
||||
return;
|
||||
|
||||
var dirty = false;
|
||||
SetLayerVisibility(uid, humanoid, layer, visible, permanent, ref dirty);
|
||||
if (dirty)
|
||||
Dirty(humanoid);
|
||||
Dirty(uid, humanoid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -787,7 +787,7 @@ public abstract class SharedStorageSystem : EntitySystem
|
||||
|
||||
if (!_sharedHandsSystem.CanDrop(player, toInsert.Value, hands))
|
||||
{
|
||||
_popupSystem.PopupClient(Loc.GetString("comp-storage-cant-drop"), uid, player);
|
||||
_popupSystem.PopupClient(Loc.GetString("comp-storage-cant-drop", ("entity", toInsert.Value)), uid, player);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ public abstract class SharedReflectSystem : EntitySystem
|
||||
|
||||
if (Resolve(projectile, ref projectileComp, false))
|
||||
{
|
||||
_adminLogger.Add(LogType.BulletHit, LogImpact.Medium, $"{ToPrettyString(user)} reflected {ToPrettyString(projectile)} from {ToPrettyString(projectileComp.Weapon!.Value)} shot by {projectileComp.Shooter!.Value}");
|
||||
_adminLogger.Add(LogType.BulletHit, LogImpact.Medium, $"{ToPrettyString(user)} reflected {ToPrettyString(projectile)} from {ToPrettyString(projectileComp.Weapon)} shot by {projectileComp.Shooter}");
|
||||
|
||||
projectileComp.Shooter = user;
|
||||
projectileComp.Weapon = user;
|
||||
|
||||
Reference in New Issue
Block a user