[Orxonox-commit 5709] r10369 - in code/branches/weaponFS15: data/levels data/levels/includes src/modules/weapons src/modules/weapons/munitions src/modules/weapons/projectiles src/modules/weapons/weaponmodes

meggiman at orxonox.net meggiman at orxonox.net
Thu Apr 16 16:43:56 CEST 2015


Author: meggiman
Date: 2015-04-16 16:43:55 +0200 (Thu, 16 Apr 2015)
New Revision: 10369

Added:
   code/branches/weaponFS15/src/modules/weapons/munitions/GravityBombMunition.cc
   code/branches/weaponFS15/src/modules/weapons/munitions/GravityBombMunition.h
   code/branches/weaponFS15/src/modules/weapons/weaponmodes/GravityBombFire.cc
Modified:
   code/branches/weaponFS15/data/levels/emptyLevel.oxw
   code/branches/weaponFS15/data/levels/includes/weaponSettingsAssff.oxi
   code/branches/weaponFS15/src/modules/weapons/WeaponsPrereqs.h
   code/branches/weaponFS15/src/modules/weapons/munitions/CMakeLists.txt
   code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBomb.cc
   code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBomb.h
   code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBombField.cc
   code/branches/weaponFS15/src/modules/weapons/weaponmodes/CMakeLists.txt
   code/branches/weaponFS15/src/modules/weapons/weaponmodes/GravityBombFire.h
Log:
Alle Klassen implementiert um die Waffe abzufeuern. Noch sehr fehlerhaft.

Modified: code/branches/weaponFS15/data/levels/emptyLevel.oxw
===================================================================
--- code/branches/weaponFS15/data/levels/emptyLevel.oxw	2015-04-16 14:24:41 UTC (rev 10368)
+++ code/branches/weaponFS15/data/levels/emptyLevel.oxw	2015-04-16 14:43:55 UTC (rev 10369)
@@ -12,7 +12,7 @@
 ?>
 
 <?lua
-  include("templates/spaceshipAssff2.oxt")
+  include("templates/spaceshipAssff.oxt")
   include("templates/spaceshipPirate.oxt")
   include("templates/spaceshipEscort.oxt")
 ?>
@@ -29,7 +29,7 @@
   >
 
     <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
-    <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
+    <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
     
   </Scene>
 </Level>

Modified: code/branches/weaponFS15/data/levels/includes/weaponSettingsAssff.oxi
===================================================================
--- code/branches/weaponFS15/data/levels/includes/weaponSettingsAssff.oxi	2015-04-16 14:24:41 UTC (rev 10368)
+++ code/branches/weaponFS15/data/levels/includes/weaponSettingsAssff.oxi	2015-04-16 14:43:55 UTC (rev 10369)
@@ -39,7 +39,7 @@
           <LightningGun mode=1 muzzleoffset="0,0,0" damage=23 />
         </Weapon>
         <Weapon>
-          <SimpleRocketFire mode=2 muzzleoffset="0,0,0" damage=30 shielddamage=20 />
+          <GravityBombFire mode=2 muzzleoffset="0,0,0" damage=30 shielddamage=20 />
           <RocketFire mode=3 muzzleoffset="0,0,0" damage=30 healthdamage=50 shielddamage=20 />
         </Weapon>
       </WeaponPack>

Modified: code/branches/weaponFS15/src/modules/weapons/WeaponsPrereqs.h
===================================================================
--- code/branches/weaponFS15/src/modules/weapons/WeaponsPrereqs.h	2015-04-16 14:24:41 UTC (rev 10368)
+++ code/branches/weaponFS15/src/modules/weapons/WeaponsPrereqs.h	2015-04-16 14:43:55 UTC (rev 10369)
@@ -74,6 +74,7 @@
     class LaserMunition;
     class ReplenishingMunition;
     class RocketMunition;
+    class GravityBombMuntion;
 
     // projectiles
     class BillboardProjectile;
@@ -92,6 +93,7 @@
     class LightningGun;
     class RocketFire;
     class SimpleRocketFire;
