Date: 2017/06/06 07:11:50 UTC-07:00
Type: Denizen Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
RailgunEvent:
type: world
debug: true
speed: 0
events:
on player scrolls their hotbar:
- if <player.item_in_hand.contains_any_text["Railgun"|"Black Hole Cannon"|"Tesla Phaser"player.item_in_hand.contains_any_text["Railgun"|"Black Hole Cannon"|"Tesla Phaser"]> {
- define iteminhand <context.item_in_hand.simple.replace[i@]>
- define player <player>
- run s@WeaponCooldown d:<def[iteminhand]>|<def[player]>
}
on player clicks with BlackHoleCannon:
- determine passively cancelled
on player clicks with Railgun:
- determine passively cancelled
- if <player.has_flag[railgun]> {
- narrate "<&c>This weapon is on cooldown!"
- queue clear
}
- define iteminhand <player.item_in_hand.simple>
- define item <context.item.simple.replace[i@]>
- define player <player>
- define dir <player.eye_location.direction.vector>
- playsound <player.location> sound:ENTITY_WITHER_SPAWN volume:2 pitch:1.7
- playsound <player.location> sound:ENTITY_WITHER_SPAWN volume:2 pitch:2
- playsound <player.location> sound:ENTITY_ZOMBIE_VILLAGER_CURE volume:0.5 pitch:1.5
- define points <player.location.points_between[<player.location.add[<player.eye_location.direction.vector.mul[100]>]>].distance[0.1]>
# - repeat <def[points].size.div[10].as_int>:
# - playeffect red_dust <def[points].get[<def[value].sub[1].mul[10].add[1]>].to[<def[value].mul[10]>]> visibility:100 quantity:0 data:1 offset:1,1,0.2
- if <context.click_type.contains_text[left]> {
- flag player railgun:leftclick duration:<s@Config.yaml_key[classvariables.railgun.leftclick.cooldown]>
}
else {
- flag player railgun:rightclick duration:<s@Config.yaml_key[classvariables.railgun.rightclick.cooldown]>
}
- run s@WeaponCooldown d:<def[item]>|<def[player]>|<def[iteminhand]>
WeaponCooldown:
type: task
debug: true
script:
- if !<def[2].has_flag[<def[1]>]> {
- narrate "<&7>-- <&a><&l>READY<&r> <&7>--"
- queue clear
}
- while <def[2].item_in_hand.scriptname.is[==].to[<def[3].scriptname||null>].and[<def[2].flag[<def[1]>].expiration.in_seconds.as_int.is[OR_MORE].than[0]||false>]||false> {
- ^actionbar "<&e>Cooldown<&7><&co> <proc[DUL_text_progress_bar].context[<def[2].flag[<def[1]>].expiration.in_seconds.as_int.div[<s@Config.yaml_key[classvariables.<def[1]>.<def[2].flag[<def[1]>]>.cooldown]>]>|60|&pipe|&e|&9]>" targets:<def[1]>
- wait 10t
}
- actionbar "<&f>"