summaryrefslogtreecommitdiff
path: root/src/actionmanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-06-24 22:49:20 +0300
committerAndrei Karas <akaras@inbox.ru>2014-06-24 22:49:20 +0300
commit84d56b88a03054d35b84dc1ecbd7ad4614f8ac86 (patch)
treea6de73a2a93ac287413917c1ba540dff6f65da5d /src/actionmanager.cpp
parent0a4da74459471686e153b600253f12706d0ce8de (diff)
downloadmanaverse-84d56b88a03054d35b84dc1ecbd7ad4614f8ac86.tar.gz
manaverse-84d56b88a03054d35b84dc1ecbd7ad4614f8ac86.tar.bz2
manaverse-84d56b88a03054d35b84dc1ecbd7ad4614f8ac86.tar.xz
manaverse-84d56b88a03054d35b84dc1ecbd7ad4614f8ac86.zip
Add new action for select closest monster without filters and sorting.
By default unassigned.
Diffstat (limited to 'src/actionmanager.cpp')
-rw-r--r--src/actionmanager.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp
index 5c0bf85fd..876c04700 100644
--- a/src/actionmanager.cpp
+++ b/src/actionmanager.cpp
@@ -402,7 +402,7 @@ impHandler0(heal)
if (!target || target->getType() != ActorType::PLAYER)
{
target = actorManager->findNearestLivingBeing(
- player_node, 10, ActorType::PLAYER);
+ player_node, 10, ActorType::PLAYER, true);
if (target)
player_node->setTarget(target);
}
@@ -1020,7 +1020,7 @@ impHandler0(talk)
if (!target && actorManager)
{
target = actorManager->findNearestLivingBeing(
- player_node, 1, ActorType::NPC);
+ player_node, 1, ActorType::NPC, true);
// ignore closest target if distance in each direction more than 1
if (target)
{
@@ -1091,7 +1091,7 @@ impHandler0(targetAttack)
{
// Only auto target Monsters
target = actorManager->findNearestLivingBeing(
- player_node, 90, ActorType::MONSTER);
+ player_node, 90, ActorType::MONSTER, true);
}
else
{
@@ -1104,12 +1104,12 @@ impHandler0(targetAttack)
return false;
}
-static bool setTarget(const ActorType::Type type)
+static bool setTarget(const ActorType::Type type, const bool allowSort)
{
if (actorManager && player_node)
{
Being *const target = actorManager->findNearestLivingBeing(
- player_node, 20, type);
+ player_node, 20, type, allowSort);
if (target && target != player_node->getTarget())
player_node->setTarget(target);
@@ -1121,17 +1121,22 @@ static bool setTarget(const ActorType::Type type)
impHandler0(targetPlayer)
{
- return setTarget(ActorType::PLAYER);
+ return setTarget(ActorType::PLAYER, true);
}
impHandler0(targetMonster)
{
- return setTarget(ActorType::MONSTER);
+ return setTarget(ActorType::MONSTER, true);
+}
+
+impHandler0(targetClosestMonster)
+{
+ return setTarget(ActorType::MONSTER, false);
}
impHandler0(targetNPC)
{
- return setTarget(ActorType::NPC);
+ return setTarget(ActorType::NPC, true);
}
impHandler0(safeVideoMode)