DayZ 1.24
Loading...
Searching...
No Matches
Events.c
Go to the documentation of this file.
1
29
30
35{
39
44 WeaponEvents GetAnimEvent() { return -1; }
47 {
48 int animEvent = GetAnimEvent() & 0x0000ffff;
49 int evShl = m_eventID << 16;
50 return evShl | animEvent;
51 }
52
55 {
57 ctx.Write(packedType);
58 ctx.Write(m_player);
59 ctx.Write(m_magazine);
60 }
61
62 string DumpToString()
63 {
64 string res = "{ WpnEv id=" + typename.EnumToString(WeaponEventID, GetEventID());
65 res = res + " pl=" + Object.GetDebugName(m_player);
66 res = res + " mag=" + Object.GetDebugName(m_magazine);
67 res = res + " }";
68 return res;
69 }
70};
71
74class WeaponEventMechanism extends WeaponEventBase
75{
76 void WeaponEventMechanism(DayZPlayer p = NULL, Magazine m = NULL) { m_eventID = WeaponEventID.MECHANISM; }
77};
80class WeaponEventTrigger extends WeaponEventBase
81{
82 void WeaponEventTrigger(DayZPlayer p = NULL, Magazine m = NULL) { m_eventID = WeaponEventID.TRIGGER; }
83};
86class WeaponEventTriggerToJam extends WeaponEventBase
87{
88 void WeaponEventTriggerToJam(DayZPlayer p = NULL, Magazine m = NULL) { m_eventID = WeaponEventID.TRIGGER_JAM; }
89};
92class WeaponEventTriggerAutoStart extends WeaponEventBase
93{
94 void WeaponEventTriggerAutoStart(DayZPlayer p = NULL, Magazine m = NULL) { m_eventID = WeaponEventID.TRIGGER_AUTO_START; }
95};
98class WeaponEventTriggerAutoEnd extends WeaponEventBase
99{
100 void WeaponEventTriggerAutoEnd(DayZPlayer p = NULL, Magazine m = NULL) { m_eventID = WeaponEventID.TRIGGER_AUTO_END; }
101};
104class WeaponEventLoad1Bullet extends WeaponEventBase
105{
106 void WeaponEventLoad1Bullet(DayZPlayer p = NULL, Magazine m = NULL) { m_eventID = WeaponEventID.LOAD1_BULLET; }
107};
110class WeaponEventContinuousLoadBulletStart extends WeaponEventBase
111{
112 void WeaponEventContinuousLoadBulletStart(DayZPlayer p = NULL, Magazine m = NULL) { m_eventID = WeaponEventID.CONTINUOUS_LOADBULLET_START; }
113};
116class WeaponEventContinuousLoadBulletEnd extends WeaponEventBase
117{
118 void WeaponEventContinuousLoadBulletEnd(DayZPlayer p = NULL, Magazine m = NULL) { m_eventID = WeaponEventID.CONTINUOUS_LOADBULLET_END; }
119};
122class WeaponEventUnjam extends WeaponEventBase
123{
124 void WeaponEventUnjam(DayZPlayer p = NULL, Magazine m = NULL) { m_eventID = WeaponEventID.UNJAM; }
125};
128class WeaponEventAttachMagazine extends WeaponEventBase
129{
130 void WeaponEventAttachMagazine(DayZPlayer p = NULL, Magazine m = NULL) { m_eventID = WeaponEventID.ATTACH_MAGAZINE; }
131};
134class WeaponEventUnjammingFailedTimeout extends WeaponEventBase
135{
136 void WeaponEventUnjammingFailedTimeout(DayZPlayer p = NULL, Magazine m = NULL) { m_eventID = WeaponEventID.UNJAMMING_FAILED_TIMEOUT; }
137};
140class WeaponEventUnjammingTimeout extends WeaponEventBase
141{
142 void WeaponEventUnjammingTimeout(DayZPlayer p = NULL, Magazine m = NULL) { m_eventID = WeaponEventID.UNJAMMING_TIMEOUT; }
143};
147class WeaponEventDetachMagazine extends WeaponEventBase
148{
151
153 {
155 super.ReadFromContext(ctx);
156 m_dst.ReadFromContext(ctx);
157 }
159 {
160 super.WriteToContext(ctx);
161 m_dst.WriteToContext(ctx);
162 }
163};
166class WeaponEventSwapMagazine extends WeaponEventBase
167{
170
172 {
173 super.ReadFromContext(ctx);
175 m_dst.ReadFromContext(ctx);
176 }
178 {
179 super.WriteToContext(ctx);
180 m_dst.WriteToContext(ctx);
181 }
182};
185class WeaponEventHumanCommandActionFinished extends WeaponEventBase
186{
187 void WeaponEventHumanCommandActionFinished(DayZPlayer p = NULL, Magazine m = NULL) { m_eventID = WeaponEventID.HUMANCOMMAND_ACTION_FINISHED; }
188};
191class WeaponEventHumanCommandActionAborted extends WeaponEventBase
192{
193 void WeaponEventHumanCommandActionAborted(DayZPlayer p = NULL, Magazine m = NULL) { m_eventID = WeaponEventID.HUMANCOMMAND_ACTION_ABORTED; }
194};
197class WeaponEventReloadTimeout extends WeaponEventBase
198{
199 void WeaponEventReloadTimeout(DayZPlayer p = NULL, Magazine m = NULL) { m_eventID = WeaponEventID.RELOAD_TIMEOUT; }
200};
203class WeaponEventDryFireTimeout extends WeaponEventBase
204{
205 void WeaponEventDryFireTimeout(DayZPlayer p = NULL, Magazine m = NULL) { m_eventID = WeaponEventID.DRY_FIRE_TIMEOUT; }
206};
207
210class WeaponEventSetNextMuzzleMode extends WeaponEventBase
211{
212 void WeaponEventSetNextMuzzleMode(DayZPlayer p = NULL, Magazine m = NULL) { m_eventID = WeaponEventID.SET_NEXT_MUZZLE_MODE; }
213};
214
216{
218 void WeaponEventAnimation(DayZPlayer p = NULL, Magazine m = NULL) { m_eventID = WeaponEventID.ANIMATION_EVENT; }
219 override int GetAnimEvent() { return m_type; }
220};
221
224{
225 switch (id)
226 {
227 case WeaponEventID.UNKNOWN: return null;
228 case WeaponEventID.MECHANISM: return new WeaponEventMechanism(p, m);
229 case WeaponEventID.TRIGGER: return new WeaponEventTrigger(p, m);
230 case WeaponEventID.TRIGGER_JAM: return new WeaponEventTriggerToJam(p, m);
231 case WeaponEventID.LOAD1_BULLET: return new WeaponEventLoad1Bullet(p, m);
232 case WeaponEventID.CONTINUOUS_LOADBULLET_START: return new WeaponEventContinuousLoadBulletStart(p, m);
233 case WeaponEventID.CONTINUOUS_LOADBULLET_END: return new WeaponEventContinuousLoadBulletEnd(p, m);
234 case WeaponEventID.UNJAM: return new WeaponEventUnjam(p, m);
235 case WeaponEventID.ATTACH_MAGAZINE: return new WeaponEventAttachMagazine(p, m);
236 case WeaponEventID.UNJAMMING_FAILED_TIMEOUT: return new WeaponEventUnjammingFailedTimeout(p, m);
237 case WeaponEventID.UNJAMMING_TIMEOUT: return new WeaponEventUnjammingTimeout(p, m);
238 case WeaponEventID.DETACH_MAGAZINE: return new WeaponEventDetachMagazine(p, m);
239 case WeaponEventID.SWAP_MAGAZINE: return new WeaponEventSwapMagazine(p, m);
240 case WeaponEventID.HUMANCOMMAND_ACTION_FINISHED: return new WeaponEventHumanCommandActionFinished(p, m);
241 case WeaponEventID.HUMANCOMMAND_ACTION_ABORTED: return new WeaponEventHumanCommandActionAborted(p, m);
242 case WeaponEventID.RELOAD_TIMEOUT: return new WeaponEventReloadTimeout(p, m);
243 case WeaponEventID.DRY_FIRE_TIMEOUT: return new WeaponEventDryFireTimeout(p, m);
244 case WeaponEventID.SET_NEXT_MUZZLE_MODE: return new WeaponEventSetNextMuzzleMode(p, m);
245 case WeaponEventID.ANIMATION_EVENT: return WeaponAnimEventFactory(aetype, p, m);
246 }
247 return NULL;
248}
249
252{
253 switch (type)
254 {
255 case WeaponEvents.ATTACHMENT_HIDE: return new WeaponEventAnimAttachmentHide(p, m);
256 case WeaponEvents.ATTACHMENT_SHOW: return new WeaponEventAnimAttachmentShow(p, m);
257 case WeaponEvents.BULLET_EJECT: return new WeaponEventAnimBulletEject(p, m);
258 case WeaponEvents.BULLET_HIDE: return new WeaponEventAnimBulletHide(p, m);
259 case WeaponEvents.BULLET_HIDE2: return new WeaponEventAnimBulletHide2(p, m);
260 case WeaponEvents.BULLET_IN_CHAMBER: return new WeaponEventAnimBulletInChamber(p, m);
261 case WeaponEvents.BULLET_IN_MAGAZINE: return new WeaponEventAnimBulletInMagazine(p, m);
262 case WeaponEvents.BULLET_SHOW: return new WeaponEventAnimBulletShow(p, m);
263 case WeaponEvents.BULLET_SHOW2: return new WeaponEventAnimBulletShow2(p, m);
264 case WeaponEvents.CANUNJAM_END: return new WeaponEventAnimCanUnjamEnd(p, m);
265 case WeaponEvents.CANUNJAM_START: return new WeaponEventAnimCanUnjamStart(p, m);
266 case WeaponEvents.COCKED: return new WeaponEventAnimCocked(p, m);
267 case WeaponEvents.MAGAZINE_ATTACHED: return new WeaponEventAnimMagazineAttached(p, m);
268 case WeaponEvents.MAGAZINE_DETACHED: return new WeaponEventAnimMagazineDetached(p, m);
269 case WeaponEvents.MAGAZINE_HIDE: return new WeaponEventAnimMagazineHide(p, m);
270 case WeaponEvents.MAGAZINE_SHOW: return new WeaponEventAnimMagazineShow(p, m);
271 case WeaponEvents.SLIDER_OPEN: return new WeaponEventAnimSliderOpen(p, m);
272 case WeaponEvents.UNJAMMED: return new WeaponEventAnimUnjammed(p, m);
273 case WeaponEvents.HAMMER_UNCOCKED: return new WeaponEventAnimHammerUncocked(p, m);
274 case WeaponEvents.HAMMER_COCKED: return new WeaponEventAnimHammerCocked(p, m);
275 case WeaponEvents.CYLINDER_ROTATE: return new WeaponEventCylinderRotate(p, m);
276 //case WeaponEvents.: return new WeaponEventAnim(p, m);
277 }
278 return NULL;
279}
280
296
297class WeaponEventAnimAttachmentHide extends WeaponEventAnimation
298{
299 void WeaponEventAnimAttachmentHide(DayZPlayer p = NULL, Magazine m = NULL) { m_type = WeaponEvents.ATTACHMENT_HIDE; }
300};
301
302class WeaponEventAnimAttachmentShow extends WeaponEventAnimation
303{
304 void WeaponEventAnimAttachmentShow(DayZPlayer p = NULL, Magazine m = NULL) { m_type = WeaponEvents.ATTACHMENT_SHOW; }
305};
306
307class WeaponEventAnimBulletEject extends WeaponEventAnimation
308{
310 {
311 m_type = WeaponEvents.BULLET_EJECT;
312
313 // Particles for ejecting bullet casings
315
316 if (player)
317 {
318 ItemBase weapon = player.GetItemInHands();
319
320 if (weapon && weapon.GetOverheatingValue() > 0)
321 {
324
325 if (weapon_base)
326 suppressor = weapon_base.GetAttachedSuppressor();
327
328 ItemBase.PlayBulletCasingEjectParticles(weapon, "", weapon, suppressor, "CfgWeapons");
329 }
330 }
331 }
332};
333
334class WeaponEventCylinderRotate extends WeaponEventAnimation
335{
336 void WeaponEventCylinderRotate(DayZPlayer p = NULL, Magazine m = NULL) { m_type = WeaponEvents.CYLINDER_ROTATE; }
337};
338
339class WeaponEventAnimBulletHide extends WeaponEventAnimation
340{
342};
343
344class WeaponEventAnimBulletHide2 extends WeaponEventAnimation
345{
347};
348
349class WeaponEventAnimBulletInChamber extends WeaponEventAnimation
350{
351 void WeaponEventAnimBulletInChamber(DayZPlayer p = NULL, Magazine m = NULL) { m_type = WeaponEvents.BULLET_IN_CHAMBER; }
352};
353
354class WeaponEventAnimBulletInMagazine extends WeaponEventAnimation
355{
356 void WeaponEventAnimBulletInMagazine(DayZPlayer p = NULL, Magazine m = NULL) { m_type = WeaponEvents.BULLET_IN_MAGAZINE; }
357};
358
359class WeaponEventAnimBulletShow extends WeaponEventAnimation
360{
362};
363
364class WeaponEventAnimBulletShow2 extends WeaponEventAnimation
365{
367};
368
369class WeaponEventAnimCanUnjamEnd extends WeaponEventAnimation
370{
372};
373
374class WeaponEventAnimCanUnjamStart extends WeaponEventAnimation
375{
376 void WeaponEventAnimCanUnjamStart(DayZPlayer p = NULL, Magazine m = NULL) { m_type = WeaponEvents.CANUNJAM_START; }
377};
378
379class WeaponEventAnimCocked extends WeaponEventAnimation
380{
382};
383
384class WeaponEventAnimMagazineAttached extends WeaponEventAnimation
385{
386 void WeaponEventAnimMagazineAttached(DayZPlayer p = NULL, Magazine m = NULL) { m_type = WeaponEvents.MAGAZINE_ATTACHED; }
387};
388
389class WeaponEventAnimMagazineDetached extends WeaponEventAnimation
390{
391 void WeaponEventAnimMagazineDetached(DayZPlayer p = NULL, Magazine m = NULL) { m_type = WeaponEvents.MAGAZINE_DETACHED; }
392};
393
394class WeaponEventAnimMagazineHide extends WeaponEventAnimation
395{
397};
398
399class WeaponEventAnimMagazineShow extends WeaponEventAnimation
400{
402};
403
404class WeaponEventAnimSliderOpen extends WeaponEventAnimation
405{
407};
408
409class WeaponEventAnimUnjammed extends WeaponEventAnimation
410{
412};
413
414
415class WeaponEventAnimHammerUncocked extends WeaponEventAnimation
416{
417 void WeaponEventAnimHammerUncocked(DayZPlayer p = NULL, Magazine m = NULL) { m_type = WeaponEvents.HAMMER_UNCOCKED; }
418};
419
420class WeaponEventAnimHammerCocked extends WeaponEventAnimation
421{
423};
424
425/*
426 class WeaponEventAnim extends WeaponEventAnimation
427 {
428 void WeaponEventAnim (DayZPlayer p = NULL, Magazine m = NULL) { m_type = WeaponEvents.; }
429 };
430*/
ref InventoryLocation m_dst
WeaponEventBase WeaponAnimEventFactory(WeaponEvents type, DayZPlayer p=NULL, Magazine m=NULL)
creates animation system events
Definition Events.c:251
WeaponEventBase WeaponEventFactory(WeaponEventID id, int aetype, DayZPlayer p=NULL, Magazine m=NULL)
creates weapon fsm events
Definition Events.c:223
WeaponEventBase CreateWeaponEventFromContext(ParamsReadContext ctx)
Definition Events.c:281
WeaponEventID
identifier for events. mainly for rpc purposes
Definition Events.c:6
@ DRY_FIRE_TIMEOUT
Definition Events.c:25
@ TRIGGER
Definition Events.c:9
@ SET_NEXT_MUZZLE_MODE
Definition Events.c:26
@ CONTINUOUS_LOADBULLET_START
Definition Events.c:14
@ CONTINUOUS_LOADBULLET_END
Definition Events.c:15
@ TRIGGER_JAM
Definition Events.c:10
@ DETACH_MAGAZINE
Definition Events.c:20
@ MECHANISM
Definition Events.c:8
@ HUMANCOMMAND_ACTION_FINISHED
Definition Events.c:22
@ UNJAM
Definition Events.c:16
@ TRIGGER_AUTO_START
Definition Events.c:11
@ UNKNOWN
Definition Events.c:7
@ RELOAD_TIMEOUT
Definition Events.c:24
@ LOAD1_BULLET
Definition Events.c:13
@ UNJAMMING_TIMEOUT
Definition Events.c:19
@ SWAP_MAGAZINE
Definition Events.c:21
@ UNJAMMING_FAILED_TIMEOUT
Definition Events.c:18
@ ANIMATION_EVENT
Definition Events.c:27
@ TRIGGER_AUTO_END
Definition Events.c:12
@ ATTACH_MAGAZINE
Definition Events.c:17
@ HUMANCOMMAND_ACTION_ABORTED
Definition Events.c:23
InventoryLocation.
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
void WeaponEventAnimBulletInChamber(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:351
void WeaponEventAnimCanUnjamStart(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:376
void WeaponEventAnimBulletShow(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:361
void WeaponEventAnimAttachmentHide(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:299
void WeaponEventAnimMagazineHide(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:396
void WeaponEventAnimHammerCocked(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:422
void WeaponEventAnimCocked(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:381
void WeaponEventAnimBulletEject(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:309
void WeaponEventAnimUnjammed(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:411
void WeaponEventAnimBulletInMagazine(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:356
void WeaponEventAnimHammerUncocked(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:417
void WeaponEventAnimBulletHide(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:341
void WeaponEventAnimMagazineDetached(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:391
void WeaponEventAnimSliderOpen(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:406
void WeaponEventAnimCanUnjamEnd(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:371
void WeaponEventAnimBulletHide2(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:346
void WeaponEventAnimMagazineAttached(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:386
void WeaponEventAnimBulletShow2(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:366
void WeaponEventAnimAttachmentShow(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:304
void WeaponEventCylinderRotate(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:336
void WeaponEventAnimMagazineShow(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:401
signalize mechanism manipulation
Definition Events.c:35
Magazine m_magazine
Definition Events.c:38
string DumpToString()
Definition Events.c:62
void WeaponEventDetachMagazine(DayZPlayer p=NULL, Magazine m=NULL, InventoryLocation il=NULL)
Definition Events.c:150
void WeaponEventUnjam(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:124
void WeaponEventTrigger(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:82
void ReadFromContext(ParamsReadContext ctx)
Definition Events.c:53
int GetPackedType()
returns eventID in upper 16 bits and AnimEvent in lower 16 bits
Definition Events.c:46
override void WriteToContext(ParamsWriteContext ctx)
Definition Events.c:158
void WeaponEventAttachMagazine(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:130
ref InventoryLocation m_dst
Definition Events.c:149
void WeaponEventTriggerAutoEnd(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:100
void WeaponEventTriggerToJam(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:88
void WeaponEventBase(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:40
void WeaponEventMechanism(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:76
void WeaponEventContinuousLoadBulletEnd(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:118
void WriteToContext(ParamsWriteContext ctx)
Definition Events.c:54
DayZPlayer m_player
Definition Events.c:37
void WeaponEventDryFireTimeout(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:205
WeaponEventID GetEventID()
returns id from enum WeaponEventID
Definition Events.c:42
void WeaponEventHumanCommandActionFinished(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:187
void WeaponEventHumanCommandActionAborted(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:193
void WeaponEventUnjammingTimeout(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:142
void WeaponEventSetNextMuzzleMode(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:212
void WeaponEventSwapMagazine(DayZPlayer p=NULL, Magazine m=NULL, InventoryLocation il=NULL)
Definition Events.c:169
override int GetAnimEvent()
Definition Events.c:219
void WeaponEventReloadTimeout(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:199
WeaponEvents m_type
Definition Events.c:217
void WeaponEventLoad1Bullet(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:106
void WeaponEventContinuousLoadBulletStart(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:112
WeaponEvents GetAnimEvent()
returns animation event from anim engine,
Definition Events.c:44
override void ReadFromContext(ParamsReadContext ctx)
Definition Events.c:152
void WeaponEventUnjammingFailedTimeout(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:136
void WeaponEventTriggerAutoStart(DayZPlayer p=NULL, Magazine m=NULL)
Definition Events.c:94
void WeaponEventAnimation(DayZPlayer p=NULL, Magazine m=NULL)
animation event from Human.WeaponEvents
Definition Events.c:218
WeaponEvents
events
Definition human.c:943