[Orxonox-commit 6612] r11252 - in code/branches/HUD_HS16: data/defaultConfig data/gui/scripts src/modules/pickup src/orxonox/controllers
patricwi at orxonox.net
patricwi at orxonox.net
Mon Oct 31 13:02:46 CET 2016
Author: patricwi
Date: 2016-10-31 13:02:46 +0100 (Mon, 31 Oct 2016)
New Revision: 11252
Modified:
code/branches/HUD_HS16/data/defaultConfig/keybindings.ini
code/branches/HUD_HS16/data/gui/scripts/KeyBindMenu.lua
code/branches/HUD_HS16/src/modules/pickup/PickupManager.cc
code/branches/HUD_HS16/src/modules/pickup/PickupManager.h
code/branches/HUD_HS16/src/orxonox/controllers/HumanController.h
Log:
setCommand vorbereitet und keybindings optimiert
Modified: code/branches/HUD_HS16/data/defaultConfig/keybindings.ini
===================================================================
--- code/branches/HUD_HS16/data/defaultConfig/keybindings.ini 2016-10-31 10:22:34 UTC (rev 11251)
+++ code/branches/HUD_HS16/data/defaultConfig/keybindings.ini 2016-10-31 12:02:46 UTC (rev 11252)
@@ -69,9 +69,9 @@
KeyNextTrack=
KeyNoConvert=
KeyNumLock=
-KeyNumRow0=
-KeyNumRow1="toggleFormationFlight"
-KeyNumRow2="FFChangeMode"
+KeyNumRow0="useUnusePickup"
+KeyNumRow1=
+KeyNumRow2=
KeyNumRow3=
KeyNumRow4=
KeyNumRow5=
@@ -79,7 +79,7 @@
KeyNumRow7=
KeyNumRow8=
KeyNumRow9=
-KeyNumpad0=
+KeyNumpad0="useUnusePickup"
KeyNumpad1=
KeyNumpad2=
KeyNumpad3=
@@ -95,8 +95,8 @@
KeyNumpadEquals=
KeyNumpadPeriod=
KeyNumpadSubtract=
-KeyO=
-KeyP=
+KeyO="toggleFormationFlight"
+KeyP="FFChangeMode"
KeyPageDown="scale -1 rotateRoll"
KeyPageUp=
KeyPause=pause
Modified: code/branches/HUD_HS16/data/gui/scripts/KeyBindMenu.lua
===================================================================
--- code/branches/HUD_HS16/data/gui/scripts/KeyBindMenu.lua 2016-10-31 10:22:34 UTC (rev 11251)
+++ code/branches/HUD_HS16/data/gui/scripts/KeyBindMenu.lua 2016-10-31 12:02:46 UTC (rev 11252)
@@ -35,6 +35,7 @@
table.insert(commandList, "mouseLook")
table.insert(commandList, "pause")
table.insert(commandList, "printScreen")
+ table.insert(commandList, "useUnusePickup")
if orxonox.GUIManager:inDevMode() then
table.insert(commandList, "printScreenHD")
table.insert(commandList, "createSkybox")
@@ -70,6 +71,7 @@
table.insert(nameList, "Look Around")
table.insert(nameList, "Pause")
table.insert(nameList, "Screenshot")
+ table.insert(nameList, "Pickup 0")
if orxonox.GUIManager:inDevMode() then
table.insert(nameList, "HD screenshot")
table.insert(nameList, "Create Skybox")
Modified: code/branches/HUD_HS16/src/modules/pickup/PickupManager.cc
===================================================================
--- code/branches/HUD_HS16/src/modules/pickup/PickupManager.cc 2016-10-31 10:22:34 UTC (rev 11251)
+++ code/branches/HUD_HS16/src/modules/pickup/PickupManager.cc 2016-10-31 12:02:46 UTC (rev 11252)
@@ -42,6 +42,7 @@
#include "network/NetworkFunctionIncludes.h"
#include "core/input/KeyBinderManager.h" //for keybinding
#include "core/input/KeyBinder.h" //for keybinding
+#include "core/command/ConsoleCommandIncludes.h"
#include "infos/PlayerInfo.h"
#include "interfaces/PickupCarrier.h"
@@ -65,6 +66,9 @@
RegisterAbstractClass(PickupManager).inheritsFrom<PickupListener>();
+ SetConsoleCommand2("useUnusePickup", &PickupManager::useUnusePickup).addShortcut().setActive(true);
+
+ // SetConsoleCommand("HumanController", "fire", &HumanController::fire ).addShortcut().keybindMode(KeybindMode::OnHold);
/**
@brief
Constructor. Registers the PickupManager and creates the default PickupRepresentation.
@@ -289,11 +293,11 @@
this->indexes_[pickup] = index;
this->pickups_[index] = pickup;
- //Add pickup keybinding
- if( KeyBinderManager::exists() )
- addKeyBindingForNewPickup(pickup, index);
- else
- orxout() << "Could not create new keybinding because KeyBinderManager doesn't exist." << endl;
+ // //Add pickup keybinding
+ // if( KeyBinderManager::exists() )
+ // addKeyBindingForNewPickup(pickup, index);
+ // else
+ // orxout() << "Could not create new keybinding because KeyBinderManager doesn't exist." << endl;
}
else // If it was dropped, it is removed from the required lists.
{
@@ -301,15 +305,15 @@
std::map<Pickupable*, uint32_t>::iterator it = this->indexes_.find(pickup);
index = it->second;
- //Remove pickup keybinding
- if( KeyBinderManager::exists() )
- removeKeyBindingForOldPickup(pickup, index);
- else
- orxout() << "Could not delete old keybinding because KeyBinderManager doesn't exist." << endl;
+ // //Remove pickup keybinding
+ // if( KeyBinderManager::exists() )
+ // removeKeyBindingForOldPickup(pickup, index);
+ // else
+ // orxout() << "Could not delete old keybinding because KeyBinderManager doesn't exist." << endl;
// Remove the Pickupable from the indexes_ and pickups_ list.
this->indexes_.erase(pickup);
- this->pickups_.find(index)->second=nullptr; //set to null, so that can be indentified as free slot by getPickupIndex()
+ this->pickups_.find(index)->second=nullptr; //set to null, so that can be identified as free slot by getPickupIndex()
}
// If we're either in standalone mode or this is the host whom the change of the pickup's status concerns.
@@ -338,36 +342,55 @@
}
//PRECONDITION: KeyBinderManager exists, pickup is not NULL, 0 < index < 9
- //FUNCTION: Adds a keybinding for the new pickup using its index
- void PickupManager::addKeyBindingForNewPickup(Pickupable* pickup, uint32_t index)
- {
- std::string name="Keys.KeyNumpad";
- std::string binding="";
+ //FUNCTION: Adds a keybinding for the new pickup using its index and sets a console command
+ // void PickupManager::addKeyBindingForNewPickup(Pickupable* pickup, uint32_t index)
+ // {
+ // std::string name="Keys.KeyNumpad";
+ // std::string binding="useOrUnusePickup";
- name.append(std::to_string(index));
+ // name.append(std::to_string(index));
+ // binding.append(std::to_string(index));
- KeyBinderManager::getInstance().getCurrent()->setBinding("KeyESC", name, true); // TODO do not set all bindings to ESC
+ // SetConsoleCommand(binding, &PickupManager::useUnusePickup(pickup, index));
+ // KeyBinderManager::getInstance().getCurrent()->setBinding(binding, name, true);
- orxout() << "Keybinding for item " << index << " has been added on keybinding " << name << endl;
+ // orxout() << "Keybinding for item " << index << " has been added on keybinding " << name << endl;
- }
+ // }
//PRECONDITION: KeyBinderManager exists, pickup is not NULL, 0 < index < 9
//FUNCTION: Removes the keybinding of the pickup using its index
- void PickupManager::removeKeyBindingForOldPickup(Pickupable* pickup, uint32_t index)
- {
- std::string name="Keys.KeyNumpad";
- std::string binding="";
+ // void PickupManager::removeKeyBindingForOldPickup(Pickupable* pickup, uint32_t index)
+ // {
+ // std::string name="Keys.KeyNumpad";
+ // std::string binding="";
- name.append(std::to_string(index));
+ // name.append(std::to_string(index));
- KeyBinderManager::getInstance().getCurrent()->setBinding("", name, true);
+ // SetConsoleCommand(binding, nullptr);
+ // KeyBinderManager::getInstance().getCurrent()->setBinding("", name, true);
- orxout() << "Keybinding for item " << index << " has been removed on keybinding " << name << endl;
+ // orxout() << "Keybinding for item " << index << " has been removed on keybinding " << name << endl;
+ // }
+
+ //This function is called by the command line or by the key binding
+ //it uses or unuses the pickup, depending on its current state
+ void PickupManager::useUnusePickup() //uint32_t index
+ {
+ // orxout() << "Hello there i was here " << index << endl;
+ orxout() << "Hello there i was here " << endl;
+ // Pickupable* pickup=pickups_.find(index)->second;
+ // if(pickup==nullptr) return; //pickup does not exist
+
+ // if(pickup->used)
+ // usePickup(pickup, false);
+ // else
+ // usePickup(pickup, true);
}
+
/**
@brief
Helper method to react to the change in the pickedUp status of a Pickupable.
Modified: code/branches/HUD_HS16/src/modules/pickup/PickupManager.h
===================================================================
--- code/branches/HUD_HS16/src/modules/pickup/PickupManager.h 2016-10-31 10:22:34 UTC (rev 11251)
+++ code/branches/HUD_HS16/src/modules/pickup/PickupManager.h 2016-10-31 12:02:46 UTC (rev 11252)
@@ -134,6 +134,8 @@
{ return (this->pickupsIterator_++)->second; }
void dropPickup(uint32_t pickup); //!< Drop the input Pickupable.
+ //void useUnusePickup(uint32_t index);
+ void useUnusePickup(); //tolua_export
void usePickup(uint32_t pickup, bool use); //!< Use (or unuse) the input Pickupable.
/**
@brief Check whether the input Pickupable is valid, meaning that it is in the PickupManager's list and still exists.
Modified: code/branches/HUD_HS16/src/orxonox/controllers/HumanController.h
===================================================================
--- code/branches/HUD_HS16/src/orxonox/controllers/HumanController.h 2016-10-31 10:22:34 UTC (rev 11251)
+++ code/branches/HUD_HS16/src/orxonox/controllers/HumanController.h 2016-10-31 12:02:46 UTC (rev 11252)
@@ -68,7 +68,6 @@
void startBoosting(void);
void stopBoosting(void);
-
static void greet();
static void switchCamera();
static void mouseLook();
More information about the Orxonox-commit
mailing list