examine for stealth effect (#12486)
Co-authored-by: Kara <lunarautomaton6@gmail.com>
This commit is contained in:
@@ -61,6 +61,12 @@ public sealed class StealthComponent : Component
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("maxVisibility")]
|
[DataField("maxVisibility")]
|
||||||
public readonly float MaxVisibility = 1.5f;
|
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]
|
[Serializable, NetSerializable]
|
||||||
|
|||||||
@@ -19,10 +19,11 @@ public abstract class SharedStealthSystem : EntitySystem
|
|||||||
SubscribeLocalEvent<StealthOnMoveComponent, GetVisibilityModifiersEvent>(OnGetVisibilityModifiers);
|
SubscribeLocalEvent<StealthOnMoveComponent, GetVisibilityModifiersEvent>(OnGetVisibilityModifiers);
|
||||||
SubscribeLocalEvent<StealthComponent, EntityPausedEvent>(OnPaused);
|
SubscribeLocalEvent<StealthComponent, EntityPausedEvent>(OnPaused);
|
||||||
SubscribeLocalEvent<StealthComponent, ComponentInit>(OnInit);
|
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)
|
if (!component.Enabled || GetVisibility(uid, component) > component.ExamineThreshold)
|
||||||
return;
|
return;
|
||||||
@@ -41,6 +42,12 @@ public abstract class SharedStealthSystem : EntitySystem
|
|||||||
args.Cancel();
|
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)
|
public virtual void SetEnabled(EntityUid uid, bool value, StealthComponent? component = null)
|
||||||
{
|
{
|
||||||
if (!Resolve(uid, ref component, false) || component.Enabled == value)
|
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]
|
||||||
Reference in New Issue
Block a user