Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/orxonox/items/PartDestructionEvent.h @ 12302

Last change on this file since 12302 was 11099, checked in by muemart, 9 years ago

Fix loads of doxygen warnings and other documentation issues

  • Property svn:eol-style set to native
File size: 5.4 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Noe Pedrazzini
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#ifndef _PartDestructionEvent_H__
30#define _PartDestructionEvent_H__
31
32#include "OrxonoxPrereqs.h"
33#include "Item.h"
34
35#include <string>
36
37
38namespace orxonox // tolua_export
39{ // 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        */
74    class _OrxonoxExport PartDestructionEvent // tolua_export
75        : public Item
76    { // tolua_export
77
78        public:
79
80            /**
81                @brief
82                    List of all allowed parameters.
83            */
84            enum class TargetParam
85            {
86                shieldhealth,
87                maxshieldhealth,
88                shieldabsorption,
89                shieldrechargerate,
90                boostpower,         // Amount of available boost
91                boostpowerrate,     // Recharge-rate of boost
92                rotationthrust,
93                boostfactor,
94                speedfront,
95                accelerationfront,
96                null
97            };
98
99            PartDestructionEvent(Context* context);
100            virtual ~PartDestructionEvent();
101
102            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
103
104            void execute();
105
106            inline void setValid(bool valid)
107                { this->valid_ = valid; }
108            inline bool isValid()
109                { return this->valid_; }
110
111            void setParent(ShipPart* parent);
112            inline ShipPart* getParent()
113                { return this->parent_; }
114
115            void setTargetType(std::string type);
116            inline std::string getTargetType()
117                { return this->targetType_; }
118
119            void setTargetName(std::string name);
120            inline std::string getTargetName()
121                { return this->targetName_; }
122
123            void setTargetParam(std::string param);
124            inline std::string getTargetParam()
125                { return this->targetName_; }
126
127            void setOperation(std::string operation);
128            inline std::string getOperation()
129                { return this->operation_; }
130
131            void setMessage(std::string msg);
132            inline std::string getMessage()
133                { return this->message_; }
134
135            float operate(float input);
136
137            void setEventValue(float value);
138            inline float getEventValue()
139                { return this->value_; }
140
141        protected:
142
143        private:
144
145            ShipPart* parent_;          //!< Pointer to the ShipPart this event belongs to
146            bool valid_;                //!< Whether this event is valid or not.
147
148            std::string targetType_;    //!< The type of the target. (ship weapon engine)
149            std::string targetName_;    //!< The name of the target.
150            TargetParam targetParam_;   //!< The parameter to be modified
151            std::string operation_;     //!< The operation to be applied
152            float value_;               //!< The value used to do the operation
153            std::string message_;       //!< The message which is shown in chat when the event is executed.
154
155
156
157    }; // tolua_export
158} // tolua_export
159
160#endif /* _PartDestructionEvent_H__ */
Note: See TracBrowser for help on using the repository browser.