summaryrefslogtreecommitdiff
path: root/src/commandhandler.cpp
diff options
context:
space:
mode:
authorJoseph Botosh <rumly111@i.ua>2012-11-12 19:12:22 +0300
committerAndrei Karas <akaras@inbox.ru>2012-11-12 19:13:40 +0300
commit97b54e33f09eb9b0417bafce18ea163af89009bb (patch)
tree6b03b0b6d5f6fca5782a4b79c9b11ff37bb4f5be /src/commandhandler.cpp
parent363223352ee9c4c7c1d65e49cf48b38b538abaf2 (diff)
downloadmv-97b54e33f09eb9b0417bafce18ea163af89009bb.tar.gz
mv-97b54e33f09eb9b0417bafce18ea163af89009bb.tar.bz2
mv-97b54e33f09eb9b0417bafce18ea163af89009bb.tar.xz
mv-97b54e33f09eb9b0417bafce18ea163af89009bb.zip
Added /atkhuman command
Diffstat (limited to 'src/commandhandler.cpp')
-rw-r--r--src/commandhandler.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp
index 001c50e6b..83078f49b 100644
--- a/src/commandhandler.cpp
+++ b/src/commandhandler.cpp
@@ -152,6 +152,8 @@ void CommandHandler::handleCommand(const std::string &command,
handleMove(args, tab);
else if (type == "target")
handleTarget(args, tab);
+ else if (type == "atkhuman")
+ handleAttackHuman(args, tab);
else if (type == "outfit")
handleOutfit(args, tab);
else if (type == "emote")
@@ -709,6 +711,25 @@ void CommandHandler::handleTarget(const std::string &args,
player_node->setTarget(target);
}
+void CommandHandler::handleAttackHuman(const std::string &args,
+ ChatTab *const tab A_UNUSED)
+{
+ if (!actorSpriteManager || !player_node)
+ return;
+
+ Being *const target = actorSpriteManager->findNearestLivingBeing(
+ player_node, 10, ActorSprite::PLAYER);
+ if (target)
+ {
+ if (player_node->checAttackPermissions(target))
+ {
+ player_node->setTarget(target);
+ player_node->attack2(target, true);
+ }
+ }
+}
+
+
void CommandHandler::handleCloseAll(const std::string &args A_UNUSED,
ChatTab *const tab A_UNUSED)
{