Changeset 7163 for code/trunk/src/orxonox/worldentities
- Timestamp:
- Aug 11, 2010, 8:55:13 AM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 16 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/worldentities/BigExplosion.cc
r5929 r7163 101 101 this->debrisEntity3_ = new MovableEntity(this); 102 102 this->debrisEntity4_ = new MovableEntity(this); 103 104 this->debrisEntity1_->setSyncMode(0); 105 this->debrisEntity2_->setSyncMode(0); 106 this->debrisEntity3_->setSyncMode(0); 107 this->debrisEntity4_->setSyncMode(0); 103 108 104 109 this->debris1_ = new Model(this); … … 106 111 this->debris3_ = new Model(this); 107 112 this->debris4_ = new Model(this); 113 114 this->debris1_->setSyncMode(0); 115 this->debris2_->setSyncMode(0); 116 this->debris3_->setSyncMode(0); 117 this->debris4_->setSyncMode(0); 108 118 109 119 this->explosion_ = new StaticEntity(this); 120 this->explosion_->setSyncMode(0); 110 121 111 122 this->debrisSmoke1_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/smoke7", this->LOD_); … … 158 169 effect->setSource("Orxonox/explosion2b"); 159 170 effect->setLifetime(4.0f); 171 effect->setSyncMode(0); 160 172 161 173 ParticleSpawner* effect2 = new ParticleSpawner(this->getCreator()); … … 163 175 effect2->setSource("Orxonox/smoke6"); 164 176 effect2->setLifetime(4.0f); 177 effect2->setSyncMode(0); 165 178 166 179 this->explosion_->attach(effect); … … 181 194 MovableEntity* partEntity1 = new MovableEntity(this); 182 195 MovableEntity* partEntity2 = new MovableEntity(this); 196 197 part1->setSyncMode(0); 198 part2->setSyncMode(0); 199 partEntity1->setSyncMode(0); 200 partEntity2->setSyncMode(0); 183 201 184 202 partEntity1->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(10,100)); -
code/trunk/src/orxonox/worldentities/BigExplosion.h
r5929 r7163 45 45 46 46 virtual void tick(float dt); 47 void registerVariables();48 47 49 48 inline void setLOD(LODParticle::Value level) … … 53 52 54 53 private: 54 void registerVariables(); 55 55 56 56 void LODchanged(); -
code/trunk/src/orxonox/worldentities/CMakeLists.txt
r6417 r7163 5 5 MobileEntity.cc 6 6 ControllableEntity.cc 7 7 Drone.cc 8 8 BigExplosion.cc 9 9 EffectContainer.cc -
code/trunk/src/orxonox/worldentities/ControllableEntity.h
r6417 r7163 49 49 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 50 50 virtual void tick(float dt); 51 void registerVariables();52 51 void setConfigValues(); 53 52 … … 137 136 inline float getMouseLookSpeed() const 138 137 { return this->mouseLookSpeed_; } 138 inline CameraPosition* getCurrentCameraPosition() 139 { return this->currentCameraPosition_; } 139 140 140 141 inline Controller* getXMLController() const … … 162 163 { this->hudtemplate_ = name; } 163 164 165 Ogre::SceneNode* cameraPositionRootNode_; 166 164 167 private: 168 void registerVariables(); 165 169 void setXMLController(Controller* controller); 166 170 … … 208 212 bool bMouseLook_; 209 213 float mouseLookSpeed_; 210 Ogre::SceneNode* cameraPositionRootNode_;211 214 std::list<SmartPtr<CameraPosition> > cameraPositions_; 212 215 CameraPosition* currentCameraPosition_; -
code/trunk/src/orxonox/worldentities/ExplosionChunk.h
r5929 r7163 44 44 45 45 virtual void tick(float dt); 46 void registerVariables();47 46 48 47 inline void setLOD(LODParticle::Value level) … … 52 51 53 52 private: 53 void registerVariables(); 54 54 void LODchanged(); 55 55 void checkStop(); -
code/trunk/src/orxonox/worldentities/MobileEntity.cc
r5781 r7163 46 46 this->angularAcceleration_ = Vector3::ZERO; 47 47 this->angularVelocity_ = Vector3::ZERO; 48 49 this->registerVariables();50 48 } 51 49 -
code/trunk/src/orxonox/worldentities/MovableEntity.h
r6417 r7163 48 48 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 49 49 virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint); 50 void registerVariables();51 50 52 51 using WorldEntity::setPosition; … … 79 78 80 79 private: 80 void registerVariables(); 81 81 void clientConnected(unsigned int clientID); 82 82 void clientDisconnected(unsigned int clientID); -
code/trunk/src/orxonox/worldentities/StaticEntity.h
r5781 r7163 42 42 virtual ~StaticEntity(); 43 43 44 void registerVariables();45 46 44 using WorldEntity::setPosition; 47 45 using WorldEntity::setOrientation; … … 51 49 52 50 private: 51 void registerVariables(); 53 52 bool isCollisionTypeLegal(CollisionType type) const; 54 53 -
code/trunk/src/orxonox/worldentities/WorldEntity.cc
r6524 r7163 81 81 this->node_->setPosition(Vector3::ZERO); 82 82 this->node_->setOrientation(Quaternion::IDENTITY); 83 83 84 84 // Activity and visibility memory. 85 85 this->bActiveMem_ = true; … … 205 205 registerVariable(this->parentID_, VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::networkcallback_parentChanged)); 206 206 } 207 207 208 208 /** 209 209 @brief … … 213 213 { 214 214 SUPER(WorldEntity, changedActivity); 215 215 216 216 for (std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++) 217 217 { … … 227 227 } 228 228 } 229 229 230 230 /** 231 231 @brief … … 235 235 { 236 236 SUPER(WorldEntity, changedVisibility); 237 237 238 238 for (std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++) 239 239 { -
code/trunk/src/orxonox/worldentities/WorldEntity.h
r6524 r7163 94 94 95 95 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 96 void registerVariables();97 96 98 97 inline const Ogre::SceneNode* getNode() const … … 105 104 static const Vector3 DOWN; 106 105 static const Vector3 UP; 107 106 108 107 virtual void changedActivity(void); 109 108 virtual void changedVisibility(void); … … 214 213 215 214 private: 215 void registerVariables(); 216 216 217 inline void lookAt_xmlport(const Vector3& target) 217 218 { this->lookAt(target); } … … 234 235 std::set<WorldEntity*> children_; 235 236 bool bDeleteWithParent_; 236 237 237 238 bool bActiveMem_; 238 239 bool bVisibleMem_; -
code/trunk/src/orxonox/worldentities/pawns/CMakeLists.txt
r5781 r7163 1 1 ADD_SOURCE_FILES(ORXONOX_SRC_FILES 2 FpsPlayer.cc 2 3 Spectator.cc 3 4 Pawn.cc -
code/trunk/src/orxonox/worldentities/pawns/Pawn.cc
r6864 r7163 53 53 CreateFactory(Pawn); 54 54 55 Pawn::Pawn(BaseObject* creator) : ControllableEntity(creator) 55 Pawn::Pawn(BaseObject* creator) 56 : ControllableEntity(creator) 57 , RadarViewable(creator, static_cast<WorldEntity*>(this)) 56 58 { 57 59 RegisterObject(Pawn); … … 64 66 this->maxHealth_ = 0; 65 67 this->initialHealth_ = 0; 68 this->shieldHealth_ = 0; 69 this->shieldAbsorption_ = 0.5; 66 70 67 71 this->lastHitOriginator_ = 0; … … 78 82 else 79 83 this->weaponSystem_ = 0; 80 81 this->setCarrierName("Pawn");82 84 83 85 this->setRadarObjectColour(ColourValue::Red); … … 105 107 XMLPortParam(Pawn, "maxhealth", setMaxHealth, getMaxHealth, xmlelement, mode).defaultValues(200); 106 108 XMLPortParam(Pawn, "initialhealth", setInitialHealth, getInitialHealth, xmlelement, mode).defaultValues(100); 109 110 XMLPortParam(Pawn, "shieldhealth", setShieldHealth, getShieldHealth, xmlelement, mode).defaultValues(0); 111 XMLPortParam(Pawn, "shieldabsorption", setShieldAbsorption, getShieldAbsorption, xmlelement, mode).defaultValues(0); 112 107 113 XMLPortParam(Pawn, "spawnparticlesource", setSpawnParticleSource, getSpawnParticleSource, xmlelement, mode); 108 114 XMLPortParam(Pawn, "spawnparticleduration", setSpawnParticleDuration, getSpawnParticleDuration, xmlelement, mode).defaultValues(3.0f); … … 116 122 void Pawn::registerVariables() 117 123 { 118 registerVariable(this->bAlive_, VariableDirection::ToClient); 119 registerVariable(this->health_, VariableDirection::ToClient); 120 registerVariable(this->initialHealth_, VariableDirection::ToClient); 121 registerVariable(this->bReload_, VariableDirection::ToServer); 122 registerVariable(this->aimPosition_, Bidirectionality::ServerMaster, 0, true); 124 registerVariable(this->bAlive_, VariableDirection::ToClient); 125 registerVariable(this->health_, VariableDirection::ToClient); 126 registerVariable(this->initialHealth_, VariableDirection::ToClient); 127 registerVariable(this->shieldHealth_, VariableDirection::ToClient); 128 registerVariable(this->shieldAbsorption_, VariableDirection::ToClient); 129 registerVariable(this->bReload_, VariableDirection::ToServer); 130 registerVariable(this->aimPosition_, VariableDirection::ToServer); // For the moment this variable gets only transfered to the server 123 131 } 124 132 … … 162 170 if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator)) 163 171 { 164 this->setHealth(this->health_ - damage); 172 //share the dealt damage to the shield and the Pawn. 173 float shielddamage = damage*this->shieldAbsorption_; 174 float healthdamage = damage*(1-this->shieldAbsorption_); 175 176 // In case the shield can not take all the shield damage. 177 if (shielddamage > this->getShieldHealth()) 178 { 179 healthdamage += shielddamage-this->getShieldHealth(); 180 this->setShieldHealth(0); 181 } 182 183 this->setHealth(this->health_ - healthdamage); 184 185 if (this->getShieldHealth() > 0) 186 { 187 this->setShieldHealth(this->shieldHealth_ - shielddamage); 188 } 189 165 190 this->lastHitOriginator_ = originator; 166 191 … … 336 361 { 337 362 if (this->weaponSystem_) 363 { 338 364 this->weaponSystem_->addWeaponPack(wPack); 365 this->addedWeaponPack(wPack); 366 } 339 367 } 340 368 … … 342 370 { 343 371 if (this->weaponSystem_) 372 { 344 373 if (!this->weaponSystem_->addWeaponPack(wPack)) 345 374 wPack->destroy(); 375 else 376 this->addedWeaponPack(wPack); 377 } 346 378 } 347 379 -
code/trunk/src/orxonox/worldentities/pawns/Pawn.h
r6711 r7163 50 50 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 51 51 virtual void tick(float dt); 52 void registerVariables();53 52 54 53 inline bool isAlive() const … … 73 72 { return this->initialHealth_; } 74 73 74 inline void setShieldHealth(float shieldHealth) 75 { this->shieldHealth_ = shieldHealth; } 76 inline float getShieldHealth() 77 { return this->shieldHealth_; } 78 79 inline void setShieldAbsorption(float shieldAbsorption) 80 { this->shieldAbsorption_ = shieldAbsorption; } 81 inline float getShieldAbsorption() 82 { return this->shieldAbsorption_; } 83 75 84 inline ControllableEntity* getLastHitOriginator() const 76 85 { return this->lastHitOriginator_; } … … 91 100 void addWeaponPackXML(WeaponPack * wPack); 92 101 WeaponPack * getWeaponPack(unsigned int index) const; 102 103 virtual void addedWeaponPack(WeaponPack* wPack) {} 93 104 94 105 inline const WorldEntity* getWorldEntity() const … … 116 127 Vector3 getAimPosition() 117 128 { return this->aimPosition_; } 118 129 119 130 virtual const Vector3& getCarrierPosition(void) 120 131 { return this->getWorldPosition(); }; … … 141 152 float maxHealth_; 142 153 float initialHealth_; 154 float shieldHealth_; 155 float shieldAbsorption_; // Has to be between 0 and 1 143 156 144 157 Pawn* lastHitOriginator_; … … 152 165 153 166 private: 167 void registerVariables(); 154 168 inline void setWeaponSystem(WeaponSystem* weaponsystem) 155 169 { this->weaponSystem_ = weaponsystem; } -
code/trunk/src/orxonox/worldentities/pawns/SpaceShip.h
r6711 r7163 47 47 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 48 48 virtual void tick(float dt); 49 void registerVariables();50 49 void setConfigValues(); 51 50 … … 99 98 100 99 private: 100 void registerVariables(); 101 101 virtual bool isCollisionTypeLegal(WorldEntity::CollisionType type) const; 102 102 103 private:104 103 void loadEngineTemplate(); 105 104 -
code/trunk/src/orxonox/worldentities/pawns/Spectator.h
r6417 r7163 44 44 45 45 void setConfigValues(); 46 void registerVariables();47 46 virtual void tick(float dt); 48 47 … … 63 62 64 63 private: 64 void registerVariables(); 65 65 void changedGreeting(); 66 66 void changedFlareVisibility();
Note: See TracChangeset
for help on using the changeset viewer.