+    class GravityBombFire;
 }
 
 #endif /* _WeaponsPrereqs_H__ */

Modified: code/branches/weaponFS15/src/modules/weapons/munitions/CMakeLists.txt
===================================================================
--- code/branches/weaponFS15/src/modules/weapons/munitions/CMakeLists.txt	2015-04-16 14:24:41 UTC (rev 10368)
+++ code/branches/weaponFS15/src/modules/weapons/munitions/CMakeLists.txt	2015-04-16 14:43:55 UTC (rev 10369)
@@ -3,4 +3,5 @@
   LaserMunition.cc
   FusionMunition.cc
   RocketMunition.cc
+  GravityBombMunition.cc
 )

Added: code/branches/weaponFS15/src/modules/weapons/munitions/GravityBombMunition.cc
===================================================================
--- code/branches/weaponFS15/src/modules/weapons/munitions/GravityBombMunition.cc	                        (rev 0)
+++ code/branches/weaponFS15/src/modules/weapons/munitions/GravityBombMunition.cc	2015-04-16 14:43:55 UTC (rev 10369)
@@ -0,0 +1,32 @@
+/*
+ * GravityBombMunition.cc
+ *
+ *  Created on: Apr 16, 2015
+ *      Author: meggiman
+ */
+#include "GravityBombMunition.h"
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+RegisterClass(GravityBombMunition);
+
+	GravityBombMunition::GravityBombMunition(Context* context) : Munition(context)
+	{
+		RegisterObject(GravityBombMunition);
+		this->maxMunitionPerMagazine_ = 1;
+		this->maxMagazines_ = 30;
+		this->magazines_ = 10;
+
+		this->bUseSeparateMagazines_ = false;
+		this->bStackMunition_ = true;
+
+		this->bAllowMunitionRefilling_ = true;
+		this->bAllowMultiMunitionRemovementUnderflow_ = false;
+	}
+
+}
+
+
+
+

Added: code/branches/weaponFS15/src/modules/weapons/munitions/GravityBombMunition.h
===================================================================
--- code/branches/weaponFS15/src/modules/weapons/munitions/GravityBombMunition.h	                        (rev 0)
+++ code/branches/weaponFS15/src/modules/weapons/munitions/GravityBombMunition.h	2015-04-16 14:43:55 UTC (rev 10369)
@@ -0,0 +1,27 @@
+/*
+ * GravityBombMunition.h
+ *
+ *  Created on: Apr 16, 2015
+ *      Author: meggiman
+ */
+
+#ifndef GRAVITYBOMBMUNITION_H_
+#define GRAVITYBOMBMUNITION_H_
+
+#include "weapons/WeaponsPrereqs.h"
+#include "weaponsystem/Munition.h"
+
+namespace orxonox
+{
+
+	class _WeaponsExport GravityBombMunition : public Munition
+    {
+        public:
+			GravityBombMunition(Context* context);
+            virtual ~GravityBombMunition() {}
+    };
+
+}
+
+
+#endif /* GRAVITYBOMBMUNITION_H_ */

Modified: code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBomb.cc
===================================================================
--- code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBomb.cc	2015-04-16 14:24:41 UTC (rev 10368)
+++ code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBomb.cc	2015-04-16 14:43:55 UTC (rev 10369)
@@ -5,14 +5,12 @@
  *      Author: meggiman
  */
 #include "GravityBomb.h"
