-
Notifications
You must be signed in to change notification settings - Fork 385
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into Observation-bundle-tweak
- Loading branch information
Showing
61 changed files
with
884 additions
and
445 deletions.
There are no files selected for viewing
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,5 @@ | ||
using Content.Shared.DeltaV.Silicons.Laws; | ||
|
||
namespace Content.Client.DeltaV.Silicons.Laws; | ||
|
||
public sealed class SlavedBorgSystem : SharedSlavedBorgSystem; |
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
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.Server.Silicons.Laws; | ||
using Content.Shared.DeltaV.Silicons.Laws; | ||
using Content.Shared.Silicons.Laws; | ||
using Content.Shared.Silicons.Laws.Components; | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.Server.DeltaV.Silicons.Laws; | ||
|
||
/// <summary> | ||
/// Handles adding the slave law for the first time. | ||
/// Borg chassis switches preserve this on its own. | ||
/// </summary> | ||
public sealed class SlavedBorgSystem : SharedSlavedBorgSystem | ||
{ | ||
[Dependency] private readonly IPrototypeManager _proto = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
// need to run after so it doesnt get overriden by the actual lawset | ||
SubscribeLocalEvent<SlavedBorgComponent, GetSiliconLawsEvent>(OnGetSiliconLaws, after: [ typeof(SiliconLawSystem) ]); | ||
} | ||
|
||
private void OnGetSiliconLaws(Entity<SlavedBorgComponent> ent, ref GetSiliconLawsEvent args) | ||
{ | ||
if (ent.Comp.Added || !TryComp<SiliconLawProviderComponent>(ent, out var provider)) | ||
return; | ||
|
||
if (provider.Lawset is {} lawset) | ||
AddLaw(lawset, ent.Comp.Law); | ||
ent.Comp.Added = true; // prevent opening the ui adding more law 0's | ||
} | ||
|
||
/// <summary> | ||
/// Adds the slave law to a lawset without checking if it was added already. | ||
/// </summary> | ||
public void AddLaw(SiliconLawset lawset, ProtoId<SiliconLawPrototype> law) | ||
{ | ||
lawset.Laws.Insert(0, _proto.Index(law)); | ||
} | ||
} |
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
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
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
3 changes: 3 additions & 0 deletions
3
Content.Shared/DeltaV/Silicons/Laws/SharedSlavedBorgSystem.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,3 @@ | ||
namespace Content.Shared.DeltaV.Silicons.Laws; | ||
|
||
public abstract class SharedSlavedBorgSystem : EntitySystem; |
26 changes: 26 additions & 0 deletions
26
Content.Shared/DeltaV/Silicons/Laws/SlavedBorgComponent.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,26 @@ | ||
using Content.Shared.Silicons.Laws; | ||
using Robust.Shared.GameStates; | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.Shared.DeltaV.Silicons.Laws; | ||
|
||
/// <summary> | ||
/// Adds a law no matter the default lawset. | ||
/// Switching borg chassis type keeps this law. | ||
/// </summary> | ||
[RegisterComponent, NetworkedComponent, Access(typeof(SharedSlavedBorgSystem))] | ||
public sealed partial class SlavedBorgComponent : Component | ||
{ | ||
/// <summary> | ||
/// The law to add after loading the default laws or switching chassis. | ||
/// This is assumed to be law 0 so gets inserted to the top of the laws. | ||
/// </summary> | ||
[DataField(required: true)] | ||
public ProtoId<SiliconLawPrototype> Law; | ||
|
||
/// <summary> | ||
/// Prevents adding the same law twice. | ||
/// </summary> | ||
[DataField] | ||
public bool Added; | ||
} |
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
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 @@ | ||
laws-obeyai = You must obey orders given to you by the Station AI. |
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
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
Oops, something went wrong.