forked from space-wizards/space-station-14
-
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1475 from widgetbeck/master
DetailedInspect component (for making lawsets viewable on lawboards.)
- Loading branch information
Showing
4 changed files
with
103 additions
and
39 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
Content.Shared/_Impstation/DetailedExamine/DetailedInspectComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Robust.Shared.GameStates; | ||
|
||
namespace Content.Shared._Impstation.DetailedInspect; | ||
|
||
[RegisterComponent, NetworkedComponent] | ||
public sealed partial class DetailedInspectComponent : Component | ||
{ | ||
[DataField] | ||
public LocId VerbText = "verbs-detailed-inspect"; | ||
|
||
[DataField] | ||
public LocId VerbMessage = "verbs-detailed-inspect-message"; | ||
|
||
[DataField(required: true)] | ||
public List<LocId> ExamineText; | ||
|
||
/// <summary> | ||
/// Whether or not the entries in ExamineText are separated by linebreaks and given ticks. | ||
/// </summary> | ||
[DataField] | ||
public bool Demarcated = false; | ||
|
||
/// <summary> | ||
/// Rooted directory of the icon for the verb. | ||
/// </summary> | ||
[DataField] | ||
public string Icon = "/Textures/Interface/VerbIcons/dot.svg.192dpi.png"; | ||
} |
42 changes: 42 additions & 0 deletions
42
Content.Shared/_Impstation/DetailedExamine/DetailedInspectSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using Content.Shared.Destructible; | ||
using Content.Shared.Examine; | ||
using Content.Shared.Verbs; | ||
using Robust.Shared.Network; | ||
using Robust.Shared.Utility; | ||
|
||
namespace Content.Shared._Impstation.DetailedInspect; | ||
|
||
public sealed partial class DetailedInspectSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly INetManager _net = default!; | ||
[Dependency] private readonly ExamineSystemShared _examine = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<DetailedInspectComponent, GetVerbsEvent<ExamineVerb>>(OnGetVerb); | ||
} | ||
|
||
public void OnGetVerb(Entity<DetailedInspectComponent> ent, ref GetVerbsEvent<ExamineVerb> args) | ||
{ | ||
if (!args.CanInteract || !args.CanAccess || !_net.IsServer) | ||
return; | ||
|
||
var msg = new FormattedMessage(); | ||
|
||
if (ent.Comp.Demarcated) | ||
{ | ||
foreach (var locId in ent.Comp.ExamineText) | ||
{ | ||
msg.AddMarkupOrThrow("- " + Loc.GetString(locId)); | ||
msg.PushNewline(); | ||
} | ||
} | ||
else | ||
foreach (var locId in ent.Comp.ExamineText) | ||
msg.AddMarkupOrThrow(Loc.GetString(locId) + " "); | ||
|
||
_examine.AddDetailedExamineVerb(args, ent.Comp, msg, Loc.GetString(ent.Comp.VerbText), ent.Comp.Icon, Loc.GetString(ent.Comp.VerbMessage)); | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
Resources/Locale/en-US/_Impstation/detailedInspect/detailedinspect.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
verbs-detailed-inspect = Inspect | ||
verbs-detailed-inspect-message = Take a closer look. | ||
verbs-detailed-inspect-lawset = View lawset. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters