Date: 2019/03/27 11:52:26 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
mountsHandler:
type: world
debug: false
events:
on player right clicks custom_mount_1:
- if !<context.entity.flag[Mount.isRidden]||false>
- flag <context.entity> Mount.isRidden
- flag <context.entity> Mount.Owner:<player>
- adjust <context.entity> owner:<player>
- adjust <context.entity> has_ai:false
- mount <player>|<context.entity> <context.entity.location>
- if <context.entity.flag[Mount.Owner]> == <player>
- mount <player>|<context.entity> <context.entity.location>
- else
- narrate "<&c><&l>(!) <&7>Sorry but this mount is not yours."
on player steers custom_mount_1:
- flag player Mount.TickCooldown:0
- flag player Mount.wantsJump:false
- if <context.jump>
- flag player Mount.wantsJump:true
- if <player.flag[Mount.TickCooldown]> == 0
- flag player Mount.Forward:+:<context.forward>
- narrate "<context.forward>"
- flag player Mount.Sideways:+:<context.sideways>
- narrate "<context.sideways>"
- flag player Mount.TickCooldown:3
- define dividing <tern[<context.entity.is_on_ground>]:8||64>
- if <context.dismount>
- define dividing <def[dividing].div[10]>
- mount cancel
- queue clear
- define sideways <context.sideways.add[<player.flag[Mount.Sideways]>].div[<def[dividing]>]>
- define forward <context.forward.add[<player.flag[Mount.Forward]>].div[<def[dividing]>]>
- define looks <player.location.direction.vector.sub[0,<player.location.direction.vector.y>,0]>
- define velocity <def[looks].mul[<def[forward]>].add[<def[looks].rotate_around_y[<el@90.to_radians>].mul[<def[sideways]>]>]>
- flag player Mount.Sideways:0
- flag player Mount.Forward:0
- if <player.flag[Mount.wantsJump]||false>
- if <context.entity.is_on_ground>
- narrate "Jump"
- define velocity <def[velocity].add[0,0.5,0]>
- define length <def[velocity].vector_length>
- if <def[length]> > 0.01
- look <context.entity> <context.entity.location.add[<def[velocity]>]>
- adjust <context.entity> velocity:<context.entity.velocity.add[<def[length]>]>
custom_mount_1:
type: entity
entity_type: POLAR_BEAR
has_ai: true
age: adult
can_pickup_items: false
speed: 1.1
invulnerable: false
custom_name: <&5><&l>Test Mount
mountSpawn:
type: command
name: spawn_mount
usage: /spawn_mount
script:
- spawn custom_mount_1 <player.location>