-
Notifications
You must be signed in to change notification settings - Fork 340
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update code to allow lawset updating
- Loading branch information
deltanedas
committed
Nov 27, 2024
1 parent
89a806f
commit 7f7bbe3
Showing
4 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
Content.Server/DeltaV/Silicons/Borgs/BorgSwitchableTypeSystem.Lawset.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,33 @@ | ||
using Content.Server.Silicons.Laws; | ||
using Content.Shared.Emag.Components; | ||
using Content.Shared.Emag.Systems; | ||
using Content.Shared.Silicons.Laws; | ||
using Content.Shared.Silicons.Laws.Components; | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.Server.Silicons.Borgs; | ||
|
||
/// <summary> | ||
/// Handles lawset patching when switching type. | ||
/// If a borg is made emagged it needs its emag laws carried over. | ||
/// </summary> | ||
public sealed partial class BorgSwitchableTypeSystem | ||
{ | ||
[Dependency] private readonly SiliconLawSystem _law = default!; | ||
|
||
private void ConfigureLawset(EntityUid uid, ProtoId<SiliconLawsetPrototype> id) | ||
{ | ||
var laws = _law.GetLawset(id); | ||
_law.SetLaws(laws.Laws, uid); | ||
|
||
// re-add law 0 and final law based on new lawset | ||
if (CompOrNull<EmagSiliconLawComponent>(uid)?.OwnerName != null) | ||
{ | ||
// raising the event manually to bypass re-emagging checks | ||
var ev = new GotEmaggedEvent(uid); // user wont be used since OwnerName isnt null, safe to pass itself | ||
RaiseLocalEvent(uid, ref ev); | ||
} | ||
|
||
// ion storms don't get mirrored because thats basically impossible to track | ||
} | ||
} |
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