Debian Codegraph @

plugins/script/interfaces/FxManagerInterface.h

raw
1 #pragma once
2
3 #include "ifx.h"
4 #include "DeclarationManagerInterface.h"
5
6 namespace script
7 {
8
9 class ScriptFxAction
10 {
11 private:
12 fx::IFxAction::Ptr _action;
13
14 public:
15 ScriptFxAction(const fx::IFxAction::Ptr& action) :
16 _action(action)
17 {}
18
19 fx::IFxAction::Type getActionType()
20 {
21 return _action ? _action->getActionType() : fx::IFxAction::Type::Undefined;
22 }
23
24 std::string getName()
25 {
26 return _action ? _action->getName() : std::string();
27 }
28
29 float getDelayInSeconds()
30 {
31 return _action ? _action->getDelayInSeconds() : 0;
32 }
33
34 float getDurationInSeconds()
35 {
36 return _action ? _action->getDurationInSeconds() : 0;
37 }
38
39 bool getIgnoreMaster()
40 {
41 return _action ? _action->getIgnoreMaster() : false;
42 }
43
44 float getShakeTimeInSeconds()
45 {
46 return _action ? _action->getShakeTimeInSeconds() : 0;
47 }
48
49 float getShakeAmplitude()
50 {
51 return _action ? _action->getShakeAmplitude() : 0;
52 }
53
54 float getShakeDistance()
55 {
56 return _action ? _action->getShakeDistance() : 0;
57 }
58
59 bool getShakeFalloff()
60 {
61 return _action ? _action->getShakeFalloff() : false;
62 }
63
64 float getShakeImpulse()
65 {
66 return _action ? _action->getShakeImpulse() : 0;
67 }
68
69 bool getNoShadows()
70 {
71 return _action ? _action->getNoShadows() : false;
72 }
73
74 std::string getFireSiblingAction()
75 {
76 return _action ? _action->getFireSiblingAction() : std::string();
77 }
78
79 std::pair<float, float> getRandomDelay()
80 {
81 return _action ? _action->getRandomDelay() : std::pair<float, float>();
82 }
83
84 float getRotate()
85 {
86 return _action ? _action->getRotate() : 0;
87 }
88
89 bool getTrackOrigin()
90 {
91 return _action ? _action->getTrackOrigin() : false;
92 }
93
94 bool getRestart()
95 {
96 return _action ? _action->getRestart() : false;
97 }
98
99 float getFadeInTimeInSeconds()
100 {
101 return _action ? _action->getFadeInTimeInSeconds() : 0;
102 }
103
104 float getFadeOutTimeInSeconds()
105 {
106 return _action ? _action->getFadeOutTimeInSeconds() : 0;
107 }
108
109 float getDecalSize()
110 {
111 return _action ? _action->getDecalSize() : 0;
112 }
113
114 Vector3 getOffset()
115 {
116 return _action ? _action->getOffset() : Vector3(0,0,0);
117 }
118
119 Vector3 getAxis()
120 {
121 return _action ? _action->getAxis() : Vector3(0,0,0);
122 }
123
124 Vector3 getAngle()
125 {
126 return _action ? _action->getAngle() : Vector3(0,0,0);
127 }
128
129 std::string getUseLight()
130 {
131 return _action ? _action->getUseLight() : std::string();
132 }
133
134 std::string getUseModel()
135 {
136 return _action ? _action->getUseModel() : std::string();
137 }
138
139 std::string getAttachLight()
140 {
141 return _action ? _action->getAttachLight() : std::string();
142 }
143
144 std::string getAttachEntity()
145 {
146 return _action ? _action->getAttachEntity() : std::string();
147 }
148
149 std::string getLaunchProjectileDef()
150 {
151 return _action ? _action->getLaunchProjectileDef() : std::string();
152 }
153
154 std::string getLightMaterialName()
155 {
156 return _action ? _action->getLightMaterialName() : std::string();
157 }
158
159 Vector3 getLightRgbColour()
160 {
161 return _action ? _action->getLightRgbColour() : Vector3(0,0,0);
162 }
163
164 float getLightRadius()
165 {
166 return _action ? _action->getLightRadius() : 0;
167 }
168
169 std::string getModelName()
170 {
171 return _action ? _action->getModelName() : std::string();
172 }
173
174 std::string getDecalMaterialName()
175 {
176 return _action ? _action->getDecalMaterialName() : std::string();
177 }
178
179 bool getParticleTrackVelocity()
180 {
181 return _action ? _action->getParticleTrackVelocity() : false;
182 }
183
184 std::string getSoundShaderName()
185 {
186 return _action ? _action->getSoundShaderName() : std::string();
187 }
188
189 std::string getShockwaveDefName()
190 {
191 return _action ? _action->getShockwaveDefName() : std::string();
192 }
193 };
194
195 class ScriptFxDeclaration :
196 public ScriptDeclaration
197 {
198 private:
199 fx::IFxDeclaration::Ptr _fx;
200
201 public:
202 ScriptFxDeclaration(const fx::IFxDeclaration::Ptr& fx) :
203 ScriptDeclaration(fx),
204 _fx(fx)
205 {}
206
207 bool isNull()
208 {
209 return !_fx;
210 }
211
212 std::size_t getNumActions()
213 {
214 return _fx ? _fx->getNumActions() : 0;
215 }
216
217 ScriptFxAction getAction(std::size_t index)
218 {
219 return ScriptFxAction(_fx ? _fx->getAction(index) : fx::IFxAction::Ptr());
220 }
221
222 std::string getBindTo()
223 {
224 return _fx ? _fx->getBindTo() : std::string();
225 }
226 };
227
228 /**
229 * Exposes the GlobalFxManager interface to scripts
230 */
231 class FxManagerInterface :
232 public IScriptInterface
233 {
234 public:
235 // Mapped methods
236 ScriptFxDeclaration findFx(const std::string& name);
237
238 // IScriptInterface implementation
239 void registerInterface(py::module& scope, py::dict& globals) override;
240 };
241
242 }