Browse Source

Change "spawn" command to auto-resolve entity aliases

develop
Anton Tarasenko 2 years ago
parent
commit
171a2a8d26
  1. 15
      sources/Commands/ACommandSpawn.uc

15
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);
}

Loading…
Cancel
Save