blob: ff34bde51d064cb8d5381dc28d5a77e5fc977c91 (
plain) (
blame)
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
|
import net.mapserv as mapserv
import commands
from utils import extends
from loggers import debuglog
__all__ = [ 'PLUGIN', 'init', 'follow' ]
PLUGIN = {
'name': 'autofollow',
'requires': (),
'blocks': (),
}
follow = ''
@extends('smsg_player_move')
def player_move(data):
if follow:
b = mapserv.beings_cache[data.id]
if b.name == follow:
mapserv.cmsg_player_change_dest(data.coor_pair.dst_x,
data.coor_pair.dst_y)
def follow_cmd(_, player):
'''Follow given player, or disable following (if no arg)'''
global follow
follow = player
if player:
debuglog.info('Following %s', player)
else:
debuglog.info('Not following anyone')
def init(config):
commands.commands['follow'] = follow_cmd
|