CameraUtil_Version:
type: version
track: true
name: "Camera Utilities"
id: 102
description: "Player's Camera utilities."
- version: 0.01
+ version: 0.02
CameraUtil:
type: task
debug: false
speed: 0t
definitions: action|location
script:
- if <def[action]> == attach {
- inject locally detach
- inject locally create
- teleport <def[location]>
- wait 1t
- inject locally attach
- queue clear
}
- if <def[action]> == detach {
- inject locally 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=102&version=<s@CameraUtil_Version.yaml_key[version]>"
+ - 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 CameraUtil 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