new command addentity

addentity <type>
  Adds an entity of the specified type at the current camera position
  and returns the index number of the new entity, so that the other
  attributes can be set by editentity.

DOCREF addentity
This commit is contained in:
ac-stef
2016-02-07 18:34:32 +01:00
parent 697197bd5b
commit ecf178866e
2 changed files with 13 additions and 0 deletions
+1
View File
@@ -72,6 +72,7 @@ complete demo demos dmo
looplist [
listoptions ""
newent ents
addentity ents
clearents ents
closestenttype ents
enumentities ents
+12
View File
@@ -445,6 +445,18 @@ void deleteentity(char *ns)
}
COMMAND(deleteentity, "s");
void addentity(char *what) // type
{
int type = findtype(what);
if(noteditmode("addentity") || multiplayer(true) || type == NOTUSED) return;
entity e((int)camera1->o.x, (int)camera1->o.y, (int)camera1->o.z, type, 0, 0, 0, 0);
e.spawned = true;
intret(ents.length());
ents.add(e);
unsavededits++;
}
COMMAND(addentity, "s");
void editentity(char **args, int numargs) // index x y z a1 a2 a3 a4 ...
{
string res = "";