Date: 2023/03/15 15:30: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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
tesla_battery:
type: item
Debug: false
material: verdant_froglight
display name: <&b><&l>Batterie de tour Tesla
tesla_panel:
type: item
Debug: false
material: sea_lantern
display name: <&b><&l>Panel de tour Tesla
tesla_antenne:
type: item
Debug: false
material: lightning_rod
display name: <&b><&l>Antenne de tour Tesla
tesla_battery_wifi:
type: item
Debug: false
material: sea_lantern
display name: <&b><&l>Batterie wifi d'énergie Tesla
tesla_core:
type: item
Debug: false
material: paper
display name: <&b><&l>Coeur Tesla
mechanisms:
custom_model_data: 25
tesla_pipe:
type: item
Debug: false
material: prismarine_wall
display name: <&b><&l>Tuyeau éléctro-Teslatérique
tesla_event:
type: world
Debug: true
events:
on player places tesla_battery:
- flag <context.location> tesla_battery
on player breaks block location_flagged:tesla_battery:
- flag <context.location> tesla_setup:!
- flag <context.location.above[1]> tesla_setup:!
- flag <context.location.above[1]> tesla_setup_fuel:!
- flag server tesla_panel_wifi:<-:<context.location.above[1]>
- flag <context.location.above[2]> tesla_setup:!
- flag server tesla_setup_antenne:<-:<context.location.above[2]>
on player places tesla_panel:
- flag <context.location> tesla_panel
on player breaks block location_flagged:tesla_panel:
- flag <context.location.below[1]> tesla_setup:!
- flag <context.location> tesla_panel:!
- flag <context.location> tesla_setup:!
- flag <context.location> tesla_setup_fuel:!
- flag server tesla_panel_wifi:<-:<context.location>
- flag <context.location.above[1]> tesla_setup:!
- flag server tesla_setup_antenne:<-:<context.location.above[1]>
on player places tesla_antenne:
- flag <context.location> tesla_antenne
on player breaks block location_flagged:tesla_antenne:
- flag <context.location.below[2]> tesla_setup:!
- flag <context.location.below[1]> tesla_setup:!
- flag <context.location.below[1]> tesla_setup_fuel:!
- flag server tesla_panel_wifi:<-:<context.location.below[1]>
- flag <context.location> tesla_setup:!
- flag <context.location> tesla_antenne:!
- flag server tesla_setup_antenne:<-:<context.location>
on player places tesla_battery_wifi:
- if <context.location.find_blocks_flagged[tesla_battery_wifi].within[15].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_battery_wifi_fuel:0
on player breaks block location_flagged:tesla_battery_wifi:
- flag <context.location> tesla_battery_wifi:!
- flag <context.location> tesla_battery_wifi_fuel:!
on player right clicks block location_flagged:tesla_panel:
- if <context.location.has_flag[tesla_setup]> && <context.location.above[1].has_flag[tesla_setup]> && <context.location.below[1].has_flag[tesla_setup]>:
- narrate "<&b><&l>Énergie électrique: <context.location.flag[tesla_setup_fuel]> / 210"
- else:
- narrate "<&4><&l>Tour Tesla non opérationelle"
on player right clicks block location_flagged:tesla_panel with:tesla_core:
- if <context.location.above[1].has_flag[tesla_antenne]> && <context.location.below[1].has_flag[tesla_battery]>:
- narrate "<&2><&l>Tour Tesla opérationelle "
- playsound <context.location> sound:entity_lightning_bolt_impact
- playeffect effect:ele at:<context.location> offset:1
- flag <context.location> tesla_setup
- flag <context.location> tesla_setup_fuel:0
- flag server tesla_panel_wifi:->:<context.location>
- flag <context.location.above[1]> tesla_setup
- flag <context.location.below[1]> tesla_setup
- flag server tesla_setup_antenne:->:<context.location.above[1]>
on system time secondly every:10:
- foreach <server.flag[tesla_panel_wifi]> as:search_tesla_battery:
- if <[search_tesla_battery].has_flag[tesla_setup]>:
- foreach <[search_tesla_battery].find_blocks_flagged[tesla_battery_wifi].within[10]> as:tesla_battery_wifi_find:
- flag <[tesla_battery_wifi_find]> tesla_battery_wifi_fuel:+:<[search_tesla_battery].flag[tesla_setup_fuel]>
- flag <[search_tesla_battery]> tesla_setup_fuel:0
on player right clicks block location_flagged:tesla_battery_wifi:
- narrate "<&b><&l>Énergie électrique: <context.location.flag[tesla_battery_wifi_fuel]> "
on system time secondly every:30:
- foreach <server.flag[tesla_setup_antenne]> as:lightning_antenne_tesla:
- random:
- repeat 1:
- if <util.random_chance[50]>:
- strike <[lightning_antenne_tesla]> no_damage
on lightning strikes:
- if <context.location> == <server.flag[tesla_setup_antenne]>:
- if <context.location.flag[tesla_setup_fuel]> >= 200:
- determine cancelled
- else:
- flag <context.location.below[1]> tesla_setup_fuel:+:1
on player places tesla_pipe:
- flag server tesla_pipee:->:<context.location>
- flag <context.location> tesla_pipe
- flag <context.location> tesla_pipes_fuel:0
on player breaks location_flagged:tesla_pipe:
- flag server tesla_pipee:<-:<context.location>
- flag <context.location> tesla_pipe:!
- flag <context.location> tesla_pipes_fuel:!
on system time secondly every:5:
- foreach <server.flag[tesla_pipee].flood_fill[10].types[block_flagged:tesla_pipe]> as:tesla_pipes:
- foreach <[tesla_pipes].find_blocks_flagged[tesla_battery_wifi].within[1]> as:tesla_pipe_find_bat:
- flag <[tesla_pipes]> tesla_pipes_fuel:+:<[tesla_pipe_find_bat].flag[tesla_battery_wifi_fuel]>
- flag <[tesla_pipe_find_bat]> tesla_battery_wifi_fuel:0