Skip to content

Commit

Permalink
Add location.yaw.simple
Browse files Browse the repository at this point in the history
Returns north/south/east/west
Again, straightforward tag.
  • Loading branch information
mcmonkey4eva committed Dec 10, 2013
1 parent 2764d48 commit c4d0fc0
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/main/java/net/aufdemrand/denizen/objects/dLocation.java
Expand Up @@ -570,6 +570,30 @@ else if (dEntity.matches(attribute.getContext(1))) {
return loc.getAttribute(attribute.fulfill(1));
}

// <--[tag]
// @attribute <l@location.yaw.simple>
// @returns Element(Decimal)
// @description
// Returns the yaw as 'North', 'South', 'East', or 'West'.
// -->
if (attribute.startsWith("yaw.simple")) {
if (getYaw() < 45)
return new Element("South")
.getAttribute(attribute.fulfill(2));
else if (getYaw() < 135)
return new Element("West")
.getAttribute(attribute.fulfill(2));
else if (getYaw() < 225)
return new Element("North")
.getAttribute(attribute.fulfill(2));
else if (getYaw() < 315)
return new Element("East")
.getAttribute(attribute.fulfill(2));
else
return new Element("South")
.getAttribute(attribute.fulfill(2));
}

// <--[tag]
// @attribute <l@location.yaw.raw>
// @returns Element(Decimal)
Expand Down Expand Up @@ -751,7 +775,7 @@ else if (attribute.startsWith("entities")
dList ent_list = new dList();
if (attribute.hasContext(1)) {
for (String ent : attribute.getContext(1).split("\\|")) {
if (dEntity.matches(ent))
if (dEntity.matches(ent))
ent_list.add(ent.toUpperCase());
}
}
Expand Down

0 comments on commit c4d0fc0

Please sign in to comment.