summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorDennis Friis <peavey@inspircd.org>2009-05-12 22:28:44 +0200
committerDennis Friis <peavey@inspircd.org>2009-05-12 22:28:44 +0200
commitf05ae6aa57a2855a0c27360689a92f923a8ef9aa (patch)
tree8454d80a54957dc375dbbbead4c9658a7b58213b /src/game.cpp
parent535a14adae4cdc5e2b8610b1c8e30501c9e95d5f (diff)
downloadmana-f05ae6aa57a2855a0c27360689a92f923a8ef9aa.tar.gz
mana-f05ae6aa57a2855a0c27360689a92f923a8ef9aa.tar.bz2
mana-f05ae6aa57a2855a0c27360689a92f923a8ef9aa.tar.xz
mana-f05ae6aa57a2855a0c27360689a92f923a8ef9aa.zip
Add target + attack key, defaults to x.
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp17
1 files changed, 17 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