Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
gamelibcomponents.c
Go to the documentation of this file.
1 #ifdef COMPONENT_SYSTEM
2 //Generic components from GameLib (script side of c++ classes)
3 
4 typedef int[] IEntityComponentSource;
5 class IEntityComponentSource: BaseContainer
6 {
7 };
8 
10 enum 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 
25 class 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 
70 class GenericComponentClass
71 {
72  bool DependsOn(typename otherClass, TypeID otherTypeID) {}
73 }
74 
86 class 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 
235 typedef int[] SoundHandle;
236 
237 class SignalInput
238 {
239  string m_name;
240  float m_value;
241 
242  void SignalInput()
243  {
244  m_value = 0;
245  }
246 };
247 
248 class 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
Play
ParticleSource Play(int particle_id, Object parent_obj, vector local_pos="0 0 0", vector local_ori="0 0 0")
Legacy function for backwards compatibility with 1.01 and below.
Definition: particlemanager.c:226
Activate
void Activate()
Definition: modifierbase.c:201
Managed
TODO doc.
Definition: enscript.c:117
SoundEvent
Definition: proto.c:39
EOnInit
protected override void EOnInit(IEntity other, int extra)
Definition: testframework.c:235
Deactivate
void Deactivate(bool trigger=true)
Definition: modifierbase.c:216
IEntity
Definition: enentity.c:164
EOnContact
override void EOnContact(IEntity other, Contact extra)
Definition: easteregg.c:112
vector
Definition: enconvert.c:105
Contact
Definition: enphysics.c:300
array< string >
Update
proto native volatile void Update()
Definition: playersoundmanager.c:125
EOnPostSimulate
override void EOnPostSimulate(IEntity other, float timeSlice)
Definition: land_underground_waterreservoir.c:166
name
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
EOnFrame
protected override void EOnFrame(IEntity other, float timeSlice)
Definition: testframework.c:240
EOnTouch
override void EOnTouch(IEntity other, int extra)
Definition: easteregg.c:106
AnimEvent
Definition: proto.c:33
IsActive
bool IsActive()
Definition: modifierbase.c:130
TypeID
int[] TypeID
script representation for C++ RTTI types
Definition: enscript.c:127
BaseContainer
Definition: enentity.c:5
SetTransform
proto native void SetTransform(vector mat[4], bool immedUpdate=true)