Changeset 3033 for code/trunk/src/orxonox/objects/worldentities
- Timestamp:
- May 23, 2009, 9:57:52 PM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 15 edited
- 8 copied
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/gametypes (added) merged: 2827,2903,2905-2906,2933-2936,2952,2954,2961,2970-2971,2978,2985-2986,3019-3020
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/worldentities/CMakeLists.txt
r2826 r3033 23 23 PongBall.cc 24 24 PongBat.cc 25 ForceField.cc 25 26 ) 26 27 -
code/trunk/src/orxonox/objects/worldentities/MobileEntity.cc
r3028 r3033 166 166 } 167 167 168 void MobileEntity::applyCentralForce(const Vector3& force) 169 { 170 if (this->isDynamic()) 171 this->physicalBody_->applyCentralForce(btVector3(force.x * this->getMass(), force.y * this->getMass(), force.z * this->getMass())); 172 } 173 168 174 bool MobileEntity::isCollisionTypeLegal(WorldEntity::CollisionType type) const 169 175 { -
code/trunk/src/orxonox/objects/worldentities/MobileEntity.h
r3028 r3033 75 75 { return this->angularAcceleration_; } 76 76 77 void applyCentralForce(const Vector3& force); 78 inline void applyCentralForce(float x, float y, float z) 79 { this->applyCentralForce(Vector3(x, y, z)); } 80 77 81 inline void setRotationRate(Degree rate) 78 82 { this->setAngularVelocity(this->getAngularVelocity().normalisedCopy() * rate.valueRadians()); } -
code/trunk/src/orxonox/objects/worldentities/MovableEntity.cc
r2896 r3033 35 35 #include "core/Executor.h" 36 36 #include "core/GameMode.h" 37 #include "objects/worldentities/pawns/Pawn.h" 37 38 38 39 namespace orxonox … … 67 68 { 68 69 SUPER(MovableEntity, XMLPort, xmlelement, mode); 70 71 XMLPortParam(MovableEntity, "enablecollisiondamage", setEnableCollisionDamage, getEnableCollisionDamage, xmlelement, mode).defaultValues(false); 72 XMLPortParam(MovableEntity, "collisiondamage", setCollisionDamage, getCollisionDamage, xmlelement, mode).defaultValues(1); 69 73 } 74 75 bool MovableEntity::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint) 76 { 77 if (GameMode::isMaster() && enableCollisionDamage_) 78 { 79 Pawn* victim = dynamic_cast<Pawn*>(otherObject); 80 if (victim) 81 { 82 victim->damage(this->collisionDamage_ * victim->getVelocity().dotProduct(this->getVelocity())); 83 } 84 } 85 86 return false; 87 } 88 70 89 71 90 void MovableEntity::registerVariables() -
code/trunk/src/orxonox/objects/worldentities/MovableEntity.h
r2662 r3033 46 46 47 47 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 48 virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint); 48 49 void registerVariables(); 49 50 … … 55 56 inline void setOrientation(const Quaternion& orientation) 56 57 { MobileEntity::setOrientation(orientation); this->overwrite_orientation_ = this->getOrientation(); } 58 59 inline void setOwner(Pawn* owner) 60 { this->owner_ = owner; } 61 inline Pawn* getOwner() const 62 { return this->owner_; } 63 64 inline void setCollisionDamage(float c) 65 { this->collisionDamage_ = c; } 66 67 inline float getCollisionDamage() 68 { return this->collisionDamage_; } 69 70 inline void setEnableCollisionDamage(bool c) 71 { 72 this->enableCollisionDamage_ = c; 73 this->enableCollisionCallback(); 74 } 75 76 inline bool getEnableCollisionDamage() 77 { return this->enableCollisionDamage_; } 57 78 58 79 private: … … 76 97 Timer<MovableEntity> resynchronizeTimer_; 77 98 Timer<MovableEntity>* continuousResynchroTimer_; 99 100 Pawn* owner_; 101 float collisionDamage_; 102 bool enableCollisionDamage_; 78 103 }; 79 104 } -
code/trunk/src/orxonox/objects/worldentities/SpawnPoint.cc
r2662 r3033 95 95 void SpawnPoint::spawn(ControllableEntity* entity) 96 96 { 97 entity->setPosition(this->get Position());98 entity->setOrientation(this->get Orientation());97 entity->setPosition(this->getWorldPosition()); 98 entity->setOrientation(this->getWorldOrientation()); 99 99 } 100 100 } -
code/trunk/src/orxonox/objects/worldentities/pawns/CMakeLists.txt
r2710 r3033 3 3 Pawn.cc 4 4 SpaceShip.cc 5 TeamBaseMatchBase.cc 6 Destroyer.cc 5 7 ) -
code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc
r2904 r3033 198 198 void Pawn::death() 199 199 { 200 this->setHealth(1); 200 201 if (this->getGametype() && this->getGametype()->allowPawnDeath(this, this->lastHitOriginator_)) 201 202 { … … 214 215 this->deatheffect(); 215 216 } 216 else217 this->setHealth(1);218 217 } 219 218 -
code/trunk/src/orxonox/objects/worldentities/triggers/CMakeLists.txt
r2710 r3033 4 4 EventTrigger.cc 5 5 PlayerTrigger.cc 6 CheckPoint.cc 6 7 ) -
code/trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc
r3028 r3033 35 35 #include "core/XMLPort.h" 36 36 37 #include "orxonox/objects/worldentities/ ControllableEntity.h"37 #include "orxonox/objects/worldentities/pawns/Pawn.h" 38 38 39 39 namespace orxonox … … 109 109 WEMask.include(Class(WorldEntity)); 110 110 this->targetMask_ *= WEMask; 111 112 this->notifyMaskUpdate(); 111 113 } 112 114 … … 133 135 if(this->isForPlayer()) 134 136 { 135 ControllableEntity* player = dynamic_cast<ControllableEntity*>(entity);137 Pawn* player = dynamic_cast<Pawn*>(entity); 136 138 this->setTriggeringPlayer(player); 137 139 } -
code/trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.h
r3028 r3033 63 63 protected: 64 64 virtual bool isTriggered(TriggerMode mode); 65 virtual void notifyMaskUpdate() {} 66 67 ClassTreeMask targetMask_; 65 68 66 69 private: 67 ClassTreeMask targetMask_;68 70 std::set<Ogre::Node*> targetSet_; 69 71 float distance_; -
code/trunk/src/orxonox/objects/worldentities/triggers/PlayerTrigger.h
r2662 r3033 60 60 @return Returns a pointer to the ControllableEntity that triggered the PlayerTrigger. 61 61 */ 62 inline ControllableEntity* getTriggeringPlayer(void) const62 inline Pawn* getTriggeringPlayer(void) const 63 63 { return this->player_; } 64 64 … … 77 77 @param player A pointer to the ControllableEntity that triggered the PlayerTrigger. 78 78 */ 79 inline void setTriggeringPlayer( ControllableEntity* player)79 inline void setTriggeringPlayer(Pawn* player) 80 80 { this->player_ = player; } 81 81 … … 88 88 89 89 private: 90 ControllableEntity* player_; //!< The player that triggered the PlayerTrigger.90 Pawn* player_; //!< The player that triggered the PlayerTrigger. 91 91 bool isForPlayer_; //!< Is true when the PlayerTrigger schould be set to normally be triggered by ControllableEntities. 92 92 -
code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.cc
r3028 r3033 102 102 { 103 103 this->bFirstTick_ = false; 104 this-> fireEvent(false);104 this->triggered(false); 105 105 } 106 106 … … 144 144 this->bTriggered_ = (newState & 0x1); 145 145 this->bActive_ = newState & 2; 146 this-> fireEvent(this->bActive_);146 this->triggered(this->bActive_); 147 147 this->stateChanges_.pop(); 148 148 if (this->stateChanges_.size() != 0) … … 160 160 else 161 161 this->setBillboardColour(ColourValue(1.0, 0.0, 0.0)); 162 } 163 164 void Trigger::triggered(bool bIsTriggered) 165 { 166 this->fireEvent(bIsTriggered); 162 167 } 163 168 -
code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.h
r3028 r3033 89 89 { return this->remainingActivations_; } 90 90 91 inline void setVisible(bool visibility) 92 { this->debugBillboard_.setVisible(visibility); } 93 91 94 void setDelay(float delay); 92 95 inline float getDelay() const … … 101 104 inline bool isTriggered() { return this->isTriggered(this->mode_); } 102 105 virtual bool isTriggered(TriggerMode mode); 106 virtual void triggered(bool bIsTriggered); 103 107 104 108 private:
Note: See TracChangeset
for help on using the changeset viewer.