From 3da7f49e31f018047d6ed5869b5f4cebb9b29717 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 22 Feb 2015 01:43:47 +0300 Subject: Add chat command for move pet to give position. New chat command: /movepet x,y Alias: /petmove x,y --- src/actions/pets.cpp | 17 +++++++++++++++++ src/actions/pets.h | 1 + src/input/inputaction.h | 1 + src/input/inputactionmap.h | 5 +++++ 4 files changed, 24 insertions(+) (limited to 'src') diff --git a/src/actions/pets.cpp b/src/actions/pets.cpp index 109da80cd..2247e0533 100644 --- a/src/actions/pets.cpp +++ b/src/actions/pets.cpp @@ -191,4 +191,21 @@ impHandler0(petAiStop) return true; } +impHandler0(petMove) +{ + const Being *const pet = getPet(); + if (!pet) + return false; + + int x = 0; + int y = 0; + + if (parse2Int(event.args, x, y)) + { + petHandler->move(pet->getId(), x, y); + return true; + } + return false; +} + } // namespace Actions diff --git a/src/actions/pets.h b/src/actions/pets.h index ba8ef36d3..597be91f3 100644 --- a/src/actions/pets.h +++ b/src/actions/pets.h @@ -42,6 +42,7 @@ namespace Actions decHandler(petDirectRight); decHandler(petAiStart); decHandler(petAiStop); + decHandler(petMove); } // namespace Actions #undef decHandler diff --git a/src/input/inputaction.h b/src/input/inputaction.h index 8ce40ffe2..ee91ed0f3 100644 --- a/src/input/inputaction.h +++ b/src/input/inputaction.h @@ -537,6 +537,7 @@ namespace InputAction DROP_CLEAR, WINDOW_CART, HEAL_MOST_DAMAGED, + PET_MOVE, TOTAL }; } // namespace InputAction diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 57cd4d7fe..0c37a2936 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -3979,6 +3979,11 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { InputCondition::GAME | InputCondition::VALIDSPEED, "healmd|saveass", false}, + {"keyPetMove", + defaultAction(&Actions::petMove), + InputCondition::INGAME, + "movepet|petmove", + true}, }; #undef defaultAction -- cgit v1.2.3-60-g2f50