summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/actions/commands.cpp30
-rw-r--r--src/actions/commands.h1
-rw-r--r--src/input/inputaction.h1
-rw-r--r--src/input/inputactionmap.h9
4 files changed, 41 insertions, 0 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index 151e54474..00c8b9a5c 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -25,6 +25,7 @@
#include "flooritem.h"
#include "inventory.h"
#include "item.h"
+#include "party.h"
#include "actions/actiondef.h"
@@ -442,6 +443,35 @@ impHandler(navigate)
return true;
}
+impHandler(navigateTo)
+{
+ if (!localPlayer)
+ return false;
+
+ const std::string args = event.args;
+ if (args.empty())
+ return true;
+
+ Being *const being = actorManager->findBeingByName(args);
+ if (being)
+ {
+ localPlayer->navigateTo(being->getTileX(), being->getTileY());
+ }
+ else if (localPlayer->isInParty())
+ {
+ const Party *const party = localPlayer->getParty();
+ if (party)
+ {
+ const PartyMember *const m = party->getMember(args);
+ const PartyMember *const o = party->getMember(
+ localPlayer->getName());
+ if (m && o && m->getMap() == o->getMap())
+ localPlayer->navigateTo(m->getX(), m->getY());
+ }
+ }
+ return true;
+}
+
impHandler(imitation)
{
if (!localPlayer)
diff --git a/src/actions/commands.h b/src/actions/commands.h
index 34dcf0c44..a8143275b 100644
--- a/src/actions/commands.h
+++ b/src/actions/commands.h
@@ -49,6 +49,7 @@ namespace Actions
decHandler(pseudoAway);
decHandler(follow);
decHandler(navigate);
+ decHandler(navigateTo);
decHandler(imitation);
decHandler(sendMail);
decHandler(info);
diff --git a/src/input/inputaction.h b/src/input/inputaction.h
index 0287e3f42..f7b061e88 100644
--- a/src/input/inputaction.h
+++ b/src/input/inputaction.h
@@ -498,6 +498,7 @@ namespace InputAction
USE,
CHAT_ADD,
WHISPER_TEXT,
+ NAVIGATE_TO,
TOTAL
};
} // namespace InputAction
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index 08d7bbf7a..e9457058b 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -4225,6 +4225,15 @@ static const InputActionData inputActionData[InputAction::TOTAL] = {
InputCondition::INGAME,
"wt|whispertext|msgtext",
true},
+ {"keyNavigateTo",
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ Input::GRP_DEFAULT,
+ &Actions::navigateTo,
+ InputAction::NO_VALUE, 50,
+ InputCondition::INGAME,
+ "navigateto",
+ true},
};
#endif // INPUT_INPUTACTIONMAP_H