Paste #38312: Repo Script Ambient Light

Date: 2016/12/14 10:31:01 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


ambienlight:
  type: command
  name: ambientlight
  usage: /ambientlight
  script:
  - if <player.has_flag[ambientlightoff]> {
    - light <context.previous_location> reset
    - flag player ambientlightoff:!
    - narrate "<&o>Ambient Lighting has been Enabled. Use this command again to disable Ambient Lighting.<&r>"
    - queue clear
    }
  - flag player ambientlightoff
  - narrate "<&o>Ambient Lighting has been Disabled. Use this command again to Enable Ambient Lighting.<&r>"
ambient:
    type: world
    debug: false
    events:
        on player steps on block:
        - if <player.has_flag[ambientlight]> {
          - light <context.previous_location> reset
          - flag player ambientlight:!
          }
        - if <player.has_flag[ambientlightoff]> {
          - queue clear
          }
        - if <player.item_in_hand.material.name> == torch || <player.item_in_offhand.material.name> == torch {
          - light <context.location.add[0,1,0]> 10
          - flag player ambientlight
          }
        - if <player.item_in_hand.material.name> == glowstone || <player.item_in_offhand.material.name> == glowstone {
          - light <context.location.add[0,1,0]> 14
          - flag player ambientlight
          }
        - if <player.item_in_hand.material.name> == sea_lantern || <player.item_in_offhand.material.name> == sea_lantern {
          - light <context.location.add[0,1,0]> 14
          - flag player ambientlight
          }
        - if <player.item_in_hand.material.name> == redstone_torch_on || <player.item_in_offhand.material.name> == redstone_torch_on {
          - light <context.location.add[0,1,0]> 7
          - flag player ambientlight
          }
        on player quits:
        - if <player.has_flag[ambientlight]> {
          - light <context.previous_location> reset
          - flag player ambientlight:!
          }