Date: 2018/08/10 08:35:47 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
EarthArmor:
type: world
debug: true
events:
on player right clicks with item:
- if <player.has_flag[element_toggled]> {
- queue clear
}
- if <player.flag[element]> == earth {
- if <player.location.cursor_on[3].material> == m@air {
- if <player.has_flag[armorcooldown]> {
- playsound <player.location> sound:BLOCK_ANVIL_PLACE volume:0.15
- queue clear
}
- if <player.has_flag[armorhealth]> {
- queue clear
}
- define hardscale <li@m@sand|m@clay|m@dirt|m@grass|m@gravel|m@diorite|m@cobblestone|m@stone|m@polished_diorite|m@andesite|m@polished_andesite|m@granite|m@polished_granite>
- if !<def[hardscale].contains[<player.location.add[0,-1,0].material>]> {
- queue clear
}
- flag <player> source:<player.location.add[0,-1,0].material>
- flag <player> sourceloc:<player.location.add[0,-1,0]>
- playeffect <player.location> effect:blockdust_<player.location.add[0,-1,0].material.id> quantity:250
- repeat 15 {
- playsound <player.location> sound:BLOCK_STONE_BREAK volume:100000000000
}
- modifyblock <player.flag[sourceloc]> m@air
- flag <player> armorhealth:<def[hardscale].find[<player.flag[source]>].mul[5]>
}
}
on player damaged:
- if <player.has_flag[armorhealth]> {
- flag <player> armorhealth:<player.flag[armorhealth].sub[<context.damage>]>
- determine passively cancelled
- if <player.flag[armorhealth]> <= 0 {
- modifyblock <player.flag[sourceloc]> <player.flag[source]>
- playeffect <player.location.points_between[<player.flag[sourceloc]>]> effect:blockdust_<player.flag[source].as_material.id> quantity:250 offset:0,0,0
- repeat 15 {
- playsound <player.location> sound:BLOCK_STONE_BREAK volume:100000000000
}
- flag <player> armorhealth:!
- flag <player> source:!
- flag <player> sourceloc:!
- flag <player> armorcooldown duration:30s
}
}