+#include "graphics/Model.h"
 
 
 namespace orxonox{
 	RegisterClass(GravityBomb);
 
-	const float GravityBomb::INITIAL_VELOCITY = 20;
-	const float GravityBomb::SLOW_DOWN_RATIO = 2;
-
 	GravityBomb::GravityBomb(Context* context):
 				BasicProjectile(),
 				MovableEntity(context),
@@ -23,21 +21,23 @@
 			this->setMass(15.0);
 			if (GameMode::isMaster())
 			{
-				//Define movement of the bomb
-				this->setVelocity(this->getOrientation()*WorldEntity::FRONT*INITIAL_VELOCITY);
-				this->velocityAtLastTick_=INITIAL_VELOCITY;
-				this->setAcceleration(this->getOrientation()*WorldEntity::BACK*SLOW_DOWN_RATIO);
-				this->setCollisionType(WorldEntity::Dynamic);
+				//Define CollisionType of the bomb
+				this->velocityAtLastTick_= 1000;
+				this->setCollisionResponse(false);
+				this->setCollisionType(WorldEntity::Kinematic);
 				this->enableCollisionCallback();
 
 				//Add Collision Shape
 				SphereCollisionShape* collisionShape = new SphereCollisionShape(context);
-				collisionShape->setRadius(5.0);
+				collisionShape->setRadius(1.0);
 				this->attachCollisionShape(collisionShape);
 
 				//Create Bomb Model
+	            Model* model = new Model(this->getContext());
+	            model->setMeshSource("rocket.mesh"); //Demo Model from SimpleRocket
+	            model->scale(0.7f);
+	            this->attach(model);
 
-
 			}
 		}
 
@@ -45,26 +45,39 @@
 
 	void GravityBomb::tick(float dt)
 	{
+			velocityAtLastTick_=getVelocity().length();
+			SUPER(GravityBomb,tick,dt);
 			if(velocityAtLastTick_ < this->getVelocity().length())
 			{
+				orxout(debug_output) << "bomb has stoped moving" <<endl;
 				setVelocity(Vector3::ZERO);
 				setAcceleration(Vector3::ZERO);
 				velocityAtLastTick_=0;
 				detonate();
+				orxout(debug_output) << "denoting" <<endl;
 			}
-			velocityAtLastTick_=getVelocity().length();
+			else
+			{
+				velocityAtLastTick_=getVelocity().length();
+				orxout(debug_output)<< velocityAtLastTick_ <<endl;
+				orxout(debug_output) << "acceleration" << getAcceleration().length() <<endl;
+				destroyCheck();
+			}
 	}
 
 	bool GravityBomb::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
 	{
-		detonate();
+		orxout(debug_output) << "collides" << endl;
 		processCollision(otherObject, contactPoint,cs);
+		//detonate();
 		return true;
 	}
 
 	void GravityBomb::detonate()
 	{
 		GravityBombField* field = new GravityBombField(this->getContext());
+		orxout(debug_output) << "denoting" <<endl;
+		this->destroy();
 	}
 }
 

Modified: code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBomb.h
===================================================================
--- code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBomb.h	2015-04-16 14:24:41 UTC (rev 10368)
+++ code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBomb.h	2015-04-16 14:43:55 UTC (rev 10369)
@@ -65,8 +65,6 @@
 			void detonate();
 
 		private:
-		static const float INITIAL_VELOCITY;
-		static const float SLOW_DOWN_RATIO;
 
 		float velocityAtLastTick_; //Used to check wether the Object is already accelarating in the oposite direction to detect the time to detonate it.
 

