DayZ 1.29
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 (g_Game.IsClient() || !g_Game.IsMultiplayer())
142 {
143 switch (action_id)
144 {
145 case EActions.GIZMO_OBJECT:
146 if (GetGizmoApi())
148 return true;
149 case EActions.GIZMO_PHYSICS:
150 if (GetGizmoApi())
151 GetGizmoApi().SelectPhysics(GetPhysics());
152 return true;
153 }
154 }
155
156 if (g_Game.IsServer())
157 {
158 switch (action_id)
159 {
160 case EActions.DELETE:
161 Delete();
162 return true;
163 }
164 }
165
166 return false;
167 }
168
169 //-------------------------------------------------------------
173 // these functions are for modded overide in script command mods
174
175 bool ModCommandHandlerBefore(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
176 {
177 return false;
178 }
179
180 bool ModCommandHandlerInside(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
181 {
182 return false;
183 }
184
185 bool ModCommandHandlerAfter(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
186 {
187 return false;
188 }
189}
190
192{
193 proto native AIAgent GetAIAgent();
194
195 proto native bool IsSoundInsideBuilding();
196#ifdef DIAG_DEVELOPER
197 proto native void DebugDisableAIControl();
198 proto native void DebugRestoreAIControl();
199#endif
200 proto native void AddDamageSphere(string bone_name, string ammo_name, float radius, float duration, bool invertTeams);
201
207 proto native void InitAIAgent(AIGroup group);
208 proto native void DestroyAIAgent();
209
210 int m_EffectTriggerCount;//how many effect triggers is this AI inside of(overlapping triggers)
211
213
214
216 {
218 SetFlags(EntityFlags.TOUCHTRIGGERS, false);
219 }
220
221
226
231
232 void AddDamageSphere(AnimDamageParams damage_params)
233 {
234 AddDamageSphere(damage_params.m_sBoneName, damage_params.m_sAmmoName, damage_params.m_fRadius, damage_params.m_fDuration, damage_params.m_bInvertTeams);
235 }
236
237 override void EEKilled(Object killer)
238 {
239 super.EEKilled(killer);
240 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
241 }
242
244 {
245 return AnimBootsType.None;
246 }
247
249 {
250 if(so == NULL)
251 {
252 return NULL;
253 }
254
256 AbstractWave wave = g_Game.GetSoundScene().Play3D(so, sob);
257 return wave;
258 }
259
260 void OnSoundEvent(int event_id, string event_user_string)
261 {
262 AnimSoundEvent sound_event = GetCreatureAIType().GetSoundEvent(event_id);
263 if(sound_event != NULL)
264 {
265 ProcessSoundEvent(sound_event);
266 }
267 }
268
269 void OnSoundVoiceEvent(int event_id, string event_user_string)
270 {
271 AnimSoundVoiceEvent voice_event = GetCreatureAIType().GetSoundVoiceEvent(event_id);
272 if(voice_event != NULL)
273 {
274 ProcessSoundVoiceEvent(voice_event);
275 }
276 }
277
278 void OnStepEvent(int event_id, string event_user_string)
279 {
280 AnimStepEvent step_event = GetCreatureAIType().GetStepEvent(event_id);
281 if(step_event != NULL)
282 {
283 ProcessStepEvent(step_event);
284 }
285 }
286
287 void OnDamageEvent(int event_id, string event_user_string)
288 {
289 AnimDamageEvent damage_event = GetCreatureAIType().GetDamageEvent(event_id);
290 if(damage_event != NULL)
291 {
292 ProcessDamageEvent(damage_event);
293 }
294 }
295
296 protected void RegisterAnimEvents()
297 {
298 if(!RegisterAnimationEvent("Sound", "OnSoundEvent"))
299 {
300 Print("Error registering anim. event (Sound)");
301 }
302
303 if(!RegisterAnimationEvent("SoundVoice", "OnSoundVoiceEvent"))
304 {
305 Print("Error registering anim. event (SoundVoice)");
306 }
307
308 if(!g_Game.IsDedicatedServer())
309 {
310 if(!RegisterAnimationEvent("Step", "OnStepEvent"))
311 {
312 Print("Error registering anim. event (Step)");
313 }
314 }
315
316 if(!RegisterAnimationEvent("Damage", "OnDamageEvent"))
317 {
318 Print("Error registering anim. event (Damage)");
319 }
320 }
321
322 private void ProcessSoundEvent(AnimSoundEvent sound_event)
323 {
324 if(!g_Game.IsDedicatedServer())
325 {
326 SoundObjectBuilder objectBuilder = sound_event.GetSoundBuilder();
327 if(NULL != objectBuilder)
328 {
329 objectBuilder.AddEnvSoundVariables(GetPosition());
330 SoundObject soundObject = objectBuilder.BuildSoundObject();
331 PlaySound(soundObject, objectBuilder);
332 }
333 }
334
335 if(g_Game.IsServer())
336 {
337 if(sound_event.m_NoiseParams != NULL)
338 g_Game.GetNoiseSystem().AddNoise(this, sound_event.m_NoiseParams, g_Game.GetWeather().GetNoiseReductionByWeather());
339 }
340 }
341
342 private void ProcessSoundVoiceEvent(AnimSoundVoiceEvent sound_event)
343 {
344 if(!g_Game.IsDedicatedServer())
345 {
346 SoundObjectBuilder objectBuilder = sound_event.GetSoundBuilder();
347 if(NULL != objectBuilder)
348 {
349 objectBuilder.AddEnvSoundVariables(GetPosition());
350 SoundObject soundObject = objectBuilder.BuildSoundObject();
351 AttenuateSoundIfNecessary(soundObject);
352 PlaySound(soundObject, objectBuilder);
353 }
354 }
355
356 if(g_Game.IsServer())
357 {
358 if(sound_event.m_NoiseParams != NULL)
359 g_Game.GetNoiseSystem().AddNoise(this, sound_event.m_NoiseParams, g_Game.GetWeather().GetNoiseReductionByWeather());
360 }
361 }
362
363 private void ProcessStepEvent(AnimStepEvent step_event)
364 {
365 SoundObjectBuilder soundBuilder = step_event.GetSoundBuilder(GetSurfaceType().Hash());
366 if(soundBuilder == NULL)
367 return;
368
369 soundBuilder.AddEnvSoundVariables(GetPosition());
370 SoundObject soundObject = soundBuilder.BuildSoundObject();
371 AttenuateSoundIfNecessary(soundObject);
372 PlaySound(soundObject, soundBuilder);
373
374 //TODO effects
375 }
376
377 private void ProcessDamageEvent(AnimDamageEvent damage_event)
378 {
379 AddDamageSphere(damage_event.m_DamageParams);
380 }
381
382 protected void AttenuateSoundIfNecessary(SoundObject soundObject)
383 {
384 if (g_Game.GetPlayer() != NULL && (IsSoundInsideBuilding() != g_Game.GetPlayer().IsSoundInsideBuilding() || g_Game.GetPlayer().IsCameraInsideVehicle()))
385 {
386 soundObject.SetKind(WaveKind.WAVEATTALWAYS);
387 }
388 else
389 {
390 soundObject.SetKind(WaveKind.WAVEEFFECTEX);
391 }
392 }
393
395 {
396 return false;
397 }
398
399 // ================
400 // EASTER EGG
401 // ================
402
403 //Used for easter egg sound selection
404 bool IsDanger()
405 {
406 return false;
407 }
408
410 {
411 return "";
412 }
413
415 {
416 return "";
417 }
418
419 // ================
420 // CINEMATIC CONTROLLER
421 // ================
422
424 {
425 m_CinematicPlayer = player;
426 }
427
429 {
430 return true;
431 }
432
433 override bool ModCommandHandlerBefore(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
434 {
436 {
437 return super.ModCommandHandlerBefore(pDt, pCurrentCommandID, pCurrentCommandFinished);
438 }
439
440 UAInterface input = m_CinematicPlayer.GetInputInterface();
441
443 g_Game.GameScript.CallFunction(this, "GetInputController", controller, 0);
444
445 if (!input || !controller)
446 {
447 return super.ModCommandHandlerBefore(pDt, pCurrentCommandID, pCurrentCommandFinished);
448 }
449
450 float movementX = input.SyncedValue_ID(UAAimRight) - input.SyncedValue_ID(UAAimLeft);
451
452 float maxTurnSpeed = 100.0;
453 movementX = Math.Clamp(movementX * maxTurnSpeed * pDt, -180, 180);
454
455 if (input.SyncedValue_ID(UALookAround) > 0)
456 {
457 movementX = 0;
458 }
459
460 bool isJump = input.SyncedValue_ID(UAGetOver) > 0;
461 bool isMove = input.SyncedValue_ID(UAMoveForward) > 0;
462
463 bool isRest = input.SyncedValue_ID(UAMoveBack) > 0;
464 bool isSleep = input.SyncedValue_ID(UAReloadMagazine) > 0;
465
466 float heading = GetOrientation()[0] + movementX;
467
468 int iAlert = 0;
469 float fAlert = 0;
470 int iSpeed = 0;
471 float fSpeed = 0;
472
473 if (isMove)
474 {
475 iAlert = 1;
476 fAlert = 0.2;
477
478 bool isSprint = input.SyncedValue_ID(UATurbo) > 0;
479 bool isJog = input.SyncedValue_ID(UAWalkRunTemp) > 0;
480 bool isWalk = !isSprint && !isJog;
481 if (isSprint)
482 {
484 iSpeed = 3;
485 }
486 else if (isJog)
487 {
489 iSpeed = 2;
490 }
491 else if (isWalk)
492 {
494 iSpeed = 1;
495 }
496 }
497
498 DayZAnimalInputController animalController;
499 if (Class.CastTo(animalController, controller))
500 {
501 animalController.OverrideBehaviourSlot(true, DayZAnimalBehaviourSlot.NON_SPECIFIC_THREAT);
502 animalController.OverrideBehaviourAction(true, DayZAnimalBehaviourAction.TRAVELING_INPUT);
503
504 if (!isMove)
505 {
506 if (isRest)
507 {
508 iSpeed = 0;
509 animalController.OverrideBehaviourAction(true, DayZAnimalBehaviourAction.IDLE1_INPUT);
510 }
511
512 if (isSleep)
513 {
514 iSpeed = 0;
515 animalController.OverrideBehaviourAction(true, DayZAnimalBehaviourAction.WALKING_INPUT);
516 }
517 }
518 }
519
520 bool lowVel = GetVelocity(this).Length() < 0.5;
521 if (iSpeed > 0 && lowVel)
522 {
523 iAlert = 4;
524 fAlert = 1.0;
525
526 iSpeed = 3;
527 }
528
529 if (animalController)
530 {
531 switch (iSpeed)
532 {
533 case 0:
534 fSpeed = 0;
535 break;
536 case 1:
537 fSpeed = 2;
538 break;
539 case 2:
540 fSpeed = 3;
541 break;
542 case 3:
543 fSpeed = 5;
544 break;
545 }
546 }
547
548 controller.OverrideTurnSpeed(true, Math.PI2 / pDt);
549 controller.OverrideMovementSpeed(true, fSpeed);
550 controller.OverrideHeading(true, heading * Math.DEG2RAD);
551 controller.OverrideAlertLevel(true, true, iAlert, fAlert);
552
553 if (CinematicCanJump() && isJump)
554 {
555 controller.OverrideJump(true, 101, 2.0);
556 }
557
558 return true;
559 }
560}
561
562enum DayZAnimalConstants
563{
570};
571
573{
574
575}
576
577class DayZAnimalCommandAttack extends AnimCommandBase
578{
579
580}
581
582class DayZAnimalCommandJump extends AnimCommandBase
583{
584
585}
586
587class DayZAnimalCommandLookAt extends AnimCommandBase
588{
589
590}
591
592class DayZAnimalCommandBehaviourModifier extends AnimCommandBase
593{
594
595}
596
597class DayZAnimalCommandHit extends AnimCommandBase
598{
599
600}
601
602class DayZAnimalCommandDeath extends AnimCommandBase
603{
604
605}
606
607class DayZAnimalCommandAnimCallback extends AnimCommandBase
608{
609
610}
611
619class DayZAnimalCommandScript extends AnimCommandBase
620{
622 //void DayZAnimalCommandScript(DayZAnimal pAnimal)
623
624 //---------------------------------------------------------------
625 // usable everywhere
626
628 proto native void SetFlagFinished(bool pFinished);
629
630 //---------------------------------------------------------------
631 // PrePhys Update
632
634 proto native bool PrePhys_GetTranslation(out vector pOutTransl); // vec3 in local space !
635 proto native bool PrePhys_GetRotation(out float pOutRot[4]); // quaternion in local space !
636 proto native void PrePhys_SetTranslation(vector pInTransl); // vec3 in local space !
637 proto native void PrePhys_SetRotation(float pInRot[4]); // quaternion in local space !
638
639 //---------------------------------------------------------------
640 // PostPhys Update
641
645 bool PostPhysUpdate(float pDt);
646
648 proto native void PostPhys_GetPosition(out vector pOutTransl);
649 proto native void PostPhys_GetRotation(out float pOutRot[4]);
650 proto native void PostPhys_SetPosition(vector pInTransl);
651 proto native void PostPhys_SetRotation(float pInRot[4]);
652 proto native void PostPhys_LockRotation();
653}
654
656{
657
660 protected string m_DefaultHitComponent;
663
665
666 proto native void StartCommand_Death(int pType, int pDirection);
667 proto native void StartCommand_Move();
668 proto native void StartCommand_Jump();
669 proto native void StartCommand_Attack();
670 proto native void StartCommand_Hit(int pType, int pDirection);
671
673 proto native DayZAnimalCommandScript StartCommand_Script(DayZAnimalCommandScript pInfectedCommand);
674 proto native DayZAnimalCommandScript StartCommand_ScriptInst(typename pCallbackClass);
675 proto native DayZAnimalCommandScript GetCommand_Script();
676
677 proto native void SignalAIAttackStarted();
678 proto native void SignalAIAttackEnded();
679
681 {
682 // testing: animals have no inventory by default
683 //GetInventory().LockInventory(LOCK_FROM_SCRIPT); // Hides animals from vicinity in inventory. Remove this if wanted otherwise.
684
686
688
691
692 SetEventMask(EntityEvent.CONTACT);
693 }
694
695 override bool IsHealthVisible()
696 {
697 return false;
698 }
699
700 override bool IsAnimal()
701 {
702 return true;
703 }
704
705 override bool IsInventoryVisible()
706 {
707 return false;
708 }
709
710 override int GetHideIconMask()
711 {
712 return EInventoryIconVisibility.HIDE_VICINITY;
713 /*
714 if (IsAlive())
715 {
716 return EInventoryIconVisibility.HIDE_VICINITY;
717 }
718 return super.GetHideIconMask();
719 */
720 }
721
722 void CommandHandler(float dt, int currentCommandID, bool currentCommandFinished)
723 {
725
727 if( ModCommandHandlerBefore(dt, currentCommandID, currentCommandFinished) )
728 {
729 return;
730 }
731
732 if (HandleDeath(currentCommandID, inputController))
733 {
734 return;
735 }
736
737 if (currentCommandFinished)
738 {
739 if (currentCommandID == DayZAnimalConstants.COMMANDID_ATTACK)
740 {
742 }
743
745
746 return;
747 }
748
750 if( ModCommandHandlerInside(dt, currentCommandID, currentCommandFinished) )
751 {
752 return;
753 }
754
755 if (HandleDamageHit(currentCommandID))
756 {
757 if (currentCommandID == DayZAnimalConstants.COMMANDID_ATTACK)
758 {
760 }
761 return;
762 }
763
764 if (currentCommandID == DayZAnimalConstants.COMMANDID_MOVE)
765 {
766 if (inputController.IsJump())
767 {
769 return;
770 }
771
772 if (inputController.IsAttack())
773 {
776 return;
777 }
778 }
779
781 if( ModCommandHandlerAfter(dt, currentCommandID, currentCommandFinished) )
782 {
783 return;
784 }
785 }
786
790
791 bool HandleDeath(int currentCommandID, DayZAnimalInputController inputController)
792 {
793 if (inputController.IsDead())
794 {
795 if (currentCommandID == DayZAnimalConstants.COMMANDID_DEATH)
796 {
797 return true;
798 }
799
801 {
802 m_DamageHitToProcess = false;
803
805 }
806 else
807 {
808 StartCommand_Death(0, 0);
809 }
810
811 return true;
812 }
813
814 return false;
815 }
816
817 bool HandleDamageHit(int currentCommandID)
818 {
820 {
821 m_DamageHitToProcess = false;
822
823 if (currentCommandID != DayZAnimalConstants.COMMANDID_HIT)
824 {
826 }
827 return true;
828 }
829 return false;
830 }
831
832 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
833 {
834 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
835 m_TransportHitRegistered = false;
836
837 int transferShockToDamageCoef = g_Game.ConfigGetInt(string.Format("%1 %2 DamageApplied transferShockToDamage", CFG_AMMO, ammo));
838 if (transferShockToDamageCoef == 1)
839 {
840 //Print("DayZAnimal | EEHitBy | nonlethal hit");
841 AddHealth("", "Health", -ConvertNonlethalDamage(damageResult.GetDamage(dmgZone, "Shock"), damageType));
842 }
843 else
844 {
845 ComponentAnimalBleeding animal_bleeding = ComponentAnimalBleeding.Cast( GetComponent( COMP_TYPE_ANIMAL_BLEEDING ) );
846 animal_bleeding.CreateWound( damageResult, dmgZone, ammo );
847 }
848
849 int type = 0;
850 int direction = 0;
851 if (ComputeDamageHitParams(source, dmgZone, ammo, type, direction) == true)
852 {
853 QueueDamageHit(type, direction);
854 }
855
856 }
857
858 void QueueDamageHit(int type, int direction)
859 {
861 m_DamageHitType = type;
862 m_DamageHitDirection = direction;
863 }
864
865 bool ComputeDamageHitParams(EntityAI source, string dmgZone, string ammo, out int type, out int direction)
866 {
867 type = 0; // not used right now
868
869 float angleDeg = ComputeHitDirectionAngleDeg(source);
870 direction = TranslateHitAngleDegToDirectionIndex(angleDeg);
871
872 direction += FindComponentDirectionOffset(dmgZone);
873
874 return true;
875 }
876
878 {
879 vector targetDirection = GetDirection();
880 vector toSourceDirection = (source.GetPosition() - GetPosition());
881
882 targetDirection[1] = 0;
883 toSourceDirection[1] = 0;
884
885 targetDirection.Normalize();
886 toSourceDirection.Normalize();
887
888 float cosFi = vector.Dot(targetDirection, toSourceDirection);
889 vector cross = targetDirection * toSourceDirection;
890
891 float dirAngleDeg = Math.Acos(cosFi) * Math.RAD2DEG;
892 if ( cross[1] < 0 )
893 dirAngleDeg = -dirAngleDeg;
894
895 return dirAngleDeg;
896 }
897
899 {
900 if (angleDeg >= -20 && angleDeg <= 20) // front
901 {
902 return 1;
903 }
904 else if (angleDeg < 0) // left
905 {
906 return 2;
907 }
908
909 return 3; // right
910 }
911
913 {
914 const int directionCount = 4;
915
916 int offset = 0;
917 if (component.Length() == 0)
918 {
919 offset = 0;
920 }
921 else if (component == "Zone_Head")
922 {
923 offset = directionCount;
924 }
925 else if (component == "Zone_Chest" || component == "Zone_Legs_Front" || component == "Zone_Spine_Front" || component == "Zone_Neck")
926 {
927 offset = 2 * directionCount;
928 }
929 else
930 {
931 offset = 3 * directionCount;
932 }
933
934 return offset;
935 }
936
937 //-------------------------------------------------------------
941
942 override protected void EOnContact(IEntity other, Contact extra)
943 {
944 if( !IsAlive() )
945 return;
946
947 Transport transport = Transport.Cast(other);
948 if( transport )
949 {
950 if ( g_Game.IsServer() )
951 {
952 RegisterTransportHit(transport);
953 }
954 }
955 }
956
968
969 override string GetHitComponentForAI()
970 {
971 string hitComp;
972
974 {
975 return hitComp;
976 }
977
978 return GetDefaultHitComponent();
979 }
980
981 override string GetDefaultHitComponent()
982 {
984 }
985
987 {
989 }
990
992 {
994 }
995
996 protected vector SetDefaultHitPosition(string pSelection)
997 {
998 return GetSelectionPositionMS(pSelection);
999 }
1000
1001 override protected float ConvertNonlethalDamage(float damage, DamageType damageType)
1002 {
1003 switch (damageType)
1004 {
1005 case DamageType.CLOSE_COMBAT:
1007 case DamageType.FIRE_ARM:
1009 }
1010
1011 return super.ConvertNonlethalDamage(damage, damageType);
1012 }
1013}
Param4< int, int, string, int > TSelectableActionInfoWithColor
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:180
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:175
override bool IsManagingArrows()
Определения DayZAnimal.c:70
bool ModCommandHandlerAfter(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
Определения DayZAnimal.c:185
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:3942
EActions
Определения EActions.c:2
proto GizmoApi GetGizmoApi()
void PlaySound()
Определения HungerSoundHandler.c:39
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
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
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
Определения Contact.c:10
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:382
proto native AIAgent GetAIAgent()
DayZPlayer m_CinematicPlayer
Определения DayZAnimal.c:212
void OnSoundVoiceEvent(int event_id, string event_user_string)
Определения DayZAnimal.c:269
void ProcessStepEvent(AnimStepEvent step_event)
Определения DayZAnimal.c:363
void ProcessDamageEvent(AnimDamageEvent damage_event)
Определения DayZAnimal.c:377
string CaptureSound()
Определения DayZAnimal.c:409
bool CinematicCanJump()
Определения DayZAnimal.c:428
void OnStepEvent(int event_id, string event_user_string)
Определения DayZAnimal.c:278
bool ResistContaminatedEffect()
Определения DayZAnimal.c:394
AbstractWave PlaySound(SoundObject so, SoundObjectBuilder sob)
Определения DayZAnimal.c:248
bool IsDanger()
Определения DayZAnimal.c:404
proto native DayZCreatureAIType GetCreatureAIType()
void DayZCreatureAI()
Определения DayZAnimal.c:215
int m_EffectTriggerCount
Определения DayZAnimal.c:210
void RegisterAnimEvents()
Определения DayZAnimal.c:296
override bool ModCommandHandlerBefore(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
Определения DayZAnimal.c:433
proto native void DestroyAIAgent()
void ProcessSoundVoiceEvent(AnimSoundVoiceEvent sound_event)
Определения DayZAnimal.c:342
vector SetDefaultHitPosition(string pSelection)
Определения DayZAnimal.c:996
int m_DamageHitType
Определения DayZAnimal.c:788
proto native void SignalAIAttackEnded()
bool HandleDeath(int currentCommandID, DayZAnimalInputController inputController)
Определения DayZAnimal.c:791
override bool IsAnimal()
Определения DayZAnimal.c:700
bool m_DamageHitToProcess
Определения DayZAnimal.c:787
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:958
int FindComponentDirectionOffset(string component)
Определения DayZAnimal.c:912
bool HandleDamageHit(int currentCommandID)
Определения DayZAnimal.c:817
override string GetDefaultHitPositionComponent()
Определения DayZAnimal.c:986
bool ComputeDamageHitParams(EntityAI source, string dmgZone, string ammo, out int type, out int direction)
Определения DayZAnimal.c:865
void DayZAnimal()
Определения DayZAnimal.c:680
override vector GetDefaultHitPosition()
Определения DayZAnimal.c:991
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:832
override int GetHideIconMask()
Определения DayZAnimal.c:710
override bool IsHealthVisible()
Определения DayZAnimal.c:695
string m_DefaultHitComponent
Определения DayZAnimal.c:660
proto native DayZAnimalInputController GetInputController()
override bool IsInventoryVisible()
Определения DayZAnimal.c:705
override string GetHitComponentForAI()
Определения DayZAnimal.c:969
float ConvertNonlethalDamage(float damage, DamageType damageType)
Определения DayZAnimal.c:1001
proto native void StartCommand_Death(int pType, int pDirection)
ref array< ref DayZAIHitComponent > m_HitComponentsForAI
Melee hit components (AI targeting)
Определения DayZAnimal.c:659
proto native DayZAnimalCommandScript StartCommand_ScriptInst(typename pCallbackClass)
void CommandHandler(float dt, int currentCommandID, bool currentCommandFinished)
Определения DayZAnimal.c:722
void EOnContact(IEntity other, Contact extra)
Определения DayZAnimal.c:942
int m_DamageHitDirection
Определения DayZAnimal.c:789
proto native void StartCommand_Move()
override string GetDefaultHitComponent()
Определения DayZAnimal.c:981
vector m_DefaultHitPosition
Определения DayZAnimal.c:662
float ComputeHitDirectionAngleDeg(EntityAI source)
Определения DayZAnimal.c:877
string m_DefaultHitPositionComponent
Определения DayZAnimal.c:661
proto native void SignalAIAttackStarted()
void QueueDamageHit(int type, int direction)
Определения DayZAnimal.c:858
int TranslateHitAngleDegToDirectionIndex(float angleDeg)
Определения DayZAnimal.c:898
do not process rotations !
Определения DayZAnimal.c:656
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:232
void OnDamageEvent(int event_id, string event_user_string)
Определения DayZAnimal.c:287
void DecreaseEffectTriggerCount()
Определения DayZAnimal.c:227
void CinematicTakeControl(DayZPlayer player)
Определения DayZAnimal.c:423
proto native bool IsSoundInsideBuilding()
void ProcessSoundEvent(AnimSoundEvent sound_event)
Определения DayZAnimal.c:322
override void EEKilled(Object killer)
Определения DayZAnimal.c:237
void OnSoundEvent(int event_id, string event_user_string)
Определения DayZAnimal.c:260
void IncreaseEffectTriggerCount()
Определения DayZAnimal.c:222
AnimBootsType GetBootsType()
Определения DayZAnimal.c:243
string ReleaseSound()
Определения DayZAnimal.c:414
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:192
Определения DayZPlayerImplement.c:87
proto void SelectObject(Object object)
proto void SelectPhysics(Physics physics)
Определения EnEntity.c:165
Определения EnMath3D.c:28
Определения EnMath.c:7
Определения 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:32
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:284
proto float Normalize()
Normalizes vector. Returns length.
Определения EnConvert.c:119
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
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/DayZ/constants.c:1006
const float NL_DAMAGE_CLOSECOMBAT_CONVERSION_ANIMALS
Определения 3_Game/DayZ/constants.c:1010
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
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/DayZ/constants.c:223
proto native vector GetVelocity(notnull IEntity ent)
Returns linear velocity.
const int SAT_DEBUG_ACTION
Определения 3_Game/DayZ/constants.c:457
class AbstractSoundScene SoundObjectBuilder(SoundParams soundParams)
vector GetPosition()
Get the world position of the Effect.
Определения Effect.c:473
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