Skip to content

Instantly share code, notes, and snippets.

@dequis
Created October 18, 2014 23:12
Show Gist options
  • Save dequis/0c05ebfa93cf9984f877 to your computer and use it in GitHub Desktop.
Save dequis/0c05ebfa93cf9984f877 to your computer and use it in GitHub Desktop.
PlayerMoveEvent test plugin written in MiniPython
# ---
# 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