Changeset 7493
- Timestamp:
- Sep 27, 2010, 7:53:30 PM (14 years ago)
- Location:
- code/trunk/src
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/objects/Script.cc
r7486 r7493 186 186 { 187 187 // If the number of executions have been used up. 188 if(this->times_ != Script::INF && this->remainingExecutions_ == 0)188 if(this->times_ != Script::INF && this->remainingExecutions_ <= 0) 189 189 return; 190 190 } … … 209 209 callStaticNetworkFunction(Script::executeHelper, it->first, this->getCode(), this->getMode(), this->getNeedsGraphics()); 210 210 if(this->times_ != Script::INF) // Decrement the number of remaining executions. 211 { 211 212 this->remainingExecutions_--; 213 if(this->remainingExecutions_ <= 0) 214 break; 215 } 212 216 } 213 217 } -
code/trunk/src/modules/pickup/CollectiblePickup.h
r7456 r7493 44 44 /** 45 45 @brief 46 Collectible Pickup class. Any pickup inheriting from this class can be added to a PickupCollection and thus be part uf such. 46 The CollectiblePickup class encompasses all @ref orxonox::Pickupable "Pickupables" that can be added to a @ref orxonox::PickupCollection "PickupCollection" and thus be part of such. 47 48 All you need to do to make your @ref orxonox:.Pickupable "Pickupable" a CollectiblePickup is to, in some way, inherit from it. (The @ref orxonox::Pickup Pickup class, for example, is already a CollectiblePickup). 49 47 50 @author 48 51 Damian 'Mozork' Frick -
code/trunk/src/modules/pickup/DroppedPickup.cc
r7401 r7493 51 51 { 52 52 RegisterObject(DroppedPickup); 53 54 53 } 55 54 … … 83 82 DroppedPickup::~DroppedPickup() 84 83 { 85 if(this->pickup_ != NULL && this->pickup_->isPickedUp()) 86 { 87 this->pickup_ = NULL; 88 } 84 89 85 } 90 86 … … 96 92 Pickupable* DroppedPickup::getPickup(void) 97 93 { 98 return this->pickup_; 94 Pickupable* pickup = this->pickup_; 95 this->pickup_ = NULL; 96 return pickup; 99 97 } 100 98 -
code/trunk/src/modules/pickup/DroppedPickup.h
r7456 r7493 45 45 /** 46 46 @brief 47 Special PickupSpawner that is created whe a Pickupable is dropped. It just spawns one pickup, the one that was dropped. 47 Special PickupSpawner that is created when a @ref orxonox::Pickupable "Pickupable" is dropped. It just spawns one pickup, the one that was dropped. 48 48 49 @author 49 50 Daniel 'Huty' Haggenmueller 51 @author 50 52 Damian 'Mozork' Frick 51 53 */ -
code/trunk/src/modules/pickup/PickupSpawner.cc
r7401 r7493 35 35 36 36 #include "core/CoreIncludes.h" 37 #include "core/GameMode.h" 37 38 #include "core/Template.h" 38 39 #include "core/XMLPort.h" … … 94 95 PickupRepresentation* representation = PickupManager::getInstance().getRepresentation(this->pickup_->getPickupIdentifier()); 95 96 this->attach(representation->getSpawnerRepresentation(this)); 97 this->setActive(true); //TODO: Needed? 96 98 } 97 99 } … … 146 148 { 147 149 PickupRepresentation* representation = PickupManager::getInstance().getRepresentation(this->pickup_->getPickupIdentifier()); 148 representation->setVisible(this->isActive());149 150 this->attach(representation->getSpawnerRepresentation(this)); 150 this->setActive(true); 151 this->setActive(true); //TODO: Needed? 151 152 } 152 153 } … … 160 161 SUPER(PickupSpawner, changedActivity); 161 162 162 this->setVisible(this->isActive()); 163 if(GameMode::isMaster()) 164 this->setVisible(this->isActive()); 163 165 } 164 166 … … 169 171 Time since last tick. 170 172 */ 171 //TODO: Replace with collisions .173 //TODO: Replace with collisions? 172 174 void PickupSpawner::tick(float dt) 173 175 { 174 176 SUPER(PickupSpawner, tick, dt); 175 177 176 // !If the PickupSpawner is active.177 if (this->isActive())178 // If the PickupSpawner is active. 179 if(GameMode::isMaster() && this->isActive()) 178 180 { 179 181 SmartPtr<PickupSpawner> temp = this; //Create a smart pointer to keep the PickupSpawner alive until we iterated through all Pawns (in case a Pawn takes the last pickup) 180 182 181 // !Iterate trough all Pawns.183 // Iterate trough all Pawns. 182 184 for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it) 183 185 { 184 186 Vector3 distance = it->getWorldPosition() - this->getWorldPosition(); 185 187 PickupCarrier* carrier = dynamic_cast<PickupCarrier*>(*it); 186 // !If a Pawn, that fits the target-range of the item spawned by this Pickup, is in trigger-distance.188 // If a Pawn, that fits the target-range of the item spawned by this Pickup, is in trigger-distance. 187 189 if (distance.length() < this->triggerDistance_ && carrier != NULL && carrier->isTarget(this->pickup_)) 188 190 { … … 214 216 { 215 217 if(this->spawnsRemaining_ != INF) 216 {217 218 this->spawnsRemaining_--; 218 } 219 219 220 if(this->spawnsRemaining_ != 0 && this->respawnTime_ > 0) 220 221 { … … 283 284 void PickupSpawner::trigger(Pawn* pawn) 284 285 { 285 if (this->isActive()) //!<Checks whether PickupSpawner is active.286 if(this->isActive()) // Checks whether PickupSpawner is active. 286 287 { 287 288 COUT(4) << "PickupSpawner (&" << this << ") triggered and active." << std::endl; … … 303 304 Pickupable* pickup = this->getPickup(); 304 305 305 if(target != NULL && pickup != NULL) 306 { 307 if(pickup->pickup(target)) 308 this->decrementSpawnsRemaining(); 309 else 310 { 311 this->selfDestruct_ = true; 312 pickup->destroy(); 313 } 314 } 315 else 316 { 317 if(target == NULL) 318 COUT(1) << "PickupSpawner (&" << this << "): Pickupable has no target." << std::endl; 319 320 if(pickup == NULL) 321 COUT(1) << "PickupSpawner (&" << this << "): getPickup produced an error, no Pickupable created." << std::endl; 322 else 323 { 324 this->selfDestruct_ = true; 325 pickup->destroy(); 326 } 327 } 306 assert(pickup); 307 assert(target); 308 assert(pickup->pickup(target)); 309 310 this->decrementSpawnsRemaining(); 328 311 } 329 312 } -
code/trunk/src/modules/pickup/items/HealthPickup.h
r7456 r7493 62 62 A pickup that can do (dependent upon the parameters) lots of different things to the health of a Pawn. 63 63 There are 4 parameters that can be chosen: 64 1) The health.The amount of health that (in a way dependent on the other parameters) is transfered to the Pawn.65 2) The activation type:It can be chosen to be either 'immediate' or 'onUse'. The activation type essentially (as indicated by the name) defines when the health is transfered, either immediately after being picked up or only after the player uses it.66 3) The duration type:It can be chosen to be either 'once' or 'continuous'. For 'once' the specified health is transfered once to the Pawn, for 'continuous' the set health is transfered over a span of time at a rate defined by the health rate parameter.67 4) The health type:The health type can be chosen to be 'limited', 'temporary' or 'permanent'. 'limited' means that the health is increased only to the maximum health of the Pawn. 'temporary' means that the maximum health is temporarily elevated but will be set back as soon as the pickup is no longer in use. 'permanent' means that the maximum health of the Pawn is increased such that the health provided by the pickup will fit in and the maximum health stays that way.64 - The @b health The amount of health that (in a way dependent on the other parameters) is transfered to the Pawn. 65 - The @b activation @b type It can be chosen to be either 'immediate' or 'onUse'. The activation type essentially (as indicated by the name) defines when the health is transfered, either immediately after being picked up or only after the player uses it. 66 - The @b duration @b type It can be chosen to be either 'once' or 'continuous'. For 'once' the specified health is transfered once to the Pawn, for 'continuous' the set health is transfered over a span of time at a rate defined by the health rate parameter. 67 - The @b health @b type The health type can be chosen to be 'limited', 'temporary' or 'permanent'. 'limited' means that the health is increased only to the maximum health of the Pawn. 'temporary' means that the maximum health is temporarily elevated but will be set back as soon as the pickup is no longer in use. 'permanent' means that the maximum health of the Pawn is increased such that the health provided by the pickup will fit in and the maximum health stays that way. 68 68 @author 69 69 Damian 'Mozork' Frick -
code/trunk/src/modules/pickup/items/InvisiblePickup.h
r7456 r7493 50 50 A pickup that makes the Pawn invisible. 51 51 There are 2 parameters that can be chosen: 52 1) The activation type:It can be chosen to be either 'immediate' or 'onUse'. The activation type essentially (as indicated by the name) defines when the Pawn will be invisible, either immediately after being picked up or only after the player uses it.53 2) The duration type:It can be chosen how long the Pawn will be invisibel.52 - The @b activation @b type It can be chosen to be either 'immediate' or 'onUse'. The activation type essentially (as indicated by the name) defines when the Pawn will be invisible, either immediately after being picked up or only after the player uses it. 53 - The @b duration @b type It can be chosen how long the Pawn will be invisibel. 54 54 @author 55 55 Benedict Simlinger -
code/trunk/src/modules/pickup/items/MetaPickup.h
r7456 r7493 58 58 @brief 59 59 The MetaPickup is a pickup that can, depending on the parameter 'metaType', do different things. If the 'metaType' is set to 60 1) 'use', all the pickups, the PickupCarrier has, are immediately set to used upon pickup of the MetaPickup.61 2) 'drop', all the pickups, the PickupCarrier has, are immediately dropped upon pickup of the MetaPickup.62 3) 'destroy', all the pickups, the PickupCarrier has, are immediately destroyed upon pickup of the MetaPickup.63 4) 'destroyCarrier', the PickupCarrier is immediately destroyed upon pickup of the MetaPickup.60 - @b use All the pickups, the PickupCarrier has, are immediately set to used upon pickup of the MetaPickup. 61 - @b drop All the pickups, the PickupCarrier has, are immediately dropped upon pickup of the MetaPickup. 62 - @b destroy All the pickups, the PickupCarrier has, are immediately destroyed upon pickup of the MetaPickup. 63 - @b destroyCarrier The PickupCarrier is immediately destroyed upon pickup of the MetaPickup. 64 64 @author 65 65 Damian 'Mozork' Frick -
code/trunk/src/modules/pickup/items/ShieldPickup.h
r7456 r7493 51 51 A Pickup which can add a Shield to the Pawn. 52 52 53 1) The percentage: The percentage the shield takes from the damage dealt to a Pawn 54 2) The hit points: The amount of damage points a shield can teake before collapsing 55 3) The activation type: 'immediate' or 'onUse'. defines if the item is used when it's picked up or only after the player chooses to use it. 56 4) The duration: the activation time of the pickup. 53 There are 4 parameters that can be cosen. 54 - The @b percentage The percentage the shield takes from the damage dealt to a Pawn 55 - The @b hit @b points The amount of damage points a shield can teake before collapsing 56 - The @b activation @b type 'immediate' or 'onUse'. defines if the item is used when it's picked up or only after the player chooses to use it. 57 - The @b duration the activation time of the pickup. 57 58 58 59 @author -
code/trunk/src/modules/pickup/items/SpeedPickup.h
r7456 r7493 50 50 A Pickup which can manipulate the Speed of a Pawn. 51 51 52 1) The speed multiplier: 53 The additional (forward) speed: 54 2) The activation type: 'immediate' or 'onUse'. defines if the item is used when it's picked up or only after the player chooses to use it. 55 4) The duration: the activation time of the pickup. 52 There are 4 parameters that can be cosen: 53 - The @b speed @b multiplier 54 - The @b additional (forward) @b speed 55 - The @b activation @b type 'immediate' or 'onUse'. defines if the item is used when it's picked up or only after the player chooses to use it. 56 - The @b duration The activation time of the pickup. 56 57 57 58 @author -
code/trunk/src/orxonox/interfaces/Pickupable.cc
r7163 r7493 68 68 Pickupable::~Pickupable() 69 69 { 70 COUT(4) << "Pickupable (" << this->getIdentifier()->getName() << ") (&" << this << ") destroyed." << std::endl;71 70 if(this->pickupIdentifier_ != NULL) 71 { 72 COUT(4) << "Pickupable (" << this->getIdentifier()->getName() << ") (&" << this << ") destroyed." << std::endl; 72 73 this->pickupIdentifier_->destroy(); 74 } 73 75 } 74 76 -
code/trunk/src/orxonox/worldentities/WorldEntity.cc
r7401 r7493 214 214 SUPER(WorldEntity, changedActivity); 215 215 216 for (std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++) 217 { 218 if(!this->isActive()) 219 { 220 (*it)->bActiveMem_ = (*it)->isActive(); 221 (*it)->setActive(this->isActive()); 222 } 223 else 224 { 225 (*it)->setActive((*it)->bActiveMem_); 216 if(GameMode::isMaster()) 217 { 218 for (std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++) 219 { 220 if(!this->isActive()) 221 { 222 (*it)->bActiveMem_ = (*it)->isActive(); 223 (*it)->setActive(this->isActive()); 224 } 225 else 226 { 227 (*it)->setActive((*it)->bActiveMem_); 228 } 226 229 } 227 230 } … … 236 239 SUPER(WorldEntity, changedVisibility); 237 240 238 for (std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++) 239 { 240 if(!this->isVisible()) 241 { 242 (*it)->bVisibleMem_ = (*it)->isVisible(); 243 (*it)->setVisible(this->isVisible()); 244 } 245 else 246 { 247 (*it)->setVisible((*it)->bVisibleMem_); 241 if(GameMode::isMaster()) 242 { 243 for (std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++) 244 { 245 if(!this->isVisible()) 246 { 247 (*it)->bVisibleMem_ = (*it)->isVisible(); 248 (*it)->setVisible(this->isVisible()); 249 } 250 else 251 { 252 (*it)->setVisible((*it)->bVisibleMem_); 253 } 248 254 } 249 255 }
Note: See TracChangeset
for help on using the changeset viewer.