From 38d5199a67d59d1ba8fc02a3771a9567d66efd7d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 12 Dec 2014 12:24:21 +0300 Subject: Add chat command for nuke players. New chat command: /nuke NAME --- src/actions/commands.cpp | 15 +++++++++++++++ src/actions/commands.h | 1 + src/input/inputaction.h | 1 + src/input/inputactionmap.h | 9 +++++++++ 4 files changed, 26 insertions(+) diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index c8d4f2b21..09895dc03 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -229,6 +229,21 @@ impHandler(chatEnemy) return true; } +impHandler(chatNuke) +{ + if (!actorManager) + return false; + + const std::string nick = getNick(event); + Being *const being = actorManager->findBeingByName( + nick, ActorType::Player); + if (!being) + return true; + + actorManager->addBlock(static_cast(being->getId())); + actorManager->destroy(being); +} + impHandler0(present) { if (chatWindow) diff --git a/src/actions/commands.h b/src/actions/commands.h index 085b89663..160737572 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -36,6 +36,7 @@ namespace Actions decHandler(chatBlackList); decHandler(chatEnemy); decHandler(chatErase); + decHandler(chatNuke); decHandler(present); decHandler(printAll); decHandler(move); diff --git a/src/input/inputaction.h b/src/input/inputaction.h index 5b9288950..e2fcae031 100644 --- a/src/input/inputaction.h +++ b/src/input/inputaction.h @@ -494,6 +494,7 @@ namespace InputAction SELL, WHISPER2, GUILD, + NUKE, TOTAL }; } // namespace InputAction diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 292fdc1c1..1ae660fb0 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -4189,6 +4189,15 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { InputCondition::INGAME, "guild", true}, + {"keyNuke", + InputType::UNKNOWN, InputAction::NO_VALUE, + InputType::UNKNOWN, InputAction::NO_VALUE, + Input::GRP_DEFAULT, + &Actions::chatNuke, + InputAction::NO_VALUE, 50, + InputCondition::INGAME, + "nuke", + true}, }; #endif // INPUT_INPUTACTIONMAP_H -- cgit v1.2.3-70-g09d2