Date: 2019/05/17 05:40:14 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
CameraUtil_Version:
type: version
track: true
name: "Camera Utilities"
id: 102
description: "Player's Camera utilities."
version: 0.02
CameraUtil:
type: task
debug: false
speed: 0t
definitions: action|location
script:
- if <def[action]> == attach {
- inject locally path:detach
- inject locally path:create
- teleport <def[location]>
- wait 1t
- inject locally path:attach
- queue clear
}
- if <def[action]> == detach {
- inject locally path:detach
}
create:
- spawn e@CameraUtil_Entity <def[location]> save:x
- define attach_to <entry[x].spawned_entities.first>
- flag <player> camerautil_attached_to:<def[attach_to]>
attach:
- define to <player.flag[camerautil_attached_to].as_entity||null>
- if <def[to]> != null {
- flag <player> camerautil_lastgamemode:<player.gamemode>
- adjust <player> gamemode:spectator
- async {
- while <player.has_flag[camerautil_attached_to]> {
- adjust <player> spectate:<def[to]>
- wait 10t
}
}
}
detach:
- if <player.has_flag[camerautil_attached_to]> {
- if <player.has_flag[camerautil_lastgamemode]> {
- adjust <player> gamemode:<player.flag[camerautil_lastgamemode]>
- flag <player> camerautil_lastgamemode:!
}
- define as <player.flag[camerautil_attached_to]>
- flag <player> camerautil_attached_to:!
- adjust <player> spectate:<player>
- remove <def[as]>
}
CameraUtil_Listener:
type: world
debug: false
events:
on system time hourly:
- if <s@CameraUtil_Version.yaml_key[track]> {
- webget "http://morphanone.space/webizen.aspx/tracker?script=<s@CameraUtil_Version.yaml_key[id]>&version=<s@CameraUtil_Version.yaml_key[version]>"
}
on player quits:
- inject s@CameraUtil path:detach
on world unload:
- foreach <context.world.entities.filter[scriptname.is[==].to[CameraUtil_Entity]]> {
- remove <def[value]>
}
CameraUtil_Entity:
type: entity
debug: false
entity_type: e@armor_stand
gravity: false
visible: false
invulnerable: true