Changeset 10715 for code/branches/fabienHS15
- Timestamp:
- Oct 27, 2015, 9:08:40 PM (9 years ago)
- Location:
- code/branches/fabienHS15
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/fabienHS15/data/levels/templates/pickupRepresentationTemplates.oxt
r10692 r10715 212 212 activationType = "immediate" 213 213 durationType = "once" 214 amount = 10 215 munitiontype = "LightningMunition" 216 /> 214 > 215 <munitioncontainers> 216 <MunitionContainer munitiontype="LaserMunition" munitionamount=16 magazinesamount=0 /> 217 <MunitionContainer munitiontype="FusionMunition" munitionamount=8 magazinesamount=0 /> 218 <MunitionContainer munitiontype="LightningMunition" munitionamount=8 magazinesamount=0 /> 219 </munitioncontainers> 220 </MunitionPickup> 217 221 </Template> 218 222 … … 238 242 activationType = "immediate" 239 243 durationType = "once" 240 amount = 20 241 munitiontype = "LightningMunition" 242 /> 243 </Template> 244 > 245 <munitioncontainers> 246 <MunitionContainer munitiontype="LaserMunition" munitionamount=32 magazinesamount=0 /> 247 <MunitionContainer munitiontype="FusionMunition" munitionamount=16 magazinesamount=0 /> 248 <MunitionContainer munitiontype="LightningMunition" munitionamount=16 magazinesamount=0 /> 249 <MunitionContainer munitiontype="SplitMunition" munitionamount=8 magazinesamount=0 /> 250 <MunitionContainer munitiontype="RocketMunition" munitionamount=0 magazinesamount=2 /> 251 </munitioncontainers> 252 </MunitionPickup></Template> 244 253 245 254 <Template name=hugemunitionpickupRepresentation> … … 264 273 activationType = "immediate" 265 274 durationType = "once" 266 amount = 30 267 munitiontype = "LightningMunition" 268 /> 275 > 276 <munitioncontainers> 277 <MunitionContainer munitiontype="LaserMunition" munitionamount=64 magazinesamount=0 /> 278 <MunitionContainer munitiontype="FusionMunition" munitionamount=32 magazinesamount=0 /> 279 <MunitionContainer munitiontype="LightningMunition" munitionamount=32 magazinesamount=0 /> 280 <MunitionContainer munitiontype="SplitMunition" munitionamount=16 magazinesamount=0 /> 281 <MunitionContainer munitiontype="RocketMunition" munitionamount=0 magazinesamount=10 /> 282 <MunitionContainer munitiontype="IceMunition" munitionamount=0 magazinesamount=10 /> 283 <MunitionContainer munitiontype="GravityBombMunition" munitionamount=0 magazinesamount=10 /> 284 </munitioncontainers> 285 </MunitionPickup> 269 286 </Template> 270 287 -
code/branches/fabienHS15/src/modules/overlays/hud/HUDWeapon.cc
r10688 r10715 75 75 { 76 76 SUPER(HUDWeapon, tick, dt); 77 78 if (this->owner_)79 {80 81 }82 77 } 83 78 … … 101 96 { 102 97 SUPER(HUDWeapon, changedOverlayGroup); 103 104 //this->getOverlayGroup()->addElement(this->textOverlay_.get());105 98 } 106 99 … … 108 101 { 109 102 SUPER(HUDWeapon, changedVisibility); 110 111 //this->textOverlay_->setVisible(this->isVisible());112 103 } 113 104 … … 115 106 { 116 107 SUPER(HUDWeapon, changedName); 117 118 //this->textOverlay_->setName(this->getName() + "text");119 108 } 120 109 -
code/branches/fabienHS15/src/modules/pickup/PickupPrereqs.h
r9348 r10715 85 85 class ShrinkPickup; 86 86 class DamageBoostPickup; 87 class MunitionPickup; 88 class MunitionContainer; 87 89 } 88 90 -
code/branches/fabienHS15/src/modules/pickup/items/CMakeLists.txt
r10692 r10715 9 9 DamageBoostPickup.cc 10 10 MunitionPickup.cc 11 MunitionContainer.cc 11 12 ) -
code/branches/fabienHS15/src/modules/pickup/items/MunitionPickup.cc
r10692 r10715 38 38 #include "core/XMLPort.h" 39 39 40 #include "worldentities/pawns/ SpaceShip.h"40 #include "worldentities/pawns/Pawn.h" 41 41 42 42 namespace orxonox … … 71 71 //Defines who is allowed to pick up the pickup. 72 72 this->addTarget(ClassIdentifier<Pawn>::getIdentifier()); 73 munitionAmount_ = 1;74 setMunitionName("LaserMunition");75 73 } 76 74 … … 83 81 SUPER(MunitionPickup, XMLPort, xmlelement, mode); 84 82 85 XMLPortParam(MunitionPickup, "amount", setMunitionAmount, getMunitionAmount, xmlelement, mode); 86 XMLPortParam(MunitionPickup, "munitiontype", setMunitionName, getMunitionName, xmlelement, mode); 83 XMLPortObject(MunitionPickup, MunitionContainer, "munitioncontainers", addMunitionContainer, getMunitionContainer, xmlelement, mode); 84 } 85 86 void MunitionPickup::addMunitionContainer(MunitionContainer* munitionContainer) 87 { 88 OrxAssert(munitionContainer != NULL, "The munitionContainer cannot be NULL."); 89 this->munitionContainers_.push_back(munitionContainer); 90 } 91 92 MunitionContainer* MunitionPickup::getMunitionContainer(unsigned int index) 93 { 94 if(this->munitionContainers_.size() >= index) 95 return NULL; 96 else 97 return this->munitionContainers_[index]; 87 98 } 88 99 … … 104 115 if(this->isUsed()) 105 116 { 106 //Get pointer to the appropriate munition 107 Munition* munition = pawn->getMunition(&munitionType_); 108 if (munition) 117 for(std::vector<MunitionContainer*>::iterator it = this->munitionContainers_.begin(); it != this->munitionContainers_.end(); ++it) 109 118 { 110 // Add munition 111 munition->addMunition(munitionAmount_); 112 // This will destroy the pickp 113 this->setUsed(false); 114 } 119 //Get pointer to the appropriate munition 120 SubclassIdentifier<Munition> identifier = (*it)->getMunitionType(); 121 Munition* munition = pawn->getMunition(&identifier); 122 if (munition) 123 { 124 // Add munition and magzines 125 munition->addMunition((*it)->getMunitionAmount()); 126 munition->addMagazines((*it)->getMagazinesAmount()); 127 } 128 (*it)->destroy(); 129 } 130 // This will destroy the pickp 131 this->setUsed(false); 115 132 } 116 133 else … … 118 135 this->Pickupable::destroy(); 119 136 } 120 } 137 } 121 138 122 139 /** … … 136 153 } 137 154 return pawn; 138 } 139 140 void MunitionPickup::setMunitionName(const std::string& munitionname) 141 { 142 Identifier* identifier = ClassByString(munitionname); 143 if (identifier) 144 { 145 this->munitionType_ = identifier; 146 } 147 else 148 { 149 orxout(internal_warning) << "No munition class defined in MunitionPickup." << endl; 150 } 151 } 152 153 void MunitionPickup::setMunitionAmount(int munitionAmount) 154 { 155 if (munitionAmount > 0) 156 { 157 munitionAmount_ = munitionAmount; 158 } 159 else 160 { 161 munitionAmount = 0; 162 } 163 } 155 } 164 156 } 165 157 -
code/branches/fabienHS15/src/modules/pickup/items/MunitionPickup.h
r10692 r10715 39 39 40 40 #include <string> 41 #include <vector> 41 42 42 43 #include "pickup/Pickup.h" 44 #include "pickup/items/MunitionContainer.h" 43 45 #include "core/class/SubclassIdentifier.h" 44 46 #include "weaponsystem/Munition.h" … … 58 60 virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around. 59 61 60 protected: 61 void setMunitionName(const std::string& munitionname); 62 inline const std::string& getMunitionName() const 63 { return this->munitionname_; } 64 void setMunitionAmount(int munitionAmount); 65 inline int getMunitionAmount() const 66 { return this->munitionAmount_; } 62 virtual void addMunitionContainer(MunitionContainer* munitionContainer); 63 MunitionContainer* getMunitionContainer(unsigned int index); 67 64 68 65 private: 69 66 void initialize(void); //!< Initializes the member variables. 70 67 Pawn* carrierToPawnHelper(void); //!< Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails. 71 72 SubclassIdentifier<Munition> munitionType_; //!< Indentifier of the munition type. 73 std::string munitionname_; //!< String containing the class name of the munition type (e.g. "LaserMunition") 74 int munitionAmount_; //!< The amount of munition added if the pickup is used 68 69 std::vector<MunitionContainer*> munitionContainers_; 75 70 76 71 }; -
code/branches/fabienHS15/src/modules/weapons/munitions/IceMunition.cc
r10713 r10715 49 49 this->deployment_ = MunitionDeployment::Stack; 50 50 51 this->bAllowMunitionRefilling_ = false;51 this->bAllowMunitionRefilling_ = true; 52 52 this->bAllowMultiMunitionRemovementUnderflow_ = false; 53 53 -
code/branches/fabienHS15/src/modules/weapons/munitions/RocketMunition.cc
r10713 r10715 49 49 this->deployment_ = MunitionDeployment::Stack; 50 50 51 this->bAllowMunitionRefilling_ = false;51 this->bAllowMunitionRefilling_ = true; 52 52 this->bAllowMultiMunitionRemovementUnderflow_ = false; 53 53 -
code/branches/fabienHS15/src/modules/weapons/munitions/SplitMunition.cc
r10713 r10715 43 43 RegisterObject(SplitMunition); 44 44 45 this->maxMunitionPerMagazine_ = 1;46 this->maxMagazines_ = 10 0;47 this->magazines_ = 25;45 this->maxMunitionPerMagazine_ = 5; 46 this->maxMagazines_ = 10; 47 this->magazines_ = 5; 48 48 49 this->deployment_ = MunitionDeployment::S tack;49 this->deployment_ = MunitionDeployment::Share; 50 50 51 51 this->bAllowMunitionRefilling_ = true;
Note: See TracChangeset
for help on using the changeset viewer.