Skip to content

Commit

Permalink
Add w@world.moon_phase, fixes #427
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Sep 22, 2013
1 parent 543443b commit a89b016
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
30 changes: 21 additions & 9 deletions src/main/java/net/aufdemrand/denizen/objects/dWorld.java
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public String getAttribute(Attribute attribute) {

// <--[tag]
// @attribute <w@world.sea_level>
// @returns Element(number)
// @returns Element(Number)
// @description
// returns the level of the sea
// -->
Expand Down Expand Up @@ -298,7 +298,7 @@ public String getAttribute(Attribute attribute) {

// <--[tag]
// @attribute <w@world.ambient_spawn_limit>
// @returns Element(integer)
// @returns Element(Number)
// @description
// Returns the number of ambient mobs that can spawn in a chunk in this world
// -->
Expand All @@ -308,7 +308,7 @@ public String getAttribute(Attribute attribute) {

// <--[tag]
// @attribute <w@world.animal_spawn_limit>
// @returns Element(integer)
// @returns Element(Number)
// @description
// Returns the number of animals that can spawn in a chunk in this world.
// -->
Expand Down Expand Up @@ -338,7 +338,7 @@ public String getAttribute(Attribute attribute) {

// <--[tag]
// @attribute <w@world.max_height>
// @returns Element(integer)
// @returns Element(Number)
// @description
// Returns the maximum height of this world.
// -->
Expand All @@ -348,7 +348,7 @@ public String getAttribute(Attribute attribute) {

// <--[tag]
// @attribute <w@world.monster_spawn_limit>
// @returns Element(integer)
// @returns Element(Number)
// @description
// Returns the number of monsters that can spawn in a chunk in this world.
// -->
Expand All @@ -358,7 +358,7 @@ public String getAttribute(Attribute attribute) {

// <--[tag]
// @attribute <w@world.ticks_per_animal_spawn>
// @returns Element(long)
// @returns Element(Number)
// @description
// Returns the world's ticks per animal spawn value
// -->
Expand All @@ -368,7 +368,7 @@ public String getAttribute(Attribute attribute) {

// <--[tag]
// @attribute <w@world.ticks_per_monster_spawn>
// @returns Element(long)
// @returns Element(Number)
// @description
// Returns the world's ticks per monster spawn value
// -->
Expand All @@ -378,7 +378,7 @@ public String getAttribute(Attribute attribute) {

// <--[tag]
// @attribute <w@world.water_animal_spawn_limit>
// @returns Element(integer)
// @returns Element(Number)
// @description
// Returns the number of water animals that can spawn in a chunk in this world
// -->
Expand Down Expand Up @@ -413,14 +413,26 @@ public String getAttribute(Attribute attribute) {

// <--[tag]
// @attribute <w@world.time>
// @returns Element(long)
// @returns Element(Number)
// @description
// returns the current time in ticks
// -->
if (attribute.startsWith("time"))
return new Element(getWorld().getTime())
.getAttribute(attribute.fulfill(1));

// <--[tag]
// @attribute <w@world.moon_phase>
// @returns Element(Number)
// @description
// returns the current phase of the moon, as
// an integer from 1 to 8
// -->
if (attribute.startsWith("moon_phase")
|| attribute.startsWith("moonphase"))
return new Element((int)((getWorld().getFullTime() / 24000) % 8) + 1)
.getAttribute(attribute.fulfill(1));


/////////////////////
// WEATHER ATTRIBUTES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public ProcedureScriptTag(Denizen denizen) {
// - if <player.money> < 3 determine false
// # The determine above will immediately end the procedure and return false
//
// # If the player has more than 15 (75%) health, he doesn't need a heal so determine false
// - if <player.health> > 15 determine false
// # If the player has more than 75% health, he doesn't need a heal so determine false
// - if <player.health.percentage> > 75 determine false
//
// # This example shouldn't get too complex, so
// # If it passed the money and health requirements:
Expand Down

0 comments on commit a89b016

Please sign in to comment.