Misc stealth and box changes (#11809)
* git mv * Disable shader while box is open * Hide entity menu / prevent examine * fix recursion fix recursion fix recursion fix recursion * Better visibility checks * min and max visibility fields * fix reference point
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using Content.Shared.CardboardBox.Components;
|
||||
using Content.Server.Storage.Components;
|
||||
using Content.Shared.CardboardBox;
|
||||
@@ -6,6 +6,8 @@ using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Movement.Systems;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Timing;
|
||||
using Content.Shared.Stealth.Components;
|
||||
using Content.Shared.Stealth;
|
||||
|
||||
namespace Content.Server.CardboardBox;
|
||||
|
||||
@@ -14,12 +16,14 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly SharedMoverController _mover = default!;
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
[Dependency] private readonly SharedStealthSystem _stealth = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<CardboardBoxComponent, StorageBeforeCloseEvent>(OnBeforeStorageClosed);
|
||||
SubscribeLocalEvent<CardboardBoxComponent, StorageAfterOpenEvent>(AfterStorageOpen);
|
||||
SubscribeLocalEvent<CardboardBoxComponent, StorageAfterCloseEvent>(AfterStorageClosed);
|
||||
}
|
||||
|
||||
private void OnBeforeStorageClosed(EntityUid uid, CardboardBoxComponent component, StorageBeforeCloseEvent args)
|
||||
@@ -57,5 +61,18 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
|
||||
}
|
||||
|
||||
component.Mover = null;
|
||||
|
||||
// If this box has a stealth/chameleon effect, disable the stealth effect while the box is open.
|
||||
_stealth.SetEnabled(uid, false);
|
||||
}
|
||||
|
||||
private void AfterStorageClosed(EntityUid uid, CardboardBoxComponent component, StorageAfterCloseEvent args)
|
||||
{
|
||||
// If this box has a stealth/chameleon effect, enable the stealth effect.
|
||||
if (TryComp(uid, out StealthComponent? stealth))
|
||||
{
|
||||
_stealth.SetVisibility(uid, stealth.MaxVisibility, stealth);
|
||||
_stealth.SetEnabled(uid, true, stealth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user