[Orxonox-commit 6225] r10882 - in code/branches/campaignHS15: data/levels src/orxonox/controllers

gania at orxonox.net gania at orxonox.net
Sat Nov 28 10:16:31 CET 2015


Author: gania
Date: 2015-11-28 10:16:31 +0100 (Sat, 28 Nov 2015)
New Revision: 10882

Modified:
   code/branches/campaignHS15/data/levels/AITest.oxw
   code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc
   code/branches/campaignHS15/src/orxonox/controllers/DivisionController.cc
   code/branches/campaignHS15/src/orxonox/controllers/FlyingController.cc
Log:
fixed a bug in DivisionController, made action transitions smoother

Modified: code/branches/campaignHS15/data/levels/AITest.oxw
===================================================================
--- code/branches/campaignHS15/data/levels/AITest.oxw	2015-11-28 08:17:24 UTC (rev 10881)
+++ code/branches/campaignHS15/data/levels/AITest.oxw	2015-11-28 09:16:31 UTC (rev 10882)
@@ -34,7 +34,7 @@
     <TeamSpawnPoint team=0 position="-1000,-1000,-1000" lookat="1,1,-1" spawnclass=SpaceShip pawndesign=spaceshipassff />
     
 <!-- HERE STARTS DEMO FOR THE "WAYPOINTS" -->
-     <!--  
+      
     <Model mesh="cube.mesh" scale=8 position="  0,2000,-600" />
     <Model mesh="cube.mesh" scale=8 position="  0,2000,-800" />
     <Model mesh="cube.mesh" scale=8 position="200,2000,-800" />
@@ -56,12 +56,12 @@
         </DivisionController>
       </controller>
     </SpaceShip> 
-    -->
+   
 <!-- HERE ENDS DEMO FOR THE "WAYPOINTS" -->
 
 <!-- HERE STARTS DEMO FOR THE ACTIONPOINTS. 
 P.S. Never set protectMe in the first actionpoint: if human didn't spawn, that actionpoint will be skipped -->
-     <!--   
+       <!-- 
     <Model mesh="cube.mesh" scale=8 position="0,0,0" />
 
     <SpaceShip position="-2000, 1500, -1000" lookat="0,0,0" team=0 name="ss2">
@@ -209,7 +209,7 @@
      -->
 <!-- HERE ENDS DEMO FOR FIGHTING -->
 <!-- HERE STARTS DEMO FOR FORMATIONS -->
-    
+    <!-- 
     <Model mesh="cube.mesh" scale=8 position="   0,2000,    0" />
     <Model mesh="cube.mesh" scale=8 position="   0,2000,-2000" />
     <Model mesh="cube.mesh" scale=8 position="2000,2000,-2000" />
@@ -258,7 +258,7 @@
         </WingmanController>
       </controller>
     </SpaceShip> 
-   
+    -->
 <!-- HERE ENDS DEMO FOR FORMATIONS -->
     <!-- 
     <SpaceShip position="2000, 2000, 2000" lookat="0,0,0" team=1 name="ss2">

Modified: code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc	2015-11-28 08:17:24 UTC (rev 10881)
+++ code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc	2015-11-28 09:16:31 UTC (rev 10882)
@@ -363,8 +363,7 @@
         Vector3 targetAbsolutePosition = ((this->getProtect()->getWorldPosition()) + 
             (this->getProtect()->getWorldOrientation()* (targetRelativePosition)));
         this->setTargetPosition(targetAbsolutePosition);
-        this->actionCounter_ += this->actionCounter_ < 100000 ? 1 : -this->actionCounter_ ;
-        if (this->actionConter_ % 3 == 0)
+        if (this->actionCounter_ % 3 == 0)
             this->setTargetOrientation(this->getProtect()->getWorldOrientation());
     }
     void ActionpointController::nextActionpoint()
@@ -386,6 +385,7 @@
             }            
         }
         this->setAction(Action::NONE);
