[Orxonox-commit 2375] r7090 - in code/branches/presentation3: . src/modules/pickup/items src/orxonox/controllers
dafrick at orxonox.net
dafrick at orxonox.net
Wed Jun 2 21:44:22 CEST 2010
Author: dafrick
Date: 2010-06-02 21:44:22 +0200 (Wed, 02 Jun 2010)
New Revision: 7090
Modified:
code/branches/presentation3/
code/branches/presentation3/src/modules/pickup/items/InvisiblePickup.cc
code/branches/presentation3/src/orxonox/controllers/AIController.cc
code/branches/presentation3/src/orxonox/controllers/ArtificialController.cc
Log:
Merged ppspickups4 branch.
Property changes on: code/branches/presentation3
___________________________________________________________________
Modified: svn:mergeinfo
- /code/branches/ai:6592-7033
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/dynamicmatch:6584-7030
/code/branches/fps:6591-7072
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hudelements:6584-6941
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/map:2801-3086,3089
/code/branches/menu:5941-6146,6148
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network64:2210-2355
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/overlay:2117-2385
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup2:5942-6405
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/presentation:2369-2652,2654-2660
/code/branches/presentation2:6106-6416
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound3:5941-6102
/code/branches/steering:5949-6091
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051
/code/branches/weaponsystem:2742-2890
+ /code/branches/ai:6592-7033
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/dynamicmatch:6584-7030
/code/branches/fps:6591-7072
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hudelements:6584-6941
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/map:2801-3086,3089
/code/branches/menu:5941-6146,6148
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network64:2210-2355
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/overlay:2117-2385
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup2:5942-6405
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660
/code/branches/presentation2:6106-6416
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound3:5941-6102
/code/branches/steering:5949-6091
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051
/code/branches/weaponsystem:2742-2890
Modified: code/branches/presentation3/src/modules/pickup/items/InvisiblePickup.cc
===================================================================
--- code/branches/presentation3/src/modules/pickup/items/InvisiblePickup.cc 2010-06-02 19:12:36 UTC (rev 7089)
+++ code/branches/presentation3/src/modules/pickup/items/InvisiblePickup.cc 2010-06-02 19:44:22 UTC (rev 7090)
@@ -42,11 +42,14 @@
#include <sstream>
+#include <OgreEntity.h>
+#include <Ogre.h>
+
namespace orxonox
{
CreateFactory(InvisiblePickup);
-
+
/**
@brief
Constructor. Registers the object and initializes the member variables.
@@ -55,18 +58,18 @@
{
RegisterObject(InvisiblePickup);
//! Defines who is allowed to pick up the pickup.
- this->initialize();
+ this->initialize();
}
-
+
/**
@brief
Destructor.
*/
InvisiblePickup::~InvisiblePickup()
- {
+ {
}
-
-
+
+
void InvisiblePickup::initializeIdentifier(void)
{
std::stringstream stream;
@@ -75,7 +78,7 @@
std::string val1 = stream.str();
this->pickupIdentifier_->addParameter(type1, val1);
}
-
+
/**
@brief
Initializes the member variables.
@@ -92,12 +95,12 @@
*/
void InvisiblePickup::XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode)
{
- SUPER(InvisiblePickup, XMLPort, xmlelement, mode);
+ SUPER(InvisiblePickup, XMLPort, xmlelement, mode);
XMLPortParam(InvisiblePickup, "duration", setDuration, getDuration, xmlelement, mode);
-
+
this->initializeIdentifier();
}
-
+
/**
@brief
Is called when the pickup has transited from used to unused or the other way around.
@@ -105,11 +108,11 @@
void InvisiblePickup::changedUsed(void)
{
SUPER(InvisiblePickup, changedUsed);
-
+
//! If the pickup is not picked up nothing must be done.
if(!this->isPickedUp())
return;
-
+
if (this->isUsed())
{
if(!this->getTimer()->isActive() && this->getTimer()->getRemainingTime() > 0.0f)
@@ -120,12 +123,14 @@
{
this->startPickupTimer(this->getDuration());
}
+
this->setInvisible(true);
+
}
else
{
this->setInvisible(false);
-
+
if(!this->getTimer()->isActive() && this->getTimer()->getRemainingTime() == this->getDuration())
{
this->destroy();
@@ -135,9 +140,9 @@
this->getTimer()->pauseTimer();
}
}
-
+
}
-
+
/**
@brief
Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
@@ -148,14 +153,14 @@
{
PickupCarrier* carrier = this->getCarrier();
Pawn* pawn = dynamic_cast<Pawn*>(carrier);
-
+
if(pawn == NULL)
{
COUT(1) << "Invalid PickupCarrier in InvisiblePickup." << std::endl;
}
return pawn;
}
-
+
/**
@brief
Creates a duplicate of the input OrxonoxClass.
@@ -166,14 +171,14 @@
{
if(item == NULL)
item = new InvisiblePickup(this);
-
+
SUPER(InvisiblePickup, clone, item);
-
+
InvisiblePickup* pickup = dynamic_cast<InvisiblePickup*>(item);
pickup->setDuration(this->getDuration());
pickup->initializeIdentifier();
}
-
+
/**
@brief
Sets the invisibility.
@@ -185,11 +190,23 @@
Pawn* pawn = this->carrierToPawnHelper();
if(pawn == NULL)
return false;
-
+
pawn->setVisible(!invisibility);
+ pawn->setRadarVisibility(!invisibility);
+
+// Test to change Material at runtime!
+
+// Ogre::MaterialPtr mat = this->mesh_.getEntity()->getSubEntity(0)->getMaterial();
+// mat->setDiffuse(0.4, 0.3, 0.1, 0.1);
+// mat->setAmbient(0.3, 0.7, 0.8);
+// mat->setSpecular(0.5, 0.5, 0.5, 0.1);
+// Ogre::SceneBlendType sbt = Ogre::SBT_ADD;
+//
+// mat->setSceneBlending(sbt);
+
return true;
}
-
+
/**
@brief
Sets the duration.
@@ -208,7 +225,7 @@
this->duration_ = 0.0f;
}
}
-
+
void InvisiblePickup::pickupTimerCallback(void)
{
this->setUsed(false);
Modified: code/branches/presentation3/src/orxonox/controllers/AIController.cc
===================================================================
--- code/branches/presentation3/src/orxonox/controllers/AIController.cc 2010-06-02 19:12:36 UTC (rev 7089)
+++ code/branches/presentation3/src/orxonox/controllers/AIController.cc 2010-06-02 19:44:22 UTC (rev 7090)
@@ -32,6 +32,7 @@
#include "core/CoreIncludes.h"
#include "core/Executor.h"
#include "worldentities/ControllableEntity.h"
+#include "worldentities/pawns/Pawn.h"
namespace orxonox
{
@@ -209,7 +210,11 @@
if (this->specificMasterAction_ == NONE)
{
if (this->target_)
- this->aimAtTarget();
+ {
+ if (!this->target_->getRadarVisibility()) /* So AI won't shoot invisible Spaceships */
+ this->forgetTarget();
+ else this->aimAtTarget();
+ }
if (this->bHasTargetPosition_)
this->moveToTargetPosition();
@@ -238,7 +243,11 @@
if (this->state_ == FREE)
{
if (this->target_)
- this->aimAtTarget();
+ {
+ if (!this->target_->getRadarVisibility()) /* So AI won't shoot invisible Spaceships */
+ this->forgetTarget();
+ else this->aimAtTarget();
+ }
if (this->bHasTargetPosition_)
this->moveToTargetPosition();
Modified: code/branches/presentation3/src/orxonox/controllers/ArtificialController.cc
===================================================================
--- code/branches/presentation3/src/orxonox/controllers/ArtificialController.cc 2010-06-02 19:12:36 UTC (rev 7089)
+++ code/branches/presentation3/src/orxonox/controllers/ArtificialController.cc 2010-06-02 19:44:22 UTC (rev 7090)
@@ -759,6 +759,10 @@
if (ArtificialController::sameTeam(this->getControllableEntity(), static_cast<ControllableEntity*>(*it), this->getGametype()))
continue;
+ /* So AI won't choose invisible Spaceships as target */
+ if (!it->getRadarVisibility())
+ continue;
+
if (static_cast<ControllableEntity*>(*it) != this->getControllableEntity())
{
float speed = this->getControllableEntity()->getVelocity().length();
More information about the Orxonox-commit
mailing list