#!/usr/bin/env python

from .command import Command
from evennia import CmdSet
from evennia.utils import logger


class CmdKnock(Command):
    """
    The ability to knock on something, like a door.

    While it would be great if it could be attached to a door or some
    other exit, we need to attach this to the room.

    """
    key = "knock"

    def func(self):
        logger.log_info(f"Seems like {self.caller.key} wants to knock on me.")
        self.obj.do_knock(self.caller)


class CmdSetKnock(CmdSet):
    def at_cmdset_creation(self):
        self.add(CmdKnock)


class CmdJump(Command):
    """
    Jump or play in or around puddles.
    """
    key = "jump"
    aliases = ["play"]

    def func(self):
        self.obj.do_jump(self.caller)


class CmdSetPuddle(CmdSet):
    def at_cmdset_creation(self):
        self.add(CmdJump)


class CmdThrow(Command):
    """
    Jump or play in or around puddles.
    """
    key = "throw"
    locks = "holds(stick)"

    def func(self):
        self.obj.do_throw(self.caller)


class CmdSetStick(CmdSet):
    def at_cmdset_creation(self):
        self.add(CmdThrow)
