Skip to content

Commit

Permalink
Merge pull request #1475 from widgetbeck/master
Browse files Browse the repository at this point in the history
DetailedInspect component (for making lawsets viewable on lawboards.)
  • Loading branch information
AftrLite authored Jan 24, 2025
2 parents 48a7971 + f3f99a4 commit 00cbeb1
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 39 deletions.
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";
}
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));
}
}
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.
68 changes: 29 additions & 39 deletions Resources/Prototypes/Entities/Mobs/Player/silicon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,17 @@
showEnts: True

# Boards
- type: entity # imp. there is no base lawboard by default
abstract: true
id: BaseLawBoard
parent: BaseElectronics
components:
- type: StealTarget
stealGroup: AILawBoard

- type: entity
id: AsimovCircuitBoard
parent: BaseElectronics
parent: BaseLawBoard # imp. these are default parented off of BaseElectronics
name: law board (Crewsimov)
description: An electronics board containing the Crewsimov lawset.
components:
Expand All @@ -133,12 +141,17 @@
state: std_mod
- type: SiliconLawProvider
laws: Crewsimov
- type: StealTarget #imp
stealGroup: AILawBoard
- type: DetailedInspect # imp. this is the format, please add it to everything else
verbMessage: verbs-detailed-inspect-lawset
demarcated: true
examineText:
- law-crewsimov-1
- law-crewsimov-2
- law-crewsimov-3

- type: entity
id: CorporateCircuitBoard
parent: BaseElectronics
parent: BaseLawBoard
name: law board (Corporate)
description: An electronics board containing the Corporate lawset.
components:
Expand All @@ -147,12 +160,10 @@
state: std_mod
- type: SiliconLawProvider
laws: Corporate
- type: StealTarget #imp
stealGroup: AILawBoard

- type: entity
id: NTDefaultCircuitBoard
parent: BaseElectronics
parent: BaseLawBoard
name: law board (NT Default)
description: An electronics board containing the NT Default lawset.
components:
Expand All @@ -161,12 +172,10 @@
state: std_mod
- type: SiliconLawProvider
laws: NTDefault
- type: StealTarget #imp
stealGroup: AILawBoard

- type: entity
id: CommandmentCircuitBoard
parent: BaseElectronics
parent: BaseLawBoard
name: law board (Ten Commandments)
description: An electronics board containing the Ten Commandments lawset.
components:
Expand All @@ -175,12 +184,11 @@
state: std_mod
- type: SiliconLawProvider
laws: CommandmentsLawset
- type: StealTarget #imp
stealGroup: AILawBoard


- type: entity
id: PaladinCircuitBoard
parent: BaseElectronics
parent: BaseLawBoard
name: law board (Paladin)
description: An electronics board containing the Paladin lawset.
components:
Expand All @@ -189,12 +197,10 @@
state: std_mod
- type: SiliconLawProvider
laws: PaladinLawset
- type: StealTarget #imp
stealGroup: AILawBoard

- type: entity
id: LiveLetLiveCircuitBoard
parent: BaseElectronics
parent: BaseLawBoard
name: law board (Live and Let Live)
description: An electronics board containing the Live and Let Live lawset.
components:
Expand All @@ -203,12 +209,10 @@
state: std_mod
- type: SiliconLawProvider
laws: LiveLetLiveLaws
- type: StealTarget #imp
stealGroup: AILawBoard

- type: entity
id: StationEfficiencyCircuitBoard
parent: BaseElectronics
parent: BaseLawBoard
name: law board (Station Efficiency)
description: An electronics board containing the Station Efficiency lawset.
components:
Expand All @@ -217,12 +221,10 @@
state: std_mod
- type: SiliconLawProvider
laws: EfficiencyLawset
- type: StealTarget #imp
stealGroup: AILawBoard

- type: entity
id: RobocopCircuitBoard
parent: BaseElectronics
parent: BaseLawBoard
name: law board (Robocop)
description: An electronics board containing the Robocop lawset.
components:
Expand All @@ -231,12 +233,10 @@
state: std_mod
- type: SiliconLawProvider
laws: RobocopLawset
- type: StealTarget #imp
stealGroup: AILawBoard

- type: entity
id: OverlordCircuitBoard
parent: BaseElectronics
parent: BaseLawBoard
name: law board (Overlord)
description: An electronics board containing the Overlord lawset.
components:
Expand All @@ -245,12 +245,10 @@
state: std_mod
- type: SiliconLawProvider
laws: OverlordLawset
- type: StealTarget #imp
stealGroup: AILawBoard

- type: entity
id: GameMasterCircuitBoard
parent: BaseElectronics
parent: BaseLawBoard
name: law board (Game Master)
description: An electronics board containing the Game Master lawset.
components:
Expand All @@ -259,12 +257,10 @@
state: std_mod
- type: SiliconLawProvider
laws: GameMasterLawset
- type: StealTarget #imp
stealGroup: AILawBoard

- type: entity
id: ArtistCircuitBoard
parent: BaseElectronics
parent: BaseLawBoard
name: law board (Artist)
description: An electronics board containing the Artist lawset.
components:
Expand All @@ -273,12 +269,10 @@
state: std_mod
- type: SiliconLawProvider
laws: PainterLawset
- type: StealTarget #imp
stealGroup: AILawBoard

- type: entity
id: AntimovCircuitBoard
parent: [BaseElectronics, BaseSyndicateContraband]
parent: [BaseLawBoard, BaseSyndicateContraband]
name: law board (Antimov)
description: An electronics board containing the Antimov lawset.
components:
Expand All @@ -288,12 +282,10 @@
- type: SiliconLawProvider
laws: AntimovLawset
lawUploadSound: /Audio/Ambience/Antag/silicon_lawboard_antimov.ogg
- type: StealTarget #imp
stealGroup: AILawBoard

- type: entity
id: NutimovCircuitBoard
parent: BaseElectronics
parent: BaseLawBoard
name: law board (Nutimov)
description: An electronics board containing the Nutimov lawset.
components:
Expand All @@ -302,8 +294,6 @@
state: std_mod
- type: SiliconLawProvider
laws: NutimovLawset
- type: StealTarget #imp
stealGroup: AILawBoard

# Items
- type: entity
Expand Down

0 comments on commit 00cbeb1

Please sign in to comment.