Large Spade


Author: aufdemrand
Created: 2013-07-04T09:44:28-0400
Edited: 2013-07-04T09:46:25-0400
Denizen Version: 0.9.1+
Views: 35
Downloads: 844
Likes: 1


WGET
Description: A building tool that takes out more when you dig. When digging with the large spade, the earth in front of you crumbles instantly.

This is a small example script that uses world scripts, items scripts, nested IFs, definitions, and location tags.

Type '/spade' to get one!

Note: Requires Denizen 0.9 builds found here:
http://ci.citizensnpcs.com/job/Denizen%20Developmental/



# +-----------------
# | Large Spade
# +
# | The large spade takes out more earth faster and easier than
# | a traditional spade!
# + 
# | Just use '/spade' to get your hands on one! You won't regret it.
 
 
# Item script defines the material and name of the spade

large spade:
  type: item

  material: gold_spade
  display name: A Large Spade
 
 
# World Script that handles the events required by the large spade.

large spade helper:
  type: world

  events:
    
    on spade command:
    - if <player.isop>
      give 'item:i@large spade'
    - determine fulfilled
 
    # This event fires when the player left clicks with the
    # Item called 'Large Spade', as defined by the item script
    # below.
    on player left clicks with Large Spade:
    
    # Define the 'direction' of the player to the location clicked.
    - define dir <player.location.direction[<c.location>]>
    
    # Define the 'material' of the location clicked.
    - define mat <c.location.block.material>
    
    # Check the direction to see which blocks need to be removed.
    # The setup below will remove the block, the block in front, and 
    # the blocks on either side of the block clicked.
    - if %dir% == west {
        - define loc1 1,0,0
        - define loc2 0,0,1
        - define loc3 0,0,-1
      } else if %dir% == east {
        - define loc1 -1,0,0
        - define loc2 0,0,1
        - define loc3 0,0,-1
      } else if %dir% == south {
        - define loc1 -1,0,0
        - define loc2 1,0,0
        - define loc3 0,0,-1
      } else if %dir% == north {
        - define loc1 -1,0,0
        - define loc2 1,0,0
        - define loc3 0,0,1
      }
 
    # Remove the block clicked. If diagonal from the block,
    # this will be the only block removed.
    - modifyblock location:<c.location> material:air
 
    # Check the material of the surrounding blocks.
    # If the material is the same, then remove it.
    # If it is different, then don't remove it.
    - if <c.location.add[%loc1%].block.material> == %mat%
      modifyblock location:<c.location.add[%loc1%]> material:air
    - if <c.location.add[%loc2%].block.material> == %mat%
      modifyblock location:<c.location.add[%loc2%]> material:air
    - if <c.location.add[%loc3%].block.material> == %mat%
      modifyblock location:<c.location.add[%loc3%]> material:air
 
    # Let Bukkit know that the original event should be cancelled.
    - determine cancelled
 
 
 




Comments
2014-07-22 21:45:10 - OzOwnz:

On line 27, - if <player.isop> should be: - if <player.is_op> Note the underscore.