DayZ 1.24
Loading...
Searching...
No Matches
gameLibComponents.c
Go to the documentation of this file.
1#ifdef COMPONENT_SYSTEM
2//Generic components from GameLib (script side of c++ classes)
3
4typedef int[] IEntityComponentSource;
5class IEntityComponentSource: BaseContainer
6{
7};
8
10enum TouchEvent
11{
12 ON_ENTER,
13 ON_STAY,
14 ON_EXIT
15};
16
18//TypeID MeshObjectTypeID;
19//TypeID HierarchyTypeID;
20//TypeID RigidBodyTypeID;
21//TypeID SphereGeometryTypeID;
22//TypeID BoxGeometryTypeID;
23
24
25class GenericComponent : Managed
26{
31 proto native int GetEventMask();
32
40 proto native int SetEventMask(IEntity owner, int mask);
41
48 proto native int ClearEventMask(IEntity owner, int mask);
49
53 proto native void Activate(IEntity owner);
54
58 proto native void Deactivate(IEntity owner);
59
64 proto native bool IsActive();
65
67 protected void GenericComponent(IEntityComponentSource src, IEntity ent);
68}
69
70class GenericComponentClass
71{
72 bool DependsOn(typename otherClass, TypeID otherTypeID) {}
73}
74
86class ScriptComponent : GenericComponent
87{
88 /*
89 Event when owner entity is touched
90 \param owner
91 Touched entity
92 \param extra
93 Bitmask of touch types TODO
94 */
95 protected void EOnTouch(IEntity owner, int extra);
96
103 protected void EOnInit(IEntity owner, int extra);
104
113 protected void EOnExtra(IEntity owner, int extra);
114
121 protected void EOnNotVisible(IEntity owner, int extra);
122
129 protected void EOnVisible(IEntity owner, int extra);
130
137 protected void EOnFrame(IEntity owner, float timeSlice);
138
145 protected void EOnPostFrame(IEntity owner, int extra);
146
153 protected void EOnAnimEvent(IEntity owner, AnimEvent extra);
154
161 protected void EOnSoundEvent(IEntity owner, SoundEvent extra);
162
169 protected void EOnPostSimulate(IEntity owner, float timeslice);
170
177 protected void EOnSimulate(IEntity owner, float timeslice);
178
186 protected void EOnJointBreak(IEntity owner, int extra);
194 protected void EOnPhysicsMove(IEntity owner, int extra);
195
202 protected void EOnContact(IEntity owner, Contact extra);
203
207 protected void EOnActivate(IEntity owner);
208
212 protected void EOnDeactivate(IEntity owner);
213
219 protected void OnComponentInsert(IEntity owner, ScriptComponent other);
220
226 protected void OnComponentRemove(IEntity owner, ScriptComponent other);
227
232 protected void OnDelete(IEntity owner);
233}
234
235typedef int[] SoundHandle;
236
237class SignalInput
238{
239 string m_name;
240 float m_value;
241
242 void SignalInput()
243 {
244 m_value = 0;
245 }
246};
247
248class BaseSoundComponent : GenericComponent
249{
250 /* Get list of 'events'. */
251 proto native int GetEventNames(out array<string> events);
252 /* Get list of 'signals. '*/
253 proto native int GetSignalNames(out array<string> signals);
254 /* Convert signal name to index. */
255 proto native int GetSignalIndex(string name);
256 /* Set signal value by 'name'. */
257 proto native void SetSignalValueName(string signal, float value);
258 /* Set signal value by 'index'. */
259 proto native void SetSignalValue(int index, float value);
260 /* Play 'event'. */
261 proto native SoundHandle Play(string name);
262 /* Play sounds based on triggers. */
263 proto native SoundHandle Update();
264 /* Terminate 'sound'. */
265 proto native void Terminate(SoundHandle handle);
266 /* Check if 'sound' is played. */
267 proto native bool IsPlayed(SoundHandle handle);
268 /* Validate handle. */
269 proto native bool IsHandleValid(SoundHandle handle);
270 /* Set sound position. */
271 proto native void SetTransform(vector[] transf);
272 /* Enable debug mode. */
273 proto native void SetDebug(bool value);
274};
275
276#endif
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
override void EOnTouch(IEntity other, int extra)
Definition EasterEgg.c:106
override void EOnContact(IEntity other, Contact extra)
Definition ItemBase.c:5827
override void EOnPostSimulate(IEntity other, float timeSlice)
bool IsActive()
void Deactivate(bool trigger=true)
void Activate()
EAnimPlayState Play()
override void EOnInit(IEntity other, int extra)
override void EOnFrame(IEntity other, float timeSlice)
TODO doc.
Definition EnScript.c:118
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
int[] TypeID
script representation for C++ RTTI types
Definition EnScript.c:127
proto native volatile void Update()
proto native void SetTransform(vector mat[4], bool immedUpdate=true)