UI to edit silicon laws from admin verb (#28483)

* UI to edit silicon laws from admin verb

(peak shitcode)

* Improve UI

* Use Moderator admin flag

* Reviews
This commit is contained in:
Simon
2024-08-09 08:16:22 +02:00
committed by GitHub
parent 8d96c993a2
commit 4c4cdb5b06
11 changed files with 395 additions and 0 deletions

View File

@@ -22,6 +22,7 @@ using Robust.Server.GameObjects;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Toolshed;
using Robust.Shared.Utility;
namespace Content.Server.Silicons.Laws;
@@ -278,6 +279,21 @@ public sealed class SiliconLawSystem : SharedSiliconLawSystem
return laws;
}
/// <summary>
/// Set the laws of a silicon entity while notifying the player.
/// </summary>
public void SetLaws(List<SiliconLaw> newLaws, EntityUid target)
{
if (!TryComp<SiliconLawProviderComponent>(target, out var component))
return;
if (component.Lawset == null)
component.Lawset = new SiliconLawset();
component.Lawset.Laws = newLaws;
NotifyLawsChanged(target);
}
}
[ToolshedCommand, AdminCommand(AdminFlags.Admin)]