mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
examine for stealth effect (#12486)
Co-authored-by: Kara <lunarautomaton6@gmail.com>
This commit is contained in:
parent
2f2d8889ab
commit
21906f45bf
3 changed files with 16 additions and 2 deletions
|
|
@ -61,6 +61,12 @@ public sealed class StealthComponent : Component
|
|||
/// </summary>
|
||||
[DataField("maxVisibility")]
|
||||
public readonly float MaxVisibility = 1.5f;
|
||||
|
||||
/// <summary>
|
||||
/// Localization string for how you'd like to describe this effect.
|
||||
/// </summary>
|
||||
[DataField("examinedDesc")]
|
||||
public string ExaminedDesc = "stealth-visual-effect";
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
|
|
|
|||
|
|
@ -19,10 +19,11 @@ public abstract class SharedStealthSystem : EntitySystem
|
|||
SubscribeLocalEvent<StealthOnMoveComponent, GetVisibilityModifiersEvent>(OnGetVisibilityModifiers);
|
||||
SubscribeLocalEvent<StealthComponent, EntityPausedEvent>(OnPaused);
|
||||
SubscribeLocalEvent<StealthComponent, ComponentInit>(OnInit);
|
||||
SubscribeLocalEvent<StealthComponent, ExamineAttemptEvent>(OnExamine);
|
||||
SubscribeLocalEvent<StealthComponent, ExamineAttemptEvent>(OnExamineAttempt);
|
||||
SubscribeLocalEvent<StealthComponent, ExaminedEvent>(OnExamined);
|
||||
}
|
||||
|
||||
private void OnExamine(EntityUid uid, StealthComponent component, ExamineAttemptEvent args)
|
||||
private void OnExamineAttempt(EntityUid uid, StealthComponent component, ExamineAttemptEvent args)
|
||||
{
|
||||
if (!component.Enabled || GetVisibility(uid, component) > component.ExamineThreshold)
|
||||
return;
|
||||
|
|
@ -41,6 +42,12 @@ public abstract class SharedStealthSystem : EntitySystem
|
|||
args.Cancel();
|
||||
}
|
||||
|
||||
private void OnExamined(EntityUid uid, StealthComponent component, ExaminedEvent args)
|
||||
{
|
||||
if (component.Enabled)
|
||||
args.PushMarkup(Loc.GetString(component.ExaminedDesc, ("target", uid)));
|
||||
}
|
||||
|
||||
public virtual void SetEnabled(EntityUid uid, bool value, StealthComponent? component = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component, false) || component.Enabled == value)
|
||||
|
|
|
|||
1
Resources/Locale/en-US/visual_effects.ftl
Normal file
1
Resources/Locale/en-US/visual_effects.ftl
Normal file
|
|
@ -0,0 +1 @@
|
|||
stealth-visual-effect = [color=lightslategray]{CAPITALIZE(SUBJECT($target))} {CONJUGATE-BASIC($target, "shimmer", "shimmers")} with strange transparency.[/color]
|
||||
Loading…
Add table
Reference in a new issue