Skip to content

Commit

Permalink
add util.spawn_entity[].at[]
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Aug 27, 2013
1 parent 89e0cc2 commit 19a582a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/main/java/net/aufdemrand/denizen/tags/core/UtilTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,22 @@ else if (type.equalsIgnoreCase("ENTITY_IS_SPAWNED")) {
event.setReplaced((ent != null && ent.isUnique() && ent.isSpawned()) ? "true" : "false");
}

// <--[tag]
// @attribute <util.spawn_entity[<entitytype>].at[<dLocation>]>
// @returns dEntity
// @description
// Returns a spawned copy of the chosen entity type.
// -->
else if (type.equalsIgnoreCase("SPAWN_ENTITY")) {
dEntity ent = dEntity.valueOf(event.getTypeContext());
if (ent.isSpawned())
event.setReplaced(ent.getAttribute(attribute.fulfill(2)));
else {
ent.spawnAt(dLocation.valueOf(event.getSubTypeContext()));
event.setReplaced(ent.getAttribute(attribute.fulfill(2)));
}
}

// <--[tag]
// @attribute <util.uppercase[<text>]>
// @returns Element
Expand Down

3 comments on commit 19a582a

@spaceemotion
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has this been added because you couldn't spawn horses/donkeys/mules with the default SPAWN command?

@aufdemrand
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather this not be added. Replaceable tags are meant to fetch information, not execute commands. I know this is possible, but we need to draw a line.

@aufdemrand
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand why you want to do this, but it needs to be handled differently.

Please sign in to comment.