// Get objects
List<dEntity> entities = (List<dEntity>) scriptEntry.getObject("entities");
dLocation location = (dLocation) scriptEntry.getObject("location");
dEntity target = (dEntity) scriptEntry.getObject("target");
Element spread = scriptEntry.getElement("spread");
boolean persistent = scriptEntry.hasObject("persistent");
// Report to dB
dB.report(scriptEntry, getName(), aH.debugObj("entities", entities.toString()) +
location.debug() +
(spread != null ?spread.debug() : "") +
(target != null ? target.debug() : "") +
(persistent ? aH.debugObj("persistent", "true") : ""));
// Keep a dList of entities that can be called using <entry[name].spawned_entities>
// later in the script queue
dList entityList = new dList();
// Go through all the entities and spawn them or teleport them,
// then set their targets if applicable
for (dEntity entity : entities) {
Location loc = location.clone();
if (spread != null) {
loc.add(CoreUtilities.getRandom().nextInt(spread.asInt() * 2) - spread.asInt(),
0,
CoreUtilities.getRandom().nextInt(spread.asInt() * 2) - spread.asInt());
}
entity.spawnAt(loc);
// Only add to entityList after the entities have been