Changeset 10067
- Timestamp:
- May 21, 2014, 10:38:09 PM (11 years ago)
- Location:
- code/branches/modularships
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/modularships/data/levels/templates/HeavyCruiser.oxt
r10058 r10067 50 50 51 51 <parts> 52 <ShipPart name="frontL" initialhealth="10" damageabsorption="0.5">52 <ShipPart name="frontL" initialhealth="10" maxhealth="10" damageabsorption="0.5" explosionposition="-76,30,-330"> 53 53 <destructionevents> 54 54 <PartDestructionEvent targetType="ship" targetParam="shieldhealth" operation="*" value="0.5"/> 55 55 </destructionevents> 56 56 </ShipPart> 57 <ShipPart name="frontR" initialhealth="10" damageabsorption="0.5">57 <ShipPart name="frontR" initialhealth="10" maxhealth="10" damageabsorption="0.5" explosionposition="76,30,-330"> 58 58 <destructionevents> 59 59 <PartDestructionEvent targetType="ship" targetParam="shieldhealth" operation="*" value="0.5"/> 60 60 </destructionevents> 61 61 </ShipPart> 62 <ShipPart name="partL" initialhealth="10" damageabsorption="0.5">62 <ShipPart name="partL" initialhealth="10" maxhealth="10" damageabsorption="0.5" explosionposition="-100,33,-200"> 63 63 <destructionevents> 64 64 <PartDestructionEvent targetType="ship" targetParam="boostpowerrate" operation="-" value="0.5" message="One of your ship's generators was destroyed!"/> 65 66 67 68 69 </ShipPart> 70 <ShipPart name="partR" initialhealth="10" damageabsorption="0.5">65 <PartDestructionEvent targetType="engine" targetName="bodyengine" targetParam="speedfront" operation="-" value="50"/> 66 <PartDestructionEvent targetType="engine" targetName="bodyengine" targetParam="accelerationfront" operation="-" value="3"/> 67 <PartDestructionEvent targetType="engine" targetName="bodyengine" targetParam="boostfactor" operation="set" value="1"/> 68 </destructionevents> 69 </ShipPart> 70 <ShipPart name="partR" initialhealth="10" maxhealth="10" damageabsorption="0.5" explosionposition="100,33,-200"> 71 71 <destructionevents> 72 72 <PartDestructionEvent targetType="ship" targetParam="boostpowerrate" operation="-" value="0.5" message="One of your ship's generators was destroyed!"/> 73 74 75 76 </destructionevents> 77 </ShipPart> 78 <ShipPart name="sidearmL" initialhealth="20" damageabsorption="0.2">73 <PartDestructionEvent targetType="engine" targetName="bodyengine" targetParam="speedfront" operation="-" value="50"/> 74 <PartDestructionEvent targetType="engine" targetName="bodyengine" targetParam="accelerationfront" operation="-" value="3"/> 75 <PartDestructionEvent targetType="engine" targetName="bodyengine" targetParam="boostfactor" operation="set" value="1"/> 76 </destructionevents> 77 </ShipPart> 78 <ShipPart name="sidearmL" initialhealth="20" maxhealth="20" damageabsorption="0.2" explosionposition="-140,30,100"> 79 79 <destructionevents> 80 80 <PartDestructionEvent targetType="engine" targetName="sidearmLengine" operation="destroy" message="The left auxiliary engine was destroyed!"/> 81 82 83 </destructionevents> 84 </ShipPart> 85 <ShipPart name="sidearmLfront" initialhealth="10" damageabsorption="0.5">81 <PartDestructionEvent targetType="part" targetName="sidearmLfront" operation="destroy"/> 82 <PartDestructionEvent targetType="ship" targetParam="rotationthrust" operation="-" value="0.04" /> 83 </destructionevents> 84 </ShipPart> 85 <ShipPart name="sidearmLfront" initialhealth="10" maxhealth="10" damageabsorption="0.5" explosionposition="-140,20,-50"> 86 86 <destructionevents> 87 87 <PartDestructionEvent targetType="engine" targetName="sidearmLengine" targetParam="boostfactor" operation="set" value="1" message="The left auxiliary engine lost it's booster!"/> 88 88 </destructionevents> 89 90 <ShipPart name="sidearmR" initialhealth="20" damageabsorption="0.2">89 </ShipPart> 90 <ShipPart name="sidearmR" initialhealth="20" maxhealth="20" damageabsorption="0.2" explosionposition="140,30,100"> 91 91 <destructionevents> 92 92 <PartDestructionEvent targetType="engine" targetName="sidearmRengine" operation="destroy" message="The right auxiliary engine was destroyed!"/> 93 94 95 96 97 <ShipPart name="sidearmRfront" initialhealth="10" damageabsorption="0.5">93 <PartDestructionEvent targetType="part" targetName="sidearmRfront" operation="destroy"/> 94 <PartDestructionEvent targetType="ship" targetParam="rotationthrust" operation="-" value="0.04" /> 95 </destructionevents> 96 </ShipPart> 97 <ShipPart name="sidearmRfront" initialhealth="10" maxhealth="10" damageabsorption="0.5" explosionposition="140,20,-50"> 98 98 <destructionevents> 99 99 <PartDestructionEvent targetType="engine" targetName="sidearmRengine" targetParam="boostfactor" operation="set" value="1" message="The right auxiliary engine lost it's booster!"/> 100 100 </destructionevents> 101 101 </ShipPart> 102 102 </parts> 103 103 -
code/branches/modularships/src/orxonox/items/ShipPart.cc
r10058 r10067 41 41 #include "worldentities/StaticEntity.h" 42 42 #include "items/PartDestructionEvent.h" 43 #include "worldentities/BigExplosion.h" 44 #include "chat/ChatManager.h" 43 45 44 46 … … 70 72 XMLPortParam(ShipPart, "damageabsorption", setDamageAbsorption, getDamageAbsorption, xmlelement, mode).defaultValues(0.5); 71 73 74 XMLPortParamTemplate(ShipPart, "explosionposition", setExplosionPosition, getExplosionPosition, xmlelement, mode, Vector3); 75 72 76 XMLPortObject(ShipPart, PartDestructionEvent, "destructionevents", addDestructionEvent, getDestructionEvent, xmlelement, mode); 73 74 /*75 XMLPortParam(ShipPart, "shieldhealth", setShieldHealth, getShieldHealth, xmlelement, mode).defaultValues(0);76 XMLPortParam(ShipPart, "initialshieldhealth", setInitialShieldHealth, getInitialShieldHealth, xmlelement, mode).defaultValues(0);77 XMLPortParam(ShipPart, "maxshieldhealth", setMaxShieldHealth, getMaxShieldHealth, xmlelement, mode).defaultValues(100);78 XMLPortParam(ShipPart, "shieldabsorption", setShieldAbsorption, getShieldAbsorption, xmlelement, mode).defaultValues(0);79 80 XMLPortParam(ShipPart, "sShipPartparticlesource", setSShipPartParticleSource, getSShipPartParticleSource, xmlelement, mode);81 XMLPortParam(ShipPart, "sShipPartparticleduration", setSShipPartParticleDuration, getSShipPartParticleDuration, xmlelement, mode).defaultValues(3.0f);82 XMLPortParam(ShipPart, "explosionchunks", setExplosionChunks, getExplosionChunks, xmlelement, mode).defaultValues(7);83 84 XMLPortParam(ShipPart, "reloadrate", setReloadRate, getReloadRate, xmlelement, mode).defaultValues(0);85 XMLPortParam(ShipPart, "reloadwaittime", setReloadWaitTime, getReloadWaitTime, xmlelement, mode).defaultValues(1.0f);86 87 XMLPortParam(ShipPart, "explosionSound", setExplosionSound, getExplosionSound, xmlelement, mode);88 89 XMLPortParam ( RadarViewable, "radarname", setRadarName, getRadarName, xmlelement, mode );90 */91 77 } 92 78 … … 102 88 return; 103 89 90 this->explode(); 104 91 this->setAlive(false); 105 92 … … 115 102 // Remove this ShipPart from the parent. 116 103 this->parent_->removeShipPart(this); 117 orxout() << this->getName() << " has died." << endl; 104 } 105 106 void ShipPart::explode() 107 { 108 BigExplosion* chunk = new BigExplosion(this->getContext()); 109 chunk->setPosition(this->parent_->getPosition() + this->parent_->getOrientation() * (this->explosionPosition_)); 110 //chunk->setPosition(this->parent_->getPosition() + this->parent_->getOrientation() * Vector3(this->entityList_[0]->getLocalInertia())); 111 chunk->setVelocity(this->parent_->getVelocity()); 112 113 // this->explosionSound_->setPosition(this->parent_->getPosition()); 114 // this->explosionSound_->play(); 118 115 } 119 116 … … 160 157 } 161 158 162 void ShipPart::printEntities()163 {164 orxout() << "ShipPart " << this->getName() << " has the following entities assigned:" << endl;165 for(unsigned int j = 0; j < this->entityList_.size(); j++)166 {167 orxout() << " " << this->entityList_[j]->getName() << endl;168 }169 }170 171 159 /** 172 160 @brief … … 221 209 void ShipPart::handleHit(float damage, float healthdamage, float shielddamage, Pawn* originator) 222 210 { 223 orxout() << "ShipPart " <<this->getName() << " is handling a hit!" << endl;224 225 211 if (parent_->getGametype() && parent_->getGametype()->allowPawnDamage(parent_, originator)) 226 212 { … … 247 233 if (this->health_ < 0) 248 234 this->death(); 249 orxout() << "Health of ShipPart " << this->getName() << " is " << this->getHealth() << endl; 235 236 // (Ugly) Chatoutput of health, until a GUI for modularspaceships-shipparts is implemented. 237 if (this->health_ < 0.2 * this->maxHealth_) 238 { 239 ChatManager::message("ShipPart " + this->getName() + " remaining health is 20%!"); 240 return; 241 } 242 if (this->health_ < 0.4 * this->maxHealth_) 243 { 244 ChatManager::message("ShipPart " + this->getName() + " remaining health is 40%!"); 245 return; 246 } 247 if (this->health_ < 0.6 * this->maxHealth_) 248 { 249 ChatManager::message("ShipPart " + this->getName() + " remaining health is 60%!"); 250 return; 251 } 252 if (this->health_ < 0.8 * this->maxHealth_) 253 { 254 ChatManager::message("ShipPart " + this->getName() + " remaining health is 80%!"); 255 return; 256 } 250 257 } 251 258 -
code/branches/modularships/src/orxonox/items/ShipPart.h
r10058 r10067 52 52 53 53 virtual void death(); 54 virtual void explode(); 54 55 55 56 //virtual void attachTo(Pawn* newParent); … … 62 63 void addDestructionEvent(PartDestructionEvent* event); 63 64 PartDestructionEvent* getDestructionEvent(unsigned int index); 64 65 void printEntities(); // FIXME: (noep) remove debug66 65 67 66 virtual void setDamageAbsorption(float value); … … 101 100 { return this->initialHealth_; } 102 101 102 inline void setExplosionPosition(Vector3 pos) 103 { this->explosionPosition_ = pos; } 104 inline Vector3 getExplosionPosition() 105 { return this->explosionPosition_; } 106 103 107 104 108 // FIXME: (noep) Why doesn't this work? Works fine in Engine.h … … 121 125 bool eventExecution_; 122 126 127 Vector3 explosionPosition_; 128 123 129 124 130 }; // tolua_export -
code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.cc
r10058 r10067 108 108 // An entry in the partMap_ is created, assigning the part to the entity. 109 109 this->addPartEntityAssignment((StaticEntity*)(this->getAttachedObject(i)), this->partList_[j]); 110 orxout() << "A matching part-entity-pair with name " << this->partList_[j]->getName() << " was found!" << endl;111 this->partList_[j]->printEntities(); // FIXME: (noep) remove debug112 110 } 113 111 } 114 112 } 115 116 orxout() << "List of all assignments:" << endl;117 for (std::map<StaticEntity*, ShipPart*>::const_iterator it = this->partMap_.begin(); it != this->partMap_.end(); ++it)118 {119 orxout() << "Entity: " << it->first << " Part: " << it->second << endl;120 }121 113 } 122 114 … … 147 139 148 140 this->partMap_[entity] = part; 149 150 orxout() << "New entity-part assignment created!" << endl;151 141 } 152 142
Note: See TracChangeset
for help on using the changeset viewer.