diff options
author | Dennis Friis <peavey@inspircd.org> | 2009-05-12 22:28:44 +0200 |
---|---|---|
committer | Dennis Friis <peavey@inspircd.org> | 2009-05-12 22:28:44 +0200 |
commit | f05ae6aa57a2855a0c27360689a92f923a8ef9aa (patch) | |
tree | 8454d80a54957dc375dbbbead4c9658a7b58213b | |
parent | 535a14adae4cdc5e2b8610b1c8e30501c9e95d5f (diff) | |
download | mana-f05ae6aa57a2855a0c27360689a92f923a8ef9aa.tar.gz mana-f05ae6aa57a2855a0c27360689a92f923a8ef9aa.tar.bz2 mana-f05ae6aa57a2855a0c27360689a92f923a8ef9aa.tar.xz mana-f05ae6aa57a2855a0c27360689a92f923a8ef9aa.zip |
Add target + attack key, defaults to x.
-rw-r--r-- | src/game.cpp | 17 | ||||
-rw-r--r-- | src/keyboardconfig.cpp | 1 | ||||
-rw-r--r-- | src/keyboardconfig.h | 1 |
3 files changed, 19 insertions, 0 deletions
diff --git a/src/game.cpp b/src/game.cpp index b56cbdde..c07d6520 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -923,6 +923,23 @@ void Game::handleInput() if (player_node->getTarget()) player_node->attack(player_node->getTarget(), true); } + + if (keyboard.isKeyActive(keyboard.KEY_TARGET_ATTACK)) + { + Being *target = NULL; + + bool newTarget = !keyboard.isKeyActive(keyboard.KEY_TARGET); + // A set target has highest priority + if (!player_node->getTarget()) + { + Uint16 targetX = x, targetY = y; + // Only auto target Monsters + target = beingManager->findNearestLivingBeing(targetX, targetY, + 20, Being::MONSTER); + } + player_node->attack(target, newTarget); + } + #endif // Target the nearest player/monster/npc diff --git a/src/keyboardconfig.cpp b/src/keyboardconfig.cpp index ff05d75b..b5db3de5 100644 --- a/src/keyboardconfig.cpp +++ b/src/keyboardconfig.cpp @@ -43,6 +43,7 @@ static KeyData const keyData[KeyboardConfig::KEY_TOTAL] = { {"keyMoveLeft", SDLK_LEFT, _("Move Left")}, {"keyMoveRight", SDLK_RIGHT, _("Move Right")}, {"keyAttack", SDLK_LCTRL, _("Attack")}, + {"keyTargetAttack", SDLK_x, _("Target & Attack")}, {"keySmilie", SDLK_LALT, _("Smilie")}, {"keyTalk", SDLK_t, _("Talk")}, {"keyTarget", SDLK_LSHIFT, _("Stop Attack")}, diff --git a/src/keyboardconfig.h b/src/keyboardconfig.h index d461c827..68a5efa6 100644 --- a/src/keyboardconfig.h +++ b/src/keyboardconfig.h @@ -154,6 +154,7 @@ class KeyboardConfig KEY_MOVE_LEFT, KEY_MOVE_RIGHT, KEY_ATTACK, + KEY_TARGET_ATTACK, KEY_EMOTE, KEY_TALK, KEY_TARGET, |