Changeset 9656 in orxonox.OLD for trunk/src/world_entities/npcs
- Timestamp:
- Aug 4, 2006, 11:01:28 PM (18 years ago)
- Location:
- trunk/src/world_entities/npcs
- Files:
-
- 4 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/npcs/ground_turret.cc
r9406 r9656 39 39 */ 40 40 GroundTurret::GroundTurret(const TiXmlElement* root) 41 : NPC(root)41 : NPC(root) 42 42 { 43 43 this->init(); … … 52 52 GroundTurret::~GroundTurret () 53 53 { 54 55 54 } 56 55 … … 80 79 81 80 /** 82 * loads a GroundTurret from a XML-element81 * @brief loads a GroundTurret from a XML-element 83 82 * @param root the XML-element to load from 84 83 * @todo make the class Loadable … … 88 87 // all the clases this Entity is directly derived from must be called in this way, to load all settings. 89 88 NPC::loadParams(root); 90 91 89 92 90 /** … … 126 124 void GroundTurret::tick(float dt) 127 125 { 128 if(this->getHealth() > 0.0f && State::getPlayer() && 129 State::getPlayer()->getPlayable() && 130 State::getPlayer()->getPlayable()->distance(this) < 120) // HACK 126 if(this->getHealth() > 0.0f 127 ) // HACK <--- YOU ARE THE MOTHERFUCKER 131 128 { 132 if (likely(this->left != NULL))133 {134 // this->left->tickW(dt);135 this->left->requestAction(WA_SHOOT);136 }137 if (likely(this->right != NULL))138 {139 // this->right->tickW(dt);140 this->right->requestAction(WA_SHOOT);141 }129 if (likely(this->left != NULL)) 130 { 131 // this->left->tickW(dt); 132 this->left->requestAction(WA_SHOOT); 133 } 134 if (likely(this->right != NULL)) 135 { 136 // this->right->tickW(dt); 137 this->right->requestAction(WA_SHOOT); 138 } 142 139 } 143 140 } … … 164 161 void GroundTurret::postSpawn () 165 162 { 166 167 163 } 168 164 … … 173 169 void GroundTurret::leftWorld () 174 170 { 175 176 171 } 177 172 -
trunk/src/world_entities/npcs/ground_turret.h
r9235 r9656 15 15 { 16 16 17 17 public: 18 18 GroundTurret(const TiXmlElement* root = NULL); 19 19 virtual ~GroundTurret(); 20 20 21 void init();22 21 virtual void loadParams(const TiXmlElement* root); 23 22 … … 30 29 virtual void tick(float time); 31 30 32 private: 33 PNode weaponHolder[2]; 34 Weapon *left, *right; 31 private: 32 void init(); 33 34 35 private: 36 PNode weaponHolder[2]; 37 Weapon *left, *right; 35 38 }; 36 39 -
trunk/src/world_entities/npcs/space_turret.cc
r9235 r9656 74 74 this->weaponHolder[0].setParent(this); 75 75 this->weaponHolder[1].setParent(this); 76 77 this->wLeftHandle = registerVarId( new SynchronizeableString( &this->wLeft, &this->wLeft, "weapon-left", PERMISSION_MASTER_SERVER ) ); 78 this->wRightHandle = registerVarId( new SynchronizeableString( &this->wRight, &this->wRight, "weapon-right", PERMISSION_MASTER_SERVER ) ); 79 76 80 } 77 81 … … 98 102 if (this->left) 99 103 { 104 this->wLeft = element->Value(); 105 100 106 this->left->setParent(this); 101 107 this->left->toList(this->getOMListNumber()); … … 110 116 if (this->right) 111 117 { 118 this->wRight = element->Value(); 119 112 120 this->right->setParent(this); 113 121 this->right->toList(this->getOMListNumber()); … … 117 125 } 118 126 } 127 128 129 /** 130 * sets the left weapon called from net sync 131 * @param wLeft the left weapon string 132 */ 133 void SpaceTurret::setWeaponLeft(const std::string& wLeft) 134 { 135 136 } 137 138 /** 139 * sets the left weapon called from net sync 140 * @param wRught the right weapon string 141 */ 142 void SpaceTurret::setWeaponRight(const std::string& wRight) 143 {} 119 144 120 145 /** … … 198 223 199 224 } 225 226 227 228 /** 229 * handler for changes on registred vars 230 * @param id id's which changed 231 */ 232 void SpaceTurret::varChangeHandler( std::list< int > & id ) 233 { 234 if ( std::find( id.begin(), id.end(), this->wLeftHandle ) != id.end()) 235 { 236 this->setWeaponLeft(this->wLeft); 237 } 238 239 if ( std::find( id.begin(), id.end(), this->wRightHandle ) != id.end() ) 240 { 241 this->setWeaponRight(this->wRight); 242 } 243 244 245 WorldEntity::varChangeHandler( id ); 246 } 247 -
trunk/src/world_entities/npcs/space_turret.h
r9235 r9656 8 8 9 9 #include "npcs/npc.h" 10 11 #include <string> 12 #include <list> 13 10 14 11 15 class Weapon; … … 20 24 21 25 virtual void loadParams(const TiXmlElement* root); 26 virtual void varChangeHandler( std::list< int > & id ); 27 28 29 void setWeaponLeft(const std::string& wLeft); 30 void setWeaponRight(const std::string& wRight); 22 31 23 32 virtual void postSpawn (); … … 36 45 PNode weaponHolder[2]; 37 46 Weapon *left, *right; 47 48 std::string wLeft; 49 std::string wRight; 50 int wLeftHandle; 51 int wRightHandle; 38 52 }; 39 53
Note: See TracChangeset
for help on using the changeset viewer.