# Path: twistedbot/plugins/base.py
# class PluginChatBase(PluginBase):
# 
#     def send_chat_message(self, msg):
#         self.world.chat.send_chat_message(msg)
# 
#     @abc.abstractproperty
#     def command_verb(self):
#         pass
# 
#     @property
#     def aliases(self):
#         return []
# 
#     @abc.abstractproperty
#     def help(self):
#         pass
# 
#     @abc.abstractmethod
#     def command(self, sender, command, args):
#         pass
# 
# Path: twistedbot/behavior_tree.py
# class FollowPlayer(BTGoal):
#     def __init__(self, **kwargs):
#         super(FollowPlayer, self).__init__(**kwargs)
#         self.last_block = None
#         self.name = "following %s" % self.blackboard.commander_name
# 
#     @property
#     def goal_reached(self):
#         return False
# 
#     def is_valid(self):
#         return self.blackboard.commander_in_game
# 
#     def choices(self):
#         while self.is_valid():
#             entity = self.blackboard.get_entity(self.blackboard.commander_eid)
#             block = self.blackboard.grid_standing_on_block(entity.aabb)
#             if block is None:
#                 yield self.make_behavior(PeekAtPlayer, player=entity)
#             elif self.last_block != block:
#                 self.last_block = block
#                 yield self.make_behavior(TravelTo, coords=block.coords, shorten_path_by=2)
#                 yield self.make_behavior(PeekAtPlayer, player=entity)
#             else:
#                 yield self.make_behavior(PeekAtPlayer, player=entity)


from twistedbot.plugins.base import PluginChatBase
from twistedbot.behavior_tree import FollowPlayer



class Follow(PluginChatBase):
    @property
    def command_verb(self):
        return "follow"

    @property
    def help(self):
        return "bot starts following you"

    def command(self, sender, command, args):

# Path: twistedbot/plugins/base.py
# class PluginChatBase(PluginBase):
# 
#     def send_chat_message(self, msg):
#         self.world.chat.send_chat_message(msg)
# 
#     @abc.abstractproperty
#     def command_verb(self):
#         pass
# 
#     @property
#     def aliases(self):
#         return []
# 
#     @abc.abstractproperty
#     def help(self):
#         pass
# 
#     @abc.abstractmethod
#     def command(self, sender, command, args):
#         pass
# 
# Path: twistedbot/behavior_tree.py
# class FollowPlayer(BTGoal):
#     def __init__(self, **kwargs):
#         super(FollowPlayer, self).__init__(**kwargs)
#         self.last_block = None
#         self.name = "following %s" % self.blackboard.commander_name
# 
#     @property
#     def goal_reached(self):
#         return False
# 
#     def is_valid(self):
#         return self.blackboard.commander_in_game
# 
#     def choices(self):
#         while self.is_valid():
#             entity = self.blackboard.get_entity(self.blackboard.commander_eid)
#             block = self.blackboard.grid_standing_on_block(entity.aabb)
#             if block is None:
#                 yield self.make_behavior(PeekAtPlayer, player=entity)
#             elif self.last_block != block:
#                 self.last_block = block
#                 yield self.make_behavior(TravelTo, coords=block.coords, shorten_path_by=2)
#                 yield self.make_behavior(PeekAtPlayer, player=entity)
#             else:
#                 yield self.make_behavior(PeekAtPlayer, player=entity)


# Path: twistedbot/plugins/core/chat_follow.py
from twistedbot.plugins.base import PluginChatBase
from twistedbot.behavior_tree import FollowPlayer




class Follow(PluginChatBase):
    @property
    def command_verb(self):
        return "follow"

    @property
    def help(self):
        return "bot starts following you"

    def command(self, sender, command, args):

        self.world.bot.behavior_tree.new_command(FollowPlayer)