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")) builder.Name(P("spawn")).Group(P("debug"))
.Summary(P("Spawns new entity on the map.")); .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" .Describe(P("Spawns new entity based on the given template at the point"
@ "player is currently looking at.")); @ "player is currently looking at."));
builder.SubCommand(P("at")) builder.SubCommand(P("at"))
.ParamText(P("template")) .ParamText(P("template"),, P("entity"))
.ParamNumber(P("x")) .ParamNumber(P("x"))
.ParamNumber(P("y")) .ParamNumber(P("y"))
.ParamNumber(P("z")) .ParamNumber(P("z"))
@ -50,18 +50,11 @@ protected function Executed(
CallData arguments, CallData arguments,
EPlayer instigator) EPlayer instigator)
{ {
local Text givenTemplate, template; local Text template;
local Vector spawnLocation; local Vector spawnLocation;
announcer.Setup(none, instigator, othersConsole); announcer.Setup(none, instigator, othersConsole);
givenTemplate = arguments.parameters.GetText(P("template")); template = arguments.parameters.GetText(P("template"));
if (givenTemplate.StartsWithS("$")) {
template = _.alias.ResolveEntity(givenTemplate, true);
}
else {
template = givenTemplate.Copy();
}
_.memory.Free(givenTemplate);
if (arguments.subCommandName.IsEmpty()) { if (arguments.subCommandName.IsEmpty()) {
SpawnInInstigatorSight(instigator, template); SpawnInInstigatorSight(instigator, template);
} }

Loading…
Cancel
Save