[Orxonox-commit 1638] r6356 - in code/branches/presentation2/src/orxonox: controllers worldentities/pawns
scheusso at orxonox.net
scheusso at orxonox.net
Tue Dec 15 23:04:40 CET 2009
Author: scheusso
Date: 2009-12-15 23:04:39 +0100 (Tue, 15 Dec 2009)
New Revision: 6356
Modified:
code/branches/presentation2/src/orxonox/controllers/Controller.cc
code/branches/presentation2/src/orxonox/controllers/Controller.h
code/branches/presentation2/src/orxonox/controllers/HumanController.cc
code/branches/presentation2/src/orxonox/controllers/HumanController.h
code/branches/presentation2/src/orxonox/worldentities/pawns/Pawn.cc
Log:
god mode hack for presentation
Modified: code/branches/presentation2/src/orxonox/controllers/Controller.cc
===================================================================
--- code/branches/presentation2/src/orxonox/controllers/Controller.cc 2009-12-15 16:02:22 UTC (rev 6355)
+++ code/branches/presentation2/src/orxonox/controllers/Controller.cc 2009-12-15 22:04:39 UTC (rev 6356)
@@ -40,6 +40,7 @@
this->player_ = 0;
this->controllableEntity_ = 0;
+ this->bGodMode_ = false;
}
Controller::~Controller()
Modified: code/branches/presentation2/src/orxonox/controllers/Controller.h
===================================================================
--- code/branches/presentation2/src/orxonox/controllers/Controller.h 2009-12-15 16:02:22 UTC (rev 6355)
+++ code/branches/presentation2/src/orxonox/controllers/Controller.h 2009-12-15 22:04:39 UTC (rev 6356)
@@ -50,6 +50,9 @@
{ return this->player_; }
virtual inline void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage) {};
+
+ void setGodMode( bool mode ){ this->bGodMode_ = mode; }
+ bool getGodMode(){ return this->bGodMode_; }
inline ControllableEntity* getControllableEntity() const
{ return this->controllableEntity_; }
@@ -69,6 +72,8 @@
protected:
PlayerInfo* player_;
ControllableEntity* controllableEntity_;
+ private:
+ bool bGodMode_;
};
}
Modified: code/branches/presentation2/src/orxonox/controllers/HumanController.cc
===================================================================
--- code/branches/presentation2/src/orxonox/controllers/HumanController.cc 2009-12-15 16:02:22 UTC (rev 6355)
+++ code/branches/presentation2/src/orxonox/controllers/HumanController.cc 2009-12-15 22:04:39 UTC (rev 6356)
@@ -53,6 +53,7 @@
SetConsoleCommand(HumanController, switchCamera, true);
SetConsoleCommand(HumanController, mouseLook, true);
SetConsoleCommand(HumanController, suicide, true);
+ SetConsoleCommand(HumanController, toggleGodMode, true);
SetConsoleCommand(HumanController, addBots, true).defaultValues(1);
SetConsoleCommand(HumanController, killBots, true).defaultValues(0);
SetConsoleCommand(HumanController, dropItems, true);
@@ -208,6 +209,11 @@
}
}
+ void HumanController::toggleGodMode()
+ {
+ HumanController::getLocalControllerSingleton()->setGodMode( !HumanController::getLocalControllerSingleton()->getGodMode() );
+ }
+
void HumanController::useItem()
{
if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
Modified: code/branches/presentation2/src/orxonox/controllers/HumanController.h
===================================================================
--- code/branches/presentation2/src/orxonox/controllers/HumanController.h 2009-12-15 16:02:22 UTC (rev 6355)
+++ code/branches/presentation2/src/orxonox/controllers/HumanController.h 2009-12-15 22:04:39 UTC (rev 6356)
@@ -73,6 +73,7 @@
static void releaseNavigationFocus();
static void suicide();
+ static void toggleGodMode();
static void addBots(unsigned int amount);
static void killBots(unsigned int amount = 0);
Modified: code/branches/presentation2/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/presentation2/src/orxonox/worldentities/pawns/Pawn.cc 2009-12-15 16:02:22 UTC (rev 6355)
+++ code/branches/presentation2/src/orxonox/worldentities/pawns/Pawn.cc 2009-12-15 22:04:39 UTC (rev 6356)
@@ -167,7 +167,7 @@
void Pawn::hit(Pawn* originator, const Vector3& force, float damage)
{
- if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator))
+ if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
{
this->damage(damage, originator);
this->setVelocity(this->getVelocity() + force);
@@ -178,7 +178,7 @@
void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage)
{
- if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator))
+ if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
{
this->damage(damage, originator);
More information about the Orxonox-commit
mailing list