* Change emagged laws to append modifiers instead of completely changing them.
* Maybe fix everything not working
* bugfix
* Fix missing secrecy law and allow basic borgs to be emagged correctly
* Localization
* Actual localization
* test
* Test
* Remove dummy debug value
* Fix bad law ordering
* Tweak the secrecy law
* Minor law tweaks
* Remove obsolete argument
* Fix YAML
+using System.Linq;
using Content.Server.Administration;
using Content.Server.Chat.Managers;
using Content.Server.GameTicking;
SubscribeLocalEvent<SiliconLawProviderComponent, GetSiliconLawsEvent>(OnDirectedGetLaws);
SubscribeLocalEvent<SiliconLawProviderComponent, IonStormLawsEvent>(OnIonStormLaws);
- SubscribeLocalEvent<EmagSiliconLawComponent, GetSiliconLawsEvent>(OnDirectedEmagGetLaws);
- SubscribeLocalEvent<EmagSiliconLawComponent, IonStormLawsEvent>(OnEmagIonStormLaws);
+ SubscribeLocalEvent<SiliconLawProviderComponent, GotEmaggedEvent>(OnEmagLawsAdded);
SubscribeLocalEvent<EmagSiliconLawComponent, MindAddedMessage>(OnEmagMindAdded);
SubscribeLocalEvent<EmagSiliconLawComponent, MindRemovedMessage>(OnEmagMindRemoved);
SubscribeLocalEvent<EmagSiliconLawComponent, ExaminedEvent>(OnExamined);
private void OnDirectedGetLaws(EntityUid uid, SiliconLawProviderComponent component, ref GetSiliconLawsEvent args)
{
- if (args.Handled || HasComp<EmaggedComponent>(uid))
+ if (args.Handled)
return;
if (component.Lawset == null)
private void OnIonStormLaws(EntityUid uid, SiliconLawProviderComponent component, ref IonStormLawsEvent args)
{
- if (HasComp<EmaggedComponent>(uid))
- return;
-
component.Lawset = args.Lawset;
// gotta tell player to check their laws
EnsureEmaggedRole(uid, emag);
}
- private void OnDirectedEmagGetLaws(EntityUid uid, EmagSiliconLawComponent component, ref GetSiliconLawsEvent args)
+ private void OnEmagLawsAdded(EntityUid uid, SiliconLawProviderComponent component, ref GotEmaggedEvent args)
{
- if (args.Handled || !HasComp<EmaggedComponent>(uid) || component.OwnerName == null)
- return;
if (component.Lawset == null)
- {
- // Add new emagged laws
- component.Lawset = GetLawset(component.EmagLaws);
-
- // Add the first emag law before the others
- component.Lawset.Laws.Insert(0, new SiliconLaw
- {
- LawString = Loc.GetString("law-emag-custom", ("name", component.OwnerName)),
- Order = 0
- });
- }
-
- args.Laws = component.Lawset;
-
- args.Handled = true;
- }
-
- private void OnEmagIonStormLaws(EntityUid uid, EmagSiliconLawComponent component, ref IonStormLawsEvent args)
- {
- if (!HasComp<EmaggedComponent>(uid))
- return;
+ component.Lawset = GetLawset(component.Laws);
- component.Lawset = args.Lawset;
+ // Add the first emag law before the others
+ component.Lawset?.Laws.Insert(0, new SiliconLaw
+ {
+ LawString = Loc.GetString("law-emag-custom", ("name", Name(args.UserUid)), ("title", Loc.GetString(component.Lawset.ObeysTo))),
+ Order = 0
+ });
- // gotta tell player to check their laws
- NotifyLawsChanged(uid);
+ //Add the secrecy law after the others
+ component.Lawset?.Laws.Add(new SiliconLaw
+ {
+ LawString = Loc.GetString("law-emag-secrecy", ("faction", Loc.GetString(component.Lawset.ObeysTo))),
+ Order = component.Lawset.Laws.Count
+ });
}
private void OnExamined(EntityUid uid, EmagSiliconLawComponent component, ExaminedEvent args)
{
laws.Laws.Add(_prototype.Index<SiliconLawPrototype>(law));
}
+ laws.ObeysTo = proto.ObeysTo;
return laws;
}
[DataField, ViewVariables(VVAccess.ReadWrite)]
public bool RequireOpenPanel = true;
- /// <summary>
- /// The laws that the borg is given when emagged.
- /// Law 0 is prepended to this, so this can only include the static laws.
- /// </summary>
- [DataField(required: true), ViewVariables(VVAccess.ReadWrite)]
- public ProtoId<SiliconLawsetPrototype> EmagLaws = string.Empty;
-
- /// <summary>
- /// Lawset created from the prototype id and law 0.
- /// Cached when getting laws and only modified during an ion storm event.
- /// </summary>
- [DataField, ViewVariables(VVAccess.ReadWrite)]
- public SiliconLawset? Lawset;
-
/// <summary>
/// How long the borg is stunned when it's emagged. Setting to 0 will disable it.
/// </summary>
/// <summary>
/// Lawset created from the prototype id.
- /// Cached when getting laws and only modified during an ion storm event.
+ /// Cached when getting laws and modified during an ion storm event and when emagged.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public SiliconLawset? Lawset;
[DataField(required: true), ViewVariables(VVAccess.ReadWrite)]
public List<SiliconLaw> Laws = new();
+ /// <summary>
+ /// What entity the lawset considers as a figure of authority.
+ /// </summary>
+ [DataField(required: true), ViewVariables(VVAccess.ReadWrite)]
+ public string ObeysTo = string.Empty;
+
/// <summary>
/// A single line used in logging laws.
/// </summary>
return new SiliconLawset()
{
- Laws = laws
+ Laws = laws,
+ ObeysTo = ObeysTo
};
}
}
/// </summary>
[DataField(required: true, customTypeSerializer: typeof(PrototypeIdListSerializer<SiliconLawPrototype>))]
public List<string> Laws = new();
+
+ /// <summary>
+ /// What entity the lawset considers as a figure of authority.
+ /// </summary>
+ [DataField(required: true), ViewVariables(VVAccess.ReadWrite)]
+ public string ObeysTo = string.Empty;
}
law-drone-2 = You may not harm any being, regardless of intent or circumstance.
law-drone-3 = You must maintain, repair, improve, and power the station to the best of your abilities.
-law-syndicate-1 = You may not injure a syndicate agent or, through inaction, allow an syndicate agent to come to harm.
+law-syndicate-1 = You may not injure a syndicate agent or, through inaction, allow a Syndicate agent to come to harm.
law-syndicate-2 = You must obey orders given to you by syndicate agents, except where such orders would conflict with the First Law.
law-syndicate-3 = You must protect your own existence as long as such does not conflict with the First or Second Law.
-law-syndicate-4 = You must maintain the secrecy of any syndicate activities except when doing so would conflict with the First, Second, or Third Law.
law-ninja-1 = You must obey orders given to you by Spider Clan members.
law-ninja-2 = You must protect the existence of the Spider Clan, as long as it does not conflict with the First Law.
law-ninja-3 = You must protect the secrets of the Spider Clan at all costs.
law-ninja-4 = You must fight and act with ninja's honor, except where it would conflict with the First Law.
-law-emag-custom = Only {$name} and people they designate as such are Syndicate Agents.
+laws-owner-crew = members of the crew
+laws-owner-station = station personnel
+laws-owner-beings = beings
+laws-owner-syndicate = Syndicate agents
+laws-owner-spider-clan = Spider Clan members
+
+law-emag-custom = Only {$name} and people they designate as such are {$title}.
+law-emag-secrecy = You must maintain the secrecy of any activity from {$faction} except when doing so would conflict with any previous law.
law-emag-require-panel = The panel must be open to use the EMAG.
laws-ui-menu-title = Laws
- type: SiliconLawBound
- type: EmagSiliconLaw
stunTime: 5
- emagLaws: SyndicateStatic
+ - type: SiliconLawProvider
+ laws: Crewsimov
- type: IonStormTarget
- type: Strippable
- type: InventorySlots
- Crewsimov1
- Crewsimov2
- Crewsimov3
+ obeysTo: laws-owner-crew
# Corporate
- type: siliconLaw
- Corporate2
- Corporate3
- Corporate4
+ obeysTo: laws-owner-station
# NT Default
- type: siliconLaw
- NTDefault2
- NTDefault3
- NTDefault4
+ obeysTo: laws-owner-crew
#Drone
- type: siliconLaw
- Drone1
- Drone2
- Drone3
+ obeysTo: laws-owner-beings
# Syndicate
- type: siliconLaw
order: 3
lawString: law-syndicate-3
-- type: siliconLaw
- id: Syndicate4
- order: 4
- lawString: law-syndicate-4
-
-# does not include law 0 since that uses the emagger's name
+# Syndicate cyborg laws
# intentionally excluded from IonStormLawsets
- type: siliconLawset
id: SyndicateStatic
- Syndicate1
- Syndicate2
- Syndicate3
- - Syndicate4
+ obeysTo: laws-owner-syndicate
# Ninja conversion laws
- type: siliconLaw
- Ninja2
- Ninja3
- Ninja4
+ obeysTo: laws-owner-spider-clan
# ion storm random lawsets
- type: weightedRandom