Update permissions for engine toolshed PR (#34029)

This commit is contained in:
Leon Friedrich
2025-02-16 21:54:59 +11:00
committed by GitHub
4 changed files with 6 additions and 46 deletions

View File

@@ -105,7 +105,7 @@ namespace Content.Server.Administration.Systems
mark.Text = Loc.GetString("toolshed-verb-mark");
mark.Message = Loc.GetString("toolshed-verb-mark-description");
mark.Category = VerbCategory.Admin;
mark.Act = () => _toolshed.InvokeCommand(player, "=> $marked", Enumerable.Repeat(args.Target, 1), out _);
mark.Act = () => _toolshed.InvokeCommand(player, "=> $marked", new List<EntityUid> {args.Target}, out _);
mark.Impact = LogImpact.Low;
args.Verbs.Add(mark);

View File

@@ -9,8 +9,7 @@ public sealed class MarkedCommand : ToolshedCommand
[CommandImplementation]
public IEnumerable<EntityUid> Marked(IInvocationContext ctx)
{
var res = (IEnumerable<EntityUid>?)ctx.ReadVar("marked");
res ??= Array.Empty<EntityUid>();
return res;
var marked = ctx.ReadVar("marked") as IEnumerable<EntityUid>;
return marked ?? Array.Empty<EntityUid>();
}
}

View File

@@ -4,6 +4,7 @@ using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Network;
using Robust.Shared.Player;
using Robust.Shared.Toolshed.Commands.Generic;
namespace Content.Server.Commands
{
@@ -50,45 +51,5 @@ namespace Content.Server.Commands
attachedEntity = session.AttachedEntity.Value;
return true;
}
public static string SubstituteEntityDetails(IConsoleShell shell, EntityUid ent, string ruleString)
{
var entMan = IoCManager.Resolve<IEntityManager>();
var transform = entMan.GetComponent<TransformComponent>(ent);
var transformSystem = entMan.System<SharedTransformSystem>();
var worldPosition = transformSystem.GetWorldPosition(transform);
// gross, is there a better way to do this?
ruleString = ruleString.Replace("$ID", ent.ToString());
ruleString = ruleString.Replace("$WX",
worldPosition.X.ToString(CultureInfo.InvariantCulture));
ruleString = ruleString.Replace("$WY",
worldPosition.Y.ToString(CultureInfo.InvariantCulture));
ruleString = ruleString.Replace("$LX",
transform.LocalPosition.X.ToString(CultureInfo.InvariantCulture));
ruleString = ruleString.Replace("$LY",
transform.LocalPosition.Y.ToString(CultureInfo.InvariantCulture));
ruleString = ruleString.Replace("$NAME", entMan.GetComponent<MetaDataComponent>(ent).EntityName);
if (shell.Player is { } player)
{
if (player.AttachedEntity is {Valid: true} p)
{
var pTransform = entMan.GetComponent<TransformComponent>(p);
var pWorldPosition = transformSystem.GetWorldPosition(pTransform);
ruleString = ruleString.Replace("$PID", ent.ToString());
ruleString = ruleString.Replace("$PWX",
pWorldPosition.X.ToString(CultureInfo.InvariantCulture));
ruleString = ruleString.Replace("$PWY",
pWorldPosition.Y.ToString(CultureInfo.InvariantCulture));
ruleString = ruleString.Replace("$PLX",
pTransform.LocalPosition.X.ToString(CultureInfo.InvariantCulture));
ruleString = ruleString.Replace("$PLY",
pTransform.LocalPosition.Y.ToString(CultureInfo.InvariantCulture));
}
}
return ruleString;
}
}
}

View File

@@ -74,7 +74,7 @@
- '%'
- '%/'
- '&~'
- '|~'
- bitornot
- '^~'
- '~'
- '<'
@@ -88,7 +88,7 @@
- '*/'
- '//'
- '&'
- '|'
- bitor
- '^'
- neg
- abs