Changeset 11175 for code/branches/sagerjFS16/src/orxonox
- Timestamp:
- Apr 28, 2016, 3:09:26 PM (9 years ago)
- Location:
- code/branches/sagerjFS16/src/orxonox
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/sagerjFS16/src/orxonox/controllers/AIController.cc
r11071 r11175 197 197 if (this->bHasTargetPosition_) 198 198 this->moveToTargetPosition(); 199 this->do Fire();199 this->doPush(); 200 200 } 201 201 … … 227 227 this->moveToTargetPosition(); 228 228 229 this->do Fire();229 this->doPush(); 230 230 } 231 231 } … … 241 241 if((timeout_< 0)||(!target_))//Check if the timeout is over or target died. 242 242 { 243 controllable-> fire(0);//kill the rocket243 controllable->push(0);//kill the rocket 244 244 this->setPreviousMode();//get out of rocket mode 245 245 } -
code/branches/sagerjFS16/src/orxonox/controllers/ArtificialController.cc
r11099 r11175 132 132 @brief DoFire is called when a bot should shoot and decides which weapon is used and whether the bot shoots at all. 133 133 */ 134 void ArtificialController::do Fire()134 void ArtificialController::doPush() 135 135 { 136 136 if(!this->bSetupWorked)//setup: find out which weapons are active ! hard coded: laser is "0", lens flare is "1", ... … … 144 144 if (this->isCloseAtTarget(130) && (firemode = getFiremode("LightningGun")) > -1 ) 145 145 {//LENSFLARE: short range weapon 146 this->getControllableEntity()-> fire(firemode); //ai uses lens flare if they're close enough to the target146 this->getControllableEntity()->push(firemode); //ai uses lens flare if they're close enough to the target 147 147 } 148 148 else if( this->isCloseAtTarget(400) && (random < this->botlevel_) && (firemode = getFiremode("RocketFire")) > -1 ) 149 149 {//ROCKET: mid range weapon 150 150 this->mode_ = ROCKET; //Vector-implementation: mode_.push_back(ROCKET); 151 this->getControllableEntity()-> fire(firemode); //launch rocket151 this->getControllableEntity()->push(firemode); //launch rocket 152 152 if(this->getControllableEntity() && this->target_) //after fire(3) is called, getControllableEntity() refers to the rocket! 153 153 { … … 161 161 } 162 162 else if ((firemode = getFiremode("HsW01")) > -1 ) //LASER: default weapon 163 this->getControllableEntity()-> fire(firemode);163 this->getControllableEntity()->push(firemode); 164 164 } 165 165 } -
code/branches/sagerjFS16/src/orxonox/controllers/ArtificialController.h
r11071 r11175 48 48 virtual void changedControllableEntity() override; 49 49 50 virtual void do Fire();50 virtual void doPush(); 51 51 void setBotLevel(float level=1.0f); 52 52 inline float getBotLevel() const -
code/branches/sagerjFS16/src/orxonox/controllers/DroneController.cc
r11071 r11175 130 130 this->aimAtTarget(); 131 131 if(!this->friendlyFire()) 132 this->getDrone()-> fire(0);132 this->getDrone()->push(0); 133 133 } 134 134 } -
code/branches/sagerjFS16/src/orxonox/controllers/FightingController.cc
r11083 r11175 318 318 } 319 319 320 this->getControllableEntity()-> fire(firemode);320 this->getControllableEntity()->push(firemode); 321 321 322 322 } -
code/branches/sagerjFS16/src/orxonox/controllers/WaypointPatrolController.cc
r11071 r11175 69 69 70 70 if (this->getControllableEntity() && this->isCloseAtTarget(this->attackradius_) && this->isLookingAtTarget(math::pi / 20.0f)) 71 this->getControllableEntity()-> fire(0);71 this->getControllableEntity()->push(0); 72 72 } 73 73 else -
code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponMode.cc
r11174 r11175 63 63 this->bAutoReload_ = true; 64 64 this->bParallelReload_ = true; 65 this->chargeable_ = false; 65 66 66 67 this->reloadTimer_.setTimer(0.0f, false, createExecutor(createFunctor(&WeaponMode::reloaded, this))); … … 120 121 bool WeaponMode::fire(float* reloadTime) 121 122 { 123 orxout() << "--- " << endl; 122 124 (*reloadTime) = this->reloadTime_; 123 125 // Fireing is only possible if this weapon mode is not reloading and there is enough munition … … 170 172 bool WeaponMode::push(float* reloadTime) 171 173 { 174 orxout() << "push " << chargeable_ << endl; 172 175 if( this->chargeable_) 173 176 { 174 177 // setting up a timer for knowing how long the weapon was charged 175 178 // and passes the value to this->cTime_ 179 orxout() << "if " << endl; 180 return false; 176 181 } else { 182 orxout() << "else " << endl; 177 183 return fire(reloadTime); 178 184 } 179 180 185 } 181 186 182 187 bool WeaponMode::release(float* reloadTime) 183 188 { 189 orxout() << "release " << endl; 184 190 if( this->chargeable_) 185 { 191 { 192 orxout() << "if " << endl; 186 193 return fire(reloadTime); 194 }else{ 195 orxout() << "else " << endl; 196 return false; 187 197 } 188 198 } -
code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponMode.h
r11174 r11175 174 174 bool bAutoReload_; // If true, the weapon reloads the magazine automatically. 175 175 bool bParallelReload_; // If true, the weapon reloads in parallel to the magazine reloading. 176 bool chargeable_; // If true, the weapon fires at release instead at push(where he charges up) 176 177 177 178 float damage_; -
code/branches/sagerjFS16/src/orxonox/worldentities/ControllableEntity.cc
r11174 r11175 49 49 RegisterClass(ControllableEntity); 50 50 51 registerMemberNetworkFunction( ControllableEntity, fire);51 registerMemberNetworkFunction( ControllableEntity, push ); 52 52 registerMemberNetworkFunction( ControllableEntity, setTargetInternal ); 53 53 … … 307 307 else 308 308 { 309 callMemberNetworkFunction(&ControllableEntity:: fire, this->getObjectID(), 0, firemode);309 callMemberNetworkFunction(&ControllableEntity::push, this->getObjectID(), 0, firemode); 310 310 } 311 311 } … … 319 319 else 320 320 { 321 callMemberNetworkFunction(&ControllableEntity:: fire, this->getObjectID(), 0, firemode);321 callMemberNetworkFunction(&ControllableEntity::release, this->getObjectID(), 0, firemode); 322 322 } 323 323 } -
code/branches/sagerjFS16/src/orxonox/worldentities/pawns/Spectator.cc
r11071 r11175 42 42 namespace orxonox 43 43 { 44 extern const std::string __CC_ fire_name;44 extern const std::string __CC_push_name; 45 45 extern const std::string __CC_suicide_name; 46 46 … … 162 162 163 163 // change keybind mode of fire command to OnPress to avoid firing after respawn 164 ModifyConsoleCommand(__CC_ fire_name).keybindMode(KeybindMode::OnPress);164 ModifyConsoleCommand(__CC_push_name).keybindMode(KeybindMode::OnPress); 165 165 166 166 // disable suicide … … 177 177 // change fire command to a helper function and change keybind mode to OnPress 178 178 // as soon as the player releases and presses the button again, the helper function will be called which changes the keybind mode back to OnHold 179 ModifyConsoleCommand(__CC_ fire_name).pushFunction(&Spectator::resetFireCommand).keybindMode(KeybindMode::OnPress);179 ModifyConsoleCommand(__CC_push_name).pushFunction(&Spectator::resetFireCommand).keybindMode(KeybindMode::OnPress); 180 180 181 181 // enable suicide … … 188 188 void Spectator::resetFireCommand(unsigned int firemode) 189 189 { 190 ModifyConsoleCommand(__CC_ fire_name).popFunction().keybindMode(KeybindMode::OnHold); // pop this helper function and change keybind mode191 192 CommandExecutor::execute(__CC_ fire_name + " " + multi_cast<std::string>(firemode)); // call the fire command again, this time with the real function190 ModifyConsoleCommand(__CC_push_name).popFunction().keybindMode(KeybindMode::OnHold); // pop this helper function and change keybind mode 191 192 CommandExecutor::execute(__CC_push_name + " " + multi_cast<std::string>(firemode)); // call the fire command again, this time with the real function 193 193 } 194 194 … … 229 229 } 230 230 231 void Spectator:: fired(unsigned int firemode)231 void Spectator::pushed(unsigned int firemode) 232 232 { 233 233 if (this->getPlayer()) -
code/branches/sagerjFS16/src/orxonox/worldentities/pawns/Spectator.h
r9667 r11175 54 54 virtual void rotateRoll(const Vector2& value); 55 55 56 virtual void fired(unsigned int firemode);56 virtual void pushed(unsigned int firemode); 57 57 virtual void greet(); 58 58 virtual void mouseLook() {}
Note: See TracChangeset
for help on using the changeset viewer.