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)
component.Enabled = false;
_appearance.SetData(uid, ToggleVisuals.Toggled, false);
+
_audio.PlayPvs(component.PowerOffSound, uid);
return true;
}
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;
- }
- }
+ OnUndock(dockUid, dock.DockedWith.Value);
+ OnUndock(dock.DockedWith.Value, dockUid);
+ Cleanup(dockUid, dock);
+ }
- if (TryComp(dock.DockedWith, out DoorComponent? doorB))
- {
- if (_doorSystem.TryClose(dock.DockedWith.Value, doorB))
- {
- doorB.ChangeAirtight = true;
- }
- }
+ private void OnUndock(EntityUid dockUid, EntityUid other)
+ {
+ if (TerminatingOrDeleted(dockUid))
+ return;
- if (LifeStage(dockUid) < EntityLifeStage.Terminating)
- {
- var recentlyDocked = EnsureComp<RecentlyDockedComponent>(dockUid);
- recentlyDocked.LastDocked = dock.DockedWith.Value;
- }
+ if (TryComp<DoorBoltComponent>(dockUid, out var airlock))
+ _bolts.SetBoltsWithAudio(dockUid, airlock, false);
- if (TryComp(dock.DockedWith.Value, out MetaDataComponent? meta) && meta.EntityLifeStage < EntityLifeStage.Terminating)
- {
- var recentlyDocked = EnsureComp<RecentlyDockedComponent>(dock.DockedWith.Value);
- recentlyDocked.LastDocked = dock.DockedWith.Value;
- }
+ if (TryComp(dockUid, out DoorComponent? door) && _doorSystem.TryClose(dockUid, door))
+ door.ChangeAirtight = true;
- Cleanup(dockUid, dock);
+ var recentlyDocked = EnsureComp<RecentlyDockedComponent>(dockUid);
+ recentlyDocked.LastDocked = other;
}
}
}
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Random;
+using Robust.Shared.Utility;
namespace Content.Server.Worldgen.Systems.Debris;
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;
-using Robust.Shared.Audio;
-using Robust.Shared.Serialization.TypeSerializers.Implementations;
+using Robust.Shared.Serialization.TypeSerializers.Implementations;
namespace Content.Server.Xenoarchaeology.Equipment.Components;
/// <summary>
/// What is being scanned?
/// </summary>
- [ViewVariables]
+ [DataField]
public EntityUid Artifact;
}
public SoundSpecifier ScanFinishedSound = new SoundPathSpecifier("/Audio/Machines/scan_finish.ogg");
#region Analysis Data
- [ViewVariables]
+ [DataField]
public EntityUid? LastAnalyzedArtifact;
[ViewVariables]
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);
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);
}
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>
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;
}
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;