[Orxonox-commit 3170] r7863 - in code/trunk/src/orxonox: controllers worldentities/pawns

landauf at orxonox.net landauf at orxonox.net
Sat Feb 12 13:09:42 CET 2011


Author: landauf
Date: 2011-02-12 13:09:42 +0100 (Sat, 12 Feb 2011)
New Revision: 7863

Modified:
   code/trunk/src/orxonox/controllers/HumanController.cc
   code/trunk/src/orxonox/worldentities/pawns/Spectator.cc
Log:
disabled suicide for Spectator

Modified: code/trunk/src/orxonox/controllers/HumanController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/HumanController.cc	2011-02-12 10:57:28 UTC (rev 7862)
+++ code/trunk/src/orxonox/controllers/HumanController.cc	2011-02-12 12:09:42 UTC (rev 7863)
@@ -40,6 +40,7 @@
 namespace orxonox
 {
     extern const std::string __CC_fire_name = "fire";
+    extern const std::string __CC_suicide_name = "suicide";
 
     SetConsoleCommand("HumanController", "moveFrontBack",          &HumanController::moveFrontBack ).addShortcut().setAsInputCommand();
     SetConsoleCommand("HumanController", "moveRightLeft",          &HumanController::moveRightLeft ).addShortcut().setAsInputCommand();
@@ -53,7 +54,7 @@
     SetConsoleCommand("HumanController", "greet",                  &HumanController::greet         ).addShortcut();
     SetConsoleCommand("HumanController", "switchCamera",           &HumanController::switchCamera  ).addShortcut();
     SetConsoleCommand("HumanController", "mouseLook",              &HumanController::mouseLook     ).addShortcut();
-    SetConsoleCommand("HumanController", "suicide",                &HumanController::suicide       ).addShortcut();
+    SetConsoleCommand("HumanController", __CC_suicide_name,        &HumanController::suicide       ).addShortcut();
     SetConsoleCommand("HumanController", "toggleGodMode",          &HumanController::toggleGodMode ).addShortcut();
     SetConsoleCommand("HumanController", "addBots",                &HumanController::addBots       ).addShortcut().defaultValues(1);
     SetConsoleCommand("HumanController", "killBots",               &HumanController::killBots      ).addShortcut().defaultValues(0);

Modified: code/trunk/src/orxonox/worldentities/pawns/Spectator.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/Spectator.cc	2011-02-12 10:57:28 UTC (rev 7862)
+++ code/trunk/src/orxonox/worldentities/pawns/Spectator.cc	2011-02-12 12:09:42 UTC (rev 7863)
@@ -42,6 +42,7 @@
 namespace orxonox
 {
     extern const std::string __CC_fire_name;
+    extern const std::string __CC_suicide_name;
 
     CreateFactory(Spectator);
 
@@ -153,7 +154,7 @@
     }
 
     /**
-        @brief Changes the keybind mode of the fire command to OnPress.
+        @brief Changes the behavior of some console commands.
     */
     void Spectator::startLocalHumanControl()
     {
@@ -161,10 +162,13 @@
 
         // change keybind mode of fire command to OnPress to avoid firing after respawn
         ModifyConsoleCommand(__CC_fire_name).keybindMode(KeybindMode::OnPress);
+
+        // disable suicide
+        ModifyConsoleCommand(__CC_suicide_name).pushFunction(&prototype::void__void);
     }
 
     /**
-        @brief Changes the keybind mode of the fire command back to OnHold.
+        @brief Changes the behavior of some console commands back to the original state.
     */
     void Spectator::stopLocalHumanControl()
     {
@@ -173,6 +177,9 @@
         // change fire command to a helper function and change keybind mode to OnPress
         // as soon as the player releases and presses the button again, the helper function will be called which changes the keybind mode back to OnHold
         ModifyConsoleCommand(__CC_fire_name).pushFunction(&Spectator::resetFireCommand).keybindMode(KeybindMode::OnPress);
+
+        // enable suicide
+        ModifyConsoleCommand(__CC_suicide_name).popFunction();
     }
 
     /**




More information about the Orxonox-commit mailing list