Changeset 8757 for code/branches/ai2
- Timestamp:
- Jul 13, 2011, 9:42:03 PM (13 years ago)
- Location:
- code/branches/ai2
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ai2/data/levels/includes/weaponSettingsSwallow.oxi
r7679 r8757 14 14 </links> 15 15 <Weapon> 16 <HsW01 mode=0 munitionpershot=0 delay=0 material="Flares/point_lensflare" /> 17 <HsW01 mode=0 munitionpershot=0 delay=0.125 material="Flares/point_lensflare" muzzleoffset=" 0.5,0.6,1.7" /> 18 <LightningGun mode=1 muzzleoffset="0,0,0" /> 16 <HsW01 mode=0 munitionpershot=0 delay=0 damage=3.14159 material="Flares/point_lensflare" /> 17 <HsW01 mode=0 munitionpershot=0 delay=0.125 damage=3.14159 material="Flares/point_lensflare" muzzleoffset=" 0.5,0.6,1.7" /> 18 19 <LightningGun mode=1 muzzleoffset="0,0,0" damage=3.14159 shielddamage=20/> 19 20 </Weapon> 20 21 <Weapon> 21 <HsW01 mode=0 munitionpershot=0 delay=0 material="Flares/point_lensflare" />22 <HsW01 mode=0 munitionpershot=0 delay=0.125 material="Flares/point_lensflare" muzzleoffset="-0.5,0.6,1.7" />23 <LightningGun mode=1 muzzleoffset="0,0,0" />22 <HsW01 mode=0 munitionpershot=0 delay=0 damage=3.14159 material="Flares/point_lensflare" /> 23 <HsW01 mode=0 munitionpershot=0 delay=0.125 damage=3.14159 material="Flares/point_lensflare" muzzleoffset="-0.5,0.6,1.7" /> 24 <LightningGun mode=1 muzzleoffset="0,0,0" damage=3.14159 shielddamage=20/> 24 25 </Weapon> 25 26 </WeaponPack> -
code/branches/ai2/src/modules/weapons/weaponmodes/EnergyDrink.cc
r8706 r8757 57 57 this->delayTimer_.setTimer(1.0f, false, createExecutor(createFunctor(&EnergyDrink::shot, this))); 58 58 this->delayTimer_.stopTimer(); 59 this->setName("ENERGY_DRINK"); 59 60 } 60 61 -
code/branches/ai2/src/modules/weapons/weaponmodes/FusionFire.cc
r8706 r8757 52 52 53 53 this->setMunitionName("FusionMunition"); 54 this->setName("FUSION_FIRE"); 54 55 } 55 56 -
code/branches/ai2/src/modules/weapons/weaponmodes/HsW01.cc
r8706 r8757 60 60 61 61 this->setDefaultSound("sounds/Weapon_HsW01.ogg"); 62 this->setName("HSW01"); 62 63 } 63 64 -
code/branches/ai2/src/modules/weapons/weaponmodes/LaserFire.cc
r8706 r8757 49 49 50 50 this->setMunitionName("LaserMunition"); 51 this->setName("LASER_FIRE"); 51 52 } 52 53 -
code/branches/ai2/src/modules/weapons/weaponmodes/LightningGun.cc
r8706 r8757 50 50 this->setMunitionName("LaserMunition"); 51 51 this->setDefaultSound("sounds/Weapon_LightningGun.ogg"); 52 this->setName("LIGHTNING_GUN"); 52 53 } 53 54 -
code/branches/ai2/src/modules/weapons/weaponmodes/RocketFire.cc
r8706 r8757 52 52 53 53 this->setMunitionName("RocketMunition"); 54 this->setName("RocketFire"); 54 55 // The firing sound of the Rocket is played in Rocket.cc (because of OpenAl sound positioning) 55 56 } -
code/branches/ai2/src/modules/weapons/weaponmodes/SimpleRocketFire.cc
r8706 r8757 55 55 this->setMunitionName("RocketMunition"); 56 56 this->setDefaultSoundWithVolume("sounds/Rocket_launch.ogg",0.4f); 57 this->setName("SimpleRocketFire"); 57 58 // The firing sound of the Rocket is played in Rocket.cc (because of OpenAl sound positioning) 58 59 } -
code/branches/ai2/src/orxonox/controllers/ArtificialController.cc
r8736 r8757 33 33 34 34 #include "util/Math.h" 35 #include "util/Convert.h" 35 36 #include "core/CoreIncludes.h" 36 37 #include "core/XMLPort.h" … … 1047 1048 float random = rnd(1);// 1048 1049 if (this->isCloseAtTarget(130) && weapons[1] ) 1049 {//LENSFLARE: short range weapon 1050 {//LENSFLARE: short range weapon 1050 1051 this->getControllableEntity()->fire(1); //ai uses lens flare if they're close enough to the target 1051 1052 } … … 1080 1081 if(pawn) 1081 1082 { 1083 this->analyseWeapons(pawn); 1082 1084 for(unsigned int i=0; i < WeaponSystem::MAX_WEAPON_MODES; i++) 1083 1085 { 1084 const std::string wpn = getWeaponname(i, pawn); COUT(0)<<wpn<< std::endl;//Temporary debug info.1086 //const std::string wpn = getWeaponname(i, 0, pawn); COUT(0)<<wpn<< std::endl;//Temporary debug info. 1085 1087 /*if(wpn=="") //future, more generic implementation; until now, only LaserMunition works. Is this a bug?? 1086 1088 weapons[i]=false; … … 1110 1112 } 1111 1113 1112 const std::string & ArtificialController::getWeaponname(int i, Pawn* pawn)1114 const std::string ArtificialController::getWeaponname(int i, int u, Pawn* pawn)//Search through all wPacks, 1113 1115 {//is there a way to minimize this long if-return structure, without triggering nullpointer exceptions? 1114 if(!pawn) return " ";1115 WeaponPack* wPack = pawn->getWeaponPack( i);1116 if(!wPack) return " ";1116 if(!pawn) return "a"; 1117 WeaponPack* wPack = pawn->getWeaponPack(u); 1118 if(!wPack) return "b"; 1117 1119 Weapon* wpn = wPack->getWeapon(i); 1118 if(!wpn) return ""; 1119 WeaponMode* wMode = wpn->getWeaponmode(i); 1120 if(!wMode) return ""; 1121 return wMode->getMunitionName(); 1120 if(!wpn && u<10 && i>0) 1121 { 1122 return this->getWeaponname(i, u+1, pawn); 1123 } 1124 else if(!wpn) 1125 return "c"; 1126 //return wpn->getName(); 1127 WeaponMode* wMode = wpn->getWeaponmode(0); 1128 if(!wMode) return "d"; 1129 return wMode->getMunitionName();//getName(); 1122 1130 }//pawn->getWeaponpack(i)->getWeapon(i)->getWeaponmode(i)->getMunitionName() 1123 1124 1131 /** 1132 @brief Display how a spaceship is equiped with weapons. TODO: why are only 3 out of 8 weapons displayed?? 1133 */ 1134 void ArtificialController::analyseWeapons(Pawn* pawn) 1135 { 1136 int max=10, i=0, j=0, k=0; 1137 if(!pawn) {COUT(0)<<"NO PAWN"<<std::endl; return;} 1138 while(i<max) 1139 { 1140 WeaponPack* wPack = pawn->getWeaponPack(i); //WeaponSet* wSet = pawn->getWeaponSet(i); 1141 i++; 1142 if(wPack==NULL) continue; 1143 while(j<max) 1144 { 1145 Weapon* wpn = wPack->getWeapon(j); 1146 j++; 1147 if(wpn==NULL) continue; 1148 while(k<max) 1149 { 1150 WeaponMode* wMode = wpn->getWeaponmode(k); 1151 k++; 1152 if(wMode==NULL) continue; 1153 COUT(0)<<wMode->getName()<<": weaponpack "+multi_cast<std::string>(i-1)<<", weapon "<<multi_cast<std::string>(j-1)<<", weaponmode "<<multi_cast<std::string>(k-1)<<std::endl; 1154 } 1155 } 1156 } 1157 } 1158 1159 1125 1160 void ArtificialController::setBotLevel(float level) 1126 1161 { 1127 1162 if (level < 0.0f) 1128 this->botlevel_ = 0.0f; 1163 this->botlevel_ = 0.0f; 1129 1164 else if (level > 1.0f) 1130 1165 this->botlevel_ = 1.0f; … … 1132 1167 this->botlevel_ = level; 1133 1168 } 1134 1169 1135 1170 void ArtificialController::setAllBotLevel(float level) 1136 1171 { … … 1143 1178 this->mode_ = DEFAULT; //Vector-implementation: mode_.pop_back(); 1144 1179 } 1145 1180 1146 1181 void ArtificialController::boostControl() 1147 1182 { -
code/branches/ai2/src/orxonox/controllers/ArtificialController.h
r8741 r8757 80 80 81 81 virtual void doFire(); 82 83 82 void setBotLevel(float level=1.0f); 83 inline float getBotLevel() const 84 84 { return this->botlevel_; } 85 85 static void setAllBotLevel(float level); … … 157 157 enum Mode {DEFAULT, ROCKET, DEFENCE, MOVING};//TODO; implement DEFENCE, MOVING modes 158 158 Mode mode_; //TODO: replace single value with stack-like implementation: std::vector<Mode> mode_; 159 void setPreviousMode(); 159 void setPreviousMode(); 160 160 void setupWeapons(); //<! Defines which weapons are available for a bot. Is recalled whenever a bot was killed. 161 const std::string& getWeaponname(int i, Pawn* pawn); //<! Function that links a weapon's firemode to its name. 161 const std::string getWeaponname(int i, int u, Pawn* pawn); //<! Function that links a weapon's firemode to its name. 162 void analyseWeapons(Pawn* pawn); 162 163 bool bSetupWorked; //<! If false, setupWeapons() is called. 163 164 };
Note: See TracChangeset
for help on using the changeset viewer.