Paste #13898: dTorch or some catchy name like that

Date: 2015/02/16 09:00:17 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


TorchLight:
  type: world
  debug: false
  events:
    on player steps on block:
    - if <player.item_in_hand.material> == m@torch {
      - define last <player.flag[torchlight.last]||null>
      - if %last% != null {
        - light %last% reset
        }
      - light <context.new_location> 10
      - flag player "torchlight.last:<context.new_location>"
      }
    on player holds item:
    - if <player.inventory.slot[<context.previous_slot>].material> == m@torch {
      - define last <player.flag[torchlight.last]||null>
      - if %last% != null {
        - light %last% reset
        - flag player "torchlight.last:!"
        }
      }
    - if <player.inventory.slot[<context.new_slot>].material> == m@torch {
      - light <player.location> 10
      - flag player "torchlight.last:<player.location>"
      }