From 171a2a8d26955d78a5ae6bf682c89e666524d96f Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Tue, 4 Oct 2022 03:53:33 +0700 Subject: [PATCH] Change "spawn" command to auto-resolve entity aliases --- sources/Commands/ACommandSpawn.uc | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/sources/Commands/ACommandSpawn.uc b/sources/Commands/ACommandSpawn.uc index c1af4a6..dfd6fb6 100644 --- a/sources/Commands/ACommandSpawn.uc +++ b/sources/Commands/ACommandSpawn.uc @@ -32,11 +32,11 @@ protected function BuildData(CommandDataBuilder builder) { builder.Name(P("spawn")).Group(P("debug")) .Summary(P("Spawns new entity on the map.")); - builder.ParamText(P("template")) + builder.ParamText(P("template"),, P("entity")) .Describe(P("Spawns new entity based on the given template at the point" @ "player is currently looking at.")); builder.SubCommand(P("at")) - .ParamText(P("template")) + .ParamText(P("template"),, P("entity")) .ParamNumber(P("x")) .ParamNumber(P("y")) .ParamNumber(P("z")) @@ -50,18 +50,11 @@ protected function Executed( CallData arguments, EPlayer instigator) { - local Text givenTemplate, template; + local Text template; local Vector spawnLocation; announcer.Setup(none, instigator, othersConsole); - givenTemplate = arguments.parameters.GetText(P("template")); - if (givenTemplate.StartsWithS("$")) { - template = _.alias.ResolveEntity(givenTemplate, true); - } - else { - template = givenTemplate.Copy(); - } - _.memory.Free(givenTemplate); + template = arguments.parameters.GetText(P("template")); if (arguments.subCommandName.IsEmpty()) { SpawnInInstigatorSight(instigator, template); }