Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 14, 2014, 8:25:08 PM (11 years ago)
Author:
noep
Message:

Cleaned up code. Added console command "ModularSpaceShip killshippart [string]" which allows manual destruction of a ShipPart by name. Added more functionality to PartDestructionEvents.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/modularships/src/orxonox/items/PartDestructionEvent.h

    r10053 r10055  
    3838namespace orxonox // tolua_export
    3939{ // tolua_export
     40    /**
     41        @brief
     42            In order to assign attached entities to a ShipPart, a ShipPart with the same name as the corresponding entity needs to be created in the <parts> tag.
     43            Here is a (primitive) example of a ModularSpaceShip with ShipParts and PartDestructionEvents defined in XML:
     44            @code
     45            <ModularSpaceShip
     46                ...
     47                >
     48                    <attached>
     49                        <StaticEntity name="generator"  . . .  />
     50                        <StaticEntity name="tail" . . . />
     51                    </attached>
     52                    <parts>
     53                        <ShipPart name="generator" . . . >
     54                            <destructionevents>
     55                                <PartDestructionEvent targetType="ship" targetParam="boostpowerrate" operation="-" value="0.5" message="Your boost-regeneration is reduced!" />
     56                            </destructionevents>
     57                        </ShipPart>
     58                        <ShipPart name="tail" . . . >
     59                            <destructionevents>
     60                                <PartDestructionEvent ... />
     61                            </destructionevents>
     62                        </ShipPart>
     63                    </parts>
     64                    <engines>
     65                        <Engine />
     66                        <Engine />
     67                    </engines>
     68                </ModularSpaceShip>
     69            @endcode
     70
     71        @author
     72            Fabian 'x3n' Landau, Noe Pedrazzini
     73        */
    4074    class _OrxonoxExport PartDestructionEvent // tolua_export
    4175        : public Item
     
    4478        public:
    4579
     80            /**
     81                @brief
     82                    List of all allowed parameters.
     83                */
    4684            enum TargetParam
    4785            {
     
    5088                shieldabsorption,
    5189                shieldrechargerate,
     90                boostpower,         // Amount of available boost
     91                boostpowerrate,     // Recharge-rate of boost
     92                boostfactor,
     93                speedfront,
     94                accelerationfront,
    5295                null
    5396            };
     
    85128                { return this->operation_; }
    86129
     130            void setMessage(std::string msg);
     131            inline std::string getMessage()
     132                { return this->message_; }
     133
    87134            float operate(float input);
    88135
     
    95142        private:
    96143
    97             ShipPart* parent_;
    98             bool valid_;
     144            ShipPart* parent_;          //!< Pointer to the ShipPart this event belongs to
     145            bool valid_;                //!< Whether this event is valid or not.
    99146
    100             std::string targetType_;
    101             std::string targetName_;
    102             TargetParam targetParam_;
    103             std::string operation_;
     147            std::string targetType_;    //!< The type of the target. (ship weapon engine)
     148            std::string targetName_;    //!< The name of the target.
     149            TargetParam targetParam_;   //!< The parameter to be modified
     150            std::string operation_;     //!< The operation to be applied
     151            float value_;               //!< The value used to do the operation
     152            std::string message_;       //!< The message which is shown in chat when the event is executed.
    104153
    105             float value_;
    106154
    107155
Note: See TracChangeset for help on using the changeset viewer.