Created
October 18, 2014 23:12
-
-
Save dequis/0c05ebfa93cf9984f877 to your computer and use it in GitHub Desktop.
PlayerMoveEvent test plugin written in MiniPython
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# --- | |
# name: Test | |
# version: 1.0 | |
# author: dx | |
# --- | |
import quick | |
def format_location(l): | |
return "x=%.3f y=%.3f z=%.3f yaw=%.3f pitch=%.3f" % \ | |
(l.x, l.y, l.z, l.yaw, l.pitch) | |
@quick.event('player.PlayerMoveEvent') | |
def move(event): | |
quick.log("from:", format_location(event.from)) | |
quick.log(" to:", format_location(event.to)) | |
angle_diff = abs(event.from.yaw - event.to.yaw) + \ | |
abs(event.from.pitch - event.to.pitch) | |
quick.log("diff: %-10.3f angle: %-10.3f" % | |
(event.to.distanceSquared(event.from), angle_diff)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment