Changeset 6906 for code/trunk
- Timestamp:
- May 17, 2010, 1:22:26 PM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/data/gui/scripts/PickupInventory.lua
r6750 r6906 74 74 75 75 local name = "orxonox/PickupInventory/Carrier" .. index 76 76 77 77 --Design parameters: 78 78 local imageHeight = 50 … … 86 86 box:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horizontalOffset), CEGUI.UDim(0, 0))) 87 87 box:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -horizontalOffset), CEGUI.UDim(1, 0))) 88 89 offset = offset+textHeight90 local title = winMgr:createWindow("MenuWidgets/StaticText", name .. "/Title")91 title:setText(carrier:getCarrierName())92 title:setSize(CEGUI.UVector2(CEGUI.UDim(1, 0), CEGUI.UDim(0, offset)))93 title:setProperty("FrameEnabled", "set:False")94 box:addChildWindow(title)95 88 96 89 local numPickups = orxonox.PickupManager:getInstance():getNumPickups(carrier) -
code/trunk/src/modules/objects/ObjectsPrereqs.h
r6864 r6906 87 87 class DistanceMultiTrigger; 88 88 class DistanceTrigger; 89 class DistanceTriggerBeacon; 89 90 class EventMultiTrigger; 90 91 class EventTrigger; -
code/trunk/src/modules/objects/triggers/CMakeLists.txt
r6864 r6906 3 3 DistanceMultiTrigger.cc 4 4 DistanceTrigger.cc 5 DistanceTriggerBeacon.cc 5 6 EventMultiTrigger.cc 6 7 EventTrigger.cc -
code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.cc
r6864 r6906 36 36 #include "core/CoreIncludes.h" 37 37 #include "core/XMLPort.h" 38 #include "DistanceTriggerBeacon.h" 38 39 39 40 namespace orxonox … … 51 52 52 53 this->distance_ = 100.0f; 54 this->targetName_ = BLANKSTRING; 55 this->singleTargetMode_ = false; 53 56 } 54 57 … … 70 73 71 74 XMLPortParam(DistanceMultiTrigger, "distance", setDistance, getDistance, xmlelement, mode); 75 XMLPortParam(DistanceMultiTrigger, "targetname", setTargetName, getTargetName, xmlelement, mode); 72 76 } 73 77 … … 128 132 continue; 129 133 134 // If the DistanceMultiTrigger is in single-target-mode. 135 if(this->singleTargetMode_) 136 { 137 // If the object that is a target is no DistanceTriggerBeacon, then the DistanceMultiTrigger can't be in single-target-mode. 138 if(!(*it)->isA(ClassIdentifier<DistanceTriggerBeacon>::getIdentifier())) 139 this->singleTargetMode_ = false; 140 // If the target name and the name of the DistancTriggreBeacon don't match. 141 else if(entity->getName().compare(this->targetName_) != 0) 142 continue; 143 } 144 130 145 Vector3 distanceVec = entity->getWorldPosition() - this->getWorldPosition(); 131 146 // If the object is in range. … … 136 151 continue; 137 152 153 // Change the entity to the parent of the DistanceTriggerBeacon (if in single-target-mode), which is the entity to which the beacon is attached. 154 if(this->singleTargetMode_) 155 entity = entity->getParent(); 156 138 157 // If no queue has been created, yet. 139 158 if(queue == NULL) -
code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.h
r6864 r6906 48 48 /** 49 49 @brief 50 The DistanceMultiTrigger is a trigger that triggers whenever an object (that is of the specified target type) is in a specified range of the DistanceMultiTrigger. 50 The DistanceMultiTrigger is a trigger that triggers whenever an object (that is of the specified target type) is in a specified range of the DistanceMultiTrigger. The object can be specified further by adding a DistanceTriggerBeacon (just attaching it) to the objects that can trigger this DistanceMultiTrigger and specify the name of the DistanceTriggerBeacon with the parameter targetname and only objects that hav a DistanceTriggerBeacon with that name attached will trigger the DistanceMultiTrigger. 51 51 @see MultiTrigger.h 52 52 For more information on MultiTriggers. … … 63 63 void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a DistanceMultiTrigger object through XML. 64 64 65 /** 66 @brief Set the target name of DistanceTriggerBeacons that triggers this DistanceMultiTrigger. 67 @param targename The name of the DistanceTriggerBeacon as a string. 68 */ 69 inline void setTargetName(const std::string& targetname) 70 { if(targetname.compare(BLANKSTRING) != 0) this->singleTargetMode_ = true; else this->singleTargetMode_ = false; this->targetName_ = targetname; } 71 /** 72 @brief Get the target name of the DistanceTriggerbeacon, that triggers this DistanceMultiTrigger. 73 @return Returns the target name as a string. 74 */ 75 inline const std::string& getTargetName(void) 76 { return this->targetName_; } 77 65 78 /** 66 79 @brief Set the distance at which the DistanceMultiTrigger triggers. … … 96 109 private: 97 110 float distance_; //!< The distance at which the DistanceMultiTrigger triggers. 111 std::string targetName_; //!< The target name, used in singleTargetMode. 112 bool singleTargetMode_; //!< To indicate whe the MultiDistanceTrigger is in single-target-mode. 113 98 114 std::map<WorldEntity*, WeakPtr<WorldEntity>* > range_; //!< The set of entities that currently are in range of the DistanceMultiTrigger. 99 115 -
code/trunk/src/modules/objects/triggers/DistanceTrigger.cc
r6417 r6906 32 32 #include "core/XMLPort.h" 33 33 #include "worldentities/pawns/Pawn.h" 34 #include "DistanceTriggerBeacon.h" 34 35 35 36 namespace orxonox … … 43 44 this->distance_ = 100; 44 45 this->targetMask_.exclude(Class(BaseObject)); 46 this->targetName_ = BLANKSTRING; 47 this->singleTargetMode_ = false; 45 48 this->setForPlayer(false); //!< Normally hasn't just players as targets. 46 49 } … … 55 58 56 59 XMLPortParam(DistanceTrigger, "distance", setDistance, getDistance, xmlelement, mode).defaultValues(100.0f); 57 XMLPortParamLoadOnly(DistanceTrigger, "target", addTargets, xmlelement, mode).defaultValues("ControllableEntity"); 60 XMLPortParamLoadOnly(DistanceTrigger, "target", addTargets, xmlelement, mode).defaultValues("Pawn"); 61 XMLPortParam(DistanceTrigger, "targetname", setTargetName, getTargetName, xmlelement, mode); 58 62 } 59 63 … … 84 88 85 89 //! Checks whether the target is (or is derived from) a ControllableEntity. 86 Identifier* controllableEntityId = Class(ControllableEntity); 87 if(targetId->isA(controllableEntityId)) 90 Identifier* pawnId = Class(Pawn); 91 Identifier* distanceTriggerBeaconId = Class(DistanceTriggerBeacon); 92 if(targetId->isA(pawnId) || targetId->isA(distanceTriggerBeaconId)) 88 93 { 89 94 this->setForPlayer(true); … … 124 129 continue; 125 130 131 if(this->singleTargetMode_) 132 { 133 if(!(*it)->isA(ClassIdentifier<DistanceTriggerBeacon>::getIdentifier())) 134 this->singleTargetMode_ = false; 135 else if(entity->getName().compare(this->targetName_) != 0) 136 continue; 137 } 138 126 139 Vector3 distanceVec = entity->getWorldPosition() - this->getWorldPosition(); 127 140 if (distanceVec.length() < this->distance_) … … 131 144 if(this->isForPlayer()) 132 145 { 146 147 if(this->singleTargetMode_) 148 entity = entity->getParent(); 149 133 150 Pawn* player = orxonox_cast<Pawn*>(entity); 134 151 this->setTriggeringPlayer(player); -
code/trunk/src/modules/objects/triggers/DistanceTrigger.h
r5781 r6906 52 52 void removeTargets(const std::string& targets); 53 53 54 inline void setTargetName(const std::string& targetname) 55 { if(targetname.compare(BLANKSTRING) != 0) this->singleTargetMode_ = true; else this->singleTargetMode_ = false; this->targetName_ = targetname; } 56 inline const std::string& getTargetName(void) 57 { return this->targetName_; } 58 54 59 inline void setDistance(float distance) 55 60 { this->distance_ = distance; } … … 67 72 private: 68 73 std::set<Ogre::Node*> targetSet_; 74 std::string targetName_; 69 75 float distance_; 76 bool singleTargetMode_; 70 77 71 78 }; -
code/trunk/src/modules/questsystem/QuestEffectBeacon.cc
r6859 r6906 99 99 bool QuestEffectBeacon::execute(bool b, BaseObject* trigger) 100 100 { 101 //TODO: Remove debug output.102 COUT(1) << "Debug: Calling execute on QuestEffectBeacon." << std::endl;103 104 101 if(!b) 105 102 { … … 108 105 if(!(this->isActive())) //!< If the QuestEffectBeacon is inactive it cannot be executed. 109 106 { 110 COUT( 3) << "The QuestEffectBeacon is inactive." << std::endl;107 COUT(4) << "The QuestEffectBeacon is inactive." << std::endl; 111 108 return false; 112 109 }
Note: See TracChangeset
for help on using the changeset viewer.