Date: 2020/11/03 17:49:39 UTC-08: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
grappling_hook:
type: item
debug: false
material: tripwire_hook
display name: <&a><&l><&n>Grappling Hook
lore:
- <&b><&l>Use this to grapple a block
- <&b><&l>and pull yourself to it.
grappling_hook_events:
type: world
debug: false
worlds: mainland|mainland_nether
events:
on player right clicks block with:grappling_hook:
- determine passively cancelled
- if !<script[grappling_hook_events].data_key[worlds].contains[<player.world.name>]>:
- narrate "<&c>You cannot use that here."
- stop
- if <player.has_flag[grappling]>:
- narrate "<&c>You can only fire one grappling hook at a time."
- stop
- shoot arrow shooter:<player> speed:3 script:grappling_hook_pull save:hook
- flag player grappling:true duration:3s
- wait 1t
- flag <entry[hook].shot_entity> no_trail:true duration:30s
- repeat 999:
- if !<server.entity_is_spawned[<entry[hook].shot_entity>]> || !<player.has_flag[grappling]>:
- stop
- playeffect redstone at:<player.location.points_between[<entry[hook].shot_entity.location>].distance[0.5]> quantity:5 special_data:1|gray offset:0.1
- wait 2t
on player shoots block flagged:grappling bukkit_priority:LOWEST:
- flag player grappling:<context.location.add[<context.hit_face>].center>
grappling_hook_pull:
type: task
debug: false
script:
- if !<[hit_entities].is_empty||true>:
- wait 1t
- if <player.can_see[<[hit_entities].first>]||false>:
- define group <yaml[claims].read[<[hit_entities].first.location.chunk.world>.<[hit_entities].first.location.chunk.x>.<[hit_entities].first.location.chunk.z>]||null>
- if <[group]> != null && !<yaml[claims].read[groups.<[group]>.members.<player.uuid>.kill-animals]||false> && !<yaml[claims].read[groups.<[group]>.members.everyone.kill-animals]>:
- narrate "<&c>You do not have permission to interact with animals here."
- stop
- push <[hit_entities]> d:<player.location> script:grappling_hook_sanity def:false
- else:
- if <server.entity_is_spawned[<[hit_entities].first>]>:
- narrate "<&c>Unable to grapple this mob from here."
- flag player grappling:!
- else if <[location].find.blocks.within[2].filter[material.name.is[!=].to[air]].is_empty> || !<player.can_see[<[last_entity]>]||true>:
- narrate "<&c>Unable to grapple to this location from here."
- flag player grappling:!
- else if <player.flag[grappling].as_location.type||null> == location:
- wait 5t
- push <player> d:<player.flag[grappling]> script:grappling_hook_sanity def:<player.flag[grappling].as_location>
- else:
- narrate "<&c>Unable to grapple to this location from here."
- flag player grappling:!
grappling_hook_sanity:
type: task
debug: false
definitions: loc
script:
- flag player grappling:!
- if <[loc].not>:
- stop
- teleport <[loc].with_pitch[<player.location.pitch>].with_yaw[<player.location.yaw>]>
arrow_no_pickup:
type: world
debug: false
events:
on player picks up arrow:
- if <context.entity.has_flag[no_trail]>:
- determine passively cancelled
- wait 1t
- remove <context.entity>