Paste #107728: Unnamed Denizen Script Paste

Date: 2023/03/22 12:08:02 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


      on player places tesla_battery_wifi:
      - if <context.location.find_blocks_flagged[tesla_battery_wifi].within[5].size> >= 1:
        - narrate "<&4><&l>Une batterie wifi est déjà présente dans la zone"
        - determine cancelled
      - else:
        - flag <context.location> tesla_battery_wifi
        - flag <context.location> tesla_fuel:0
        - flag server tesla_battery_wifis:->:<context.location>

      on player breaks block location_flagged:tesla_battery_wifi:
      - flag <context.location> tesla_battery_wifi:!
      - flag <context.location> tesla_fuel:!
      - flag server tesla_battery_wifis:<-:<context.location>
      - flag <context.location> linked_origin:!
      - flag <context.location> linked_goal:!
      - flag <context.location.flag[linked_origin]> linked_origin:!
      - flag <context.location.flag[linked_to2]> linked_goal:!

      on player right clicks block with:battery_linker:
      - if <context.location.has_flag[tesla_fuel]>:
        - if <player.has_flag[tesla_link]>:
          - flag <player.flag[tesla_link]> linked_goal:<context.location>
          - flag <context.location> linked_origin:<player.flag[tesla_link]>
          - flag server linked_sender:->:<context.location>
          - narrate "<&2>Position de récéption enregistré "
          - flag <player> tesla_link:!
        - else:
          - flag <player> tesla_link:<context.location>
          - narrate "<&2>Position d'envoie enregistré "


      on system time secondly:
      - foreach <server.flag[tesla_battery_wifis]> as:t_bat:
        - if <[t_bat].has_flag[linked_goal]>:
          - if <[t_bat].flag[tesla_fuel]> >= 1:
            - flag <[t_bat]> tesla_fuel:-:1
            - flag <[t_bat].flag[linked_goal]> tesla_fuel:+:1
          - repeat 20:
            - playeffect at:<[t_bat].center.points_between[<[t_bat].flag[linked_goal].center>]> effect:electric_spark offset:0 visibility:20
            - playeffect at:<[t_bat].center.points_between[<[t_bat].flag[linked_goal].center>]> effect:wax_off offset:0 visibility:20
            - wait 1t
      - foreach <server.flag[]>
      - foreach <server.flag[t_rod_panel]> as:search_tesla_battery:
        - if <[search_tesla_battery].chunk.is_loaded>:
            - foreach <[search_tesla_battery].find_blocks_flagged[tesla_battery_wifi].within[5]> as:tesla_battery_wifi_find:
              - flag <[tesla_battery_wifi_find]> tesla_fuel:+:<[search_tesla_battery].flag[tesla_fuel]>
              - flag <[search_tesla_battery]> tesla_fuel:0
              - repeat 20:
                - playeffect at:<[search_tesla_battery].center.points_between[<[tesla_battery_wifi_find].center>]> effect:electric_spark offset:0 visibility:20
                - playeffect at:<[search_tesla_battery].center.points_between[<[tesla_battery_wifi_find].center>]> effect:wax_off offset:0 visibility:20
                - wait 1t