DayZ 1.28
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
DayZAnimal.c
См. документацию.
2{
3 private void DayZCreatureAnimInterface() {}
4 private void ~DayZCreatureAnimInterface() {}
5
6 //-----------------------------------------------------
7 // Binds, returns -1 when error, otherwise if ok
8
10 proto native TAnimGraphCommand BindCommand(string pCommandName);
13 proto native TAnimGraphVariable BindVariableFloat(string pVariable);
14 proto native TAnimGraphVariable BindVariableInt(string pVariable);
15 proto native TAnimGraphVariable BindVariableBool(string pVariable);
16
18 proto native TAnimGraphTag BindTag(string pTagName);
19
21 proto native TAnimGraphEvent BindEvent(string pEventName);
22}
23
24class DayZCreature extends EntityAI
25{
26 #ifdef _DAYZ_CREATURE_DEBUG_SHADOW
27 proto native void DebugSetShadow(DayZCreature creature);
28 #endif
29
30 proto native bool RegisterAnimationEvent(string event_name, string function_name);
31
32 proto native void SetAnimationInstanceByName(string animation_instance_name, int instance_uuid, float duration);
34
36
37
38 proto native void UpdateSimulationPrecision(int simLOD);
39
40 //---------------------------------------------------------
41 // helper functions for disabling simulation upon death
42 proto native void StartDeath();
43 proto native void ResetDeath();
44
45 proto native void ResetDeathCooldown();
46 proto native bool IsDeathProcessed();
47 proto native bool IsDeathConditionMet();
48
49 //---------------------------------------------------------
50 // bone transforms
51
53 proto native int GetBoneIndexByName(string pBoneName);
54
55 override bool IsDayZCreature()
56 {
57 return true;
58 }
59
60 override bool CanBeSkinned()
61 {
62 return !GetIsFrozen();
63 }
64
66 {
67 return IsRuined();
68 }
69
70 override bool IsManagingArrows()
71 {
72 return true;
73 }
74
75 override bool DisableVicinityIcon()
76 {
77 return true;
78 }
79
80 override void AddArrow(Object arrow, int componentIndex, vector closeBonePosWS, vector closeBoneRotWS)
81 {
83 GetActionComponentNameList(componentIndex, CachedObjectsArrays.ARRAY_STRING, "fire");
84
85 int pivot = -1;
86
87
88 for (int i = 0; i < CachedObjectsArrays.ARRAY_STRING.Count() && pivot == -1; i++)
89 {
91 }
92
93 vector parentTransMat[4];
94 vector arrowTransMat[4];
95
96 if (pivot == -1)
97 {
98 GetTransform(parentTransMat);
99 }
100 else
101 {
102 vector rotMatrix[3];
103 Math3D.YawPitchRollMatrix(closeBoneRotWS * Math.RAD2DEG,rotMatrix);
104
105 parentTransMat[0] = rotMatrix[0];
106 parentTransMat[1] = rotMatrix[1];
107 parentTransMat[2] = rotMatrix[2];
108 parentTransMat[3] = closeBonePosWS;
109 }
110
111 arrow.GetTransform(arrowTransMat);
112 Math3D.MatrixInvMultiply4(parentTransMat, arrowTransMat, arrowTransMat);
113 // orthogonalize matrix - parent might be skewed
114 Math3D.MatrixOrthogonalize4(arrowTransMat);
115 arrow.SetTransform(arrowTransMat);
116
117 AddChild(arrow, pivot);
118 }
119
121 {
122 return true;
123 }
124
125 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
126 {
127 super.GetDebugActions(outputList);
128
129 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
130 if (Gizmo_IsSupported())
131 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GIZMO_OBJECT, "Gizmo Object", FadeColors.LIGHT_GREY));
132 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GIZMO_PHYSICS, "Gizmo Physics (SP Only)", FadeColors.LIGHT_GREY)); // intentionally allowed for testing physics desync
133 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
134 }
135
136 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
137 {
138 if (super.OnAction(action_id, player, ctx))
139 return true;
140
141 if (GetGame().IsClient() || !GetGame().IsMultiplayer())
142 {
143 switch (action_id)
144 {
145 case EActions.GIZMO_OBJECT:
147 return true;
148 case EActions.GIZMO_PHYSICS:
149 GetGame().GizmoSelectPhysics(GetPhysics());
150 return true;
151 }
152 }
153
154 if (GetGame().IsServer())
155 {
156 switch (action_id)
157 {
158 case EActions.DELETE:
159 Delete();
160 return true;
161 }
162 }
163
164 return false;
165 }
166
167 //-------------------------------------------------------------
171 // these functions are for modded overide in script command mods
172
173 bool ModCommandHandlerBefore(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
174 {
175 return false;
176 }
177
178 bool ModCommandHandlerInside(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
179 {
180 return false;
181 }
182
183 bool ModCommandHandlerAfter(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
184 {
185 return false;
186 }
187}
188
190{
191 proto native AIAgent GetAIAgent();
192
193 proto native bool IsSoundInsideBuilding();
194#ifdef DIAG_DEVELOPER
195 proto native void DebugDisableAIControl();
196 proto native void DebugRestoreAIControl();
197#endif
198 proto native void AddDamageSphere(string bone_name, string ammo_name, float radius, float duration, bool invertTeams);
199
205 proto native void InitAIAgent(AIGroup group);
206 proto native void DestroyAIAgent();
207
208 int m_EffectTriggerCount;//how many effect triggers is this AI inside of(overlapping triggers)
209
211
212
214 {
216 SetFlags(EntityFlags.TOUCHTRIGGERS, false);
217 }
218
219
224
229
230 void AddDamageSphere(AnimDamageParams damage_params)
231 {
232 AddDamageSphere(damage_params.m_sBoneName, damage_params.m_sAmmoName, damage_params.m_fRadius, damage_params.m_fDuration, damage_params.m_bInvertTeams);
233 }
234
235 override void EEKilled(Object killer)
236 {
237 super.EEKilled(killer);
238 CreateComponent(COMP_TYPE_BODY_STAGING); // TO DO: This is never called on clients in multiplayer! That's why skinning doesn't work properly in MP. DAYZ-28269
239 }
240
242 {
243 return AnimBootsType.None;
244 }
245
247 {
248 if(so == NULL)
249 {
250 return NULL;
251 }
252
254 AbstractWave wave = GetGame().GetSoundScene().Play3D(so, sob);
255 return wave;
256 }
257
258 void OnSoundEvent(int event_id, string event_user_string)
259 {
260 AnimSoundEvent sound_event = GetCreatureAIType().GetSoundEvent(event_id);
261 if(sound_event != NULL)
262 {
263 ProcessSoundEvent(sound_event);
264 }
265 }
266
267 void OnSoundVoiceEvent(int event_id, string event_user_string)
268 {
269 AnimSoundVoiceEvent voice_event = GetCreatureAIType().GetSoundVoiceEvent(event_id);
270 if(voice_event != NULL)
271 {
272 ProcessSoundVoiceEvent(voice_event);
273 }
274 }
275
276 void OnStepEvent(int event_id, string event_user_string)
277 {
278 AnimStepEvent step_event = GetCreatureAIType().GetStepEvent(event_id);
279 if(step_event != NULL)
280 {
281 ProcessStepEvent(step_event);
282 }
283 }
284
285 void OnDamageEvent(int event_id, string event_user_string)
286 {
287 AnimDamageEvent damage_event = GetCreatureAIType().GetDamageEvent(event_id);
288 if(damage_event != NULL)
289 {
290 ProcessDamageEvent(damage_event);
291 }
292 }
293
294 protected void RegisterAnimEvents()
295 {
296 if(!RegisterAnimationEvent("Sound", "OnSoundEvent"))
297 {
298 Print("Error registering anim. event (Sound)");
299 }
300
301 if(!RegisterAnimationEvent("SoundVoice", "OnSoundVoiceEvent"))
302 {
303 Print("Error registering anim. event (SoundVoice)");
304 }
305
306 if(!GetGame().IsDedicatedServer())
307 {
308 if(!RegisterAnimationEvent("Step", "OnStepEvent"))
309 {
310 Print("Error registering anim. event (Step)");
311 }
312 }
313
314 if(!RegisterAnimationEvent("Damage", "OnDamageEvent"))
315 {
316 Print("Error registering anim. event (Damage)");
317 }
318 }
319
320 private void ProcessSoundEvent(AnimSoundEvent sound_event)
321 {
322 if(!GetGame().IsDedicatedServer())
323 {
324 SoundObjectBuilder objectBuilder = sound_event.GetSoundBuilder();
325 if(NULL != objectBuilder)
326 {
327 objectBuilder.AddEnvSoundVariables(GetPosition());
328 SoundObject soundObject = objectBuilder.BuildSoundObject();
329 PlaySound(soundObject, objectBuilder);
330 }
331 }
332
333 if(GetGame().IsServer())
334 {
335 if(sound_event.m_NoiseParams != NULL)
336 GetGame().GetNoiseSystem().AddNoise(this, sound_event.m_NoiseParams, GetGame().GetWeather().GetNoiseReductionByWeather());
337 }
338 }
339
340 private void ProcessSoundVoiceEvent(AnimSoundVoiceEvent sound_event)
341 {
342 if(!GetGame().IsDedicatedServer())
343 {
344 SoundObjectBuilder objectBuilder = sound_event.GetSoundBuilder();
345 if(NULL != objectBuilder)
346 {
347 objectBuilder.AddEnvSoundVariables(GetPosition());
348 SoundObject soundObject = objectBuilder.BuildSoundObject();
349 AttenuateSoundIfNecessary(soundObject);
350 PlaySound(soundObject, objectBuilder);
351 }
352 }
353
354 if(GetGame().IsServer())
355 {
356 if(sound_event.m_NoiseParams != NULL)
357 GetGame().GetNoiseSystem().AddNoise(this, sound_event.m_NoiseParams, GetGame().GetWeather().GetNoiseReductionByWeather());
358 }
359 }
360
361 private void ProcessStepEvent(AnimStepEvent step_event)
362 {
363 SoundObjectBuilder soundBuilder = step_event.GetSoundBuilder(GetSurfaceType().Hash());
364 if(soundBuilder == NULL)
365 return;
366
367 soundBuilder.AddEnvSoundVariables(GetPosition());
368 SoundObject soundObject = soundBuilder.BuildSoundObject();
369 AttenuateSoundIfNecessary(soundObject);
370 PlaySound(soundObject, soundBuilder);
371
372 //TODO effects
373 }
374
375 private void ProcessDamageEvent(AnimDamageEvent damage_event)
376 {
377 AddDamageSphere(damage_event.m_DamageParams);
378 }
379
380 protected void AttenuateSoundIfNecessary(SoundObject soundObject)
381 {
382 if (GetGame().GetPlayer() != NULL && (IsSoundInsideBuilding() != GetGame().GetPlayer().IsSoundInsideBuilding() || GetGame().GetPlayer().IsCameraInsideVehicle()))
383 {
384 soundObject.SetKind(WaveKind.WAVEATTALWAYS);
385 }
386 else
387 {
388 soundObject.SetKind(WaveKind.WAVEEFFECTEX);
389 }
390 }
391
393 {
394 return false;
395 }
396
397 // ================
398 // EASTER EGG
399 // ================
400
401 //Used for easter egg sound selection
402 bool IsDanger()
403 {
404 return false;
405 }
406
408 {
409 return "";
410 }
411
413 {
414 return "";
415 }
416
417 // ================
418 // CINEMATIC CONTROLLER
419 // ================
420
422 {
423 m_CinematicPlayer = player;
424 }
425
427 {
428 return true;
429 }
430
431 override bool ModCommandHandlerBefore(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
432 {
434 {
435 return super.ModCommandHandlerBefore(pDt, pCurrentCommandID, pCurrentCommandFinished);
436 }
437
438 UAInterface input = m_CinematicPlayer.GetInputInterface();
439
441 GetGame().GameScript.CallFunction(this, "GetInputController", controller, 0);
442
443 if (!input || !controller)
444 {
445 return super.ModCommandHandlerBefore(pDt, pCurrentCommandID, pCurrentCommandFinished);
446 }
447
448 float movementX = input.SyncedValue_ID(UAAimRight) - input.SyncedValue_ID(UAAimLeft);
449
450 float maxTurnSpeed = 100.0;
451 movementX = Math.Clamp(movementX * maxTurnSpeed * pDt, -180, 180);
452
453 if (input.SyncedValue_ID(UALookAround) > 0)
454 {
455 movementX = 0;
456 }
457
458 bool isJump = input.SyncedValue_ID(UAGetOver) > 0;
459 bool isMove = input.SyncedValue_ID(UAMoveForward) > 0;
460
461 bool isRest = input.SyncedValue_ID(UAMoveBack) > 0;
462 bool isSleep = input.SyncedValue_ID(UAReloadMagazine) > 0;
463
464 float heading = GetOrientation()[0] + movementX;
465
466 int iAlert = 0;
467 float fAlert = 0;
468 int iSpeed = 0;
469 float fSpeed = 0;
470
471 if (isMove)
472 {
473 iAlert = 1;
474 fAlert = 0.2;
475
476 bool isSprint = input.SyncedValue_ID(UATurbo) > 0;
477 bool isJog = input.SyncedValue_ID(UAWalkRunTemp) > 0;
478 bool isWalk = !isSprint && !isJog;
479 if (isSprint)
480 {
482 iSpeed = 3;
483 }
484 else if (isJog)
485 {
487 iSpeed = 2;
488 }
489 else if (isWalk)
490 {
492 iSpeed = 1;
493 }
494 }
495
496 DayZAnimalInputController animalController;
497 if (Class.CastTo(animalController, controller))
498 {
499 animalController.OverrideBehaviourSlot(true, DayZAnimalBehaviourSlot.NON_SPECIFIC_THREAT);
500 animalController.OverrideBehaviourAction(true, DayZAnimalBehaviourAction.TRAVELING_INPUT);
501
502 if (!isMove)
503 {
504 if (isRest)
505 {
506 iSpeed = 0;
507 animalController.OverrideBehaviourAction(true, DayZAnimalBehaviourAction.IDLE1_INPUT);
508 }
509
510 if (isSleep)
511 {
512 iSpeed = 0;
513 animalController.OverrideBehaviourAction(true, DayZAnimalBehaviourAction.WALKING_INPUT);
514 }
515 }
516 }
517
518 bool lowVel = GetVelocity(this).Length() < 0.5;
519 if (iSpeed > 0 && lowVel)
520 {
521 iAlert = 4;
522 fAlert = 1.0;
523
524 iSpeed = 3;
525 }
526
527 if (animalController)
528 {
529 switch (iSpeed)
530 {
531 case 0:
532 fSpeed = 0;
533 break;
534 case 1:
535 fSpeed = 2;
536 break;
537 case 2:
538 fSpeed = 3;
539 break;
540 case 3:
541 fSpeed = 5;
542 break;
543 }
544 }
545
546 controller.OverrideTurnSpeed(true, Math.PI2 / pDt);
547 controller.OverrideMovementSpeed(true, fSpeed);
548 controller.OverrideHeading(true, heading * Math.DEG2RAD);
549 controller.OverrideAlertLevel(true, true, iAlert, fAlert);
550
551 if (CinematicCanJump() && isJump)
552 {
553 controller.OverrideJump(true, 101, 2.0);
554 }
555
556 return true;
557 }
558}
559
560enum DayZAnimalConstants
561{
568};
569
571{
572
573}
574
575class DayZAnimalCommandAttack extends AnimCommandBase
576{
577
578}
579
580class DayZAnimalCommandJump extends AnimCommandBase
581{
582
583}
584
585class DayZAnimalCommandLookAt extends AnimCommandBase
586{
587
588}
589
590class DayZAnimalCommandBehaviourModifier extends AnimCommandBase
591{
592
593}
594
595class DayZAnimalCommandHit extends AnimCommandBase
596{
597
598}
599
600class DayZAnimalCommandDeath extends AnimCommandBase
601{
602
603}
604
605class DayZAnimalCommandAnimCallback extends AnimCommandBase
606{
607
608}
609
617class DayZAnimalCommandScript extends AnimCommandBase
618{
620 //void DayZAnimalCommandScript(DayZAnimal pAnimal)
621
622 //---------------------------------------------------------------
623 // usable everywhere
624
626 proto native void SetFlagFinished(bool pFinished);
627
628 //---------------------------------------------------------------
629 // PrePhys Update
630
632 proto native bool PrePhys_GetTranslation(out vector pOutTransl); // vec3 in local space !
633 proto native bool PrePhys_GetRotation(out float pOutRot[4]); // quaternion in local space !
634 proto native void PrePhys_SetTranslation(vector pInTransl); // vec3 in local space !
635 proto native void PrePhys_SetRotation(float pInRot[4]); // quaternion in local space !
636
637 //---------------------------------------------------------------
638 // PostPhys Update
639
643 bool PostPhysUpdate(float pDt);
644
646 proto native void PostPhys_GetPosition(out vector pOutTransl);
647 proto native void PostPhys_GetRotation(out float pOutRot[4]);
648 proto native void PostPhys_SetPosition(vector pInTransl);
649 proto native void PostPhys_SetRotation(float pInRot[4]);
650 proto native void PostPhys_LockRotation();
651}
652
654{
655
658 protected string m_DefaultHitComponent;
661
663
664 proto native void StartCommand_Death(int pType, int pDirection);
665 proto native void StartCommand_Move();
666 proto native void StartCommand_Jump();
667 proto native void StartCommand_Attack();
668 proto native void StartCommand_Hit(int pType, int pDirection);
669
671 proto native DayZAnimalCommandScript StartCommand_Script(DayZAnimalCommandScript pInfectedCommand);
672 proto native DayZAnimalCommandScript StartCommand_ScriptInst(typename pCallbackClass);
673 proto native DayZAnimalCommandScript GetCommand_Script();
674
675 proto native void SignalAIAttackStarted();
676 proto native void SignalAIAttackEnded();
677
679 {
680 // testing: animals have no inventory by default
681 //GetInventory().LockInventory(LOCK_FROM_SCRIPT); // Hides animals from vicinity in inventory. Remove this if wanted otherwise.
682
684
686
689
690 SetEventMask(EntityEvent.CONTACT);
691 }
692
693 override bool IsHealthVisible()
694 {
695 return false;
696 }
697
698 override bool IsAnimal()
699 {
700 return true;
701 }
702
703 override bool IsInventoryVisible()
704 {
705 return false;
706 }
707
708 override int GetHideIconMask()
709 {
710 return EInventoryIconVisibility.HIDE_VICINITY;
711 /*
712 if (IsAlive())
713 {
714 return EInventoryIconVisibility.HIDE_VICINITY;
715 }
716 return super.GetHideIconMask();
717 */
718 }
719
720 void CommandHandler(float dt, int currentCommandID, bool currentCommandFinished)
721 {
723
725 if( ModCommandHandlerBefore(dt, currentCommandID, currentCommandFinished) )
726 {
727 return;
728 }
729
730 if (HandleDeath(currentCommandID, inputController))
731 {
732 return;
733 }
734
735 if (currentCommandFinished)
736 {
737 if (currentCommandID == DayZAnimalConstants.COMMANDID_ATTACK)
738 {
740 }
741
743
744 return;
745 }
746
748 if( ModCommandHandlerInside(dt, currentCommandID, currentCommandFinished) )
749 {
750 return;
751 }
752
753 if (HandleDamageHit(currentCommandID))
754 {
755 if (currentCommandID == DayZAnimalConstants.COMMANDID_ATTACK)
756 {
758 }
759 return;
760 }
761
762 if (currentCommandID == DayZAnimalConstants.COMMANDID_MOVE)
763 {
764 if (inputController.IsJump())
765 {
767 return;
768 }
769
770 if (inputController.IsAttack())
771 {
774 return;
775 }
776 }
777
779 if( ModCommandHandlerAfter(dt, currentCommandID, currentCommandFinished) )
780 {
781 return;
782 }
783 }
784
788
789 bool HandleDeath(int currentCommandID, DayZAnimalInputController inputController)
790 {
791 if (inputController.IsDead())
792 {
793 if (currentCommandID == DayZAnimalConstants.COMMANDID_DEATH)
794 {
795 return true;
796 }
797
799 {
800 m_DamageHitToProcess = false;
801
803 }
804 else
805 {
806 StartCommand_Death(0, 0);
807 }
808
809 return true;
810 }
811
812 return false;
813 }
814
815 bool HandleDamageHit(int currentCommandID)
816 {
818 {
819 m_DamageHitToProcess = false;
820
821 if (currentCommandID != DayZAnimalConstants.COMMANDID_HIT)
822 {
824 }
825 return true;
826 }
827 return false;
828 }
829
830 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
831 {
832 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
833 m_TransportHitRegistered = false;
834
835 int transferShockToDamageCoef = g_Game.ConfigGetInt(string.Format("%1 %2 DamageApplied transferShockToDamage", CFG_AMMO, ammo));
836 if (transferShockToDamageCoef == 1)
837 {
838 //Print("DayZAnimal | EEHitBy | nonlethal hit");
839 AddHealth("", "Health", -ConvertNonlethalDamage(damageResult.GetDamage(dmgZone, "Shock"), damageType));
840 }
841 else
842 {
843 ComponentAnimalBleeding animal_bleeding = ComponentAnimalBleeding.Cast( GetComponent( COMP_TYPE_ANIMAL_BLEEDING ) );
844 animal_bleeding.CreateWound( damageResult, dmgZone, ammo );
845 }
846
847 int type = 0;
848 int direction = 0;
849 if (ComputeDamageHitParams(source, dmgZone, ammo, type, direction) == true)
850 {
851 QueueDamageHit(type, direction);
852 }
853
854 }
855
856 void QueueDamageHit(int type, int direction)
857 {
859 m_DamageHitType = type;
860 m_DamageHitDirection = direction;
861 }
862
863 bool ComputeDamageHitParams(EntityAI source, string dmgZone, string ammo, out int type, out int direction)
864 {
865 type = 0; // not used right now
866
867 float angleDeg = ComputeHitDirectionAngleDeg(source);
868 direction = TranslateHitAngleDegToDirectionIndex(angleDeg);
869
870 direction += FindComponentDirectionOffset(dmgZone);
871
872 return true;
873 }
874
876 {
877 vector targetDirection = GetDirection();
878 vector toSourceDirection = (source.GetPosition() - GetPosition());
879
880 targetDirection[1] = 0;
881 toSourceDirection[1] = 0;
882
883 targetDirection.Normalize();
884 toSourceDirection.Normalize();
885
886 float cosFi = vector.Dot(targetDirection, toSourceDirection);
887 vector cross = targetDirection * toSourceDirection;
888
889 float dirAngleDeg = Math.Acos(cosFi) * Math.RAD2DEG;
890 if ( cross[1] < 0 )
891 dirAngleDeg = -dirAngleDeg;
892
893 return dirAngleDeg;
894 }
895
897 {
898 if (angleDeg >= -20 && angleDeg <= 20) // front
899 {
900 return 1;
901 }
902 else if (angleDeg < 0) // left
903 {
904 return 2;
905 }
906
907 return 3; // right
908 }
909
911 {
912 const int directionCount = 4;
913
914 int offset = 0;
915 if (component.Length() == 0)
916 {
917 offset = 0;
918 }
919 else if (component == "Zone_Head")
920 {
921 offset = directionCount;
922 }
923 else if (component == "Zone_Chest" || component == "Zone_Legs_Front" || component == "Zone_Spine_Front" || component == "Zone_Neck")
924 {
925 offset = 2 * directionCount;
926 }
927 else
928 {
929 offset = 3 * directionCount;
930 }
931
932 return offset;
933 }
934
935 //-------------------------------------------------------------
939
940 override protected void EOnContact(IEntity other, Contact extra)
941 {
942 if( !IsAlive() )
943 return;
944
945 Transport transport = Transport.Cast(other);
946 if( transport )
947 {
948 if ( GetGame().IsServer() )
949 {
950 RegisterTransportHit(transport);
951 }
952 }
953 }
954
966
967 override string GetHitComponentForAI()
968 {
969 string hitComp;
970
972 {
973 return hitComp;
974 }
975
976 return GetDefaultHitComponent();
977 }
978
979 override string GetDefaultHitComponent()
980 {
982 }
983
985 {
987 }
988
990 {
992 }
993
994 protected vector SetDefaultHitPosition(string pSelection)
995 {
996 return GetSelectionPositionMS(pSelection);
997 }
998
999 override protected float ConvertNonlethalDamage(float damage, DamageType damageType)
1000 {
1001 switch (damageType)
1002 {
1003 case DamageType.CLOSE_COMBAT:
1005 case DamageType.FIRE_ARM:
1007 }
1008
1009 return super.ConvertNonlethalDamage(damage, damageType);
1010 }
1011}
Param4< int, int, string, int > TSelectableActionInfoWithColor
Определения 3_Game/Entities/EntityAI.c:97
class AnimalBase extends DayZAnimal RegisterHitComponentsForAI()
Определения AnimalBase.c:40
vector GetOrientation()
Определения AreaDamageManager.c:306
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
AnimBootsType
Определения DayZAnimEvents.c:98
override bool DisableVicinityIcon()
Определения DayZAnimal.c:75
proto native DayZCreatureAnimInterface GetAnimInterface()
proto native void PrePhys_SetRotation(float pInRot[4])
bool PostPhysUpdate(float pDt)
class DayZCreatureAI extends DayZCreature COMMANDID_ATTACK
proto native void SetAnimationInstanceByName(string animation_instance_name, int instance_uuid, float duration)
proto native void PostPhys_SetPosition(vector pInTransl)
quaternion in world space
bool ModCommandHandlerInside(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
Определения DayZAnimal.c:178
class DayZCreatureAI extends DayZCreature COMMANDID_HIT
class DayZCreatureAnimInterface RegisterAnimationEvent(string event_name, string function_name)
class DayZAnimalCommandMove extends AnimCommandBase SetFlagFinished(bool pFinished)
DayZAnimalCommandScript fully scriptable command.
override bool HasFixedActionTargetCursorPosition()
Определения DayZAnimal.c:120
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Определения DayZAnimal.c:136
proto native void UpdateSimulationPrecision(int simLOD)
proto native bool PrePhys_GetRotation(out float pOutRot[4])
proto native int GetCurrentAnimationInstanceUUID()
proto native bool IsDeathProcessed()
proto native void PostPhys_GetRotation(out float pOutRot[4])
vec3 in world space
override void AddArrow(Object arrow, int componentIndex, vector closeBonePosWS, vector closeBoneRotWS)
Определения DayZAnimal.c:80
proto native int GetBoneIndexByName(string pBoneName)
returns bone index for a name (-1 if pBoneName doesn't exist)
proto native bool PrePhys_GetTranslation(out vector pOutTransl)
script function usable in PrePhysUpdate
proto native void PostPhys_SetRotation(float pInRot[4])
vec3 in world space
override bool IsIgnoredByConstruction()
Определения DayZAnimal.c:65
proto native void PrePhys_SetTranslation(vector pInTransl)
proto native void ResetDeath()
proto native void StartDeath()
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Определения DayZAnimal.c:125
class DayZCreatureAI extends DayZCreature COMMANDID_JUMP
proto native void PostPhys_LockRotation()
quaternion in world space
override bool CanBeSkinned()
Определения DayZAnimal.c:60
proto native void ResetDeathCooldown()
bool ModCommandHandlerBefore(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
Определения DayZAnimal.c:173
override bool IsManagingArrows()
Определения DayZAnimal.c:70
bool ModCommandHandlerAfter(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
Определения DayZAnimal.c:183
override bool IsDayZCreature()
Определения DayZAnimal.c:55
proto native void PostPhys_GetPosition(out vector pOutTransl)
script function usable in PostPhysUpdate
proto native bool IsDeathConditionMet()
DayZAnimalBehaviourSlot
defined in C++
Определения DayZAnimalInputController.c:3
DayZAnimalBehaviourAction
defined in C++
Определения DayZAnimalInputController.c:27
DayZGame g_Game
Определения DayZGame.c:3868
EActions
Определения EActions.c:2
void PlaySound()
Определения HungerSoundHandler.c:38
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
PlayerBase GetPlayer()
Определения ModifierBase.c:51
WaveKind
Определения Sound.c:2
Определения AIAgent.c:2
Определения AIGroup.c:2
base class of all commands exposed to script to provide common functionality over animations
Определения AnimCommand.c:3
proto native NoiseSystem GetNoiseSystem()
proto native void GizmoSelectObject(Object object)
proto native AbstractSoundScene GetSoundScene()
proto native void GizmoSelectPhysics(Physics physics)
ScriptModule GameScript
Определения Global/game.c:12
static ref TStringArray ARRAY_STRING
Определения UtilityClasses.c:49
Super root of all classes in Enforce script.
Определения EnScript.c:11
void CreateWound(TotalDamageResult damage_result, string zone_name, string ammo)
Определения ComponentAnimalBleeding.c:51
Определения EnPhysics.c:326
static void RegisterHitComponent(array< ref DayZAIHitComponent > pHitComponents, string pName, float pWeight)
Register Hit Component for AI targeting.
Определения DayZAIHitComponents.c:21
static bool SelectMostProbableHitComponent(array< ref DayZAIHitComponent > pHitComponents, out string pHitComponent)
Определения DayZAIHitComponents.c:40
proto native void OverrideBehaviourAction(bool state, int action)
proto native bool IsDead()
proto native bool IsAttack()
void AttenuateSoundIfNecessary(SoundObject soundObject)
Определения DayZAnimal.c:380
proto native AIAgent GetAIAgent()
DayZPlayer m_CinematicPlayer
Определения DayZAnimal.c:210
void OnSoundVoiceEvent(int event_id, string event_user_string)
Определения DayZAnimal.c:267
void ProcessStepEvent(AnimStepEvent step_event)
Определения DayZAnimal.c:361
void ProcessDamageEvent(AnimDamageEvent damage_event)
Определения DayZAnimal.c:375
string CaptureSound()
Определения DayZAnimal.c:407
bool CinematicCanJump()
Определения DayZAnimal.c:426
void OnStepEvent(int event_id, string event_user_string)
Определения DayZAnimal.c:276
bool ResistContaminatedEffect()
Определения DayZAnimal.c:392
AbstractWave PlaySound(SoundObject so, SoundObjectBuilder sob)
Определения DayZAnimal.c:246
bool IsDanger()
Определения DayZAnimal.c:402
proto native DayZCreatureAIType GetCreatureAIType()
void DayZCreatureAI()
Определения DayZAnimal.c:213
int m_EffectTriggerCount
Определения DayZAnimal.c:208
void RegisterAnimEvents()
Определения DayZAnimal.c:294
override bool ModCommandHandlerBefore(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
Определения DayZAnimal.c:431
proto native void DestroyAIAgent()
void ProcessSoundVoiceEvent(AnimSoundVoiceEvent sound_event)
Определения DayZAnimal.c:340
vector SetDefaultHitPosition(string pSelection)
Определения DayZAnimal.c:994
int m_DamageHitType
Определения DayZAnimal.c:786
proto native void SignalAIAttackEnded()
bool HandleDeath(int currentCommandID, DayZAnimalInputController inputController)
Определения DayZAnimal.c:789
override bool IsAnimal()
Определения DayZAnimal.c:698
bool m_DamageHitToProcess
Определения DayZAnimal.c:785
proto native DayZAnimalCommandScript StartCommand_Script(DayZAnimalCommandScript pInfectedCommand)
scripted commands
proto native void StartCommand_Hit(int pType, int pDirection)
proto native void StartCommand_Jump()
proto native DayZAnimalCommandScript GetCommand_Script()
void RegisterHitComponentsForAI()
register hit components for AI melee (used by attacking AI)
Определения DayZAnimal.c:956
int FindComponentDirectionOffset(string component)
Определения DayZAnimal.c:910
bool HandleDamageHit(int currentCommandID)
Определения DayZAnimal.c:815
override string GetDefaultHitPositionComponent()
Определения DayZAnimal.c:984
bool ComputeDamageHitParams(EntityAI source, string dmgZone, string ammo, out int type, out int direction)
Определения DayZAnimal.c:863
void DayZAnimal()
Определения DayZAnimal.c:678
override vector GetDefaultHitPosition()
Определения DayZAnimal.c:989
proto native void StartCommand_Attack()
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Определения DayZAnimal.c:830
override int GetHideIconMask()
Определения DayZAnimal.c:708
override bool IsHealthVisible()
Определения DayZAnimal.c:693
string m_DefaultHitComponent
Определения DayZAnimal.c:658
proto native DayZAnimalInputController GetInputController()
override bool IsInventoryVisible()
Определения DayZAnimal.c:703
override string GetHitComponentForAI()
Определения DayZAnimal.c:967
float ConvertNonlethalDamage(float damage, DamageType damageType)
Определения DayZAnimal.c:999
proto native void StartCommand_Death(int pType, int pDirection)
ref array< ref DayZAIHitComponent > m_HitComponentsForAI
Melee hit components (AI targeting)
Определения DayZAnimal.c:657
proto native DayZAnimalCommandScript StartCommand_ScriptInst(typename pCallbackClass)
void CommandHandler(float dt, int currentCommandID, bool currentCommandFinished)
Определения DayZAnimal.c:720
void EOnContact(IEntity other, Contact extra)
Определения DayZAnimal.c:940
int m_DamageHitDirection
Определения DayZAnimal.c:787
proto native void StartCommand_Move()
override string GetDefaultHitComponent()
Определения DayZAnimal.c:979
vector m_DefaultHitPosition
Определения DayZAnimal.c:660
float ComputeHitDirectionAngleDeg(EntityAI source)
Определения DayZAnimal.c:875
string m_DefaultHitPositionComponent
Определения DayZAnimal.c:659
proto native void SignalAIAttackStarted()
void QueueDamageHit(int type, int direction)
Определения DayZAnimal.c:856
int TranslateHitAngleDegToDirectionIndex(float angleDeg)
Определения DayZAnimal.c:896
do not process rotations !
Определения DayZAnimal.c:654
proto native void OverrideAlertLevel(bool state, bool alerted, int level, float inLevel)
proto native void OverrideJump(bool state, int jumpType, float jumpHeight=0)
proto native bool IsJump()
proto native void OverrideBehaviourSlot(bool state, int slot)
proto native void OverrideMovementSpeed(bool state, float movementSpeed)
proto native void OverrideHeading(bool state, float heading)
proto native void OverrideTurnSpeed(bool state, float turnSpeed)
void AddDamageSphere(AnimDamageParams damage_params)
Определения DayZAnimal.c:230
void OnDamageEvent(int event_id, string event_user_string)
Определения DayZAnimal.c:285
void DecreaseEffectTriggerCount()
Определения DayZAnimal.c:225
void CinematicTakeControl(DayZPlayer player)
Определения DayZAnimal.c:421
proto native bool IsSoundInsideBuilding()
void ProcessSoundEvent(AnimSoundEvent sound_event)
Определения DayZAnimal.c:320
override void EEKilled(Object killer)
Определения DayZAnimal.c:235
void OnSoundEvent(int event_id, string event_user_string)
Определения DayZAnimal.c:258
void IncreaseEffectTriggerCount()
Определения DayZAnimal.c:220
AnimBootsType GetBootsType()
Определения DayZAnimal.c:241
string ReleaseSound()
Определения DayZAnimal.c:412
proto native void InitAIAgent(AIGroup group)
proto native void AddDamageSphere(string bone_name, string ammo_name, float radius, float duration, bool invertTeams)
proto native TAnimGraphVariable BindVariableFloat(string pVariable)
proto native TAnimGraphTag BindTag(string pTagName)
proto native TAnimGraphVariable BindVariableBool(string pVariable)
proto native TAnimGraphCommand BindCommand(string pCommandName)
returns command index -
proto native TAnimGraphEvent BindEvent(string pEventName)
void ~DayZCreatureAnimInterface()
Определения DayZAnimal.c:4
void DayZCreatureAnimInterface()
Определения DayZAnimal.c:3
proto native TAnimGraphVariable BindVariableInt(string pVariable)
Определения DayZAnimal.c:190
Определения EnEntity.c:165
Определения EnMath3D.c:28
Определения EnMath.c:7
proto void AddNoise(EntityAI source_entity, NoiseParams noise_params, float external_strenght_multiplier=1.0)
Определения ObjectTyped.c:2
Определения Sound.c:112
proto native float GetDamage(string zoneName, string healthType)
Определения DamageSystem.c:2
Native class for boats - handles physics simulation.
Определения Boat.c:28
proto native float SyncedValue_ID(int action, bool check_focus=true)
Get action state.
Определения UAInput.c:97
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native float Length()
Returns length of vector (magnitude)
static float Dot(vector v1, vector v2)
Returns Dot product of vector v1 and vector v2.
Определения EnConvert.c:271
proto float Normalize()
Normalizes vector. Returns length.
Определения EnConvert.c:106
string GetDefaultHitComponent()
Определения dayzplayer.c:497
@ COMMANDID_MOVE
Определения dayzplayer.c:696
@ COMMANDID_SCRIPT
Определения dayzplayer.c:708
@ COMMANDID_DEATH
Определения dayzplayer.c:701
string GetDefaultHitPositionComponent()
Определения dayzplayer.c:502
Serializer ParamsReadContext
Определения gameplay.c:15
proto native CGame GetGame()
const int COMP_TYPE_ANIMAL_BLEEDING
Определения Component.c:11
const int COMP_TYPE_BODY_STAGING
Определения Component.c:10
proto void Print(void var)
Prints content of variable to console/log.
proto native void SetFlags(ShapeFlags flags)
const float NL_DAMAGE_FIREARM_CONVERSION_ANIMALS
Определения 3_Game/constants.c:1003
const float NL_DAMAGE_CLOSECOMBAT_CONVERSION_ANIMALS
Определения 3_Game/constants.c:1007
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
proto volatile int CallFunction(Class inst, string function, out void returnVal, void parm)
EntityEvent
Entity events for event-mask, or throwing event from code.
Определения EnEntity.c:45
EntityFlags
Entity flags.
Определения EnEntity.c:115
static proto void YawPitchRollMatrix(vector ang, out vector mat[3])
Creates rotation matrix from angles.
static proto void MatrixInvMultiply4(vector mat0[4], vector mat1[4], out vector res[4])
Invert-transforms matrix.
static proto void MatrixOrthogonalize4(vector mat[4])
Orthogonalizes matrix.
static const float PI2
Определения EnMath.c:13
static proto float Acos(float c)
Returns angle in radians from cosinus.
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 const float RAD2DEG
Определения EnMath.c:16
static const float DEG2RAD
Определения EnMath.c:17
const string CFG_AMMO
Определения 3_Game/constants.c:223
proto native vector GetVelocity(notnull IEntity ent)
Returns linear velocity.
const int SAT_DEBUG_ACTION
Определения 3_Game/constants.c:454
proto native AbstractWave Play3D(SoundObject soundObject, SoundObjectBuilder soundBuilder)
class AbstractSoundScene SoundObjectBuilder(SoundParams soundParams)
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9
void AbstractWave()
Определения Sound.c:167
proto native void SetPosition(vector position)
Note: Sets the position locally if parented, retrieves globally with the sound offset.
proto native void SetKind(WaveKind kind)
proto native void AddChild(Widget child, bool immedUpdate=true)
int TAnimGraphVariable
Определения human.c:277
int TAnimGraphTag
Определения human.c:278
class HumanInputController TAnimGraphCommand
int TAnimGraphEvent
Определения human.c:279