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
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
using System.Linq;
|
||||||
using Content.Server.Administration;
|
using Content.Server.Administration;
|
||||||
using Content.Server.Chat.Managers;
|
using Content.Server.Chat.Managers;
|
||||||
using Content.Server.GameTicking;
|
using Content.Server.GameTicking;
|
||||||
@@ -53,8 +54,7 @@ public sealed class SiliconLawSystem : SharedSiliconLawSystem
|
|||||||
|
|
||||||
SubscribeLocalEvent<SiliconLawProviderComponent, GetSiliconLawsEvent>(OnDirectedGetLaws);
|
SubscribeLocalEvent<SiliconLawProviderComponent, GetSiliconLawsEvent>(OnDirectedGetLaws);
|
||||||
SubscribeLocalEvent<SiliconLawProviderComponent, IonStormLawsEvent>(OnIonStormLaws);
|
SubscribeLocalEvent<SiliconLawProviderComponent, IonStormLawsEvent>(OnIonStormLaws);
|
||||||
SubscribeLocalEvent<EmagSiliconLawComponent, GetSiliconLawsEvent>(OnDirectedEmagGetLaws);
|
SubscribeLocalEvent<SiliconLawProviderComponent, GotEmaggedEvent>(OnEmagLawsAdded);
|
||||||
SubscribeLocalEvent<EmagSiliconLawComponent, IonStormLawsEvent>(OnEmagIonStormLaws);
|
|
||||||
SubscribeLocalEvent<EmagSiliconLawComponent, MindAddedMessage>(OnEmagMindAdded);
|
SubscribeLocalEvent<EmagSiliconLawComponent, MindAddedMessage>(OnEmagMindAdded);
|
||||||
SubscribeLocalEvent<EmagSiliconLawComponent, MindRemovedMessage>(OnEmagMindRemoved);
|
SubscribeLocalEvent<EmagSiliconLawComponent, MindRemovedMessage>(OnEmagMindRemoved);
|
||||||
SubscribeLocalEvent<EmagSiliconLawComponent, ExaminedEvent>(OnExamined);
|
SubscribeLocalEvent<EmagSiliconLawComponent, ExaminedEvent>(OnExamined);
|
||||||
@@ -108,7 +108,7 @@ public sealed class SiliconLawSystem : SharedSiliconLawSystem
|
|||||||
|
|
||||||
private void OnDirectedGetLaws(EntityUid uid, SiliconLawProviderComponent component, ref GetSiliconLawsEvent args)
|
private void OnDirectedGetLaws(EntityUid uid, SiliconLawProviderComponent component, ref GetSiliconLawsEvent args)
|
||||||
{
|
{
|
||||||
if (args.Handled || HasComp<EmaggedComponent>(uid))
|
if (args.Handled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (component.Lawset == null)
|
if (component.Lawset == null)
|
||||||
@@ -121,9 +121,6 @@ public sealed class SiliconLawSystem : SharedSiliconLawSystem
|
|||||||
|
|
||||||
private void OnIonStormLaws(EntityUid uid, SiliconLawProviderComponent component, ref IonStormLawsEvent args)
|
private void OnIonStormLaws(EntityUid uid, SiliconLawProviderComponent component, ref IonStormLawsEvent args)
|
||||||
{
|
{
|
||||||
if (HasComp<EmaggedComponent>(uid))
|
|
||||||
return;
|
|
||||||
|
|
||||||
component.Lawset = args.Lawset;
|
component.Lawset = args.Lawset;
|
||||||
|
|
||||||
// gotta tell player to check their laws
|
// gotta tell player to check their laws
|
||||||
@@ -134,38 +131,25 @@ public sealed class SiliconLawSystem : SharedSiliconLawSystem
|
|||||||
EnsureEmaggedRole(uid, emag);
|
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)
|
if (component.Lawset == null)
|
||||||
|
component.Lawset = GetLawset(component.Laws);
|
||||||
|
|
||||||
|
// Add the first emag law before the others
|
||||||
|
component.Lawset?.Laws.Insert(0, new SiliconLaw
|
||||||
{
|
{
|
||||||
// Add new emagged laws
|
LawString = Loc.GetString("law-emag-custom", ("name", Name(args.UserUid)), ("title", Loc.GetString(component.Lawset.ObeysTo))),
|
||||||
component.Lawset = GetLawset(component.EmagLaws);
|
Order = 0
|
||||||
|
});
|
||||||
|
|
||||||
// Add the first emag law before the others
|
//Add the secrecy law after the others
|
||||||
component.Lawset.Laws.Insert(0, new SiliconLaw
|
component.Lawset?.Laws.Add(new SiliconLaw
|
||||||
{
|
{
|
||||||
LawString = Loc.GetString("law-emag-custom", ("name", component.OwnerName)),
|
LawString = Loc.GetString("law-emag-secrecy", ("faction", Loc.GetString(component.Lawset.ObeysTo))),
|
||||||
Order = 0
|
Order = component.Lawset.Laws.Count
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
args.Laws = component.Lawset;
|
|
||||||
|
|
||||||
args.Handled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnEmagIonStormLaws(EntityUid uid, EmagSiliconLawComponent component, ref IonStormLawsEvent args)
|
|
||||||
{
|
|
||||||
if (!HasComp<EmaggedComponent>(uid))
|
|
||||||
return;
|
|
||||||
|
|
||||||
component.Lawset = args.Lawset;
|
|
||||||
|
|
||||||
// gotta tell player to check their laws
|
|
||||||
NotifyLawsChanged(uid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnExamined(EntityUid uid, EmagSiliconLawComponent component, ExaminedEvent args)
|
private void OnExamined(EntityUid uid, EmagSiliconLawComponent component, ExaminedEvent args)
|
||||||
@@ -299,6 +283,7 @@ public sealed class SiliconLawSystem : SharedSiliconLawSystem
|
|||||||
{
|
{
|
||||||
laws.Laws.Add(_prototype.Index<SiliconLawPrototype>(law));
|
laws.Laws.Add(_prototype.Index<SiliconLawPrototype>(law));
|
||||||
}
|
}
|
||||||
|
laws.ObeysTo = proto.ObeysTo;
|
||||||
|
|
||||||
return laws;
|
return laws;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,20 +23,6 @@ public sealed partial class EmagSiliconLawComponent : Component
|
|||||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||||
public bool RequireOpenPanel = true;
|
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>
|
/// <summary>
|
||||||
/// How long the borg is stunned when it's emagged. Setting to 0 will disable it.
|
/// How long the borg is stunned when it's emagged. Setting to 0 will disable it.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public sealed partial class SiliconLawProviderComponent : Component
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Lawset created from the prototype id.
|
/// 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>
|
/// </summary>
|
||||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||||
public SiliconLawset? Lawset;
|
public SiliconLawset? Lawset;
|
||||||
|
|||||||
@@ -17,6 +17,12 @@ public sealed partial class SiliconLawset
|
|||||||
[DataField(required: true), ViewVariables(VVAccess.ReadWrite)]
|
[DataField(required: true), ViewVariables(VVAccess.ReadWrite)]
|
||||||
public List<SiliconLaw> Laws = new();
|
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>
|
/// <summary>
|
||||||
/// A single line used in logging laws.
|
/// A single line used in logging laws.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -45,7 +51,8 @@ public sealed partial class SiliconLawset
|
|||||||
|
|
||||||
return new SiliconLawset()
|
return new SiliconLawset()
|
||||||
{
|
{
|
||||||
Laws = laws
|
Laws = laws,
|
||||||
|
ObeysTo = ObeysTo
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -66,4 +73,10 @@ public sealed partial class SiliconLawsetPrototype : IPrototype
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField(required: true, customTypeSerializer: typeof(PrototypeIdListSerializer<SiliconLawPrototype>))]
|
[DataField(required: true, customTypeSerializer: typeof(PrototypeIdListSerializer<SiliconLawPrototype>))]
|
||||||
public List<string> Laws = new();
|
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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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-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-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-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-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-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-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-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-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.
|
law-emag-require-panel = The panel must be open to use the EMAG.
|
||||||
|
|
||||||
laws-ui-menu-title = Laws
|
laws-ui-menu-title = Laws
|
||||||
|
|||||||
@@ -74,7 +74,8 @@
|
|||||||
- type: SiliconLawBound
|
- type: SiliconLawBound
|
||||||
- type: EmagSiliconLaw
|
- type: EmagSiliconLaw
|
||||||
stunTime: 5
|
stunTime: 5
|
||||||
emagLaws: SyndicateStatic
|
- type: SiliconLawProvider
|
||||||
|
laws: Crewsimov
|
||||||
- type: IonStormTarget
|
- type: IonStormTarget
|
||||||
- type: Strippable
|
- type: Strippable
|
||||||
- type: InventorySlots
|
- type: InventorySlots
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
- Crewsimov1
|
- Crewsimov1
|
||||||
- Crewsimov2
|
- Crewsimov2
|
||||||
- Crewsimov3
|
- Crewsimov3
|
||||||
|
obeysTo: laws-owner-crew
|
||||||
|
|
||||||
# Corporate
|
# Corporate
|
||||||
- type: siliconLaw
|
- type: siliconLaw
|
||||||
@@ -49,6 +50,7 @@
|
|||||||
- Corporate2
|
- Corporate2
|
||||||
- Corporate3
|
- Corporate3
|
||||||
- Corporate4
|
- Corporate4
|
||||||
|
obeysTo: laws-owner-station
|
||||||
|
|
||||||
# NT Default
|
# NT Default
|
||||||
- type: siliconLaw
|
- type: siliconLaw
|
||||||
@@ -78,6 +80,7 @@
|
|||||||
- NTDefault2
|
- NTDefault2
|
||||||
- NTDefault3
|
- NTDefault3
|
||||||
- NTDefault4
|
- NTDefault4
|
||||||
|
obeysTo: laws-owner-crew
|
||||||
|
|
||||||
#Drone
|
#Drone
|
||||||
- type: siliconLaw
|
- type: siliconLaw
|
||||||
@@ -101,6 +104,7 @@
|
|||||||
- Drone1
|
- Drone1
|
||||||
- Drone2
|
- Drone2
|
||||||
- Drone3
|
- Drone3
|
||||||
|
obeysTo: laws-owner-beings
|
||||||
|
|
||||||
# Syndicate
|
# Syndicate
|
||||||
- type: siliconLaw
|
- type: siliconLaw
|
||||||
@@ -118,12 +122,7 @@
|
|||||||
order: 3
|
order: 3
|
||||||
lawString: law-syndicate-3
|
lawString: law-syndicate-3
|
||||||
|
|
||||||
- type: siliconLaw
|
# Syndicate cyborg laws
|
||||||
id: Syndicate4
|
|
||||||
order: 4
|
|
||||||
lawString: law-syndicate-4
|
|
||||||
|
|
||||||
# does not include law 0 since that uses the emagger's name
|
|
||||||
# intentionally excluded from IonStormLawsets
|
# intentionally excluded from IonStormLawsets
|
||||||
- type: siliconLawset
|
- type: siliconLawset
|
||||||
id: SyndicateStatic
|
id: SyndicateStatic
|
||||||
@@ -131,7 +130,7 @@
|
|||||||
- Syndicate1
|
- Syndicate1
|
||||||
- Syndicate2
|
- Syndicate2
|
||||||
- Syndicate3
|
- Syndicate3
|
||||||
- Syndicate4
|
obeysTo: laws-owner-syndicate
|
||||||
|
|
||||||
# Ninja conversion laws
|
# Ninja conversion laws
|
||||||
- type: siliconLaw
|
- type: siliconLaw
|
||||||
@@ -161,6 +160,7 @@
|
|||||||
- Ninja2
|
- Ninja2
|
||||||
- Ninja3
|
- Ninja3
|
||||||
- Ninja4
|
- Ninja4
|
||||||
|
obeysTo: laws-owner-spider-clan
|
||||||
|
|
||||||
# ion storm random lawsets
|
# ion storm random lawsets
|
||||||
- type: weightedRandom
|
- type: weightedRandom
|
||||||
|
|||||||
Reference in New Issue
Block a user