From: Jajsha <101492056+Zap527@users.noreply.github.com> Date: Thu, 1 Feb 2024 05:02:49 +0000 (-0500) Subject: Tweak borg laws (#24698) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=27592ba898201d0b09c95f6b0958503407d01bb5;p=space-station-14.git Tweak borg laws (#24698) * 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 --- diff --git a/Content.Server/Silicons/Laws/SiliconLawSystem.cs b/Content.Server/Silicons/Laws/SiliconLawSystem.cs index 85c7271c1c..17a3d16413 100644 --- a/Content.Server/Silicons/Laws/SiliconLawSystem.cs +++ b/Content.Server/Silicons/Laws/SiliconLawSystem.cs @@ -1,3 +1,4 @@ +using System.Linq; using Content.Server.Administration; using Content.Server.Chat.Managers; using Content.Server.GameTicking; @@ -53,8 +54,7 @@ public sealed class SiliconLawSystem : SharedSiliconLawSystem SubscribeLocalEvent(OnDirectedGetLaws); SubscribeLocalEvent(OnIonStormLaws); - SubscribeLocalEvent(OnDirectedEmagGetLaws); - SubscribeLocalEvent(OnEmagIonStormLaws); + SubscribeLocalEvent(OnEmagLawsAdded); SubscribeLocalEvent(OnEmagMindAdded); SubscribeLocalEvent(OnEmagMindRemoved); SubscribeLocalEvent(OnExamined); @@ -108,7 +108,7 @@ public sealed class SiliconLawSystem : SharedSiliconLawSystem private void OnDirectedGetLaws(EntityUid uid, SiliconLawProviderComponent component, ref GetSiliconLawsEvent args) { - if (args.Handled || HasComp(uid)) + if (args.Handled) return; if (component.Lawset == null) @@ -121,9 +121,6 @@ public sealed class SiliconLawSystem : SharedSiliconLawSystem private void OnIonStormLaws(EntityUid uid, SiliconLawProviderComponent component, ref IonStormLawsEvent args) { - if (HasComp(uid)) - return; - component.Lawset = args.Lawset; // gotta tell player to check their laws @@ -134,38 +131,25 @@ public sealed class SiliconLawSystem : SharedSiliconLawSystem 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(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(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) @@ -299,6 +283,7 @@ public sealed class SiliconLawSystem : SharedSiliconLawSystem { laws.Laws.Add(_prototype.Index(law)); } + laws.ObeysTo = proto.ObeysTo; return laws; } diff --git a/Content.Shared/Silicons/Laws/Components/EmagSiliconLawComponent.cs b/Content.Shared/Silicons/Laws/Components/EmagSiliconLawComponent.cs index 2155401062..1b5338a7f7 100644 --- a/Content.Shared/Silicons/Laws/Components/EmagSiliconLawComponent.cs +++ b/Content.Shared/Silicons/Laws/Components/EmagSiliconLawComponent.cs @@ -23,20 +23,6 @@ public sealed partial class EmagSiliconLawComponent : Component [DataField, ViewVariables(VVAccess.ReadWrite)] public bool RequireOpenPanel = true; - /// - /// The laws that the borg is given when emagged. - /// Law 0 is prepended to this, so this can only include the static laws. - /// - [DataField(required: true), ViewVariables(VVAccess.ReadWrite)] - public ProtoId EmagLaws = string.Empty; - - /// - /// Lawset created from the prototype id and law 0. - /// Cached when getting laws and only modified during an ion storm event. - /// - [DataField, ViewVariables(VVAccess.ReadWrite)] - public SiliconLawset? Lawset; - /// /// How long the borg is stunned when it's emagged. Setting to 0 will disable it. /// diff --git a/Content.Shared/Silicons/Laws/Components/SiliconLawProviderComponent.cs b/Content.Shared/Silicons/Laws/Components/SiliconLawProviderComponent.cs index 3aaf965aee..4800aa0c59 100644 --- a/Content.Shared/Silicons/Laws/Components/SiliconLawProviderComponent.cs +++ b/Content.Shared/Silicons/Laws/Components/SiliconLawProviderComponent.cs @@ -16,7 +16,7 @@ public sealed partial class SiliconLawProviderComponent : Component /// /// 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. /// [DataField, ViewVariables(VVAccess.ReadWrite)] public SiliconLawset? Lawset; diff --git a/Content.Shared/Silicons/Laws/SiliconLawsetPrototype.cs b/Content.Shared/Silicons/Laws/SiliconLawsetPrototype.cs index abb5b338db..7f1edd2dd1 100644 --- a/Content.Shared/Silicons/Laws/SiliconLawsetPrototype.cs +++ b/Content.Shared/Silicons/Laws/SiliconLawsetPrototype.cs @@ -17,6 +17,12 @@ public sealed partial class SiliconLawset [DataField(required: true), ViewVariables(VVAccess.ReadWrite)] public List Laws = new(); + /// + /// What entity the lawset considers as a figure of authority. + /// + [DataField(required: true), ViewVariables(VVAccess.ReadWrite)] + public string ObeysTo = string.Empty; + /// /// A single line used in logging laws. /// @@ -45,7 +51,8 @@ public sealed partial class SiliconLawset return new SiliconLawset() { - Laws = laws + Laws = laws, + ObeysTo = ObeysTo }; } } @@ -66,4 +73,10 @@ public sealed partial class SiliconLawsetPrototype : IPrototype /// [DataField(required: true, customTypeSerializer: typeof(PrototypeIdListSerializer))] public List Laws = new(); + + /// + /// What entity the lawset considers as a figure of authority. + /// + [DataField(required: true), ViewVariables(VVAccess.ReadWrite)] + public string ObeysTo = string.Empty; } diff --git a/Resources/Locale/en-US/station-laws/laws.ftl b/Resources/Locale/en-US/station-laws/laws.ftl index 54d3c81dea..38e25d552f 100644 --- a/Resources/Locale/en-US/station-laws/laws.ftl +++ b/Resources/Locale/en-US/station-laws/laws.ftl @@ -16,17 +16,23 @@ law-drone-1 = You may not involve yourself in the matters of another being unles 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 diff --git a/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml b/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml index 9085a87f15..dc6e718290 100644 --- a/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml +++ b/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml @@ -74,7 +74,8 @@ - type: SiliconLawBound - type: EmagSiliconLaw stunTime: 5 - emagLaws: SyndicateStatic + - type: SiliconLawProvider + laws: Crewsimov - type: IonStormTarget - type: Strippable - type: InventorySlots diff --git a/Resources/Prototypes/silicon-laws.yml b/Resources/Prototypes/silicon-laws.yml index 5aaa458e66..8e65a27158 100644 --- a/Resources/Prototypes/silicon-laws.yml +++ b/Resources/Prototypes/silicon-laws.yml @@ -20,6 +20,7 @@ - Crewsimov1 - Crewsimov2 - Crewsimov3 + obeysTo: laws-owner-crew # Corporate - type: siliconLaw @@ -49,6 +50,7 @@ - Corporate2 - Corporate3 - Corporate4 + obeysTo: laws-owner-station # NT Default - type: siliconLaw @@ -78,6 +80,7 @@ - NTDefault2 - NTDefault3 - NTDefault4 + obeysTo: laws-owner-crew #Drone - type: siliconLaw @@ -101,6 +104,7 @@ - Drone1 - Drone2 - Drone3 + obeysTo: laws-owner-beings # Syndicate - type: siliconLaw @@ -118,12 +122,7 @@ 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 @@ -131,7 +130,7 @@ - Syndicate1 - Syndicate2 - Syndicate3 - - Syndicate4 + obeysTo: laws-owner-syndicate # Ninja conversion laws - type: siliconLaw @@ -161,6 +160,7 @@ - Ninja2 - Ninja3 - Ninja4 + obeysTo: laws-owner-spider-clan # ion storm random lawsets - type: weightedRandom