diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/commandhandler.cpp | 21 | ||||
-rw-r--r-- | src/commandhandler.h | 4 |
2 files changed, 25 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) { diff --git a/src/commandhandler.h b/src/commandhandler.h index 5a73b2335..228682783 100644 --- a/src/commandhandler.h +++ b/src/commandhandler.h @@ -219,6 +219,10 @@ class CommandHandler final * Handle target command. */ static void handleTarget(const std::string &args, ChatTab *const tab); + /** + * Handle atkhuman command. + */ + static void handleAttackHuman(const std::string &args, ChatTab *const tab); /** * Handle closeall command. |