Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8454


Ignore:
Timestamp:
May 12, 2011, 1:17:38 PM (13 years ago)
Author:
anbueche
Message:

comments added

Location:
code/branches/portals
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/portals/data/levels/portals.oxw

    r8290 r8454  
    1010  include("stats.oxo")
    1111  include("templates/spaceshipAssff.oxt")
     12  include("templates/pickupRepresentationTemplates.oxt")
    1213  include("templates/lodInformation.oxt")
    1314?>
     
    2627  >
    2728
    28     <Template name=portalDefault>
     29    <Template name=PortalDefault>
    2930        <PortalEndPoint>
    3031            <attached>
    31                 <Billboard material="Examples/Flare" />
     32                <Billboard material="Portals/Default" />
    3233            </attached>
    3334        </PortalEndPoint>
    3435    </Template>
    3536
    36     <PortalEndPoint position="0,0,0" id="1" distance="40" target="MobileEntity" design="portalDefault" eventTemplate="portalEventTemplate" />
    37     <PortalEndPoint position="-400,0,0" id="2" distance="40" lookat="0,100,0" target="MobileEntity" design="portalDefault" />
     37    <PortalEndPoint position="0,0,0" id="1" distance="40" target="MobileEntity" design="PortalDefault"/>
     38    <PortalEndPoint position="-90,0,0" id="2" distance="40" target="MobileEntity" design="PortalDefault"/>
    3839    <PortalLink fromID="1" toID="2" />
    3940    <PortalLink fromID="2" toID="1" />
     41
     42    <PickupSpawner position="-100,0,0" triggerDistance="10" respawnTime="10" maxSpawnedItems="10">
     43      <pickup>
     44        <DronePickup template=dronepickup />
     45      </pickup>
     46    </PickupSpawner>
    4047
    4148    <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
  • code/branches/portals/src/modules/portals/PortalEndPoint.cc

    r8290 r8454  
    5353    bool PortalEndPoint::execute(bool bTriggered, BaseObject* trigger)
    5454    {
     55        if(!this->isActive())
     56            return true;
     57       
    5558        MultiTriggerContainer * cont = orxonox_cast<MultiTriggerContainer *>(trigger);
    5659        if(cont == 0)
     
    6467        }
    6568       
    66         if(this->getAttachedObjects().find(orxonox_cast<WorldEntity *>(originatingTrigger)) == this->getAttachedObjects().end())  // only necessary if events have the same name
    67             return true;
    68        
    6969        MobileEntity * entity = orxonox_cast<MobileEntity *>(cont->getData());
    7070        if(entity == 0)
     
    7373        if(bTriggered)
    7474        {
    75             if(this->recentlyJumpedOut_.find(entity) == this->recentlyJumpedOut_.end())  // only enter the portal if not recently jumped out of it
     75            if(this->recentlyJumpedOut_.find(entity) == this->recentlyJumpedOut_.end())  // only enter the portal if not just jumped out of it
    7676            {
    7777                PortalLink::use(entity, this);
     
    8989    {
    9090        this->recentlyJumpedOut_.insert(entity);
     91       
    9192        entity->setPosition(this->getWorldPosition());
    9293        entity->rotate(this->getWorldOrientation());
    9394        entity->setVelocity(this->getWorldOrientation() * entity->getVelocity());
     95        entity->setVelocity(entity->getVelocity() * 1.5);
    9496    }
    9597
  • code/branches/portals/src/modules/portals/PortalEndPoint.h

    r8290 r8454  
    2121            virtual ~PortalEndPoint();
    2222            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    23             inline void setTargets(const std::string & targets)
     23            inline void setTargets(const std::string & targets)                 //!< set types which are allowed to activate the PortalEndPoint
    2424            {
    2525                this->trigger_->addTargets(targets);
     
    2727           
    2828            void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
    29             static std::map<unsigned int, PortalEndPoint *> idMap_s; //!< maps integer id values to portalendpoints
     29            static std::map<unsigned int, PortalEndPoint *> idMap_s; //!< Maps the id of each PortalEndPoint to a pointer to that PortalEndPoint
    3030            inline void setID(unsigned int id)
    3131            {
     
    3737                return this->id_;
    3838            }
     39           
     40            /// \brief Set templateName_ (the name of the design Template) and add that Template to this Object
    3941            inline void setTemplate(const std::string & name)
    4042            {
     
    4244                this->addTemplate(name);
    4345            }
     46
     47            /// \brief Get the name of the attached design template
    4448            inline const std::string & getTemplate()
    4549            {
    4650                return this->templateName_;
    4751            }
     52
     53            /*! \brief This function is called each time the DistanceMultiTrigger of this PortalEndPoint changed
     54             * \param bTriggered true if the trigger was triggered on, false if the trigger has switched to off
     55             * \param trigger the MultiTriggerContainer containing the triggering BaseObject (and trigger_ the portal's MultiDistanceTrigger which we already know)
     56             *
     57             * if bTriggered is \c true the triggering entity enters this portal (if it is an entrance)
     58             * otherwise the triggering entity is removed from the set of entities who recently jumped out of this portal */
    4859            bool execute(bool bTriggered, BaseObject* trigger);
     60
     61            /*! \brief Let an Entity jump out of this portal no matter where it was before
     62             * \param entity The Entity which should jump out of this portal */
    4963            void jumpOut(MobileEntity * entity);
    5064        protected:
    5165           
    5266        private:
    53             static const std::string EVENTFUNCTIONNAME;
     67            static const std::string EVENTFUNCTIONNAME; //!< = "execute"
    5468           
    55             unsigned int id_;
    56             DistanceMultiTrigger * trigger_;
    57             std::string templateName_;
     69            unsigned int id_;            //!< the hopefully (depends on the writer of the levelfile) unique id, which is used to establish links between PortalEndPoints
     70            DistanceMultiTrigger * trigger_;      //!< the DistanceMultiTrigger which notices near entities of the defined type
     71            std::string templateName_;            //!< The name of the design template used for this endpoint
    5872
    5973            std::set<MobileEntity *> recentlyJumpedOut_; //!< Entities which recently jumped out of this EndPoint, hence they shouldn't be pulled in again if the endpoint is the beginning of a link
Note: See TracChangeset for help on using the changeset viewer.