[Orxonox-commit 6182] r10840 - in code/branches/campaignHS15: data/levels src/orxonox/controllers
gania at orxonox.net
gania at orxonox.net
Mon Nov 23 16:56:50 CET 2015
Author: gania
Date: 2015-11-23 16:56:50 +0100 (Mon, 23 Nov 2015)
New Revision: 10840
Modified:
code/branches/campaignHS15/data/levels/AITest.oxw
code/branches/campaignHS15/src/orxonox/controllers/CommonController.cc
code/branches/campaignHS15/src/orxonox/controllers/CommonController.h
code/branches/campaignHS15/src/orxonox/controllers/DivisionController.cc
code/branches/campaignHS15/src/orxonox/controllers/SectionController.cc
Log:
action PROTECT works. Look FUCK
Modified: code/branches/campaignHS15/data/levels/AITest.oxw
===================================================================
--- code/branches/campaignHS15/data/levels/AITest.oxw 2015-11-23 14:58:23 UTC (rev 10839)
+++ code/branches/campaignHS15/data/levels/AITest.oxw 2015-11-23 15:56:50 UTC (rev 10840)
@@ -65,7 +65,7 @@
<Template link=spaceshipassff />
</templates>
<controller>
- <WingmanController >
+ <WingmanController team=0>
</WingmanController>
</controller>
</SpaceShip>
@@ -74,7 +74,7 @@
<Template link=spaceshipassff />
</templates>
<controller>
- <WingmanController >
+ <WingmanController team=0>
</WingmanController>
</controller>
</SpaceShip>
@@ -83,7 +83,7 @@
<Template link=spaceshipassff />
</templates>
<controller>
- <SectionController >
+ <SectionController team=0>
</SectionController>
</controller>
</SpaceShip>
@@ -92,7 +92,7 @@
<Template link=spaceshipassff />
</templates>
<controller>
- <SectionController>
+ <SectionController team=0>
</SectionController>
</controller>
</SpaceShip>
Modified: code/branches/campaignHS15/src/orxonox/controllers/CommonController.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/CommonController.cc 2015-11-23 14:58:23 UTC (rev 10839)
+++ code/branches/campaignHS15/src/orxonox/controllers/CommonController.cc 2015-11-23 15:56:50 UTC (rev 10840)
@@ -79,14 +79,14 @@
}
void CommonController::setProtectXML( std::string val )
{
- for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
- {
- if ((*itP)->getName() == val)
- {
- this->setProtect (static_cast<ControllableEntity*>(*itP));
- }
- }
+ this->protectName_ = val;
+
}
+ void CommonController::tick(float dt)
+ {
+
+ }
+
std::string CommonController::getProtectXML ()
{
if (!this->getProtect())
@@ -201,6 +201,8 @@
}
else if (action == Action::PROTECT)
{
+ if (target)
+ this->setProtect (target);
}
}
void CommonController::setAction (Action::Value action, const Vector3& target)
@@ -210,10 +212,7 @@
{
this->setTargetPosition (target);
}
- else if (action == Action::PROTECT)
- {
-
- }
+
}
void CommonController::setAction (Action::Value action, const Vector3& target, const Quaternion& orient )
{
@@ -223,10 +222,7 @@
this->setTargetPosition (target);
this->setTargetOrientation (orient);
}
- else if (action == Action::PROTECT)
- {
-
- }
+
}
void CommonController::setClosestTarget()
{
Modified: code/branches/campaignHS15/src/orxonox/controllers/CommonController.h
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/CommonController.h 2015-11-23 14:58:23 UTC (rev 10839)
+++ code/branches/campaignHS15/src/orxonox/controllers/CommonController.h 2015-11-23 15:56:50 UTC (rev 10840)
@@ -77,6 +77,8 @@
CommonController(Context* context);
virtual ~CommonController();
+ virtual void tick(float dt);
+
//----[XML data]----
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
//----[Action data]----
@@ -193,6 +195,7 @@
//----["Private" variables]----
FormationMode::Value formationMode_;
Rank::Value rank_;
+ std::string protectName_;
Action::Value action_;
//----[/"Private" variables]----
};
Modified: code/branches/campaignHS15/src/orxonox/controllers/DivisionController.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/DivisionController.cc 2015-11-23 14:58:23 UTC (rev 10839)
+++ code/branches/campaignHS15/src/orxonox/controllers/DivisionController.cc 2015-11-23 15:56:50 UTC (rev 10840)
@@ -132,10 +132,35 @@
}
else if (this->action_ == Action::PROTECT)
{
- if (this->getProtect())
+ if (!this->getProtect())
{
- orxout(internal_error) << "PROTECT FOUND" << endl;
+ for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
+ {
+ if ((*itP)->getName() == this->protectName_)
+ {
+ this->setProtect (static_cast<ControllableEntity*>(*itP));
+ }
+ }
}
+ else
+ {
+ /* if (this->myWingman_)
+ this->myWingman_->setAction (Action::PROTECT, this->getProtect());
+ if (this->myFollower_)
+ this->myFollower_->setAction (Action::PROTECT, this->getProtect());
+ */
+ Vector3* targetRelativePosition;
+
+ targetRelativePosition = new Vector3 (0, 0, 500);
+
+ Vector3 targetAbsolutePosition = ((this->getProtect()->getWorldPosition()) +
+ (this->getProtect()->getWorldOrientation()* (*targetRelativePosition)));
+ this->setTargetPosition(targetAbsolutePosition);
+
+ this->setTargetPositionOfWingman();
+ this->setTargetPositionOfFollower();
+ }
+
}
}
Modified: code/branches/campaignHS15/src/orxonox/controllers/SectionController.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/SectionController.cc 2015-11-23 14:58:23 UTC (rev 10839)
+++ code/branches/campaignHS15/src/orxonox/controllers/SectionController.cc 2015-11-23 15:56:50 UTC (rev 10840)
@@ -144,6 +144,10 @@
//----action was set to protect----
else if (this->action_ == Action::PROTECT)
{
+ /* if (this->myWingman_)
+ this->myWingman_->setAction (Action::PROTECT, this->getProtect());
+*/
+ this->setTargetPositionOfWingman();
}
More information about the Orxonox-commit
mailing list