forked from ShoOtaku/fpt_plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Facing.py
40 lines (34 loc) · 1.14 KB
/
Facing.py
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
from math import atan2
from FFxivPythonTrigger import *
command = "@Facing" #command
class TestFacing(PluginBase):
name = "Facing"
def __init__(self):
super().__init__()
frame_inject.register_continue_call(self.work)
api.command.register(command, self.process_command)
self.enable = False
def _onunload(self):
frame_inject.unregister_continue_call(self.work)
api.command.unregister(command)
def work(self):
if not self.enable:
return
t = api.XivMemory.targets.focus
if t is None:
t = api.XivMemory.targets.current
if t is None:
return
me = api.Coordinate()
me.r = atan2(me.x-t.pos.x, me.y-t.pos.y)
def process_command(self, args):
if args:
if args[0] == 'on':
self.enable = True
elif args[0] == 'off':
self.enable = False
else:
api.Magic.echo_msg("unknown args: %s" % args[0])
else:
self.enable = not self.enable
api.Magic.echo_msg("faceing: [%s]" % ('enable' if self.enable else 'disable'))