diff --git a/Content.Server/Medical/DefibrillatorSystem.cs b/Content.Server/Medical/DefibrillatorSystem.cs index f85ad8d1bf..12391d724f 100644 --- a/Content.Server/Medical/DefibrillatorSystem.cs +++ b/Content.Server/Medical/DefibrillatorSystem.cs @@ -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; } diff --git a/Content.Server/Shuttles/Systems/DockingSystem.cs b/Content.Server/Shuttles/Systems/DockingSystem.cs index f765ed6976..778d244376 100644 --- a/Content.Server/Shuttles/Systems/DockingSystem.cs +++ b/Content.Server/Shuttles/Systems/DockingSystem.cs @@ -459,45 +459,24 @@ namespace Content.Server.Shuttles.Systems if (dock.DockedWith == null) return; - if (TryComp(dockUid, out var airlockA)) - { - _bolts.SetBoltsWithAudio(dockUid, airlockA, false); - } - - if (TryComp(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(dockUid); - recentlyDocked.LastDocked = dock.DockedWith.Value; - } - - if (TryComp(dock.DockedWith.Value, out MetaDataComponent? meta) && meta.EntityLifeStage < EntityLifeStage.Terminating) - { - var recentlyDocked = EnsureComp(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(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(dockUid); + recentlyDocked.LastDocked = other; + } } } diff --git a/Content.Server/Worldgen/Systems/Debris/DebrisFeaturePlacerSystem.cs b/Content.Server/Worldgen/Systems/Debris/DebrisFeaturePlacerSystem.cs index 65af0b68cb..47ee6f6214 100644 --- a/Content.Server/Worldgen/Systems/Debris/DebrisFeaturePlacerSystem.cs +++ b/Content.Server/Worldgen/Systems/Debris/DebrisFeaturePlacerSystem.cs @@ -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; diff --git a/Content.Server/Xenoarchaeology/Equipment/Components/ActiveArtifactAnalyzerComponent.cs b/Content.Server/Xenoarchaeology/Equipment/Components/ActiveArtifactAnalyzerComponent.cs index 6bd20b2bf4..7d3fe6a2f0 100644 --- a/Content.Server/Xenoarchaeology/Equipment/Components/ActiveArtifactAnalyzerComponent.cs +++ b/Content.Server/Xenoarchaeology/Equipment/Components/ActiveArtifactAnalyzerComponent.cs @@ -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 /// /// What is being scanned? /// - [ViewVariables] + [DataField] public EntityUid Artifact; } diff --git a/Content.Server/Xenoarchaeology/Equipment/Components/ArtifactAnalyzerComponent.cs b/Content.Server/Xenoarchaeology/Equipment/Components/ArtifactAnalyzerComponent.cs index cea3b9fbf8..07096c59af 100644 --- a/Content.Server/Xenoarchaeology/Equipment/Components/ArtifactAnalyzerComponent.cs +++ b/Content.Server/Xenoarchaeology/Equipment/Components/ArtifactAnalyzerComponent.cs @@ -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] diff --git a/Content.Server/Xenoarchaeology/Equipment/Systems/ArtifactAnalyzerSystem.cs b/Content.Server/Xenoarchaeology/Equipment/Systems/ArtifactAnalyzerSystem.cs index 63095c7827..17e801cc18 100644 --- a/Content.Server/Xenoarchaeology/Equipment/Systems/ArtifactAnalyzerSystem.cs +++ b/Content.Server/Xenoarchaeology/Equipment/Systems/ArtifactAnalyzerSystem.cs @@ -195,7 +195,7 @@ public sealed class ArtifactAnalyzerSystem : EntitySystem var canScan = false; var canPrint = false; var points = 0; - if (component.AnalyzerEntity != null && TryComp(component.AnalyzerEntity, out var analyzer)) + if (TryComp(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); } diff --git a/Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs b/Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs index a61470bfdf..02e29549d4 100644 --- a/Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs +++ b/Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs @@ -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); } /// diff --git a/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs b/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs index 5c98cb011b..43939b29f9 100644 --- a/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs +++ b/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs @@ -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; } diff --git a/Content.Shared/Weapons/Reflect/SharedReflectSystem.cs b/Content.Shared/Weapons/Reflect/SharedReflectSystem.cs index 4986f9a341..b9dead8231 100644 --- a/Content.Shared/Weapons/Reflect/SharedReflectSystem.cs +++ b/Content.Shared/Weapons/Reflect/SharedReflectSystem.cs @@ -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;