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:
@@ -12,6 +12,12 @@ namespace Content.Shared.Stealth.Components;
|
||||
[Access(typeof(SharedStealthSystem))]
|
||||
public sealed class StealthComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether or not the stealth effect should currently be applied.
|
||||
/// </summary>
|
||||
[DataField("enabled")]
|
||||
public bool Enabled = true;
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the entity previously had an interaction outline prior to cloaking.
|
||||
/// </summary>
|
||||
@@ -19,12 +25,21 @@ public sealed class StealthComponent : Component
|
||||
public bool HadOutline;
|
||||
|
||||
/// <summary>
|
||||
/// Last set level of visibility. Ranges from 1 (fully visible) and -1 (fully hidden). To get the actual current
|
||||
/// visibility, use <see cref="SharedStealthSystem.GetVisibility(EntityUid, StealthComponent?)"/>
|
||||
/// Minimum visibility before the entity becomes unexaminable (and thus no longer appears on context menus).
|
||||
/// </summary>
|
||||
[DataField("examineThreshold")]
|
||||
public readonly float ExamineThreshold = 0.5f;
|
||||
|
||||
/// <summary>
|
||||
/// Last set level of visibility. The visual effect ranges from 1 (fully visible) and -1 (fully hidden). Values
|
||||
/// outside of this range simply act as a buffer for the visual effect (i.e., a delay before turning invisible). To
|
||||
/// get the actual current visibility, use <see cref="SharedStealthSystem.GetVisibility(EntityUid,
|
||||
/// StealthComponent?)"/>
|
||||
/// </summary>
|
||||
[DataField("lastVisibility")]
|
||||
[Access(typeof(SharedStealthSystem), Other = AccessPermissions.None)]
|
||||
public float LastVisibility;
|
||||
public float LastVisibility = 1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Time at which <see cref="LastVisibility"/> was set. Null implies the entity is currently paused and not
|
||||
@@ -44,17 +59,31 @@ public sealed class StealthComponent : Component
|
||||
/// </summary>
|
||||
[DataField("movementVisibilityRate")]
|
||||
public readonly float MovementVisibilityRate = 0.2f;
|
||||
|
||||
/// <summary>
|
||||
/// Minimum visibility. Note that the visual effect caps out at -1, but this value is allowed to be larger or smaller.
|
||||
/// </summary>
|
||||
[DataField("minVisibility")]
|
||||
public readonly float MinVisibility = -1f;
|
||||
|
||||
/// <summary>
|
||||
/// Maximum visibility. Note that the visual effect caps out at +1, but this value is allowed to be larger or smaller.
|
||||
/// </summary>
|
||||
[DataField("maxVisibility")]
|
||||
public readonly float MaxVisibility = 1.5f;
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class StealthComponentState : ComponentState
|
||||
{
|
||||
public float Visibility;
|
||||
public TimeSpan? LastUpdated;
|
||||
public readonly float Visibility;
|
||||
public readonly TimeSpan? LastUpdated;
|
||||
public readonly bool Enabled;
|
||||
|
||||
public StealthComponentState(float stealthLevel, TimeSpan? lastUpdated)
|
||||
public StealthComponentState(float stealthLevel, TimeSpan? lastUpdated, bool enabled)
|
||||
{
|
||||
Visibility = stealthLevel;
|
||||
LastUpdated = lastUpdated;
|
||||
Enabled = enabled;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user