diff options
Diffstat (limited to 'src/commandhandler.cpp')
-rw-r--r-- | src/commandhandler.cpp | 21 |
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) { |