Modified: code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBombField.cc
===================================================================
--- code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBombField.cc	2015-04-16 14:24:41 UTC (rev 10368)
+++ code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBombField.cc	2015-04-16 14:43:55 UTC (rev 10369)
@@ -10,12 +10,13 @@
 namespace orxonox{
 	RegisterClass(GravityBombField);
 
-	const float GravityBombField::FORCE_FIELD_LIFETIME = 10;
-	const float GravityBombField::FORCE_SPHERE_START_RADIUS = 50;
-	const float GravityBombField::FORCE_SPHERE_START_STRENGTH = -300;
+	const float GravityBombField::FORCE_FIELD_LIFETIME = 5;
+	const float GravityBombField::FORCE_SPHERE_START_RADIUS = 100;
+	const float GravityBombField::FORCE_SPHERE_START_STRENGTH = -1000;
 
 	GravityBombField::GravityBombField(Context* context) : ForceField(context)
 	{
+		RegisterObject(GravityBombField);
 		lifetime_=FORCE_FIELD_LIFETIME;
 		setVelocity(FORCE_SPHERE_START_STRENGTH);
 		setDiameter(FORCE_SPHERE_START_RADIUS);
@@ -26,6 +27,7 @@
 
 	void GravityBombField::tick(float dt)
 	{
+		SUPER(GravityBombField,tick,dt);
 		lifetime_-=dt;
 		if(lifetime_ < 0)
 		{
@@ -36,7 +38,7 @@
 	void GravityBombField::destroy()
 	{
 		//Animation
-		//SUPER(GravityBombField,destroy);
+		ForceField::destroy();
 	}
 
 }

Modified: code/branches/weaponFS15/src/modules/weapons/weaponmodes/CMakeLists.txt
===================================================================
--- code/branches/weaponFS15/src/modules/weapons/weaponmodes/CMakeLists.txt	2015-04-16 14:24:41 UTC (rev 10368)
+++ code/branches/weaponFS15/src/modules/weapons/weaponmodes/CMakeLists.txt	2015-04-16 14:43:55 UTC (rev 10369)
@@ -6,4 +6,5 @@
   LightningGun.cc
   RocketFire.cc
   SimpleRocketFire.cc
+  GravityBombFire.cc
 )

Added: code/branches/weaponFS15/src/modules/weapons/weaponmodes/GravityBombFire.cc
===================================================================
--- code/branches/weaponFS15/src/modules/weapons/weaponmodes/GravityBombFire.cc	                        (rev 0)
+++ code/branches/weaponFS15/src/modules/weapons/weaponmodes/GravityBombFire.cc	2015-04-16 14:43:55 UTC (rev 10369)
@@ -0,0 +1,55 @@
+/*
+ * GravityBombFire.cc
+ *
+ *  Created on: Apr 16, 2015
+ *      Author: meggiman
+ */
+#include "GravityBombFire.h"
+
+#include "core/CoreIncludes.h"
+#include "weaponsystem/Weapon.h"
+#include "weaponsystem/WeaponPack.h"
+#include "weaponsystem/WeaponSystem.h"
+#include "worldentities/pawns/Pawn.h"
+
+#include "weapons/projectiles/GravityBomb.h"
+
+namespace orxonox
+{
+	RegisterClass(GravityBombFire);
+
+	GravityBombFire::GravityBombFire(Context* context) : WeaponMode(context)
+	{
+		RegisterObject(GravityBombFire);
+
+		this->reloadTime_ = 0.50f;
+		this->bParallelReload_ = false;
+		this->damage_ = 0.0f;
+		this->speed_ = 200.0f;
+		this->slowDownRate_ = -10.0f;
+
+		this->setMunitionName("GravityBombMunition");
+		// The firing sound of the Rocket is played in Rocket.cc (because of OpenAl sound positioning)
+	}
+
+	GravityBombFire::~GravityBombFire(){};
+
+	void GravityBombFire::fire()
+	{
+		GravityBomb* bomb = new GravityBomb(this->getContext());
+        this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
+        bomb->setOrientation(this->getMuzzleOrientation());
+        bomb->setPosition(this->getMuzzlePosition());
+        bomb->setVelocity(this->getMuzzleDirection() * this->speed_);
+        bomb->setAcceleration(this->getMuzzleDirection()* this->slowDownRate_);
+
+        bomb->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
+		bomb->setDamage(this->getDamage());
+		bomb->setShieldDamage(this->getShieldDamage());
+		bomb->setHealthDamage(this->getHealthDamage());
+	}
+
+
+}
+
+

Modified: code/branches/weaponFS15/src/modules/weapons/weaponmodes/GravityBombFire.h
===================================================================
--- code/branches/weaponFS15/src/modules/weapons/weaponmodes/GravityBombFire.h	2015-04-16 14:24:41 UTC (rev 10368)
+++ code/branches/weaponFS15/src/modules/weapons/weaponmodes/GravityBombFire.h	2015-04-16 14:43:55 UTC (rev 10369)
@@ -57,6 +57,7 @@
 
         private:
             float speed_; //!< The initial speed of the bomb when it is launched.
+            float slowDownRate_;
     };
 }
 




More information about the Orxonox-commit mailing list