+        this->bHasTargetPosition_ = false;
     }
     void ActionpointController::moveBackToTop()
     {
@@ -418,7 +418,8 @@
         if (!this || !this->getControllableEntity())
             return;
         // orxout (internal_error) << "Size of actions is " << this->parsedActionpoints_.size() << endl;
-        this->startAttackingEnemiesThatAreClose();
+        if (this->actionCounter_ % 5 == 0)
+            this->startAttackingEnemiesThatAreClose();
         //No action -> pop one from stack
         if (this->action_ == Action::NONE || this->bTakenOver_)
         {
@@ -426,9 +427,11 @@
             {
                 Point p = { Action::FIGHTALL, "", Vector3::ZERO, false };
                 this->parsedActionpoints_.push_back (p);
+
             }
             this->executeActionpoint();
             this->bTakenOver_ = false;
+            this->action();
         }
         //Action fightall -> fight till nobody alive
         if (this->action_ == Action::FIGHTALL)
@@ -444,7 +447,12 @@
                 else
                 {
                     this->nextActionpoint();
-                    return;
+
+                    if (!(this->parsedActionpoints_.empty() && this->loopActionpoints_.empty()))
+                    {
+                        this->action();
+                    }
+                    
                 }
             }
             else if (this->hasTarget())
@@ -467,7 +475,7 @@
                 else
                 {
                     this->nextActionpoint();
-                    return;
+                    this->action();
                 }
             }
             else if (this->hasTarget())
@@ -487,7 +495,7 @@
                     else
                     {
                         this->nextActionpoint();
-                        return;
+                        this->action();
                     }
                 }
             }
@@ -497,15 +505,15 @@
             if (this->squaredDistanceToTarget() <= this->squaredaccuracy_)
             {
                 this->nextActionpoint();   
-                return;
+                this->action();
             }
         }
         else if (this->action_ == Action::PROTECT)
         {
             if (!this->getProtect())
             {
-                this->nextActionpoint(); 
-                return;
+                this->nextActionpoint();
+                this->action(); 
             }
             this->stayNearProtect();
         }
@@ -514,7 +522,7 @@
             if (!this->hasTarget())
             {
                 this->nextActionpoint();
-                return;
+                this->action();
             }
         }
         if (this->hasTarget())
@@ -524,6 +532,8 @@
             //----fire if you can----
             this->bShooting_ = this->canFire();                
         }
+        this->actionCounter_ += this->actionCounter_ < 100000 ? 1 : -this->actionCounter_ ;
+
     }
     void ActionpointController::takeActionpoints (std::vector<Point > vector, std::vector<Point > loop, bool b)
     {

Modified: code/branches/campaignHS15/src/orxonox/controllers/DivisionController.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/DivisionController.cc	2015-11-28 08:17:24 UTC (rev 10881)
+++ code/branches/campaignHS15/src/orxonox/controllers/DivisionController.cc	2015-11-28 09:16:31 UTC (rev 10882)
@@ -116,6 +116,10 @@
         if (!this->myFollower_)
         {
             this->myFollower_ = newFollower;
+            if (this->hasWingman())
+            {
+                this->myWingman_->takeActionpoints (std::vector<Point>(), std::vector<Point>(), false);
+            }
             return true;
         }
         else
@@ -134,7 +138,7 @@
     {
         if (this->myFollower_)
             return true;
-        else
-            return false;
+        
+        return false;
     }
 }

Modified: code/branches/campaignHS15/src/orxonox/controllers/FlyingController.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/controllers/FlyingController.cc	2015-11-28 08:17:24 UTC (rev 10881)
+++ code/branches/campaignHS15/src/orxonox/controllers/FlyingController.cc	2015-11-28 09:16:31 UTC (rev 10882)
@@ -38,7 +38,7 @@
     {
         this->rotationProgress_ = 0;
         this->spread_ = 200;
-        this->tolerance_ = 80;
+        this->tolerance_ = 60;
         RegisterObject( FlyingController );
     }
     FlyingController::~FlyingController() 




More information about the Orxonox-commit mailing list