Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
boatscript.c
Go to the documentation of this file.
8
9enum EBoatOperationalState
10{
11 OK = 0,
12 RUINED = 1,
15}
16
17enum EBoatEngineSoundState
18{
23 STOP_NO_FUEL
24}
25
26class BoatScriptOwnerState : BoatOwnerState
27{
28};
29
31{
32};
33
34#ifdef DIAG_DEVELOPER
35BoatScript _boat;
36#endif
37
41class BoatScript : Boat
42{
43 protected const int DECAY_PLAYER_RANGE = 300; // when a player is found within this range, decay is deactivated
44 protected const int DECAY_FLAG_RANGE = 100; // when a boat is parked around a territoryflag, decay is deactivated
45 protected const float DECAY_TICK_FREQUENCY = 10; // seconds
46 protected const float DECAY_DAMAGE = 0.017;
47 protected const float DECAY_FLIPPED_MULT = 4;
48
49 protected const float SOUND_ENGINE_FADE = 0.2;
50 protected const float SPLASH_THRESHOLD_CONDITION = 0.08; // diff between sea surface and propeller pos which determines if the splash should happen
51 protected const float SPLASH_THRESHOLD = 0.18; // diff between sea surface and propeller pos which determines when the splash happens
52
55 private bool m_ActionsInitialized;
56
58 protected float m_MomentumPrevTick;
60 protected ref Timer m_DecayTimer;
61
62 // particles
63 protected bool m_UpdateParticles;
65
66 // sounds
67 protected bool m_SplashIncoming; // boat is high enough for the splash to trigger when it falls back down to sea level
69 protected bool m_PlaySoundImpactLight;
70 protected bool m_PlaySoundImpactHeavy;
71 protected bool m_PlaySoundPushBoat;
72 protected bool m_IsEngineSoundFading;
73 protected bool m_EngineFadeDirection; // true>in | false>out
74 protected float m_EngineFadeTime;
75 protected string m_SoundImpactLight;
76 protected string m_SoundImpactHeavy;
77 protected string m_SoundPushBoat;
78 protected string m_SoundWaterSplash;
79 protected string m_SoundEngineStart;
80 protected string m_SoundEngineStop;
81 protected string m_SoundEngineStartNoFuel;
82 protected string m_SoundEngineStopNoFuel;
83
84 // caches to avoid multiple triggers
88 protected ref EffectSound m_SoundEngineEffectDeletion; // hold engine sound which is being stopped & deleted while another is starting
89
91 {
92#ifdef DIAG_DEVELOPER
93 _boat = this;
94#endif
95
96 SetEventMask(EntityEvent.POSTSIMULATE);
97 SetEventMask(EntityEvent.FRAME);
98
101
102 RegisterNetSyncVariableBool("m_PlaySoundEngineStopNoFuel");
103 RegisterNetSyncVariableBool("m_PlaySoundPushBoat");
104 RegisterNetSyncVariableBoolSignal("m_PlaySoundImpactLight");
105 RegisterNetSyncVariableBoolSignal("m_PlaySoundImpactHeavy");
106
107 m_SoundImpactHeavy = "boat_01_hit_light_SoundSet";
108 m_SoundImpactLight = "boat_01_hit_heavy_SoundSet";
109 m_SoundPushBoat = "boat_01_push_SoundSet";
110 m_SoundWaterSplash = "boat_01_splash_SoundSet";
111 m_SoundEngineStart = "boat_01_engine_start_SoundSet";
112 m_SoundEngineStop = "boat_01_engine_stop_SoundSet";
113 m_SoundEngineStartNoFuel = "boat_01_engine_start_no_fuel_SoundSet";
114 m_SoundEngineStopNoFuel = "boat_01_engine_stop_no_fuel_SoundSet";
115
116 if (g_Game.IsServer())
117 {
119 m_DecayTimer.Run(DECAY_TICK_FREQUENCY, this, "DecayHealthTick", NULL, true);
120 }
121
122 if (g_Game.IsDedicatedServer())
123 return;
124
129
130 if (MemoryPointExists("ptcFxFront"))
131 m_WaterEffects[EBoatEffects.PTC_FRONT].AttachTo(this, GetMemoryPointPos("ptcFxFront"));
132
133 if (MemoryPointExists("ptcFxBack"))
134 m_WaterEffects[EBoatEffects.PTC_BACK].AttachTo(this, GetMemoryPointPos("ptcFxBack"));
135
136 if (MemoryPointExists("ptcFxSide1"))
137 m_WaterEffects[EBoatEffects.PTC_SIDE_L].AttachTo(this, GetMemoryPointPos("ptcFxSide1"));
138
139 if (MemoryPointExists("ptcFxSide2"))
140 m_WaterEffects[EBoatEffects.PTC_SIDE_R].AttachTo(this, GetMemoryPointPos("ptcFxSide2"));
141 }
142
144 {
145 if (m_DecayTimer)
146 m_DecayTimer.Stop();
147
148 #ifndef SERVER
150 #endif
151 }
152
153 override void EEDelete(EntityAI parent)
154 {
155 if (!g_Game.IsDedicatedServer())
157 }
158
160 {
162 if (!m_InputActionMap)
163 {
165 m_InputActionMap = iam;
166 SetActions();
167 m_BoatTypeActionsMap.Insert(this.Type(), m_InputActionMap);
168 }
169 }
170
171 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
172 {
174 {
177 }
178
179 actions = m_InputActionMap.Get(action_input_type);
180 }
181
182 override bool DisableVicinityIcon()
183 {
184 return true;
185 }
186
187 override string GetVehicleType()
188 {
189 return "VehicleTypeBoat";
190 }
191
192 override bool IsInventoryVisible()
193 {
194 return (g_Game.GetPlayer() && (!g_Game.GetPlayer().GetCommand_Vehicle() || g_Game.GetPlayer().GetCommand_Vehicle().GetTransport() == this));
195 }
196
198 {
199 return 4.5;
200 }
201
203 {
204 return "0 1.4 0";
205 }
206
207 override int GetAnimInstance()
208 {
209 return VehicleAnimInstances.ZODIAC;
210 }
211
216
217 override bool CrewCanGetThrough(int posIdx)
218 {
219 return true;
220 }
221
222 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
223 {
224 return true;
225 }
226
227 override bool CanReachSeatFromDoors(string pSeatSelection, vector pFromPos, float pDistance = 1.0)
228 {
229 return true;
230 }
231
232 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
233 {
234 return true;
235 }
236
237 override bool IsAreaAtDoorFree(int currentSeat, float maxAllowedObjHeight, inout vector extents, out vector transform[4])
238 {
239 return super.IsAreaAtDoorFree(currentSeat, maxAllowedObjHeight, extents, transform);
240 }
241
247 override bool OnBeforeEngineStart()
248 {
249 EBoatOperationalState state = CheckOperationalRequirements();
250 return state == EBoatOperationalState.OK;
251 }
252
253 // Whether the car engine can be started
255 {
256 int state = EBoatOperationalState.OK;
257
258 EntityAI item = null;
259
260 if (GetHealthLevel("") >= GameConstants.STATE_RUINED || GetHealthLevel("Engine") >= GameConstants.STATE_RUINED)
261 {
262 state |= EBoatOperationalState.RUINED;
263 }
264
265 if (GetFluidFraction(BoatFluid.FUEL) <= 0)
266 {
267 state |= EBoatOperationalState.NO_FUEL;
268 }
269
270 if (IsVitalSparkPlug())
271 {
272 item = FindAttachmentBySlotName("SparkPlug");
273 if (!item || (item && item.IsRuined()))
274 state |= EBoatOperationalState.NO_IGNITER;
275 }
276
277 return state;
278 }
279
281 {
282 EBoatOperationalState state = CheckOperationalRequirements();
283
284 if (state == EBoatOperationalState.RUINED)
285 {
286 return;
287 }
288
289 if (state & EBoatOperationalState.NO_IGNITER)
290 {
291 HandleEngineSound(EBoatEngineSoundState.START_NO_FUEL);
292 return;
293 }
294
295 if (state & EBoatOperationalState.NO_FUEL)
296 {
297 HandleEngineSound(EBoatEngineSoundState.START_NO_FUEL);
298 return;
299 }
300 }
301
302 override void OnEngineStart()
303 {
304 super.OnEngineStart();
305
306 if (g_Game.IsDedicatedServer())
307 return;
308
309 FadeEngineSound(true);
310 HandleEngineSound(EBoatEngineSoundState.START_OK);
311 ClearWaterEffects(); // in case they are still active
312 }
313
314 override void OnEngineStop()
315 {
316 super.OnEngineStop();
317
318 if (g_Game.IsDedicatedServer())
319 return;
320
321 FadeEngineSound(false);
322 HandleEngineSound(EBoatEngineSoundState.STOP_OK);
323
324 vector mat[4];
325 dBodyGetWorldTransform(this, mat);
326 vector pos = mat[3] + VectorToParent(PropellerGetPosition());
327
328 if (g_Game.GetWaterDepth(pos) < 0) // stop instantly
330 else
331 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(StopParticleUpdate, 3000);
332 }
333
334 override void EEOnCECreate()
335 {
336 float maxVolume = GetFluidCapacity(BoatFluid.FUEL);
337 float amount = Math.RandomFloat(0.0, maxVolume * 0.35);
338
339 Fill(BoatFluid.FUEL, amount);
340 }
341
342 override void OnInput(float dt)
343 {
344 super.OnInput(dt);
345 }
346
347 override void EOnPostSimulate(IEntity other, float timeSlice)
348 {
349 if (!IsProxy())
350 {
351 if (EngineIsOn())
352 {
353 if (GetFluidFraction(BoatFluid.FUEL) <= 0)
354 {
355 if (g_Game.IsServer())
356 {
358 SetSynchDirty();
360 }
361
362 EngineStop();
363 }
364 }
365 }
366
367 if (g_Game.IsServer())
368 {
371 m_MomentumPrevTick = GetMomentum();
372 }
373
374 if (!g_Game.IsDedicatedServer())
375 {
376 if (EngineIsOn())
377 m_UpdateParticles = true;
378
381
382 }
383 }
384
385 override void EOnSimulate(IEntity other, float dt)
386 {
387 if (!IsProxy())
388 {
389 if (EngineIsOn())
390 {
391 vector mat[4];
392 dBodyGetWorldTransform(this, mat);
393 vector pos = mat[3] + VectorToParent(PropellerGetPosition());
394
395 if (g_Game.GetWaterDepth(pos) < -0.2)
396 EngineStop();
397 }
398 }
399 }
400
401 override void EOnFrame(IEntity other, float timeSlice)
402 {
403 if (!g_Game.IsDedicatedServer())
404 {
406 UpdateParticles(timeSlice);
407
409 {
410 m_EngineFadeTime -= timeSlice;
411 if (m_EngineFadeTime < 0)
412 m_IsEngineSoundFading = false;
413 }
414 }
415 }
416
418 override void OnContact(string zoneName, vector localPos, IEntity other, Contact data)
419 {
420 if (g_Game.IsServer())
421 {
422 if (m_ContactData)
423 return;
424
425 float momentumDelta = GetMomentum() - m_MomentumPrevTick;
426 float dot = vector.Dot(m_VelocityPrevTick.Normalized(), GetVelocity(this).Normalized());
427 if (dot < 0)
428 momentumDelta = m_MomentumPrevTick;
429
431 m_ContactData.SetData(localPos, other, momentumDelta); // change to local pos
432 }
433
434 if (!IsProxy())
435 {
436 if (EngineIsOn() && !CheckOperationalState())
437 EngineStop();
438 }
439 }
440
441 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
442 {
443 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
444
445 if (!IsProxy())
446 {
447 if (EngineIsOn() && !CheckOperationalState())
448 EngineStop();
449 }
450 }
451
453 {
454 super.OnVariablesSynchronized();
455
457 {
458 EffectSound impactHeavy;
461 }
462
464 {
465 EffectSound impactLight;
468 }
469
472 else if (m_SoundPushBoatEffect && m_SoundPushBoatEffect.IsPlaying())
474
476 {
477 HandleEngineSound(EBoatEngineSoundState.STOP_NO_FUEL);
479 }
480 }
481
482 protected override bool DetectFlipped(VehicleFlippedContext ctx)
483 {
484 if (!DetectFlippedUsingSurface(ctx, GameConstants.VEHICLE_FLIP_ANGLE_TOLERANCE))
485 return false;
486 return true;
487 }
488
489 override float OnSound(BoatSoundCtrl ctrl, float oldValue)
490 {
492 {
495 else
497
498 return oldValue;
499 }
500
501 return super.OnSound(ctrl, oldValue);
502 }
503
504 override void MarkCrewMemberUnconscious(int crewMemberIndex)
505 {
506 if (!IsAuthority())
507 return;
508
509 if (crewMemberIndex == DayZPlayerConstants.VEHICLESEAT_DRIVER)
510 {
511 EngineStop();
512 }
513 }
514
515 override void MarkCrewMemberDead(int crewMemberIndex)
516 {
517 if (!IsAuthority())
518 return;
519
520 if (crewMemberIndex == DayZPlayerConstants.VEHICLESEAT_DRIVER)
521 {
522 EngineStop();
523 }
524 }
525
526 protected void DecayHealthTick()
527 {
529 return;
530
532
533 if (IsFlipped())
534 damage *= DECAY_FLIPPED_MULT;
535
536 if (IsInFlagRange())
537 damage *= 0.3;
538
539 AddHealth("Engine","Health", -damage);
540 }
541
542 protected bool IsInFlagRange()
543 {
544 array<vector> locations = g_Game.GetMission().GetActiveRefresherLocations();
545 if (!locations)
546 return false;
547
548 int count = locations.Count();
549 if (count > 0)
550 {
551 vector pos = GetWorldPosition();
552 for (int i = 0; i < count; i++)
553 {
554 if (vector.Distance(pos, locations.Get(i)) < DECAY_FLAG_RANGE)
555 return true;
556 }
557
558 return false;
559 }
560 else
561 return false;
562 }
563
565 {
566 if (GetHealthLevel("") >= GameConstants.STATE_RUINED || GetHealthLevel("Engine") >= GameConstants.STATE_RUINED)
567 return false;
568
569 if (IsVitalSparkPlug())
570 {
571 EntityAI item = FindAttachmentBySlotName("SparkPlug");
572 if (!item || (item && item.IsRuined()))
573 return false;
574 }
575
576 return true;
577 }
578
579 override void OnDriverExit(Human player)
580 {
581 super.OnDriverExit(player);
582
583 if (GetGear() != GetNeutralGear())
584 {
585 EngineStop();
586 }
587 }
588
589 // Server side event for jump out processing
591 {
592 vector posMS = data.m_Player.WorldToModel(data.m_Player.GetPosition());
594 healthCoef = Math.Clamp(healthCoef, 0.0, 1.0);
595 data.m_Player.ProcessDirectDamage(DamageType.CUSTOM, data.m_Player, "", "FallDamageHealth", posMS, healthCoef);
596 }
597
598 protected void HandleEngineSound(EBoatEngineSoundState state)
599 {
600 if (g_Game.IsDedicatedServer())
601 return;
602
603 string soundset;
604
605 switch (state)
606 {
607 case EBoatEngineSoundState.START_OK:
608 soundset = m_SoundEngineStart;
609 break;
610 case EBoatEngineSoundState.STOP_OK:
611 soundset = m_SoundEngineStop;
612 break;
613 case EBoatEngineSoundState.START_NO_FUEL:
614 soundset = m_SoundEngineStartNoFuel;
615 break;
616 case EBoatEngineSoundState.STOP_NO_FUEL:
617 soundset = m_SoundEngineStopNoFuel;
618 break;
619 }
620
621 // already playing same type of sound
623 {
624 if (m_SoundEngineEffect.GetSoundSet() == soundset) // already playing same type of sound
625 return;
626 else
627 {
629 m_SoundEngineEffectDeletion.SoundStop(); // stop the existing sound
630
631 m_SoundEngineEffect = null;
632 }
633
634 }
635
636 PlaySound(soundset, m_SoundEngineEffect, ModelToWorld(PropellerGetPosition()));
637 }
638
639 protected void PlaySound(string soundset, inout EffectSound sound, vector position = vector.Zero)
640 {
641 #ifndef SERVER
642 if (position == vector.Zero)
643 position = GetPosition();
644
645 if (!sound)
646 {
647 sound = SEffectManager.PlaySoundCachedParams(soundset, position);
648 sound.SetAttachmentParent(this);
649 sound.SetAutodestroy(true); // SoundWaveObjects tend to null themselves for unknown reasons, breaking the effect in the process
650 }
651 else
652 {
653 if (!sound.IsSoundPlaying())
654 {
655 sound.SetCurrentPosition(position);
656 sound.SoundPlay();
657 }
658 }
659 #endif
660 }
661
662 protected void HandleBoatSplashSound()
663 {
664 float propPosRelative = g_Game.SurfaceGetSeaLevel() - CoordToParent(PropellerGetPosition())[1];
665 if (propPosRelative < SPLASH_THRESHOLD_CONDITION)
666 m_SplashIncoming = true;
667
668 if (m_SplashIncoming && propPosRelative > SPLASH_THRESHOLD)
669 {
671 m_SoundWaterSplashEffect.SetAttachmentParent(this);
672 m_SoundWaterSplashEffect.SetLocalPosition(PropellerGetPosition());
673 m_SoundWaterSplashEffect.SetAutodestroy(true);
674
675 vector velocity = dBodyGetVelocityAt(this, CoordToParent(PropellerGetPosition()));
676 float speed = velocity.Normalize() * 3.6; // to km/h
677 float lerp = Math.InverseLerp(0, 30, speed);
678 m_SoundWaterSplashEffect.SetSoundVolume(lerp);
679
681
682 m_SplashIncoming = false;
683 }
684 }
685
686 protected void SyncSoundImpactLight()
687 {
689 {
691 SetSynchDirty();
692 }
693 }
694
695 protected void SyncSoundImpactHeavy()
696 {
698 {
700 SetSynchDirty();
701 }
702 }
703
704 void SyncSoundPushBoat(bool play)
705 {
706 if (m_PlaySoundPushBoat != play)
707 {
708 m_PlaySoundPushBoat = play;
709 SetSynchDirty();
710 }
711 }
712
713 // Set engine sound to fade on start/stop
714 protected void FadeEngineSound(bool fadeIn)
715 {
717 m_EngineFadeDirection = fadeIn;
719 }
720
721 protected void FlipVehicle()
722 {
723 vector orient = GetOrientation();
724 orient[2] = orient[2] + 180;
725 SetOrientation(orient);
726
727 vector pos = GetPosition();
728 pos[1] = pos[1] + 0.5;
729 SetPosition(pos);
730 }
731
732 protected void CheckContactCache()
733 {
734 if (!m_ContactData)
735 return;
736
737 float impulse = Math.AbsInt(m_ContactData.m_Impulse);
738 m_ContactData = null;
739
741 return;
742 else if (impulse < GameConstants.CARS_CONTACT_DMG_THRESHOLD)
744 else
746 }
747
748 protected void SetActions()
749 {
752 }
753
754 void AddAction(typename actionName)
755 {
756 ActionBase action = ActionManagerBase.GetAction(actionName);
757
758 if (!action)
759 {
760 Debug.LogError("Action " + actionName + " dosn't exist!");
761 return;
762 }
763
764 typename ai = action.GetInputType();
765 if (!ai)
766 {
767 m_ActionsInitialized = false;
768 return;
769 }
770
771 array<ActionBase_Basic> actionArray = m_InputActionMap.Get(ai);
772
773 if (!actionArray)
774 {
775 actionArray = new array<ActionBase_Basic>;
776 m_InputActionMap.Insert(ai, actionArray);
777 }
778
780 {
781 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action" );
782 }
783
784 actionArray.Insert(action);
785 }
786
787 void RemoveAction(typename actionName)
788 {
789 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
790 ActionBase action = player.GetActionManager().GetAction(actionName);
791 typename ai = action.GetInputType();
792 array<ActionBase_Basic> actionArray = m_InputActionMap.Get(ai);
793
794 if (actionArray)
795 {
796 actionArray.RemoveItem(action);
797 }
798 }
799
800 protected void UpdateParticles(float timeSlice = 0)
801 {
802 for (int i; i < 4; i++)
803 {
804 m_WaterEffects[i].Update(timeSlice);
805 }
806 }
807
808 protected void StopParticleUpdate()
809 {
810 m_UpdateParticles = false;
812 }
813
814 protected void ClearWaterEffects()
815 {
816 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(StopParticleUpdate);
817
818 for (int i; i < 4; i++)
819 {
820 if (m_WaterEffects[i].IsPlaying())
821 {
823 {
824 m_WaterEffects[i].GetParticle().SetParticleParam(EmitorParam.BIRTH_RATE, 0);
825 m_WaterEffects[i].GetParticle().SetParticleParam(EmitorParam.BIRTH_RATE_RND, 0);
826 }
827 m_WaterEffects[i].Stop();
828 }
829 }
830 }
831
832 // Called on destroy/stream out
833 protected void CleanupEffects()
834 {
835 for (int i; i < 4; i++)
836 {
838 {
839 m_WaterEffects[i].Stop();
841 }
842 }
843
846 }
847
848 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
849 {
850 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_ENTITY, "Flip vehicle", FadeColors.LIGHT_GREY));
851
852 super.GetDebugActions(outputList);
853 }
854
855 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
856 {
857 if (super.OnAction(action_id, player, ctx))
858 return true;
859
860 if (!g_Game.IsServer())
861 {
862 return false;
863 }
864
865 switch (action_id)
866 {
867 case EActions.FLIP_ENTITY:
868 FlipVehicle();
869 return true;
870 }
871
872 return false;
873 }
874
875 protected override event typename GetOwnerStateType()
876 {
877 return BoatScriptOwnerState;
878 }
879
880 protected override event typename GetMoveType()
881 {
882 return BoatScriptMove;
883 }
884
885 #ifdef DIAG_DEVELOPER
886 override void FixEntity()
887 {
888 super.FixEntity();
889
890 if (g_Game.IsServer())
891 Fill(BoatFluid.FUEL, GetFluidCapacity(BoatFluid.FUEL));
892
893
894 }
895 #endif
896}
Param4< int, int, string, int > TSelectableActionInfoWithColor
Definition entityai.c:104
void ActionManagerBase(PlayerBase player)
map< typename, ref array< ActionBase_Basic > > TInputActionMap
vector GetOrientation()
@ OK
0 - No error. Can be returned from any call.
BoatSoundCtrl
Boat's sound controller list. (native, do not change or extend).
Definition boat.c:3
BoatFluid
Type of vehicle's fluid. (native, do not change or extend).
Definition boat.c:14
enum EBoatEffects STOP_OK
enum EBoatEffects NO_FUEL
enum EBoatEffects NO_IGNITER
enum EBoatEffects START_NO_FUEL
enum EBoatEffects START_OK
EBoatEffects
Definition boatscript.c:2
@ PTC_SIDE_L
Definition boatscript.c:5
@ PTC_BACK
Definition boatscript.c:4
@ PTC_FRONT
Definition boatscript.c:3
@ PTC_SIDE_R
Definition boatscript.c:6
void EffectBoatWaterFront()
void EffectBoatWaterSide()
proto native bool AvoidPlayer(vector vPos, float fDistance)
Check if there is a player within a radius.
proto native CEApi GetCEApi()
Get the CE API.
Base script class for boats.
Definition boatscript.c:42
override bool DisableVicinityIcon()
Definition boatscript.c:182
const float DECAY_DAMAGE
Definition boatscript.c:46
override bool IsInventoryVisible()
Definition boatscript.c:192
override void MarkCrewMemberUnconscious(int crewMemberIndex)
Definition boatscript.c:504
override void EOnPostSimulate(IEntity other, float timeSlice)
Definition boatscript.c:347
ref EffectSound m_SoundPushBoatEffect
Definition boatscript.c:85
override vector GetTransportCameraOffset()
Definition boatscript.c:202
void SyncSoundPushBoat(bool play)
Definition boatscript.c:704
const float DECAY_FLIPPED_MULT
Definition boatscript.c:47
void DecayHealthTick()
Definition boatscript.c:526
vector m_VelocityPrevTick
Definition boatscript.c:57
string m_SoundEngineStopNoFuel
Definition boatscript.c:82
override void OnDriverExit(Human player)
Definition boatscript.c:579
void FadeEngineSound(bool fadeIn)
Definition boatscript.c:714
string m_SoundImpactLight
Definition boatscript.c:75
override void MarkCrewMemberDead(int crewMemberIndex)
Definition boatscript.c:515
override float GetTransportCameraDistance()
Definition boatscript.c:197
bool m_PlaySoundEngineStopNoFuel
Definition boatscript.c:68
TInputActionMap m_InputActionMap
Definition boatscript.c:54
const float SPLASH_THRESHOLD
Definition boatscript.c:51
void SetActions()
Definition boatscript.c:748
override int Get3rdPersonCameraType()
Definition boatscript.c:212
override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
Definition boatscript.c:232
void StopParticleUpdate()
Definition boatscript.c:808
override bool IsAreaAtDoorFree(int currentSeat, float maxAllowedObjHeight, inout vector extents, out vector transform[4])
Definition boatscript.c:237
override bool OnBeforeEngineStart()
Gets called everytime the game wants to start the engine.
Definition boatscript.c:247
void HandleBoatSplashSound()
Definition boatscript.c:662
override float OnSound(BoatSoundCtrl ctrl, float oldValue)
Definition boatscript.c:489
override int GetAnimInstance()
Definition boatscript.c:207
override bool CrewCanGetThrough(int posIdx)
Definition boatscript.c:217
const float SOUND_ENGINE_FADE
Definition boatscript.c:49
const int DECAY_FLAG_RANGE
Definition boatscript.c:44
bool m_PlaySoundPushBoat
Definition boatscript.c:71
string m_SoundEngineStartNoFuel
Definition boatscript.c:81
override void EOnSimulate(IEntity other, float dt)
Definition boatscript.c:385
static ref map< typename, ref TInputActionMap > m_BoatTypeActionsMap
Definition boatscript.c:53
bool m_ActionsInitialized
Definition boatscript.c:55
void AddAction(typename actionName)
Definition boatscript.c:754
bool m_SplashIncoming
Definition boatscript.c:67
void OnVehicleJumpOutServer(GetOutTransportActionData data)
Definition boatscript.c:590
bool m_PlaySoundImpactHeavy
Definition boatscript.c:70
override void EEOnCECreate()
Definition boatscript.c:334
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Definition boatscript.c:855
void CheckContactCache()
Definition boatscript.c:732
override event GetOwnerStateType()
Definition boatscript.c:875
const int DECAY_PLAYER_RANGE
Definition boatscript.c:43
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
Definition boatscript.c:171
ref Timer m_DecayTimer
Definition boatscript.c:60
ref VehicleContactData m_ContactData
Definition boatscript.c:59
bool m_IsEngineSoundFading
Definition boatscript.c:72
override void OnEngineStart()
Definition boatscript.c:302
void OnIgnition()
Definition boatscript.c:280
void CleanupEffects()
Definition boatscript.c:833
override bool DetectFlipped(VehicleFlippedContext ctx)
Definition boatscript.c:482
ref EffectSound m_SoundEngineEffect
Definition boatscript.c:87
override void EEDelete(EntityAI parent)
Definition boatscript.c:153
float m_MomentumPrevTick
Definition boatscript.c:58
bool m_PlaySoundImpactLight
Definition boatscript.c:69
override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
Definition boatscript.c:222
const float DECAY_TICK_FREQUENCY
Definition boatscript.c:45
int CheckOperationalRequirements()
Definition boatscript.c:254
string m_SoundPushBoat
Definition boatscript.c:77
const float SPLASH_THRESHOLD_CONDITION
Definition boatscript.c:50
void ~BoatScript()
Definition boatscript.c:143
bool IsInFlagRange()
Definition boatscript.c:542
void SyncSoundImpactLight()
Definition boatscript.c:686
override string GetVehicleType()
Definition boatscript.c:187
void BoatScript()
Definition boatscript.c:90
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Definition boatscript.c:441
string m_SoundEngineStart
Definition boatscript.c:79
void PlaySound(string soundset, inout EffectSound sound, vector position=vector.Zero)
Definition boatscript.c:639
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Definition boatscript.c:848
string m_SoundImpactHeavy
Definition boatscript.c:76
string m_SoundEngineStop
Definition boatscript.c:80
void SyncSoundImpactHeavy()
Definition boatscript.c:695
override event GetMoveType()
Definition boatscript.c:880
override bool CanReachSeatFromDoors(string pSeatSelection, vector pFromPos, float pDistance=1.0)
Definition boatscript.c:227
void HandleEngineSound(EBoatEngineSoundState state)
Definition boatscript.c:598
override void OnContact(string zoneName, vector localPos, IEntity other, Contact data)
WARNING: Can be called very frequently in one frame, use with caution.
Definition boatscript.c:418
bool m_EngineFadeDirection
Definition boatscript.c:73
override void OnVariablesSynchronized()
Definition boatscript.c:452
bool CheckOperationalState()
Definition boatscript.c:564
float m_EngineFadeTime
Definition boatscript.c:74
string m_SoundWaterSplash
Definition boatscript.c:78
bool m_UpdateParticles
Definition boatscript.c:63
void UpdateParticles(float timeSlice=0)
Definition boatscript.c:800
void FlipVehicle()
Definition boatscript.c:721
void ClearWaterEffects()
Definition boatscript.c:814
ref EffectBoatWaterBase m_WaterEffects[4]
Definition boatscript.c:64
ref EffectSound m_SoundEngineEffectDeletion
Definition boatscript.c:88
void RemoveAction(typename actionName)
Definition boatscript.c:787
override void OnInput(float dt)
Definition boatscript.c:342
override void EOnFrame(IEntity other, float timeSlice)
Definition boatscript.c:401
ref EffectSound m_SoundWaterSplashEffect
Definition boatscript.c:86
override void OnEngineStop()
Definition boatscript.c:314
void InitializeActions()
Definition boatscript.c:159
static float GetBoatDecayMultiplier()
Output structure for reporting collisions.
Definition contact.c:10
static const int DAYZCAMERA_3RD_VEHICLE
generic vehicle 3rd person
Definition debug.c:2
static void ActionLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Definition debug.c:187
static void LogError(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message as error message.
Definition debug.c:305
Wrapper class for managing sound through SEffectManager.
Definition effectsound.c:5
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
Internal ancestor of all Entity implementations.
Definition enentity.c:165
static bool IsActionLogEnable()
Definition debug.c:736
Definition enmath.c:7
Manager class for managing Effect (EffectParticle, EffectSound).
static EffectSound CreateSound(string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false, bool enviroment=false)
Create an EffectSound.
static EffectSound PlaySoundCachedParams(string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
Create and play an EffectSound, using or creating cached SoundParams.
static void DestroyEffect(Effect effect)
Unregisters, stops and frees the Effect.
static void EffectUnregisterEx(Effect effect)
Unregisters Effect in SEffectManager.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
proto float Normalize()
Normalizes vector.
static const vector Zero
Definition enconvert.c:123
static float Dot(vector v1, vector v2)
Returns Dot product of vector v1 and vector v2.
Definition enconvert.c:284
DamageType
exposed from C++ (do not change)
DayZGame g_Game
Definition dayzgame.c:3942
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
EActions
Definition eactions.c:2
bool IsRegistered()
Get whether this Effect is registered in SEffectManager.
Definition effect.c:570
bool IsPlaying()
Returns true when the Effect is playing, false otherwise.
Definition effect.c:197
Serializer ParamsReadContext
Definition gameplay.c:15
const float CARS_CONTACT_DMG_MIN
Definition constants.c:842
const float CARS_CONTACT_DMG_THRESHOLD
Definition constants.c:841
proto native void SetPosition(vector position)
Set the world position of the Effect.
Definition effect.c:463
EntityEvent
Entity events for event-mask, or throwing event from code.
Definition enentity.c:45
const int STATE_RUINED
Definition constants.c:851
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
static proto int AbsInt(int i)
Returns absolute value.
EmitorParam
Definition envisual.c:114
@ NONE
body is not in simulation, nor in collision world
proto native vector dBodyGetVelocityAt(notnull IEntity body, vector globalpos)
proto native vector GetVelocity(notnull IEntity ent)
Returns linear velocity.
proto native void dBodyGetWorldTransform(notnull IEntity body, out vector matrix[4])
const int SAT_DEBUG_ACTION
Definition constants.c:457
vector GetPosition()
Get the world position of the Effect.
Definition effect.c:473
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8
const float VEHICLE_FLIP_ANGLE_TOLERANCE
Definition constants.c:821
bool IsProxy()
Definition hand_events.c:65
void PlaySound()
@ RUINED
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
string Type
proto native ParticleSource GetParticle(int index)
Manually get the particle at index.
VehicleAnimInstances