DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Файл Hatchback_02.c

См. исходные тексты.

Структуры данных

class  CarScript
 
class  Hatchback_02
 

Функции

void Hatchback_02 ()
 
override void EEInit ()
 
override void OnEngineStart ()
 
override void OnEngineStop ()
 
override void EOnPostSimulate (IEntity other, float timeSlice)
 
override int GetAnimInstance ()
 
override int GetSeatAnimationType (int posIdx)
 
override CarRearLightBase CreateRearLight ()
 
override CarLightBase CreateFrontLight ()
 
override bool CanReleaseAttachment (EntityAI attachment)
 
bool CanManipulateSpareWheel (string slotSelectionName)
 
override bool CanDisplayAttachmentCategory (string category_name)
 
override bool CanDisplayCargo ()
 
override int GetCarDoorsState (string slotType)
 
override bool CrewCanGetThrough (int posIdx)
 
override string GetDoorSelectionNameFromSeatPos (int posIdx)
 
override string GetDoorInvSlotNameFromSeatPos (int posIdx)
 
override float OnSound (CarSoundCtrl ctrl, float oldValue)
 
override string GetAnimSourceFromSelection (string selection)
 
override bool IsVitalTruckBattery ()
 
override bool IsVitalGlowPlug ()
 
override bool CanReachSeatFromSeat (int currentSeat, int nextSeat)
 
override bool CanReachDoorsFromSeat (string pDoorsSelection, int pCurrentSeat)
 

Переменные

ref UniversalTemperatureSource m_UTSource
 
ref UniversalTemperatureSourceSettings m_UTSSettings
 
ref UniversalTemperatureSourceLambdaEngine m_UTSLEngine
 
class Hatchback_02_Blue extends Hatchback_02 OnDebugSpawn
 

Функции

◆ CanDisplayAttachmentCategory()

override bool CanDisplayAttachmentCategory ( string category_name)
protected

◆ CanDisplayCargo()

override bool CanDisplayCargo ( )
protected
556{
560
561 void Hatchback_02()
562 {
563 //m_dmgContactCoef = 0.070;
564
565 m_EngineStartOK = "Hatchback_02_engine_start_SoundSet";
566 m_EngineStartBattery = "Hatchback_02_engine_failed_start_battery_SoundSet";
567 m_EngineStartPlug = "Hatchback_02_engine_failed_start_sparkplugs_SoundSet";
568 m_EngineStartFuel = "Hatchback_02_engine_failed_start_fuel_SoundSet";
569 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
570
571 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
572 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
573
574 m_CarHornShortSoundName = "Hatchback_02_Horn_Short_SoundSet";
575 m_CarHornLongSoundName = "Hatchback_02_Horn_SoundSet";
576
577 SetEnginePos("0 0.7 1.4");
578 }
579
580 override void EEInit()
581 {
582 super.EEInit();
583
584 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
585 {
587 m_UTSSettings.m_ManualUpdate = true;
588 m_UTSSettings.m_TemperatureMin = 0;
589 m_UTSSettings.m_TemperatureMax = 30;
591 m_UTSSettings.m_TemperatureCap = 0;
592 m_UTSSettings.m_RangeFull = 0.5;
593 m_UTSSettings.m_RangeMax = 2;
594
597 }
598 }
599
600 override void OnEngineStart()
601 {
602 super.OnEngineStart();
603
604 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
605 {
606 m_UTSource.SetDefferedActive(true, 20.0);
607 }
608 }
609
610 override void OnEngineStop()
611 {
612 super.OnEngineStop();
613
614 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
615 {
616 m_UTSource.SetDefferedActive(false, 10.0);
617 }
618 }
619
620 override void EOnPostSimulate(IEntity other, float timeSlice)
621 {
622 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
623 {
624 if (m_UTSource.IsActive())
625 {
627 }
628 }
629 }
630
631 override int GetAnimInstance()
632 {
633 return VehicleAnimInstances.GOLF;
634 }
635
636 override int GetSeatAnimationType(int posIdx)
637 {
638 switch (posIdx)
639 {
640 case 0:
641 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
642 case 1:
643 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
644 case 2:
645 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
646 case 3:
647 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
648 }
649
650 return 0;
651 }
652
653 // Override for car-specific light type
655 {
656 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02RearLight));
657 }
658
659 // Override for car-specific light type
661 {
662 return CarLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02FrontLight));
663 }
664
666 {
667 if (!super.CanReleaseAttachment(attachment))
668 {
669 return false;
670 }
671
672 if (EngineIsOn() || GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED)
673 {
674 string attType = attachment.GetType();
675 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
676 {
677 return false;
678 }
679 }
680
681 return true;
682 }
683
684 override protected bool CanManipulateSpareWheel(string slotSelectionName)
685 {
686 return GetCarDoorsState("Hatchback_02_Trunk") != CarDoorState.DOORS_CLOSED;
687 }
688
689 override bool CanDisplayAttachmentCategory( string category_name )
690 {
691 //super
692 if ( !super.CanDisplayAttachmentCategory( category_name ) )
693 return false;
694 //
695
696 category_name.ToLower();
697 if ( category_name.Contains("engine") )
698 {
699 if ( GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED )
700 return false;
701 }
702
703 return true;
704 }
705
706 override bool CanDisplayCargo()
707 {
708 if ( !super.CanDisplayCargo() )
709 return false;
710
711 if ( GetCarDoorsState("Hatchback_02_Trunk") == CarDoorState.DOORS_CLOSED )
712 return false;
713
714 return true;
715 }
716
717 override int GetCarDoorsState(string slotType)
718 {
720
721 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
722 if (!carDoor)
723 {
724 return CarDoorState.DOORS_MISSING;
725 }
726
727 switch (slotType)
728 {
729 case "Hatchback_02_Door_1_1":
730 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
731
732 case "Hatchback_02_Door_2_1":
733 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
734
735 case "Hatchback_02_Door_1_2":
736 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
737
738 case "Hatchback_02_Door_2_2":
739 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
740
741 case "Hatchback_02_Hood":
742 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
743
744 case "Hatchback_02_Trunk":
745 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
746 }
747
748 return CarDoorState.DOORS_MISSING;
749 }
750
751
752 override bool CrewCanGetThrough(int posIdx)
753 {
754 switch (posIdx)
755 {
756 case 0:
757 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
758 {
759 return false;
760 }
761
762 return true;
763
764 case 1:
765 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
766 {
767 return false;
768 }
769
770 return true;
771
772 case 2:
773 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
774 {
775 return false;
776 }
777
778 return true;
779
780 case 3:
781 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
782 {
783 return false;
784 }
785
786 return true;
787 }
788
789 return false;
790 }
791
792 override string GetDoorSelectionNameFromSeatPos(int posIdx)
793 {
794 switch( posIdx )
795 {
796 case 0:
797 return "doors_driver";
798 break;
799 case 1:
800 return "doors_codriver";
801 break;
802 case 2:
803 return "doors_cargo1";
804 break;
805 case 3:
806 return "doors_cargo2";
807 break;
808 }
809
810 return super.GetDoorSelectionNameFromSeatPos(posIdx);
811 }
812
813 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
814 {
815 switch( posIdx )
816 {
817 case 0:
818 return "Hatchback_02_Door_1_1";
819 break;
820 case 1:
821 return "Hatchback_02_Door_2_1";
822 break;
823 case 2:
824 return "Hatchback_02_Door_1_2";
825 break;
826 case 3:
827 return "Hatchback_02_Door_2_2";
828 break;
829 }
830
831 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
832 }
833
834 override float OnSound(CarSoundCtrl ctrl, float oldValue)
835 {
836 switch (ctrl)
837 {
838 case CarSoundCtrl.DOORS:
839 float newValue = 0;
840 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
841 {
842 newValue += 0.25;
843 }
844
845 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
846 {
847 newValue += 0.25;
848 }
849
850 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
851 {
852 newValue += 0.25;
853 }
854
855 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
856 {
857 newValue += 0.25;
858 }
859
860 return Math.Clamp(newValue, 0, 1);
861 break;
862 }
863
864 return super.OnSound(ctrl, oldValue);
865 }
866
867 override string GetAnimSourceFromSelection( string selection )
868 {
869 switch( selection )
870 {
871 case "doors_driver":
872 return "DoorsDriver";
873 case "doors_codriver":
874 return "DoorsCoDriver";
875 case "doors_cargo1":
876 return "DoorsCargo1";
877 case "doors_cargo2":
878 return "DoorsCargo2";
879 case "doors_hood":
880 return "DoorsHood";
881 case "doors_trunk":
882 return "DoorsTrunk";
883 }
884
885 return "";
886 }
887
888
889 override bool IsVitalTruckBattery()
890 {
891 return false;
892 }
893
894 override bool IsVitalGlowPlug()
895 {
896 return false;
897 }
898
899 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
900 {
901 switch (currentSeat)
902 {
903 case 0:
904 return nextSeat == 1;
905 case 1:
906 return nextSeat == 0;
907 case 2:
908 return nextSeat == 3;
909 case 3:
910 return nextSeat == 2;
911 }
912
913 return false;
914 }
915
916 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
917 {
918 switch (pCurrentSeat)
919 {
920 case 0:
921 return pDoorsSelection == "DoorsDriver";
922 case 1:
923 return pDoorsSelection == "DoorsCoDriver";
924 case 2:
925 return pDoorsSelection == "DoorsCargo1";
926 case 3:
927 return pDoorsSelection == "DoorsCargo2";
928 }
929
930 return false;
931 }
932
933 override void OnDebugSpawn()
934 {
938
939 GetInventory().CreateInInventory("Hatchback_02_Wheel");
940 GetInventory().CreateInInventory("Hatchback_02_Wheel");
941 GetInventory().CreateInInventory("Hatchback_02_Wheel");
942 GetInventory().CreateInInventory("Hatchback_02_Wheel");
943
944 GetInventory().CreateInInventory("Hatchback_02_Door_1_1");
945 GetInventory().CreateInInventory("Hatchback_02_Door_1_2");
946 GetInventory().CreateInInventory("Hatchback_02_Door_2_1");
947 GetInventory().CreateInInventory("Hatchback_02_Door_2_2");
948 GetInventory().CreateInInventory("Hatchback_02_Hood");
949 GetInventory().CreateInInventory("Hatchback_02_Trunk");
950
951 //-----IN CAR CARGO
952 GetInventory().CreateInInventory("Hatchback_02_Wheel");
953 GetInventory().CreateInInventory("Hatchback_02_Wheel");
954 }
955}
956
958{
959 override void OnDebugSpawn()
960 {
964
965 GetInventory().CreateInInventory("Hatchback_02_Wheel");
966 GetInventory().CreateInInventory("Hatchback_02_Wheel");
967 GetInventory().CreateInInventory("Hatchback_02_Wheel");
968 GetInventory().CreateInInventory("Hatchback_02_Wheel");
969
970 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Black");
971 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Black");
972 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Black");
973 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Black");
974 GetInventory().CreateInInventory("Hatchback_02_Hood_Black");
975 GetInventory().CreateInInventory("Hatchback_02_Trunk_Black");
976
977 //-----IN CAR CARGO
978 GetInventory().CreateInInventory("Hatchback_02_Wheel");
979 GetInventory().CreateInInventory("Hatchback_02_Wheel");
980 }
981};
982
984{
985 override void OnDebugSpawn()
986 {
990
991 GetInventory().CreateInInventory("Hatchback_02_Wheel");
992 GetInventory().CreateInInventory("Hatchback_02_Wheel");
993 GetInventory().CreateInInventory("Hatchback_02_Wheel");
994 GetInventory().CreateInInventory("Hatchback_02_Wheel");
995
996 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Blue");
997 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Blue");
998 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Blue");
999 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Blue");
1000 GetInventory().CreateInInventory("Hatchback_02_Hood_Blue");
1001 GetInventory().CreateInInventory("Hatchback_02_Trunk_Blue");
1002
1003 //-----IN CAR CARGO
1004 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1005 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1006 }
1007}
CarSoundCtrl
Car's sound controller list. (native, do not change or extend)
Definition Car.c:4
void SpawnUniversalParts()
Definition CarScript.c:2761
CarDoorState TranslateAnimationPhaseToCarDoorState(string animation)
Definition CarScript.c:2474
CarDoorState
Definition CarScript.c:2
void SpawnAdditionalItems()
Definition CarScript.c:2799
string m_EngineStartOK
Sounds.
Definition CarScript.c:207
string m_CarDoorCloseSound
Definition CarScript.c:214
string m_EngineStartBattery
Definition CarScript.c:208
string m_EngineStartPlug
Definition CarScript.c:209
string m_EngineStartFuel
Definition CarScript.c:210
string m_CarHornShortSoundName
Definition CarScript.c:218
void FillUpCarFluids()
Definition CarScript.c:2829
string m_CarHornLongSoundName
Definition CarScript.c:219
string m_EngineStopFuel
Definition CarScript.c:211
string m_CarDoorOpenSound
Definition CarScript.c:213
override int GetCarDoorsState(string slotType)
Definition Hatchback_02.c:566
override bool CanDisplayAttachmentCategory(string category_name)
Definition Hatchback_02.c:538
class Hatchback_02_Blue extends Hatchback_02 OnDebugSpawn
Definition Hatchback_02.c:405
override void EOnPostSimulate(IEntity other, float timeSlice)
Definition Hatchback_02.c:469
ref UniversalTemperatureSourceSettings m_UTSSettings
Definition Hatchback_02.c:407
override bool IsVitalGlowPlug()
Definition Hatchback_02.c:743
override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
Definition Hatchback_02.c:765
override bool CanDisplayCargo()
Definition Hatchback_02.c:555
override int GetAnimInstance()
Definition Hatchback_02.c:480
override bool CrewCanGetThrough(int posIdx)
Definition Hatchback_02.c:601
override CarLightBase CreateFrontLight()
Definition Hatchback_02.c:509
override CarRearLightBase CreateRearLight()
Definition Hatchback_02.c:503
void Hatchback_02()
Definition Hatchback_02.c:410
override void EEInit()
Definition Hatchback_02.c:429
ref UniversalTemperatureSourceLambdaEngine m_UTSLEngine
Definition Hatchback_02.c:408
override float OnSound(CarSoundCtrl ctrl, float oldValue)
Definition Hatchback_02.c:683
override bool IsVitalTruckBattery()
Definition Hatchback_02.c:738
override bool CanReleaseAttachment(EntityAI attachment)
Definition Hatchback_02.c:514
override void OnEngineStart()
Definition Hatchback_02.c:449
override string GetAnimSourceFromSelection(string selection)
Definition Hatchback_02.c:716
override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
Definition Hatchback_02.c:748
override string GetDoorSelectionNameFromSeatPos(int posIdx)
Definition Hatchback_02.c:641
override int GetSeatAnimationType(int posIdx)
Definition Hatchback_02.c:485
ref UniversalTemperatureSource m_UTSource
Definition Hatchback_02.c:406
override string GetDoorInvSlotNameFromSeatPos(int posIdx)
Definition Hatchback_02.c:662
bool CanManipulateSpareWheel(string slotSelectionName)
Definition Hatchback_02.c:533
override void OnEngineStop()
Definition Hatchback_02.c:459
UniversalTemperatureSourceLambdaBaseImpl UniversalTemperatureSourceLambdaBase UniversalTemperatureSourceLambdaEngine()
Definition UniversalTemperatureSourceLambdaBaseImpl.c:175
VehicleAnimInstances
Definition VehicleAnimInstances.c:2
Definition InventoryItem.c:496
Definition CarRearLightBase.c:2
Definition CivilianSedanRearLight.c:2
Super root of all classes in Enforce script.
Definition EnScript.c:11
Definition Building.c:6
Definition constants.c:638
Definition Hatchback_02.c:430
Definition EnEntity.c:165
Definition EnMath.c:7
Definition EntityAI.c:95
Definition PointLightBase.c:2
original Timer deletes m_params which is unwanted
Definition UniversalTemperatureSource.c:28
Definition UniversalTemperatureSource.c:2
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
Definition constants.c:777
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'.

◆ CanManipulateSpareWheel()

bool CanManipulateSpareWheel ( string slotSelectionName)
protected
534{
538
539 void Hatchback_02()
540 {
541 //m_dmgContactCoef = 0.070;
542
543 m_EngineStartOK = "Hatchback_02_engine_start_SoundSet";
544 m_EngineStartBattery = "Hatchback_02_engine_failed_start_battery_SoundSet";
545 m_EngineStartPlug = "Hatchback_02_engine_failed_start_sparkplugs_SoundSet";
546 m_EngineStartFuel = "Hatchback_02_engine_failed_start_fuel_SoundSet";
547 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
548
549 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
550 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
551
552 m_CarHornShortSoundName = "Hatchback_02_Horn_Short_SoundSet";
553 m_CarHornLongSoundName = "Hatchback_02_Horn_SoundSet";
554
555 SetEnginePos("0 0.7 1.4");
556 }
557
558 override void EEInit()
559 {
560 super.EEInit();
561
562 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
563 {
565 m_UTSSettings.m_ManualUpdate = true;
566 m_UTSSettings.m_TemperatureMin = 0;
567 m_UTSSettings.m_TemperatureMax = 30;
569 m_UTSSettings.m_TemperatureCap = 0;
570 m_UTSSettings.m_RangeFull = 0.5;
571 m_UTSSettings.m_RangeMax = 2;
572
575 }
576 }
577
578 override void OnEngineStart()
579 {
580 super.OnEngineStart();
581
582 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
583 {
584 m_UTSource.SetDefferedActive(true, 20.0);
585 }
586 }
587
588 override void OnEngineStop()
589 {
590 super.OnEngineStop();
591
592 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
593 {
594 m_UTSource.SetDefferedActive(false, 10.0);
595 }
596 }
597
598 override void EOnPostSimulate(IEntity other, float timeSlice)
599 {
600 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
601 {
602 if (m_UTSource.IsActive())
603 {
605 }
606 }
607 }
608
609 override int GetAnimInstance()
610 {
611 return VehicleAnimInstances.GOLF;
612 }
613
614 override int GetSeatAnimationType(int posIdx)
615 {
616 switch (posIdx)
617 {
618 case 0:
619 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
620 case 1:
621 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
622 case 2:
623 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
624 case 3:
625 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
626 }
627
628 return 0;
629 }
630
631 // Override for car-specific light type
633 {
634 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02RearLight));
635 }
636
637 // Override for car-specific light type
639 {
640 return CarLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02FrontLight));
641 }
642
644 {
645 if (!super.CanReleaseAttachment(attachment))
646 {
647 return false;
648 }
649
650 if (EngineIsOn() || GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED)
651 {
652 string attType = attachment.GetType();
653 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
654 {
655 return false;
656 }
657 }
658
659 return true;
660 }
661
662 override protected bool CanManipulateSpareWheel(string slotSelectionName)
663 {
664 return GetCarDoorsState("Hatchback_02_Trunk") != CarDoorState.DOORS_CLOSED;
665 }
666
667 override bool CanDisplayAttachmentCategory( string category_name )
668 {
669 //super
670 if ( !super.CanDisplayAttachmentCategory( category_name ) )
671 return false;
672 //
673
674 category_name.ToLower();
675 if ( category_name.Contains("engine") )
676 {
677 if ( GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED )
678 return false;
679 }
680
681 return true;
682 }
683
684 override bool CanDisplayCargo()
685 {
686 if ( !super.CanDisplayCargo() )
687 return false;
688
689 if ( GetCarDoorsState("Hatchback_02_Trunk") == CarDoorState.DOORS_CLOSED )
690 return false;
691
692 return true;
693 }
694
695 override int GetCarDoorsState(string slotType)
696 {
698
699 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
700 if (!carDoor)
701 {
702 return CarDoorState.DOORS_MISSING;
703 }
704
705 switch (slotType)
706 {
707 case "Hatchback_02_Door_1_1":
708 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
709
710 case "Hatchback_02_Door_2_1":
711 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
712
713 case "Hatchback_02_Door_1_2":
714 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
715
716 case "Hatchback_02_Door_2_2":
717 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
718
719 case "Hatchback_02_Hood":
720 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
721
722 case "Hatchback_02_Trunk":
723 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
724 }
725
726 return CarDoorState.DOORS_MISSING;
727 }
728
729
730 override bool CrewCanGetThrough(int posIdx)
731 {
732 switch (posIdx)
733 {
734 case 0:
735 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
736 {
737 return false;
738 }
739
740 return true;
741
742 case 1:
743 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
744 {
745 return false;
746 }
747
748 return true;
749
750 case 2:
751 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
752 {
753 return false;
754 }
755
756 return true;
757
758 case 3:
759 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
760 {
761 return false;
762 }
763
764 return true;
765 }
766
767 return false;
768 }
769
770 override string GetDoorSelectionNameFromSeatPos(int posIdx)
771 {
772 switch( posIdx )
773 {
774 case 0:
775 return "doors_driver";
776 break;
777 case 1:
778 return "doors_codriver";
779 break;
780 case 2:
781 return "doors_cargo1";
782 break;
783 case 3:
784 return "doors_cargo2";
785 break;
786 }
787
788 return super.GetDoorSelectionNameFromSeatPos(posIdx);
789 }
790
791 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
792 {
793 switch( posIdx )
794 {
795 case 0:
796 return "Hatchback_02_Door_1_1";
797 break;
798 case 1:
799 return "Hatchback_02_Door_2_1";
800 break;
801 case 2:
802 return "Hatchback_02_Door_1_2";
803 break;
804 case 3:
805 return "Hatchback_02_Door_2_2";
806 break;
807 }
808
809 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
810 }
811
812 override float OnSound(CarSoundCtrl ctrl, float oldValue)
813 {
814 switch (ctrl)
815 {
816 case CarSoundCtrl.DOORS:
817 float newValue = 0;
818 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
819 {
820 newValue += 0.25;
821 }
822
823 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
824 {
825 newValue += 0.25;
826 }
827
828 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
829 {
830 newValue += 0.25;
831 }
832
833 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
834 {
835 newValue += 0.25;
836 }
837
838 return Math.Clamp(newValue, 0, 1);
839 break;
840 }
841
842 return super.OnSound(ctrl, oldValue);
843 }
844
845 override string GetAnimSourceFromSelection( string selection )
846 {
847 switch( selection )
848 {
849 case "doors_driver":
850 return "DoorsDriver";
851 case "doors_codriver":
852 return "DoorsCoDriver";
853 case "doors_cargo1":
854 return "DoorsCargo1";
855 case "doors_cargo2":
856 return "DoorsCargo2";
857 case "doors_hood":
858 return "DoorsHood";
859 case "doors_trunk":
860 return "DoorsTrunk";
861 }
862
863 return "";
864 }
865
866
867 override bool IsVitalTruckBattery()
868 {
869 return false;
870 }
871
872 override bool IsVitalGlowPlug()
873 {
874 return false;
875 }
876
877 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
878 {
879 switch (currentSeat)
880 {
881 case 0:
882 return nextSeat == 1;
883 case 1:
884 return nextSeat == 0;
885 case 2:
886 return nextSeat == 3;
887 case 3:
888 return nextSeat == 2;
889 }
890
891 return false;
892 }
893
894 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
895 {
896 switch (pCurrentSeat)
897 {
898 case 0:
899 return pDoorsSelection == "DoorsDriver";
900 case 1:
901 return pDoorsSelection == "DoorsCoDriver";
902 case 2:
903 return pDoorsSelection == "DoorsCargo1";
904 case 3:
905 return pDoorsSelection == "DoorsCargo2";
906 }
907
908 return false;
909 }
910
911 override void OnDebugSpawn()
912 {
916
917 GetInventory().CreateInInventory("Hatchback_02_Wheel");
918 GetInventory().CreateInInventory("Hatchback_02_Wheel");
919 GetInventory().CreateInInventory("Hatchback_02_Wheel");
920 GetInventory().CreateInInventory("Hatchback_02_Wheel");
921
922 GetInventory().CreateInInventory("Hatchback_02_Door_1_1");
923 GetInventory().CreateInInventory("Hatchback_02_Door_1_2");
924 GetInventory().CreateInInventory("Hatchback_02_Door_2_1");
925 GetInventory().CreateInInventory("Hatchback_02_Door_2_2");
926 GetInventory().CreateInInventory("Hatchback_02_Hood");
927 GetInventory().CreateInInventory("Hatchback_02_Trunk");
928
929 //-----IN CAR CARGO
930 GetInventory().CreateInInventory("Hatchback_02_Wheel");
931 GetInventory().CreateInInventory("Hatchback_02_Wheel");
932 }
933}
934
936{
937 override void OnDebugSpawn()
938 {
942
943 GetInventory().CreateInInventory("Hatchback_02_Wheel");
944 GetInventory().CreateInInventory("Hatchback_02_Wheel");
945 GetInventory().CreateInInventory("Hatchback_02_Wheel");
946 GetInventory().CreateInInventory("Hatchback_02_Wheel");
947
948 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Black");
949 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Black");
950 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Black");
951 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Black");
952 GetInventory().CreateInInventory("Hatchback_02_Hood_Black");
953 GetInventory().CreateInInventory("Hatchback_02_Trunk_Black");
954
955 //-----IN CAR CARGO
956 GetInventory().CreateInInventory("Hatchback_02_Wheel");
957 GetInventory().CreateInInventory("Hatchback_02_Wheel");
958 }
959};
960
962{
963 override void OnDebugSpawn()
964 {
968
969 GetInventory().CreateInInventory("Hatchback_02_Wheel");
970 GetInventory().CreateInInventory("Hatchback_02_Wheel");
971 GetInventory().CreateInInventory("Hatchback_02_Wheel");
972 GetInventory().CreateInInventory("Hatchback_02_Wheel");
973
974 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Blue");
975 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Blue");
976 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Blue");
977 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Blue");
978 GetInventory().CreateInInventory("Hatchback_02_Hood_Blue");
979 GetInventory().CreateInInventory("Hatchback_02_Trunk_Blue");
980
981 //-----IN CAR CARGO
982 GetInventory().CreateInInventory("Hatchback_02_Wheel");
983 GetInventory().CreateInInventory("Hatchback_02_Wheel");
984 }
985}

◆ CanReachDoorsFromSeat()

override bool CanReachDoorsFromSeat ( string pDoorsSelection,
int pCurrentSeat )
protected
766{
770
771 void Hatchback_02()
772 {
773 //m_dmgContactCoef = 0.070;
774
775 m_EngineStartOK = "Hatchback_02_engine_start_SoundSet";
776 m_EngineStartBattery = "Hatchback_02_engine_failed_start_battery_SoundSet";
777 m_EngineStartPlug = "Hatchback_02_engine_failed_start_sparkplugs_SoundSet";
778 m_EngineStartFuel = "Hatchback_02_engine_failed_start_fuel_SoundSet";
779 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
780
781 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
782 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
783
784 m_CarHornShortSoundName = "Hatchback_02_Horn_Short_SoundSet";
785 m_CarHornLongSoundName = "Hatchback_02_Horn_SoundSet";
786
787 SetEnginePos("0 0.7 1.4");
788 }
789
790 override void EEInit()
791 {
792 super.EEInit();
793
794 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
795 {
797 m_UTSSettings.m_ManualUpdate = true;
798 m_UTSSettings.m_TemperatureMin = 0;
799 m_UTSSettings.m_TemperatureMax = 30;
801 m_UTSSettings.m_TemperatureCap = 0;
802 m_UTSSettings.m_RangeFull = 0.5;
803 m_UTSSettings.m_RangeMax = 2;
804
807 }
808 }
809
810 override void OnEngineStart()
811 {
812 super.OnEngineStart();
813
814 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
815 {
816 m_UTSource.SetDefferedActive(true, 20.0);
817 }
818 }
819
820 override void OnEngineStop()
821 {
822 super.OnEngineStop();
823
824 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
825 {
826 m_UTSource.SetDefferedActive(false, 10.0);
827 }
828 }
829
830 override void EOnPostSimulate(IEntity other, float timeSlice)
831 {
832 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
833 {
834 if (m_UTSource.IsActive())
835 {
837 }
838 }
839 }
840
841 override int GetAnimInstance()
842 {
843 return VehicleAnimInstances.GOLF;
844 }
845
846 override int GetSeatAnimationType(int posIdx)
847 {
848 switch (posIdx)
849 {
850 case 0:
851 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
852 case 1:
853 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
854 case 2:
855 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
856 case 3:
857 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
858 }
859
860 return 0;
861 }
862
863 // Override for car-specific light type
865 {
866 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02RearLight));
867 }
868
869 // Override for car-specific light type
871 {
872 return CarLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02FrontLight));
873 }
874
876 {
877 if (!super.CanReleaseAttachment(attachment))
878 {
879 return false;
880 }
881
882 if (EngineIsOn() || GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED)
883 {
884 string attType = attachment.GetType();
885 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
886 {
887 return false;
888 }
889 }
890
891 return true;
892 }
893
894 override protected bool CanManipulateSpareWheel(string slotSelectionName)
895 {
896 return GetCarDoorsState("Hatchback_02_Trunk") != CarDoorState.DOORS_CLOSED;
897 }
898
899 override bool CanDisplayAttachmentCategory( string category_name )
900 {
901 //super
902 if ( !super.CanDisplayAttachmentCategory( category_name ) )
903 return false;
904 //
905
906 category_name.ToLower();
907 if ( category_name.Contains("engine") )
908 {
909 if ( GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED )
910 return false;
911 }
912
913 return true;
914 }
915
916 override bool CanDisplayCargo()
917 {
918 if ( !super.CanDisplayCargo() )
919 return false;
920
921 if ( GetCarDoorsState("Hatchback_02_Trunk") == CarDoorState.DOORS_CLOSED )
922 return false;
923
924 return true;
925 }
926
927 override int GetCarDoorsState(string slotType)
928 {
930
931 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
932 if (!carDoor)
933 {
934 return CarDoorState.DOORS_MISSING;
935 }
936
937 switch (slotType)
938 {
939 case "Hatchback_02_Door_1_1":
940 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
941
942 case "Hatchback_02_Door_2_1":
943 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
944
945 case "Hatchback_02_Door_1_2":
946 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
947
948 case "Hatchback_02_Door_2_2":
949 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
950
951 case "Hatchback_02_Hood":
952 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
953
954 case "Hatchback_02_Trunk":
955 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
956 }
957
958 return CarDoorState.DOORS_MISSING;
959 }
960
961
962 override bool CrewCanGetThrough(int posIdx)
963 {
964 switch (posIdx)
965 {
966 case 0:
967 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
968 {
969 return false;
970 }
971
972 return true;
973
974 case 1:
975 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
976 {
977 return false;
978 }
979
980 return true;
981
982 case 2:
983 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
984 {
985 return false;
986 }
987
988 return true;
989
990 case 3:
991 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
992 {
993 return false;
994 }
995
996 return true;
997 }
998
999 return false;
1000 }
1001
1002 override string GetDoorSelectionNameFromSeatPos(int posIdx)
1003 {
1004 switch( posIdx )
1005 {
1006 case 0:
1007 return "doors_driver";
1008 break;
1009 case 1:
1010 return "doors_codriver";
1011 break;
1012 case 2:
1013 return "doors_cargo1";
1014 break;
1015 case 3:
1016 return "doors_cargo2";
1017 break;
1018 }
1019
1020 return super.GetDoorSelectionNameFromSeatPos(posIdx);
1021 }
1022
1023 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
1024 {
1025 switch( posIdx )
1026 {
1027 case 0:
1028 return "Hatchback_02_Door_1_1";
1029 break;
1030 case 1:
1031 return "Hatchback_02_Door_2_1";
1032 break;
1033 case 2:
1034 return "Hatchback_02_Door_1_2";
1035 break;
1036 case 3:
1037 return "Hatchback_02_Door_2_2";
1038 break;
1039 }
1040
1041 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
1042 }
1043
1044 override float OnSound(CarSoundCtrl ctrl, float oldValue)
1045 {
1046 switch (ctrl)
1047 {
1048 case CarSoundCtrl.DOORS:
1049 float newValue = 0;
1050 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
1051 {
1052 newValue += 0.25;
1053 }
1054
1055 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
1056 {
1057 newValue += 0.25;
1058 }
1059
1060 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
1061 {
1062 newValue += 0.25;
1063 }
1064
1065 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
1066 {
1067 newValue += 0.25;
1068 }
1069
1070 return Math.Clamp(newValue, 0, 1);
1071 break;
1072 }
1073
1074 return super.OnSound(ctrl, oldValue);
1075 }
1076
1077 override string GetAnimSourceFromSelection( string selection )
1078 {
1079 switch( selection )
1080 {
1081 case "doors_driver":
1082 return "DoorsDriver";
1083 case "doors_codriver":
1084 return "DoorsCoDriver";
1085 case "doors_cargo1":
1086 return "DoorsCargo1";
1087 case "doors_cargo2":
1088 return "DoorsCargo2";
1089 case "doors_hood":
1090 return "DoorsHood";
1091 case "doors_trunk":
1092 return "DoorsTrunk";
1093 }
1094
1095 return "";
1096 }
1097
1098
1099 override bool IsVitalTruckBattery()
1100 {
1101 return false;
1102 }
1103
1104 override bool IsVitalGlowPlug()
1105 {
1106 return false;
1107 }
1108
1109 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
1110 {
1111 switch (currentSeat)
1112 {
1113 case 0:
1114 return nextSeat == 1;
1115 case 1:
1116 return nextSeat == 0;
1117 case 2:
1118 return nextSeat == 3;
1119 case 3:
1120 return nextSeat == 2;
1121 }
1122
1123 return false;
1124 }
1125
1126 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
1127 {
1128 switch (pCurrentSeat)
1129 {
1130 case 0:
1131 return pDoorsSelection == "DoorsDriver";
1132 case 1:
1133 return pDoorsSelection == "DoorsCoDriver";
1134 case 2:
1135 return pDoorsSelection == "DoorsCargo1";
1136 case 3:
1137 return pDoorsSelection == "DoorsCargo2";
1138 }
1139
1140 return false;
1141 }
1142
1143 override void OnDebugSpawn()
1144 {
1148
1149 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1150 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1151 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1152 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1153
1154 GetInventory().CreateInInventory("Hatchback_02_Door_1_1");
1155 GetInventory().CreateInInventory("Hatchback_02_Door_1_2");
1156 GetInventory().CreateInInventory("Hatchback_02_Door_2_1");
1157 GetInventory().CreateInInventory("Hatchback_02_Door_2_2");
1158 GetInventory().CreateInInventory("Hatchback_02_Hood");
1159 GetInventory().CreateInInventory("Hatchback_02_Trunk");
1160
1161 //-----IN CAR CARGO
1162 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1163 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1164 }
1165}
1166
1167class Hatchback_02_Black extends Hatchback_02
1168{
1169 override void OnDebugSpawn()
1170 {
1174
1175 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1176 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1177 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1178 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1179
1180 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Black");
1181 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Black");
1182 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Black");
1183 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Black");
1184 GetInventory().CreateInInventory("Hatchback_02_Hood_Black");
1185 GetInventory().CreateInInventory("Hatchback_02_Trunk_Black");
1186
1187 //-----IN CAR CARGO
1188 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1189 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1190 }
1191};
1192
1193class Hatchback_02_Blue extends Hatchback_02
1194{
1195 override void OnDebugSpawn()
1196 {
1200
1201 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1202 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1203 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1204 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1205
1206 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Blue");
1207 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Blue");
1208 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Blue");
1209 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Blue");
1210 GetInventory().CreateInInventory("Hatchback_02_Hood_Blue");
1211 GetInventory().CreateInInventory("Hatchback_02_Trunk_Blue");
1212
1213 //-----IN CAR CARGO
1214 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1215 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1216 }
1217}

◆ CanReachSeatFromSeat()

override bool CanReachSeatFromSeat ( int currentSeat,
int nextSeat )
protected
749{
753
754 void Hatchback_02()
755 {
756 //m_dmgContactCoef = 0.070;
757
758 m_EngineStartOK = "Hatchback_02_engine_start_SoundSet";
759 m_EngineStartBattery = "Hatchback_02_engine_failed_start_battery_SoundSet";
760 m_EngineStartPlug = "Hatchback_02_engine_failed_start_sparkplugs_SoundSet";
761 m_EngineStartFuel = "Hatchback_02_engine_failed_start_fuel_SoundSet";
762 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
763
764 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
765 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
766
767 m_CarHornShortSoundName = "Hatchback_02_Horn_Short_SoundSet";
768 m_CarHornLongSoundName = "Hatchback_02_Horn_SoundSet";
769
770 SetEnginePos("0 0.7 1.4");
771 }
772
773 override void EEInit()
774 {
775 super.EEInit();
776
777 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
778 {
780 m_UTSSettings.m_ManualUpdate = true;
781 m_UTSSettings.m_TemperatureMin = 0;
782 m_UTSSettings.m_TemperatureMax = 30;
784 m_UTSSettings.m_TemperatureCap = 0;
785 m_UTSSettings.m_RangeFull = 0.5;
786 m_UTSSettings.m_RangeMax = 2;
787
790 }
791 }
792
793 override void OnEngineStart()
794 {
795 super.OnEngineStart();
796
797 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
798 {
799 m_UTSource.SetDefferedActive(true, 20.0);
800 }
801 }
802
803 override void OnEngineStop()
804 {
805 super.OnEngineStop();
806
807 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
808 {
809 m_UTSource.SetDefferedActive(false, 10.0);
810 }
811 }
812
813 override void EOnPostSimulate(IEntity other, float timeSlice)
814 {
815 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
816 {
817 if (m_UTSource.IsActive())
818 {
820 }
821 }
822 }
823
824 override int GetAnimInstance()
825 {
826 return VehicleAnimInstances.GOLF;
827 }
828
829 override int GetSeatAnimationType(int posIdx)
830 {
831 switch (posIdx)
832 {
833 case 0:
834 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
835 case 1:
836 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
837 case 2:
838 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
839 case 3:
840 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
841 }
842
843 return 0;
844 }
845
846 // Override for car-specific light type
848 {
849 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02RearLight));
850 }
851
852 // Override for car-specific light type
854 {
855 return CarLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02FrontLight));
856 }
857
859 {
860 if (!super.CanReleaseAttachment(attachment))
861 {
862 return false;
863 }
864
865 if (EngineIsOn() || GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED)
866 {
867 string attType = attachment.GetType();
868 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
869 {
870 return false;
871 }
872 }
873
874 return true;
875 }
876
877 override protected bool CanManipulateSpareWheel(string slotSelectionName)
878 {
879 return GetCarDoorsState("Hatchback_02_Trunk") != CarDoorState.DOORS_CLOSED;
880 }
881
882 override bool CanDisplayAttachmentCategory( string category_name )
883 {
884 //super
885 if ( !super.CanDisplayAttachmentCategory( category_name ) )
886 return false;
887 //
888
889 category_name.ToLower();
890 if ( category_name.Contains("engine") )
891 {
892 if ( GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED )
893 return false;
894 }
895
896 return true;
897 }
898
899 override bool CanDisplayCargo()
900 {
901 if ( !super.CanDisplayCargo() )
902 return false;
903
904 if ( GetCarDoorsState("Hatchback_02_Trunk") == CarDoorState.DOORS_CLOSED )
905 return false;
906
907 return true;
908 }
909
910 override int GetCarDoorsState(string slotType)
911 {
913
914 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
915 if (!carDoor)
916 {
917 return CarDoorState.DOORS_MISSING;
918 }
919
920 switch (slotType)
921 {
922 case "Hatchback_02_Door_1_1":
923 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
924
925 case "Hatchback_02_Door_2_1":
926 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
927
928 case "Hatchback_02_Door_1_2":
929 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
930
931 case "Hatchback_02_Door_2_2":
932 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
933
934 case "Hatchback_02_Hood":
935 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
936
937 case "Hatchback_02_Trunk":
938 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
939 }
940
941 return CarDoorState.DOORS_MISSING;
942 }
943
944
945 override bool CrewCanGetThrough(int posIdx)
946 {
947 switch (posIdx)
948 {
949 case 0:
950 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
951 {
952 return false;
953 }
954
955 return true;
956
957 case 1:
958 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
959 {
960 return false;
961 }
962
963 return true;
964
965 case 2:
966 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
967 {
968 return false;
969 }
970
971 return true;
972
973 case 3:
974 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
975 {
976 return false;
977 }
978
979 return true;
980 }
981
982 return false;
983 }
984
985 override string GetDoorSelectionNameFromSeatPos(int posIdx)
986 {
987 switch( posIdx )
988 {
989 case 0:
990 return "doors_driver";
991 break;
992 case 1:
993 return "doors_codriver";
994 break;
995 case 2:
996 return "doors_cargo1";
997 break;
998 case 3:
999 return "doors_cargo2";
1000 break;
1001 }
1002
1003 return super.GetDoorSelectionNameFromSeatPos(posIdx);
1004 }
1005
1006 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
1007 {
1008 switch( posIdx )
1009 {
1010 case 0:
1011 return "Hatchback_02_Door_1_1";
1012 break;
1013 case 1:
1014 return "Hatchback_02_Door_2_1";
1015 break;
1016 case 2:
1017 return "Hatchback_02_Door_1_2";
1018 break;
1019 case 3:
1020 return "Hatchback_02_Door_2_2";
1021 break;
1022 }
1023
1024 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
1025 }
1026
1027 override float OnSound(CarSoundCtrl ctrl, float oldValue)
1028 {
1029 switch (ctrl)
1030 {
1031 case CarSoundCtrl.DOORS:
1032 float newValue = 0;
1033 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
1034 {
1035 newValue += 0.25;
1036 }
1037
1038 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
1039 {
1040 newValue += 0.25;
1041 }
1042
1043 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
1044 {
1045 newValue += 0.25;
1046 }
1047
1048 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
1049 {
1050 newValue += 0.25;
1051 }
1052
1053 return Math.Clamp(newValue, 0, 1);
1054 break;
1055 }
1056
1057 return super.OnSound(ctrl, oldValue);
1058 }
1059
1060 override string GetAnimSourceFromSelection( string selection )
1061 {
1062 switch( selection )
1063 {
1064 case "doors_driver":
1065 return "DoorsDriver";
1066 case "doors_codriver":
1067 return "DoorsCoDriver";
1068 case "doors_cargo1":
1069 return "DoorsCargo1";
1070 case "doors_cargo2":
1071 return "DoorsCargo2";
1072 case "doors_hood":
1073 return "DoorsHood";
1074 case "doors_trunk":
1075 return "DoorsTrunk";
1076 }
1077
1078 return "";
1079 }
1080
1081
1082 override bool IsVitalTruckBattery()
1083 {
1084 return false;
1085 }
1086
1087 override bool IsVitalGlowPlug()
1088 {
1089 return false;
1090 }
1091
1092 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
1093 {
1094 switch (currentSeat)
1095 {
1096 case 0:
1097 return nextSeat == 1;
1098 case 1:
1099 return nextSeat == 0;
1100 case 2:
1101 return nextSeat == 3;
1102 case 3:
1103 return nextSeat == 2;
1104 }
1105
1106 return false;
1107 }
1108
1109 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
1110 {
1111 switch (pCurrentSeat)
1112 {
1113 case 0:
1114 return pDoorsSelection == "DoorsDriver";
1115 case 1:
1116 return pDoorsSelection == "DoorsCoDriver";
1117 case 2:
1118 return pDoorsSelection == "DoorsCargo1";
1119 case 3:
1120 return pDoorsSelection == "DoorsCargo2";
1121 }
1122
1123 return false;
1124 }
1125
1126 override void OnDebugSpawn()
1127 {
1131
1132 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1133 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1134 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1135 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1136
1137 GetInventory().CreateInInventory("Hatchback_02_Door_1_1");
1138 GetInventory().CreateInInventory("Hatchback_02_Door_1_2");
1139 GetInventory().CreateInInventory("Hatchback_02_Door_2_1");
1140 GetInventory().CreateInInventory("Hatchback_02_Door_2_2");
1141 GetInventory().CreateInInventory("Hatchback_02_Hood");
1142 GetInventory().CreateInInventory("Hatchback_02_Trunk");
1143
1144 //-----IN CAR CARGO
1145 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1146 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1147 }
1148}
1149
1150class Hatchback_02_Black extends Hatchback_02
1151{
1152 override void OnDebugSpawn()
1153 {
1157
1158 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1159 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1160 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1161 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1162
1163 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Black");
1164 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Black");
1165 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Black");
1166 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Black");
1167 GetInventory().CreateInInventory("Hatchback_02_Hood_Black");
1168 GetInventory().CreateInInventory("Hatchback_02_Trunk_Black");
1169
1170 //-----IN CAR CARGO
1171 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1172 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1173 }
1174};
1175
1176class Hatchback_02_Blue extends Hatchback_02
1177{
1178 override void OnDebugSpawn()
1179 {
1183
1184 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1185 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1186 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1187 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1188
1189 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Blue");
1190 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Blue");
1191 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Blue");
1192 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Blue");
1193 GetInventory().CreateInInventory("Hatchback_02_Hood_Blue");
1194 GetInventory().CreateInInventory("Hatchback_02_Trunk_Blue");
1195
1196 //-----IN CAR CARGO
1197 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1198 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1199 }
1200}

◆ CanReleaseAttachment()

override bool CanReleaseAttachment ( EntityAI attachment)
protected
515{
519
520 void Hatchback_02()
521 {
522 //m_dmgContactCoef = 0.070;
523
524 m_EngineStartOK = "Hatchback_02_engine_start_SoundSet";
525 m_EngineStartBattery = "Hatchback_02_engine_failed_start_battery_SoundSet";
526 m_EngineStartPlug = "Hatchback_02_engine_failed_start_sparkplugs_SoundSet";
527 m_EngineStartFuel = "Hatchback_02_engine_failed_start_fuel_SoundSet";
528 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
529
530 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
531 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
532
533 m_CarHornShortSoundName = "Hatchback_02_Horn_Short_SoundSet";
534 m_CarHornLongSoundName = "Hatchback_02_Horn_SoundSet";
535
536 SetEnginePos("0 0.7 1.4");
537 }
538
539 override void EEInit()
540 {
541 super.EEInit();
542
543 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
544 {
546 m_UTSSettings.m_ManualUpdate = true;
547 m_UTSSettings.m_TemperatureMin = 0;
548 m_UTSSettings.m_TemperatureMax = 30;
550 m_UTSSettings.m_TemperatureCap = 0;
551 m_UTSSettings.m_RangeFull = 0.5;
552 m_UTSSettings.m_RangeMax = 2;
553
556 }
557 }
558
559 override void OnEngineStart()
560 {
561 super.OnEngineStart();
562
563 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
564 {
565 m_UTSource.SetDefferedActive(true, 20.0);
566 }
567 }
568
569 override void OnEngineStop()
570 {
571 super.OnEngineStop();
572
573 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
574 {
575 m_UTSource.SetDefferedActive(false, 10.0);
576 }
577 }
578
579 override void EOnPostSimulate(IEntity other, float timeSlice)
580 {
581 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
582 {
583 if (m_UTSource.IsActive())
584 {
586 }
587 }
588 }
589
590 override int GetAnimInstance()
591 {
592 return VehicleAnimInstances.GOLF;
593 }
594
595 override int GetSeatAnimationType(int posIdx)
596 {
597 switch (posIdx)
598 {
599 case 0:
600 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
601 case 1:
602 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
603 case 2:
604 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
605 case 3:
606 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
607 }
608
609 return 0;
610 }
611
612 // Override for car-specific light type
614 {
615 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02RearLight));
616 }
617
618 // Override for car-specific light type
620 {
621 return CarLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02FrontLight));
622 }
623
625 {
626 if (!super.CanReleaseAttachment(attachment))
627 {
628 return false;
629 }
630
631 if (EngineIsOn() || GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED)
632 {
633 string attType = attachment.GetType();
634 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
635 {
636 return false;
637 }
638 }
639
640 return true;
641 }
642
643 override protected bool CanManipulateSpareWheel(string slotSelectionName)
644 {
645 return GetCarDoorsState("Hatchback_02_Trunk") != CarDoorState.DOORS_CLOSED;
646 }
647
648 override bool CanDisplayAttachmentCategory( string category_name )
649 {
650 //super
651 if ( !super.CanDisplayAttachmentCategory( category_name ) )
652 return false;
653 //
654
655 category_name.ToLower();
656 if ( category_name.Contains("engine") )
657 {
658 if ( GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED )
659 return false;
660 }
661
662 return true;
663 }
664
665 override bool CanDisplayCargo()
666 {
667 if ( !super.CanDisplayCargo() )
668 return false;
669
670 if ( GetCarDoorsState("Hatchback_02_Trunk") == CarDoorState.DOORS_CLOSED )
671 return false;
672
673 return true;
674 }
675
676 override int GetCarDoorsState(string slotType)
677 {
679
680 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
681 if (!carDoor)
682 {
683 return CarDoorState.DOORS_MISSING;
684 }
685
686 switch (slotType)
687 {
688 case "Hatchback_02_Door_1_1":
689 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
690
691 case "Hatchback_02_Door_2_1":
692 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
693
694 case "Hatchback_02_Door_1_2":
695 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
696
697 case "Hatchback_02_Door_2_2":
698 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
699
700 case "Hatchback_02_Hood":
701 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
702
703 case "Hatchback_02_Trunk":
704 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
705 }
706
707 return CarDoorState.DOORS_MISSING;
708 }
709
710
711 override bool CrewCanGetThrough(int posIdx)
712 {
713 switch (posIdx)
714 {
715 case 0:
716 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
717 {
718 return false;
719 }
720
721 return true;
722
723 case 1:
724 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
725 {
726 return false;
727 }
728
729 return true;
730
731 case 2:
732 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
733 {
734 return false;
735 }
736
737 return true;
738
739 case 3:
740 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
741 {
742 return false;
743 }
744
745 return true;
746 }
747
748 return false;
749 }
750
751 override string GetDoorSelectionNameFromSeatPos(int posIdx)
752 {
753 switch( posIdx )
754 {
755 case 0:
756 return "doors_driver";
757 break;
758 case 1:
759 return "doors_codriver";
760 break;
761 case 2:
762 return "doors_cargo1";
763 break;
764 case 3:
765 return "doors_cargo2";
766 break;
767 }
768
769 return super.GetDoorSelectionNameFromSeatPos(posIdx);
770 }
771
772 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
773 {
774 switch( posIdx )
775 {
776 case 0:
777 return "Hatchback_02_Door_1_1";
778 break;
779 case 1:
780 return "Hatchback_02_Door_2_1";
781 break;
782 case 2:
783 return "Hatchback_02_Door_1_2";
784 break;
785 case 3:
786 return "Hatchback_02_Door_2_2";
787 break;
788 }
789
790 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
791 }
792
793 override float OnSound(CarSoundCtrl ctrl, float oldValue)
794 {
795 switch (ctrl)
796 {
797 case CarSoundCtrl.DOORS:
798 float newValue = 0;
799 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
800 {
801 newValue += 0.25;
802 }
803
804 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
805 {
806 newValue += 0.25;
807 }
808
809 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
810 {
811 newValue += 0.25;
812 }
813
814 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
815 {
816 newValue += 0.25;
817 }
818
819 return Math.Clamp(newValue, 0, 1);
820 break;
821 }
822
823 return super.OnSound(ctrl, oldValue);
824 }
825
826 override string GetAnimSourceFromSelection( string selection )
827 {
828 switch( selection )
829 {
830 case "doors_driver":
831 return "DoorsDriver";
832 case "doors_codriver":
833 return "DoorsCoDriver";
834 case "doors_cargo1":
835 return "DoorsCargo1";
836 case "doors_cargo2":
837 return "DoorsCargo2";
838 case "doors_hood":
839 return "DoorsHood";
840 case "doors_trunk":
841 return "DoorsTrunk";
842 }
843
844 return "";
845 }
846
847
848 override bool IsVitalTruckBattery()
849 {
850 return false;
851 }
852
853 override bool IsVitalGlowPlug()
854 {
855 return false;
856 }
857
858 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
859 {
860 switch (currentSeat)
861 {
862 case 0:
863 return nextSeat == 1;
864 case 1:
865 return nextSeat == 0;
866 case 2:
867 return nextSeat == 3;
868 case 3:
869 return nextSeat == 2;
870 }
871
872 return false;
873 }
874
875 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
876 {
877 switch (pCurrentSeat)
878 {
879 case 0:
880 return pDoorsSelection == "DoorsDriver";
881 case 1:
882 return pDoorsSelection == "DoorsCoDriver";
883 case 2:
884 return pDoorsSelection == "DoorsCargo1";
885 case 3:
886 return pDoorsSelection == "DoorsCargo2";
887 }
888
889 return false;
890 }
891
892 override void OnDebugSpawn()
893 {
897
898 GetInventory().CreateInInventory("Hatchback_02_Wheel");
899 GetInventory().CreateInInventory("Hatchback_02_Wheel");
900 GetInventory().CreateInInventory("Hatchback_02_Wheel");
901 GetInventory().CreateInInventory("Hatchback_02_Wheel");
902
903 GetInventory().CreateInInventory("Hatchback_02_Door_1_1");
904 GetInventory().CreateInInventory("Hatchback_02_Door_1_2");
905 GetInventory().CreateInInventory("Hatchback_02_Door_2_1");
906 GetInventory().CreateInInventory("Hatchback_02_Door_2_2");
907 GetInventory().CreateInInventory("Hatchback_02_Hood");
908 GetInventory().CreateInInventory("Hatchback_02_Trunk");
909
910 //-----IN CAR CARGO
911 GetInventory().CreateInInventory("Hatchback_02_Wheel");
912 GetInventory().CreateInInventory("Hatchback_02_Wheel");
913 }
914}
915
917{
918 override void OnDebugSpawn()
919 {
923
924 GetInventory().CreateInInventory("Hatchback_02_Wheel");
925 GetInventory().CreateInInventory("Hatchback_02_Wheel");
926 GetInventory().CreateInInventory("Hatchback_02_Wheel");
927 GetInventory().CreateInInventory("Hatchback_02_Wheel");
928
929 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Black");
930 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Black");
931 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Black");
932 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Black");
933 GetInventory().CreateInInventory("Hatchback_02_Hood_Black");
934 GetInventory().CreateInInventory("Hatchback_02_Trunk_Black");
935
936 //-----IN CAR CARGO
937 GetInventory().CreateInInventory("Hatchback_02_Wheel");
938 GetInventory().CreateInInventory("Hatchback_02_Wheel");
939 }
940};
941
943{
944 override void OnDebugSpawn()
945 {
949
950 GetInventory().CreateInInventory("Hatchback_02_Wheel");
951 GetInventory().CreateInInventory("Hatchback_02_Wheel");
952 GetInventory().CreateInInventory("Hatchback_02_Wheel");
953 GetInventory().CreateInInventory("Hatchback_02_Wheel");
954
955 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Blue");
956 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Blue");
957 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Blue");
958 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Blue");
959 GetInventory().CreateInInventory("Hatchback_02_Hood_Blue");
960 GetInventory().CreateInInventory("Hatchback_02_Trunk_Blue");
961
962 //-----IN CAR CARGO
963 GetInventory().CreateInInventory("Hatchback_02_Wheel");
964 GetInventory().CreateInInventory("Hatchback_02_Wheel");
965 }
966}

◆ CreateFrontLight()

override CarLightBase CreateFrontLight ( )
protected
510{
514
515 void Hatchback_02()
516 {
517 //m_dmgContactCoef = 0.070;
518
519 m_EngineStartOK = "Hatchback_02_engine_start_SoundSet";
520 m_EngineStartBattery = "Hatchback_02_engine_failed_start_battery_SoundSet";
521 m_EngineStartPlug = "Hatchback_02_engine_failed_start_sparkplugs_SoundSet";
522 m_EngineStartFuel = "Hatchback_02_engine_failed_start_fuel_SoundSet";
523 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
524
525 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
526 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
527
528 m_CarHornShortSoundName = "Hatchback_02_Horn_Short_SoundSet";
529 m_CarHornLongSoundName = "Hatchback_02_Horn_SoundSet";
530
531 SetEnginePos("0 0.7 1.4");
532 }
533
534 override void EEInit()
535 {
536 super.EEInit();
537
538 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
539 {
541 m_UTSSettings.m_ManualUpdate = true;
542 m_UTSSettings.m_TemperatureMin = 0;
543 m_UTSSettings.m_TemperatureMax = 30;
545 m_UTSSettings.m_TemperatureCap = 0;
546 m_UTSSettings.m_RangeFull = 0.5;
547 m_UTSSettings.m_RangeMax = 2;
548
551 }
552 }
553
554 override void OnEngineStart()
555 {
556 super.OnEngineStart();
557
558 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
559 {
560 m_UTSource.SetDefferedActive(true, 20.0);
561 }
562 }
563
564 override void OnEngineStop()
565 {
566 super.OnEngineStop();
567
568 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
569 {
570 m_UTSource.SetDefferedActive(false, 10.0);
571 }
572 }
573
574 override void EOnPostSimulate(IEntity other, float timeSlice)
575 {
576 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
577 {
578 if (m_UTSource.IsActive())
579 {
581 }
582 }
583 }
584
585 override int GetAnimInstance()
586 {
587 return VehicleAnimInstances.GOLF;
588 }
589
590 override int GetSeatAnimationType(int posIdx)
591 {
592 switch (posIdx)
593 {
594 case 0:
595 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
596 case 1:
597 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
598 case 2:
599 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
600 case 3:
601 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
602 }
603
604 return 0;
605 }
606
607 // Override for car-specific light type
609 {
610 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02RearLight));
611 }
612
613 // Override for car-specific light type
615 {
616 return CarLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02FrontLight));
617 }
618
620 {
621 if (!super.CanReleaseAttachment(attachment))
622 {
623 return false;
624 }
625
626 if (EngineIsOn() || GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED)
627 {
628 string attType = attachment.GetType();
629 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
630 {
631 return false;
632 }
633 }
634
635 return true;
636 }
637
638 override protected bool CanManipulateSpareWheel(string slotSelectionName)
639 {
640 return GetCarDoorsState("Hatchback_02_Trunk") != CarDoorState.DOORS_CLOSED;
641 }
642
643 override bool CanDisplayAttachmentCategory( string category_name )
644 {
645 //super
646 if ( !super.CanDisplayAttachmentCategory( category_name ) )
647 return false;
648 //
649
650 category_name.ToLower();
651 if ( category_name.Contains("engine") )
652 {
653 if ( GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED )
654 return false;
655 }
656
657 return true;
658 }
659
660 override bool CanDisplayCargo()
661 {
662 if ( !super.CanDisplayCargo() )
663 return false;
664
665 if ( GetCarDoorsState("Hatchback_02_Trunk") == CarDoorState.DOORS_CLOSED )
666 return false;
667
668 return true;
669 }
670
671 override int GetCarDoorsState(string slotType)
672 {
674
675 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
676 if (!carDoor)
677 {
678 return CarDoorState.DOORS_MISSING;
679 }
680
681 switch (slotType)
682 {
683 case "Hatchback_02_Door_1_1":
684 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
685
686 case "Hatchback_02_Door_2_1":
687 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
688
689 case "Hatchback_02_Door_1_2":
690 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
691
692 case "Hatchback_02_Door_2_2":
693 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
694
695 case "Hatchback_02_Hood":
696 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
697
698 case "Hatchback_02_Trunk":
699 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
700 }
701
702 return CarDoorState.DOORS_MISSING;
703 }
704
705
706 override bool CrewCanGetThrough(int posIdx)
707 {
708 switch (posIdx)
709 {
710 case 0:
711 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
712 {
713 return false;
714 }
715
716 return true;
717
718 case 1:
719 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
720 {
721 return false;
722 }
723
724 return true;
725
726 case 2:
727 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
728 {
729 return false;
730 }
731
732 return true;
733
734 case 3:
735 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
736 {
737 return false;
738 }
739
740 return true;
741 }
742
743 return false;
744 }
745
746 override string GetDoorSelectionNameFromSeatPos(int posIdx)
747 {
748 switch( posIdx )
749 {
750 case 0:
751 return "doors_driver";
752 break;
753 case 1:
754 return "doors_codriver";
755 break;
756 case 2:
757 return "doors_cargo1";
758 break;
759 case 3:
760 return "doors_cargo2";
761 break;
762 }
763
764 return super.GetDoorSelectionNameFromSeatPos(posIdx);
765 }
766
767 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
768 {
769 switch( posIdx )
770 {
771 case 0:
772 return "Hatchback_02_Door_1_1";
773 break;
774 case 1:
775 return "Hatchback_02_Door_2_1";
776 break;
777 case 2:
778 return "Hatchback_02_Door_1_2";
779 break;
780 case 3:
781 return "Hatchback_02_Door_2_2";
782 break;
783 }
784
785 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
786 }
787
788 override float OnSound(CarSoundCtrl ctrl, float oldValue)
789 {
790 switch (ctrl)
791 {
792 case CarSoundCtrl.DOORS:
793 float newValue = 0;
794 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
795 {
796 newValue += 0.25;
797 }
798
799 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
800 {
801 newValue += 0.25;
802 }
803
804 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
805 {
806 newValue += 0.25;
807 }
808
809 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
810 {
811 newValue += 0.25;
812 }
813
814 return Math.Clamp(newValue, 0, 1);
815 break;
816 }
817
818 return super.OnSound(ctrl, oldValue);
819 }
820
821 override string GetAnimSourceFromSelection( string selection )
822 {
823 switch( selection )
824 {
825 case "doors_driver":
826 return "DoorsDriver";
827 case "doors_codriver":
828 return "DoorsCoDriver";
829 case "doors_cargo1":
830 return "DoorsCargo1";
831 case "doors_cargo2":
832 return "DoorsCargo2";
833 case "doors_hood":
834 return "DoorsHood";
835 case "doors_trunk":
836 return "DoorsTrunk";
837 }
838
839 return "";
840 }
841
842
843 override bool IsVitalTruckBattery()
844 {
845 return false;
846 }
847
848 override bool IsVitalGlowPlug()
849 {
850 return false;
851 }
852
853 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
854 {
855 switch (currentSeat)
856 {
857 case 0:
858 return nextSeat == 1;
859 case 1:
860 return nextSeat == 0;
861 case 2:
862 return nextSeat == 3;
863 case 3:
864 return nextSeat == 2;
865 }
866
867 return false;
868 }
869
870 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
871 {
872 switch (pCurrentSeat)
873 {
874 case 0:
875 return pDoorsSelection == "DoorsDriver";
876 case 1:
877 return pDoorsSelection == "DoorsCoDriver";
878 case 2:
879 return pDoorsSelection == "DoorsCargo1";
880 case 3:
881 return pDoorsSelection == "DoorsCargo2";
882 }
883
884 return false;
885 }
886
887 override void OnDebugSpawn()
888 {
892
893 GetInventory().CreateInInventory("Hatchback_02_Wheel");
894 GetInventory().CreateInInventory("Hatchback_02_Wheel");
895 GetInventory().CreateInInventory("Hatchback_02_Wheel");
896 GetInventory().CreateInInventory("Hatchback_02_Wheel");
897
898 GetInventory().CreateInInventory("Hatchback_02_Door_1_1");
899 GetInventory().CreateInInventory("Hatchback_02_Door_1_2");
900 GetInventory().CreateInInventory("Hatchback_02_Door_2_1");
901 GetInventory().CreateInInventory("Hatchback_02_Door_2_2");
902 GetInventory().CreateInInventory("Hatchback_02_Hood");
903 GetInventory().CreateInInventory("Hatchback_02_Trunk");
904
905 //-----IN CAR CARGO
906 GetInventory().CreateInInventory("Hatchback_02_Wheel");
907 GetInventory().CreateInInventory("Hatchback_02_Wheel");
908 }
909}
910
912{
913 override void OnDebugSpawn()
914 {
918
919 GetInventory().CreateInInventory("Hatchback_02_Wheel");
920 GetInventory().CreateInInventory("Hatchback_02_Wheel");
921 GetInventory().CreateInInventory("Hatchback_02_Wheel");
922 GetInventory().CreateInInventory("Hatchback_02_Wheel");
923
924 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Black");
925 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Black");
926 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Black");
927 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Black");
928 GetInventory().CreateInInventory("Hatchback_02_Hood_Black");
929 GetInventory().CreateInInventory("Hatchback_02_Trunk_Black");
930
931 //-----IN CAR CARGO
932 GetInventory().CreateInInventory("Hatchback_02_Wheel");
933 GetInventory().CreateInInventory("Hatchback_02_Wheel");
934 }
935};
936
938{
939 override void OnDebugSpawn()
940 {
944
945 GetInventory().CreateInInventory("Hatchback_02_Wheel");
946 GetInventory().CreateInInventory("Hatchback_02_Wheel");
947 GetInventory().CreateInInventory("Hatchback_02_Wheel");
948 GetInventory().CreateInInventory("Hatchback_02_Wheel");
949
950 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Blue");
951 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Blue");
952 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Blue");
953 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Blue");
954 GetInventory().CreateInInventory("Hatchback_02_Hood_Blue");
955 GetInventory().CreateInInventory("Hatchback_02_Trunk_Blue");
956
957 //-----IN CAR CARGO
958 GetInventory().CreateInInventory("Hatchback_02_Wheel");
959 GetInventory().CreateInInventory("Hatchback_02_Wheel");
960 }
961}

◆ CreateRearLight()

override CarRearLightBase CreateRearLight ( )
protected
504{
508
509 void Hatchback_02()
510 {
511 //m_dmgContactCoef = 0.070;
512
513 m_EngineStartOK = "Hatchback_02_engine_start_SoundSet";
514 m_EngineStartBattery = "Hatchback_02_engine_failed_start_battery_SoundSet";
515 m_EngineStartPlug = "Hatchback_02_engine_failed_start_sparkplugs_SoundSet";
516 m_EngineStartFuel = "Hatchback_02_engine_failed_start_fuel_SoundSet";
517 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
518
519 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
520 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
521
522 m_CarHornShortSoundName = "Hatchback_02_Horn_Short_SoundSet";
523 m_CarHornLongSoundName = "Hatchback_02_Horn_SoundSet";
524
525 SetEnginePos("0 0.7 1.4");
526 }
527
528 override void EEInit()
529 {
530 super.EEInit();
531
532 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
533 {
535 m_UTSSettings.m_ManualUpdate = true;
536 m_UTSSettings.m_TemperatureMin = 0;
537 m_UTSSettings.m_TemperatureMax = 30;
539 m_UTSSettings.m_TemperatureCap = 0;
540 m_UTSSettings.m_RangeFull = 0.5;
541 m_UTSSettings.m_RangeMax = 2;
542
545 }
546 }
547
548 override void OnEngineStart()
549 {
550 super.OnEngineStart();
551
552 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
553 {
554 m_UTSource.SetDefferedActive(true, 20.0);
555 }
556 }
557
558 override void OnEngineStop()
559 {
560 super.OnEngineStop();
561
562 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
563 {
564 m_UTSource.SetDefferedActive(false, 10.0);
565 }
566 }
567
568 override void EOnPostSimulate(IEntity other, float timeSlice)
569 {
570 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
571 {
572 if (m_UTSource.IsActive())
573 {
575 }
576 }
577 }
578
579 override int GetAnimInstance()
580 {
581 return VehicleAnimInstances.GOLF;
582 }
583
584 override int GetSeatAnimationType(int posIdx)
585 {
586 switch (posIdx)
587 {
588 case 0:
589 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
590 case 1:
591 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
592 case 2:
593 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
594 case 3:
595 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
596 }
597
598 return 0;
599 }
600
601 // Override for car-specific light type
603 {
604 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02RearLight));
605 }
606
607 // Override for car-specific light type
609 {
610 return CarLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02FrontLight));
611 }
612
614 {
615 if (!super.CanReleaseAttachment(attachment))
616 {
617 return false;
618 }
619
620 if (EngineIsOn() || GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED)
621 {
622 string attType = attachment.GetType();
623 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
624 {
625 return false;
626 }
627 }
628
629 return true;
630 }
631
632 override protected bool CanManipulateSpareWheel(string slotSelectionName)
633 {
634 return GetCarDoorsState("Hatchback_02_Trunk") != CarDoorState.DOORS_CLOSED;
635 }
636
637 override bool CanDisplayAttachmentCategory( string category_name )
638 {
639 //super
640 if ( !super.CanDisplayAttachmentCategory( category_name ) )
641 return false;
642 //
643
644 category_name.ToLower();
645 if ( category_name.Contains("engine") )
646 {
647 if ( GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED )
648 return false;
649 }
650
651 return true;
652 }
653
654 override bool CanDisplayCargo()
655 {
656 if ( !super.CanDisplayCargo() )
657 return false;
658
659 if ( GetCarDoorsState("Hatchback_02_Trunk") == CarDoorState.DOORS_CLOSED )
660 return false;
661
662 return true;
663 }
664
665 override int GetCarDoorsState(string slotType)
666 {
668
669 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
670 if (!carDoor)
671 {
672 return CarDoorState.DOORS_MISSING;
673 }
674
675 switch (slotType)
676 {
677 case "Hatchback_02_Door_1_1":
678 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
679
680 case "Hatchback_02_Door_2_1":
681 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
682
683 case "Hatchback_02_Door_1_2":
684 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
685
686 case "Hatchback_02_Door_2_2":
687 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
688
689 case "Hatchback_02_Hood":
690 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
691
692 case "Hatchback_02_Trunk":
693 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
694 }
695
696 return CarDoorState.DOORS_MISSING;
697 }
698
699
700 override bool CrewCanGetThrough(int posIdx)
701 {
702 switch (posIdx)
703 {
704 case 0:
705 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
706 {
707 return false;
708 }
709
710 return true;
711
712 case 1:
713 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
714 {
715 return false;
716 }
717
718 return true;
719
720 case 2:
721 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
722 {
723 return false;
724 }
725
726 return true;
727
728 case 3:
729 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
730 {
731 return false;
732 }
733
734 return true;
735 }
736
737 return false;
738 }
739
740 override string GetDoorSelectionNameFromSeatPos(int posIdx)
741 {
742 switch( posIdx )
743 {
744 case 0:
745 return "doors_driver";
746 break;
747 case 1:
748 return "doors_codriver";
749 break;
750 case 2:
751 return "doors_cargo1";
752 break;
753 case 3:
754 return "doors_cargo2";
755 break;
756 }
757
758 return super.GetDoorSelectionNameFromSeatPos(posIdx);
759 }
760
761 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
762 {
763 switch( posIdx )
764 {
765 case 0:
766 return "Hatchback_02_Door_1_1";
767 break;
768 case 1:
769 return "Hatchback_02_Door_2_1";
770 break;
771 case 2:
772 return "Hatchback_02_Door_1_2";
773 break;
774 case 3:
775 return "Hatchback_02_Door_2_2";
776 break;
777 }
778
779 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
780 }
781
782 override float OnSound(CarSoundCtrl ctrl, float oldValue)
783 {
784 switch (ctrl)
785 {
786 case CarSoundCtrl.DOORS:
787 float newValue = 0;
788 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
789 {
790 newValue += 0.25;
791 }
792
793 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
794 {
795 newValue += 0.25;
796 }
797
798 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
799 {
800 newValue += 0.25;
801 }
802
803 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
804 {
805 newValue += 0.25;
806 }
807
808 return Math.Clamp(newValue, 0, 1);
809 break;
810 }
811
812 return super.OnSound(ctrl, oldValue);
813 }
814
815 override string GetAnimSourceFromSelection( string selection )
816 {
817 switch( selection )
818 {
819 case "doors_driver":
820 return "DoorsDriver";
821 case "doors_codriver":
822 return "DoorsCoDriver";
823 case "doors_cargo1":
824 return "DoorsCargo1";
825 case "doors_cargo2":
826 return "DoorsCargo2";
827 case "doors_hood":
828 return "DoorsHood";
829 case "doors_trunk":
830 return "DoorsTrunk";
831 }
832
833 return "";
834 }
835
836
837 override bool IsVitalTruckBattery()
838 {
839 return false;
840 }
841
842 override bool IsVitalGlowPlug()
843 {
844 return false;
845 }
846
847 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
848 {
849 switch (currentSeat)
850 {
851 case 0:
852 return nextSeat == 1;
853 case 1:
854 return nextSeat == 0;
855 case 2:
856 return nextSeat == 3;
857 case 3:
858 return nextSeat == 2;
859 }
860
861 return false;
862 }
863
864 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
865 {
866 switch (pCurrentSeat)
867 {
868 case 0:
869 return pDoorsSelection == "DoorsDriver";
870 case 1:
871 return pDoorsSelection == "DoorsCoDriver";
872 case 2:
873 return pDoorsSelection == "DoorsCargo1";
874 case 3:
875 return pDoorsSelection == "DoorsCargo2";
876 }
877
878 return false;
879 }
880
881 override void OnDebugSpawn()
882 {
886
887 GetInventory().CreateInInventory("Hatchback_02_Wheel");
888 GetInventory().CreateInInventory("Hatchback_02_Wheel");
889 GetInventory().CreateInInventory("Hatchback_02_Wheel");
890 GetInventory().CreateInInventory("Hatchback_02_Wheel");
891
892 GetInventory().CreateInInventory("Hatchback_02_Door_1_1");
893 GetInventory().CreateInInventory("Hatchback_02_Door_1_2");
894 GetInventory().CreateInInventory("Hatchback_02_Door_2_1");
895 GetInventory().CreateInInventory("Hatchback_02_Door_2_2");
896 GetInventory().CreateInInventory("Hatchback_02_Hood");
897 GetInventory().CreateInInventory("Hatchback_02_Trunk");
898
899 //-----IN CAR CARGO
900 GetInventory().CreateInInventory("Hatchback_02_Wheel");
901 GetInventory().CreateInInventory("Hatchback_02_Wheel");
902 }
903}
904
906{
907 override void OnDebugSpawn()
908 {
912
913 GetInventory().CreateInInventory("Hatchback_02_Wheel");
914 GetInventory().CreateInInventory("Hatchback_02_Wheel");
915 GetInventory().CreateInInventory("Hatchback_02_Wheel");
916 GetInventory().CreateInInventory("Hatchback_02_Wheel");
917
918 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Black");
919 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Black");
920 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Black");
921 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Black");
922 GetInventory().CreateInInventory("Hatchback_02_Hood_Black");
923 GetInventory().CreateInInventory("Hatchback_02_Trunk_Black");
924
925 //-----IN CAR CARGO
926 GetInventory().CreateInInventory("Hatchback_02_Wheel");
927 GetInventory().CreateInInventory("Hatchback_02_Wheel");
928 }
929};
930
932{
933 override void OnDebugSpawn()
934 {
938
939 GetInventory().CreateInInventory("Hatchback_02_Wheel");
940 GetInventory().CreateInInventory("Hatchback_02_Wheel");
941 GetInventory().CreateInInventory("Hatchback_02_Wheel");
942 GetInventory().CreateInInventory("Hatchback_02_Wheel");
943
944 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Blue");
945 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Blue");
946 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Blue");
947 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Blue");
948 GetInventory().CreateInInventory("Hatchback_02_Hood_Blue");
949 GetInventory().CreateInInventory("Hatchback_02_Trunk_Blue");
950
951 //-----IN CAR CARGO
952 GetInventory().CreateInInventory("Hatchback_02_Wheel");
953 GetInventory().CreateInInventory("Hatchback_02_Wheel");
954 }
955}

◆ CrewCanGetThrough()

override bool CrewCanGetThrough ( int posIdx)
protected
602{
606
607 void Hatchback_02()
608 {
609 //m_dmgContactCoef = 0.070;
610
611 m_EngineStartOK = "Hatchback_02_engine_start_SoundSet";
612 m_EngineStartBattery = "Hatchback_02_engine_failed_start_battery_SoundSet";
613 m_EngineStartPlug = "Hatchback_02_engine_failed_start_sparkplugs_SoundSet";
614 m_EngineStartFuel = "Hatchback_02_engine_failed_start_fuel_SoundSet";
615 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
616
617 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
618 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
619
620 m_CarHornShortSoundName = "Hatchback_02_Horn_Short_SoundSet";
621 m_CarHornLongSoundName = "Hatchback_02_Horn_SoundSet";
622
623 SetEnginePos("0 0.7 1.4");
624 }
625
626 override void EEInit()
627 {
628 super.EEInit();
629
630 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
631 {
633 m_UTSSettings.m_ManualUpdate = true;
634 m_UTSSettings.m_TemperatureMin = 0;
635 m_UTSSettings.m_TemperatureMax = 30;
637 m_UTSSettings.m_TemperatureCap = 0;
638 m_UTSSettings.m_RangeFull = 0.5;
639 m_UTSSettings.m_RangeMax = 2;
640
643 }
644 }
645
646 override void OnEngineStart()
647 {
648 super.OnEngineStart();
649
650 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
651 {
652 m_UTSource.SetDefferedActive(true, 20.0);
653 }
654 }
655
656 override void OnEngineStop()
657 {
658 super.OnEngineStop();
659
660 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
661 {
662 m_UTSource.SetDefferedActive(false, 10.0);
663 }
664 }
665
666 override void EOnPostSimulate(IEntity other, float timeSlice)
667 {
668 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
669 {
670 if (m_UTSource.IsActive())
671 {
673 }
674 }
675 }
676
677 override int GetAnimInstance()
678 {
679 return VehicleAnimInstances.GOLF;
680 }
681
682 override int GetSeatAnimationType(int posIdx)
683 {
684 switch (posIdx)
685 {
686 case 0:
687 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
688 case 1:
689 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
690 case 2:
691 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
692 case 3:
693 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
694 }
695
696 return 0;
697 }
698
699 // Override for car-specific light type
701 {
702 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02RearLight));
703 }
704
705 // Override for car-specific light type
707 {
708 return CarLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02FrontLight));
709 }
710
712 {
713 if (!super.CanReleaseAttachment(attachment))
714 {
715 return false;
716 }
717
718 if (EngineIsOn() || GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED)
719 {
720 string attType = attachment.GetType();
721 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
722 {
723 return false;
724 }
725 }
726
727 return true;
728 }
729
730 override protected bool CanManipulateSpareWheel(string slotSelectionName)
731 {
732 return GetCarDoorsState("Hatchback_02_Trunk") != CarDoorState.DOORS_CLOSED;
733 }
734
735 override bool CanDisplayAttachmentCategory( string category_name )
736 {
737 //super
738 if ( !super.CanDisplayAttachmentCategory( category_name ) )
739 return false;
740 //
741
742 category_name.ToLower();
743 if ( category_name.Contains("engine") )
744 {
745 if ( GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED )
746 return false;
747 }
748
749 return true;
750 }
751
752 override bool CanDisplayCargo()
753 {
754 if ( !super.CanDisplayCargo() )
755 return false;
756
757 if ( GetCarDoorsState("Hatchback_02_Trunk") == CarDoorState.DOORS_CLOSED )
758 return false;
759
760 return true;
761 }
762
763 override int GetCarDoorsState(string slotType)
764 {
766
767 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
768 if (!carDoor)
769 {
770 return CarDoorState.DOORS_MISSING;
771 }
772
773 switch (slotType)
774 {
775 case "Hatchback_02_Door_1_1":
776 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
777
778 case "Hatchback_02_Door_2_1":
779 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
780
781 case "Hatchback_02_Door_1_2":
782 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
783
784 case "Hatchback_02_Door_2_2":
785 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
786
787 case "Hatchback_02_Hood":
788 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
789
790 case "Hatchback_02_Trunk":
791 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
792 }
793
794 return CarDoorState.DOORS_MISSING;
795 }
796
797
798 override bool CrewCanGetThrough(int posIdx)
799 {
800 switch (posIdx)
801 {
802 case 0:
803 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
804 {
805 return false;
806 }
807
808 return true;
809
810 case 1:
811 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
812 {
813 return false;
814 }
815
816 return true;
817
818 case 2:
819 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
820 {
821 return false;
822 }
823
824 return true;
825
826 case 3:
827 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
828 {
829 return false;
830 }
831
832 return true;
833 }
834
835 return false;
836 }
837
838 override string GetDoorSelectionNameFromSeatPos(int posIdx)
839 {
840 switch( posIdx )
841 {
842 case 0:
843 return "doors_driver";
844 break;
845 case 1:
846 return "doors_codriver";
847 break;
848 case 2:
849 return "doors_cargo1";
850 break;
851 case 3:
852 return "doors_cargo2";
853 break;
854 }
855
856 return super.GetDoorSelectionNameFromSeatPos(posIdx);
857 }
858
859 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
860 {
861 switch( posIdx )
862 {
863 case 0:
864 return "Hatchback_02_Door_1_1";
865 break;
866 case 1:
867 return "Hatchback_02_Door_2_1";
868 break;
869 case 2:
870 return "Hatchback_02_Door_1_2";
871 break;
872 case 3:
873 return "Hatchback_02_Door_2_2";
874 break;
875 }
876
877 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
878 }
879
880 override float OnSound(CarSoundCtrl ctrl, float oldValue)
881 {
882 switch (ctrl)
883 {
884 case CarSoundCtrl.DOORS:
885 float newValue = 0;
886 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
887 {
888 newValue += 0.25;
889 }
890
891 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
892 {
893 newValue += 0.25;
894 }
895
896 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
897 {
898 newValue += 0.25;
899 }
900
901 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
902 {
903 newValue += 0.25;
904 }
905
906 return Math.Clamp(newValue, 0, 1);
907 break;
908 }
909
910 return super.OnSound(ctrl, oldValue);
911 }
912
913 override string GetAnimSourceFromSelection( string selection )
914 {
915 switch( selection )
916 {
917 case "doors_driver":
918 return "DoorsDriver";
919 case "doors_codriver":
920 return "DoorsCoDriver";
921 case "doors_cargo1":
922 return "DoorsCargo1";
923 case "doors_cargo2":
924 return "DoorsCargo2";
925 case "doors_hood":
926 return "DoorsHood";
927 case "doors_trunk":
928 return "DoorsTrunk";
929 }
930
931 return "";
932 }
933
934
935 override bool IsVitalTruckBattery()
936 {
937 return false;
938 }
939
940 override bool IsVitalGlowPlug()
941 {
942 return false;
943 }
944
945 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
946 {
947 switch (currentSeat)
948 {
949 case 0:
950 return nextSeat == 1;
951 case 1:
952 return nextSeat == 0;
953 case 2:
954 return nextSeat == 3;
955 case 3:
956 return nextSeat == 2;
957 }
958
959 return false;
960 }
961
962 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
963 {
964 switch (pCurrentSeat)
965 {
966 case 0:
967 return pDoorsSelection == "DoorsDriver";
968 case 1:
969 return pDoorsSelection == "DoorsCoDriver";
970 case 2:
971 return pDoorsSelection == "DoorsCargo1";
972 case 3:
973 return pDoorsSelection == "DoorsCargo2";
974 }
975
976 return false;
977 }
978
979 override void OnDebugSpawn()
980 {
984
985 GetInventory().CreateInInventory("Hatchback_02_Wheel");
986 GetInventory().CreateInInventory("Hatchback_02_Wheel");
987 GetInventory().CreateInInventory("Hatchback_02_Wheel");
988 GetInventory().CreateInInventory("Hatchback_02_Wheel");
989
990 GetInventory().CreateInInventory("Hatchback_02_Door_1_1");
991 GetInventory().CreateInInventory("Hatchback_02_Door_1_2");
992 GetInventory().CreateInInventory("Hatchback_02_Door_2_1");
993 GetInventory().CreateInInventory("Hatchback_02_Door_2_2");
994 GetInventory().CreateInInventory("Hatchback_02_Hood");
995 GetInventory().CreateInInventory("Hatchback_02_Trunk");
996
997 //-----IN CAR CARGO
998 GetInventory().CreateInInventory("Hatchback_02_Wheel");
999 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1000 }
1001}
1002
1003class Hatchback_02_Black extends Hatchback_02
1004{
1005 override void OnDebugSpawn()
1006 {
1010
1011 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1012 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1013 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1014 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1015
1016 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Black");
1017 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Black");
1018 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Black");
1019 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Black");
1020 GetInventory().CreateInInventory("Hatchback_02_Hood_Black");
1021 GetInventory().CreateInInventory("Hatchback_02_Trunk_Black");
1022
1023 //-----IN CAR CARGO
1024 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1025 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1026 }
1027};
1028
1029class Hatchback_02_Blue extends Hatchback_02
1030{
1031 override void OnDebugSpawn()
1032 {
1036
1037 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1038 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1039 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1040 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1041
1042 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Blue");
1043 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Blue");
1044 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Blue");
1045 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Blue");
1046 GetInventory().CreateInInventory("Hatchback_02_Hood_Blue");
1047 GetInventory().CreateInInventory("Hatchback_02_Trunk_Blue");
1048
1049 //-----IN CAR CARGO
1050 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1051 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1052 }
1053}

◆ EEInit()

override void EEInit ( )
protected
430{
431 override void OnDebugSpawn()
432 {
436
437 GetInventory().CreateInInventory("Hatchback_02_Wheel");
438 GetInventory().CreateInInventory("Hatchback_02_Wheel");
439 GetInventory().CreateInInventory("Hatchback_02_Wheel");
440 GetInventory().CreateInInventory("Hatchback_02_Wheel");
441
442 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Blue");
443 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Blue");
444 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Blue");
445 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Blue");
446 GetInventory().CreateInInventory("Hatchback_02_Hood_Blue");
447 GetInventory().CreateInInventory("Hatchback_02_Trunk_Blue");

◆ EOnPostSimulate()

override void EOnPostSimulate ( IEntity other,
float timeSlice )
protected
470{
474
475 void Hatchback_02()
476 {
477 //m_dmgContactCoef = 0.070;
478
479 m_EngineStartOK = "Hatchback_02_engine_start_SoundSet";
480 m_EngineStartBattery = "Hatchback_02_engine_failed_start_battery_SoundSet";
481 m_EngineStartPlug = "Hatchback_02_engine_failed_start_sparkplugs_SoundSet";
482 m_EngineStartFuel = "Hatchback_02_engine_failed_start_fuel_SoundSet";
483 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
484
485 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
486 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
487
488 m_CarHornShortSoundName = "Hatchback_02_Horn_Short_SoundSet";
489 m_CarHornLongSoundName = "Hatchback_02_Horn_SoundSet";
490
491 SetEnginePos("0 0.7 1.4");
492 }
493
494 override void EEInit()
495 {
496 super.EEInit();
497
498 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
499 {
501 m_UTSSettings.m_ManualUpdate = true;
502 m_UTSSettings.m_TemperatureMin = 0;
503 m_UTSSettings.m_TemperatureMax = 30;
505 m_UTSSettings.m_TemperatureCap = 0;
506 m_UTSSettings.m_RangeFull = 0.5;
507 m_UTSSettings.m_RangeMax = 2;
508
511 }
512 }
513
514 override void OnEngineStart()
515 {
516 super.OnEngineStart();
517
518 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
519 {
520 m_UTSource.SetDefferedActive(true, 20.0);
521 }
522 }
523
524 override void OnEngineStop()
525 {
526 super.OnEngineStop();
527
528 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
529 {
530 m_UTSource.SetDefferedActive(false, 10.0);
531 }
532 }
533
534 override void EOnPostSimulate(IEntity other, float timeSlice)
535 {
536 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
537 {
538 if (m_UTSource.IsActive())
539 {
541 }
542 }
543 }
544
545 override int GetAnimInstance()
546 {
547 return VehicleAnimInstances.GOLF;
548 }
549
550 override int GetSeatAnimationType(int posIdx)
551 {
552 switch (posIdx)
553 {
554 case 0:
555 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
556 case 1:
557 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
558 case 2:
559 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
560 case 3:
561 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
562 }
563
564 return 0;
565 }
566
567 // Override for car-specific light type
569 {
570 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02RearLight));
571 }
572
573 // Override for car-specific light type
575 {
576 return CarLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02FrontLight));
577 }
578
580 {
581 if (!super.CanReleaseAttachment(attachment))
582 {
583 return false;
584 }
585
586 if (EngineIsOn() || GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED)
587 {
588 string attType = attachment.GetType();
589 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
590 {
591 return false;
592 }
593 }
594
595 return true;
596 }
597
598 override protected bool CanManipulateSpareWheel(string slotSelectionName)
599 {
600 return GetCarDoorsState("Hatchback_02_Trunk") != CarDoorState.DOORS_CLOSED;
601 }
602
603 override bool CanDisplayAttachmentCategory( string category_name )
604 {
605 //super
606 if ( !super.CanDisplayAttachmentCategory( category_name ) )
607 return false;
608 //
609
610 category_name.ToLower();
611 if ( category_name.Contains("engine") )
612 {
613 if ( GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED )
614 return false;
615 }
616
617 return true;
618 }
619
620 override bool CanDisplayCargo()
621 {
622 if ( !super.CanDisplayCargo() )
623 return false;
624
625 if ( GetCarDoorsState("Hatchback_02_Trunk") == CarDoorState.DOORS_CLOSED )
626 return false;
627
628 return true;
629 }
630
631 override int GetCarDoorsState(string slotType)
632 {
634
635 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
636 if (!carDoor)
637 {
638 return CarDoorState.DOORS_MISSING;
639 }
640
641 switch (slotType)
642 {
643 case "Hatchback_02_Door_1_1":
644 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
645
646 case "Hatchback_02_Door_2_1":
647 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
648
649 case "Hatchback_02_Door_1_2":
650 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
651
652 case "Hatchback_02_Door_2_2":
653 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
654
655 case "Hatchback_02_Hood":
656 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
657
658 case "Hatchback_02_Trunk":
659 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
660 }
661
662 return CarDoorState.DOORS_MISSING;
663 }
664
665
666 override bool CrewCanGetThrough(int posIdx)
667 {
668 switch (posIdx)
669 {
670 case 0:
671 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
672 {
673 return false;
674 }
675
676 return true;
677
678 case 1:
679 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
680 {
681 return false;
682 }
683
684 return true;
685
686 case 2:
687 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
688 {
689 return false;
690 }
691
692 return true;
693
694 case 3:
695 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
696 {
697 return false;
698 }
699
700 return true;
701 }
702
703 return false;
704 }
705
706 override string GetDoorSelectionNameFromSeatPos(int posIdx)
707 {
708 switch( posIdx )
709 {
710 case 0:
711 return "doors_driver";
712 break;
713 case 1:
714 return "doors_codriver";
715 break;
716 case 2:
717 return "doors_cargo1";
718 break;
719 case 3:
720 return "doors_cargo2";
721 break;
722 }
723
724 return super.GetDoorSelectionNameFromSeatPos(posIdx);
725 }
726
727 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
728 {
729 switch( posIdx )
730 {
731 case 0:
732 return "Hatchback_02_Door_1_1";
733 break;
734 case 1:
735 return "Hatchback_02_Door_2_1";
736 break;
737 case 2:
738 return "Hatchback_02_Door_1_2";
739 break;
740 case 3:
741 return "Hatchback_02_Door_2_2";
742 break;
743 }
744
745 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
746 }
747
748 override float OnSound(CarSoundCtrl ctrl, float oldValue)
749 {
750 switch (ctrl)
751 {
752 case CarSoundCtrl.DOORS:
753 float newValue = 0;
754 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
755 {
756 newValue += 0.25;
757 }
758
759 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
760 {
761 newValue += 0.25;
762 }
763
764 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
765 {
766 newValue += 0.25;
767 }
768
769 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
770 {
771 newValue += 0.25;
772 }
773
774 return Math.Clamp(newValue, 0, 1);
775 break;
776 }
777
778 return super.OnSound(ctrl, oldValue);
779 }
780
781 override string GetAnimSourceFromSelection( string selection )
782 {
783 switch( selection )
784 {
785 case "doors_driver":
786 return "DoorsDriver";
787 case "doors_codriver":
788 return "DoorsCoDriver";
789 case "doors_cargo1":
790 return "DoorsCargo1";
791 case "doors_cargo2":
792 return "DoorsCargo2";
793 case "doors_hood":
794 return "DoorsHood";
795 case "doors_trunk":
796 return "DoorsTrunk";
797 }
798
799 return "";
800 }
801
802
803 override bool IsVitalTruckBattery()
804 {
805 return false;
806 }
807
808 override bool IsVitalGlowPlug()
809 {
810 return false;
811 }
812
813 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
814 {
815 switch (currentSeat)
816 {
817 case 0:
818 return nextSeat == 1;
819 case 1:
820 return nextSeat == 0;
821 case 2:
822 return nextSeat == 3;
823 case 3:
824 return nextSeat == 2;
825 }
826
827 return false;
828 }
829
830 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
831 {
832 switch (pCurrentSeat)
833 {
834 case 0:
835 return pDoorsSelection == "DoorsDriver";
836 case 1:
837 return pDoorsSelection == "DoorsCoDriver";
838 case 2:
839 return pDoorsSelection == "DoorsCargo1";
840 case 3:
841 return pDoorsSelection == "DoorsCargo2";
842 }
843
844 return false;
845 }
846
847 override void OnDebugSpawn()
848 {
852
853 GetInventory().CreateInInventory("Hatchback_02_Wheel");
854 GetInventory().CreateInInventory("Hatchback_02_Wheel");
855 GetInventory().CreateInInventory("Hatchback_02_Wheel");
856 GetInventory().CreateInInventory("Hatchback_02_Wheel");
857
858 GetInventory().CreateInInventory("Hatchback_02_Door_1_1");
859 GetInventory().CreateInInventory("Hatchback_02_Door_1_2");
860 GetInventory().CreateInInventory("Hatchback_02_Door_2_1");
861 GetInventory().CreateInInventory("Hatchback_02_Door_2_2");
862 GetInventory().CreateInInventory("Hatchback_02_Hood");
863 GetInventory().CreateInInventory("Hatchback_02_Trunk");
864
865 //-----IN CAR CARGO
866 GetInventory().CreateInInventory("Hatchback_02_Wheel");
867 GetInventory().CreateInInventory("Hatchback_02_Wheel");
868 }
869}
870
872{
873 override void OnDebugSpawn()
874 {
878
879 GetInventory().CreateInInventory("Hatchback_02_Wheel");
880 GetInventory().CreateInInventory("Hatchback_02_Wheel");
881 GetInventory().CreateInInventory("Hatchback_02_Wheel");
882 GetInventory().CreateInInventory("Hatchback_02_Wheel");
883
884 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Black");
885 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Black");
886 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Black");
887 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Black");
888 GetInventory().CreateInInventory("Hatchback_02_Hood_Black");
889 GetInventory().CreateInInventory("Hatchback_02_Trunk_Black");
890
891 //-----IN CAR CARGO
892 GetInventory().CreateInInventory("Hatchback_02_Wheel");
893 GetInventory().CreateInInventory("Hatchback_02_Wheel");
894 }
895};
896
898{
899 override void OnDebugSpawn()
900 {
904
905 GetInventory().CreateInInventory("Hatchback_02_Wheel");
906 GetInventory().CreateInInventory("Hatchback_02_Wheel");
907 GetInventory().CreateInInventory("Hatchback_02_Wheel");
908 GetInventory().CreateInInventory("Hatchback_02_Wheel");
909
910 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Blue");
911 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Blue");
912 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Blue");
913 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Blue");
914 GetInventory().CreateInInventory("Hatchback_02_Hood_Blue");
915 GetInventory().CreateInInventory("Hatchback_02_Trunk_Blue");
916
917 //-----IN CAR CARGO
918 GetInventory().CreateInInventory("Hatchback_02_Wheel");
919 GetInventory().CreateInInventory("Hatchback_02_Wheel");
920 }
921}

◆ GetAnimInstance()

override int GetAnimInstance ( )
protected
481{
485
486 void Hatchback_02()
487 {
488 //m_dmgContactCoef = 0.070;
489
490 m_EngineStartOK = "Hatchback_02_engine_start_SoundSet";
491 m_EngineStartBattery = "Hatchback_02_engine_failed_start_battery_SoundSet";
492 m_EngineStartPlug = "Hatchback_02_engine_failed_start_sparkplugs_SoundSet";
493 m_EngineStartFuel = "Hatchback_02_engine_failed_start_fuel_SoundSet";
494 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
495
496 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
497 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
498
499 m_CarHornShortSoundName = "Hatchback_02_Horn_Short_SoundSet";
500 m_CarHornLongSoundName = "Hatchback_02_Horn_SoundSet";
501
502 SetEnginePos("0 0.7 1.4");
503 }
504
505 override void EEInit()
506 {
507 super.EEInit();
508
509 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
510 {
512 m_UTSSettings.m_ManualUpdate = true;
513 m_UTSSettings.m_TemperatureMin = 0;
514 m_UTSSettings.m_TemperatureMax = 30;
516 m_UTSSettings.m_TemperatureCap = 0;
517 m_UTSSettings.m_RangeFull = 0.5;
518 m_UTSSettings.m_RangeMax = 2;
519
522 }
523 }
524
525 override void OnEngineStart()
526 {
527 super.OnEngineStart();
528
529 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
530 {
531 m_UTSource.SetDefferedActive(true, 20.0);
532 }
533 }
534
535 override void OnEngineStop()
536 {
537 super.OnEngineStop();
538
539 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
540 {
541 m_UTSource.SetDefferedActive(false, 10.0);
542 }
543 }
544
545 override void EOnPostSimulate(IEntity other, float timeSlice)
546 {
547 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
548 {
549 if (m_UTSource.IsActive())
550 {
552 }
553 }
554 }
555
556 override int GetAnimInstance()
557 {
558 return VehicleAnimInstances.GOLF;
559 }
560
561 override int GetSeatAnimationType(int posIdx)
562 {
563 switch (posIdx)
564 {
565 case 0:
566 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
567 case 1:
568 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
569 case 2:
570 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
571 case 3:
572 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
573 }
574
575 return 0;
576 }
577
578 // Override for car-specific light type
580 {
581 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02RearLight));
582 }
583
584 // Override for car-specific light type
586 {
587 return CarLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02FrontLight));
588 }
589
591 {
592 if (!super.CanReleaseAttachment(attachment))
593 {
594 return false;
595 }
596
597 if (EngineIsOn() || GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED)
598 {
599 string attType = attachment.GetType();
600 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
601 {
602 return false;
603 }
604 }
605
606 return true;
607 }
608
609 override protected bool CanManipulateSpareWheel(string slotSelectionName)
610 {
611 return GetCarDoorsState("Hatchback_02_Trunk") != CarDoorState.DOORS_CLOSED;
612 }
613
614 override bool CanDisplayAttachmentCategory( string category_name )
615 {
616 //super
617 if ( !super.CanDisplayAttachmentCategory( category_name ) )
618 return false;
619 //
620
621 category_name.ToLower();
622 if ( category_name.Contains("engine") )
623 {
624 if ( GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED )
625 return false;
626 }
627
628 return true;
629 }
630
631 override bool CanDisplayCargo()
632 {
633 if ( !super.CanDisplayCargo() )
634 return false;
635
636 if ( GetCarDoorsState("Hatchback_02_Trunk") == CarDoorState.DOORS_CLOSED )
637 return false;
638
639 return true;
640 }
641
642 override int GetCarDoorsState(string slotType)
643 {
645
646 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
647 if (!carDoor)
648 {
649 return CarDoorState.DOORS_MISSING;
650 }
651
652 switch (slotType)
653 {
654 case "Hatchback_02_Door_1_1":
655 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
656
657 case "Hatchback_02_Door_2_1":
658 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
659
660 case "Hatchback_02_Door_1_2":
661 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
662
663 case "Hatchback_02_Door_2_2":
664 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
665
666 case "Hatchback_02_Hood":
667 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
668
669 case "Hatchback_02_Trunk":
670 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
671 }
672
673 return CarDoorState.DOORS_MISSING;
674 }
675
676
677 override bool CrewCanGetThrough(int posIdx)
678 {
679 switch (posIdx)
680 {
681 case 0:
682 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
683 {
684 return false;
685 }
686
687 return true;
688
689 case 1:
690 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
691 {
692 return false;
693 }
694
695 return true;
696
697 case 2:
698 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
699 {
700 return false;
701 }
702
703 return true;
704
705 case 3:
706 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
707 {
708 return false;
709 }
710
711 return true;
712 }
713
714 return false;
715 }
716
717 override string GetDoorSelectionNameFromSeatPos(int posIdx)
718 {
719 switch( posIdx )
720 {
721 case 0:
722 return "doors_driver";
723 break;
724 case 1:
725 return "doors_codriver";
726 break;
727 case 2:
728 return "doors_cargo1";
729 break;
730 case 3:
731 return "doors_cargo2";
732 break;
733 }
734
735 return super.GetDoorSelectionNameFromSeatPos(posIdx);
736 }
737
738 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
739 {
740 switch( posIdx )
741 {
742 case 0:
743 return "Hatchback_02_Door_1_1";
744 break;
745 case 1:
746 return "Hatchback_02_Door_2_1";
747 break;
748 case 2:
749 return "Hatchback_02_Door_1_2";
750 break;
751 case 3:
752 return "Hatchback_02_Door_2_2";
753 break;
754 }
755
756 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
757 }
758
759 override float OnSound(CarSoundCtrl ctrl, float oldValue)
760 {
761 switch (ctrl)
762 {
763 case CarSoundCtrl.DOORS:
764 float newValue = 0;
765 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
766 {
767 newValue += 0.25;
768 }
769
770 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
771 {
772 newValue += 0.25;
773 }
774
775 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
776 {
777 newValue += 0.25;
778 }
779
780 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
781 {
782 newValue += 0.25;
783 }
784
785 return Math.Clamp(newValue, 0, 1);
786 break;
787 }
788
789 return super.OnSound(ctrl, oldValue);
790 }
791
792 override string GetAnimSourceFromSelection( string selection )
793 {
794 switch( selection )
795 {
796 case "doors_driver":
797 return "DoorsDriver";
798 case "doors_codriver":
799 return "DoorsCoDriver";
800 case "doors_cargo1":
801 return "DoorsCargo1";
802 case "doors_cargo2":
803 return "DoorsCargo2";
804 case "doors_hood":
805 return "DoorsHood";
806 case "doors_trunk":
807 return "DoorsTrunk";
808 }
809
810 return "";
811 }
812
813
814 override bool IsVitalTruckBattery()
815 {
816 return false;
817 }
818
819 override bool IsVitalGlowPlug()
820 {
821 return false;
822 }
823
824 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
825 {
826 switch (currentSeat)
827 {
828 case 0:
829 return nextSeat == 1;
830 case 1:
831 return nextSeat == 0;
832 case 2:
833 return nextSeat == 3;
834 case 3:
835 return nextSeat == 2;
836 }
837
838 return false;
839 }
840
841 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
842 {
843 switch (pCurrentSeat)
844 {
845 case 0:
846 return pDoorsSelection == "DoorsDriver";
847 case 1:
848 return pDoorsSelection == "DoorsCoDriver";
849 case 2:
850 return pDoorsSelection == "DoorsCargo1";
851 case 3:
852 return pDoorsSelection == "DoorsCargo2";
853 }
854
855 return false;
856 }
857
858 override void OnDebugSpawn()
859 {
863
864 GetInventory().CreateInInventory("Hatchback_02_Wheel");
865 GetInventory().CreateInInventory("Hatchback_02_Wheel");
866 GetInventory().CreateInInventory("Hatchback_02_Wheel");
867 GetInventory().CreateInInventory("Hatchback_02_Wheel");
868
869 GetInventory().CreateInInventory("Hatchback_02_Door_1_1");
870 GetInventory().CreateInInventory("Hatchback_02_Door_1_2");
871 GetInventory().CreateInInventory("Hatchback_02_Door_2_1");
872 GetInventory().CreateInInventory("Hatchback_02_Door_2_2");
873 GetInventory().CreateInInventory("Hatchback_02_Hood");
874 GetInventory().CreateInInventory("Hatchback_02_Trunk");
875
876 //-----IN CAR CARGO
877 GetInventory().CreateInInventory("Hatchback_02_Wheel");
878 GetInventory().CreateInInventory("Hatchback_02_Wheel");
879 }
880}
881
883{
884 override void OnDebugSpawn()
885 {
889
890 GetInventory().CreateInInventory("Hatchback_02_Wheel");
891 GetInventory().CreateInInventory("Hatchback_02_Wheel");
892 GetInventory().CreateInInventory("Hatchback_02_Wheel");
893 GetInventory().CreateInInventory("Hatchback_02_Wheel");
894
895 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Black");
896 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Black");
897 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Black");
898 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Black");
899 GetInventory().CreateInInventory("Hatchback_02_Hood_Black");
900 GetInventory().CreateInInventory("Hatchback_02_Trunk_Black");
901
902 //-----IN CAR CARGO
903 GetInventory().CreateInInventory("Hatchback_02_Wheel");
904 GetInventory().CreateInInventory("Hatchback_02_Wheel");
905 }
906};
907
909{
910 override void OnDebugSpawn()
911 {
915
916 GetInventory().CreateInInventory("Hatchback_02_Wheel");
917 GetInventory().CreateInInventory("Hatchback_02_Wheel");
918 GetInventory().CreateInInventory("Hatchback_02_Wheel");
919 GetInventory().CreateInInventory("Hatchback_02_Wheel");
920
921 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Blue");
922 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Blue");
923 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Blue");
924 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Blue");
925 GetInventory().CreateInInventory("Hatchback_02_Hood_Blue");
926 GetInventory().CreateInInventory("Hatchback_02_Trunk_Blue");
927
928 //-----IN CAR CARGO
929 GetInventory().CreateInInventory("Hatchback_02_Wheel");
930 GetInventory().CreateInInventory("Hatchback_02_Wheel");
931 }
932}

◆ GetAnimSourceFromSelection()

override string GetAnimSourceFromSelection ( string selection)
protected
717{
721
722 void Hatchback_02()
723 {
724 //m_dmgContactCoef = 0.070;
725
726 m_EngineStartOK = "Hatchback_02_engine_start_SoundSet";
727 m_EngineStartBattery = "Hatchback_02_engine_failed_start_battery_SoundSet";
728 m_EngineStartPlug = "Hatchback_02_engine_failed_start_sparkplugs_SoundSet";
729 m_EngineStartFuel = "Hatchback_02_engine_failed_start_fuel_SoundSet";
730 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
731
732 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
733 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
734
735 m_CarHornShortSoundName = "Hatchback_02_Horn_Short_SoundSet";
736 m_CarHornLongSoundName = "Hatchback_02_Horn_SoundSet";
737
738 SetEnginePos("0 0.7 1.4");
739 }
740
741 override void EEInit()
742 {
743 super.EEInit();
744
745 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
746 {
748 m_UTSSettings.m_ManualUpdate = true;
749 m_UTSSettings.m_TemperatureMin = 0;
750 m_UTSSettings.m_TemperatureMax = 30;
752 m_UTSSettings.m_TemperatureCap = 0;
753 m_UTSSettings.m_RangeFull = 0.5;
754 m_UTSSettings.m_RangeMax = 2;
755
758 }
759 }
760
761 override void OnEngineStart()
762 {
763 super.OnEngineStart();
764
765 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
766 {
767 m_UTSource.SetDefferedActive(true, 20.0);
768 }
769 }
770
771 override void OnEngineStop()
772 {
773 super.OnEngineStop();
774
775 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
776 {
777 m_UTSource.SetDefferedActive(false, 10.0);
778 }
779 }
780
781 override void EOnPostSimulate(IEntity other, float timeSlice)
782 {
783 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
784 {
785 if (m_UTSource.IsActive())
786 {
788 }
789 }
790 }
791
792 override int GetAnimInstance()
793 {
794 return VehicleAnimInstances.GOLF;
795 }
796
797 override int GetSeatAnimationType(int posIdx)
798 {
799 switch (posIdx)
800 {
801 case 0:
802 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
803 case 1:
804 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
805 case 2:
806 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
807 case 3:
808 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
809 }
810
811 return 0;
812 }
813
814 // Override for car-specific light type
816 {
817 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02RearLight));
818 }
819
820 // Override for car-specific light type
822 {
823 return CarLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02FrontLight));
824 }
825
827 {
828 if (!super.CanReleaseAttachment(attachment))
829 {
830 return false;
831 }
832
833 if (EngineIsOn() || GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED)
834 {
835 string attType = attachment.GetType();
836 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
837 {
838 return false;
839 }
840 }
841
842 return true;
843 }
844
845 override protected bool CanManipulateSpareWheel(string slotSelectionName)
846 {
847 return GetCarDoorsState("Hatchback_02_Trunk") != CarDoorState.DOORS_CLOSED;
848 }
849
850 override bool CanDisplayAttachmentCategory( string category_name )
851 {
852 //super
853 if ( !super.CanDisplayAttachmentCategory( category_name ) )
854 return false;
855 //
856
857 category_name.ToLower();
858 if ( category_name.Contains("engine") )
859 {
860 if ( GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED )
861 return false;
862 }
863
864 return true;
865 }
866
867 override bool CanDisplayCargo()
868 {
869 if ( !super.CanDisplayCargo() )
870 return false;
871
872 if ( GetCarDoorsState("Hatchback_02_Trunk") == CarDoorState.DOORS_CLOSED )
873 return false;
874
875 return true;
876 }
877
878 override int GetCarDoorsState(string slotType)
879 {
881
882 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
883 if (!carDoor)
884 {
885 return CarDoorState.DOORS_MISSING;
886 }
887
888 switch (slotType)
889 {
890 case "Hatchback_02_Door_1_1":
891 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
892
893 case "Hatchback_02_Door_2_1":
894 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
895
896 case "Hatchback_02_Door_1_2":
897 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
898
899 case "Hatchback_02_Door_2_2":
900 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
901
902 case "Hatchback_02_Hood":
903 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
904
905 case "Hatchback_02_Trunk":
906 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
907 }
908
909 return CarDoorState.DOORS_MISSING;
910 }
911
912
913 override bool CrewCanGetThrough(int posIdx)
914 {
915 switch (posIdx)
916 {
917 case 0:
918 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
919 {
920 return false;
921 }
922
923 return true;
924
925 case 1:
926 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
927 {
928 return false;
929 }
930
931 return true;
932
933 case 2:
934 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
935 {
936 return false;
937 }
938
939 return true;
940
941 case 3:
942 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
943 {
944 return false;
945 }
946
947 return true;
948 }
949
950 return false;
951 }
952
953 override string GetDoorSelectionNameFromSeatPos(int posIdx)
954 {
955 switch( posIdx )
956 {
957 case 0:
958 return "doors_driver";
959 break;
960 case 1:
961 return "doors_codriver";
962 break;
963 case 2:
964 return "doors_cargo1";
965 break;
966 case 3:
967 return "doors_cargo2";
968 break;
969 }
970
971 return super.GetDoorSelectionNameFromSeatPos(posIdx);
972 }
973
974 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
975 {
976 switch( posIdx )
977 {
978 case 0:
979 return "Hatchback_02_Door_1_1";
980 break;
981 case 1:
982 return "Hatchback_02_Door_2_1";
983 break;
984 case 2:
985 return "Hatchback_02_Door_1_2";
986 break;
987 case 3:
988 return "Hatchback_02_Door_2_2";
989 break;
990 }
991
992 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
993 }
994
995 override float OnSound(CarSoundCtrl ctrl, float oldValue)
996 {
997 switch (ctrl)
998 {
999 case CarSoundCtrl.DOORS:
1000 float newValue = 0;
1001 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
1002 {
1003 newValue += 0.25;
1004 }
1005
1006 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
1007 {
1008 newValue += 0.25;
1009 }
1010
1011 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
1012 {
1013 newValue += 0.25;
1014 }
1015
1016 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
1017 {
1018 newValue += 0.25;
1019 }
1020
1021 return Math.Clamp(newValue, 0, 1);
1022 break;
1023 }
1024
1025 return super.OnSound(ctrl, oldValue);
1026 }
1027
1028 override string GetAnimSourceFromSelection( string selection )
1029 {
1030 switch( selection )
1031 {
1032 case "doors_driver":
1033 return "DoorsDriver";
1034 case "doors_codriver":
1035 return "DoorsCoDriver";
1036 case "doors_cargo1":
1037 return "DoorsCargo1";
1038 case "doors_cargo2":
1039 return "DoorsCargo2";
1040 case "doors_hood":
1041 return "DoorsHood";
1042 case "doors_trunk":
1043 return "DoorsTrunk";
1044 }
1045
1046 return "";
1047 }
1048
1049
1050 override bool IsVitalTruckBattery()
1051 {
1052 return false;
1053 }
1054
1055 override bool IsVitalGlowPlug()
1056 {
1057 return false;
1058 }
1059
1060 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
1061 {
1062 switch (currentSeat)
1063 {
1064 case 0:
1065 return nextSeat == 1;
1066 case 1:
1067 return nextSeat == 0;
1068 case 2:
1069 return nextSeat == 3;
1070 case 3:
1071 return nextSeat == 2;
1072 }
1073
1074 return false;
1075 }
1076
1077 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
1078 {
1079 switch (pCurrentSeat)
1080 {
1081 case 0:
1082 return pDoorsSelection == "DoorsDriver";
1083 case 1:
1084 return pDoorsSelection == "DoorsCoDriver";
1085 case 2:
1086 return pDoorsSelection == "DoorsCargo1";
1087 case 3:
1088 return pDoorsSelection == "DoorsCargo2";
1089 }
1090
1091 return false;
1092 }
1093
1094 override void OnDebugSpawn()
1095 {
1099
1100 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1101 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1102 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1103 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1104
1105 GetInventory().CreateInInventory("Hatchback_02_Door_1_1");
1106 GetInventory().CreateInInventory("Hatchback_02_Door_1_2");
1107 GetInventory().CreateInInventory("Hatchback_02_Door_2_1");
1108 GetInventory().CreateInInventory("Hatchback_02_Door_2_2");
1109 GetInventory().CreateInInventory("Hatchback_02_Hood");
1110 GetInventory().CreateInInventory("Hatchback_02_Trunk");
1111
1112 //-----IN CAR CARGO
1113 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1114 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1115 }
1116}
1117
1118class Hatchback_02_Black extends Hatchback_02
1119{
1120 override void OnDebugSpawn()
1121 {
1125
1126 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1127 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1128 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1129 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1130
1131 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Black");
1132 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Black");
1133 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Black");
1134 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Black");
1135 GetInventory().CreateInInventory("Hatchback_02_Hood_Black");
1136 GetInventory().CreateInInventory("Hatchback_02_Trunk_Black");
1137
1138 //-----IN CAR CARGO
1139 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1140 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1141 }
1142};
1143
1144class Hatchback_02_Blue extends Hatchback_02
1145{
1146 override void OnDebugSpawn()
1147 {
1151
1152 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1153 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1154 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1155 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1156
1157 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Blue");
1158 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Blue");
1159 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Blue");
1160 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Blue");
1161 GetInventory().CreateInInventory("Hatchback_02_Hood_Blue");
1162 GetInventory().CreateInInventory("Hatchback_02_Trunk_Blue");
1163
1164 //-----IN CAR CARGO
1165 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1166 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1167 }
1168}

◆ GetCarDoorsState()

override int GetCarDoorsState ( string slotType)
protected
567{
571
572 void Hatchback_02()
573 {
574 //m_dmgContactCoef = 0.070;
575
576 m_EngineStartOK = "Hatchback_02_engine_start_SoundSet";
577 m_EngineStartBattery = "Hatchback_02_engine_failed_start_battery_SoundSet";
578 m_EngineStartPlug = "Hatchback_02_engine_failed_start_sparkplugs_SoundSet";
579 m_EngineStartFuel = "Hatchback_02_engine_failed_start_fuel_SoundSet";
580 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
581
582 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
583 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
584
585 m_CarHornShortSoundName = "Hatchback_02_Horn_Short_SoundSet";
586 m_CarHornLongSoundName = "Hatchback_02_Horn_SoundSet";
587
588 SetEnginePos("0 0.7 1.4");
589 }
590
591 override void EEInit()
592 {
593 super.EEInit();
594
595 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
596 {
598 m_UTSSettings.m_ManualUpdate = true;
599 m_UTSSettings.m_TemperatureMin = 0;
600 m_UTSSettings.m_TemperatureMax = 30;
602 m_UTSSettings.m_TemperatureCap = 0;
603 m_UTSSettings.m_RangeFull = 0.5;
604 m_UTSSettings.m_RangeMax = 2;
605
608 }
609 }
610
611 override void OnEngineStart()
612 {
613 super.OnEngineStart();
614
615 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
616 {
617 m_UTSource.SetDefferedActive(true, 20.0);
618 }
619 }
620
621 override void OnEngineStop()
622 {
623 super.OnEngineStop();
624
625 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
626 {
627 m_UTSource.SetDefferedActive(false, 10.0);
628 }
629 }
630
631 override void EOnPostSimulate(IEntity other, float timeSlice)
632 {
633 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
634 {
635 if (m_UTSource.IsActive())
636 {
638 }
639 }
640 }
641
642 override int GetAnimInstance()
643 {
644 return VehicleAnimInstances.GOLF;
645 }
646
647 override int GetSeatAnimationType(int posIdx)
648 {
649 switch (posIdx)
650 {
651 case 0:
652 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
653 case 1:
654 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
655 case 2:
656 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
657 case 3:
658 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
659 }
660
661 return 0;
662 }
663
664 // Override for car-specific light type
666 {
667 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02RearLight));
668 }
669
670 // Override for car-specific light type
672 {
673 return CarLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02FrontLight));
674 }
675
677 {
678 if (!super.CanReleaseAttachment(attachment))
679 {
680 return false;
681 }
682
683 if (EngineIsOn() || GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED)
684 {
685 string attType = attachment.GetType();
686 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
687 {
688 return false;
689 }
690 }
691
692 return true;
693 }
694
695 override protected bool CanManipulateSpareWheel(string slotSelectionName)
696 {
697 return GetCarDoorsState("Hatchback_02_Trunk") != CarDoorState.DOORS_CLOSED;
698 }
699
700 override bool CanDisplayAttachmentCategory( string category_name )
701 {
702 //super
703 if ( !super.CanDisplayAttachmentCategory( category_name ) )
704 return false;
705 //
706
707 category_name.ToLower();
708 if ( category_name.Contains("engine") )
709 {
710 if ( GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED )
711 return false;
712 }
713
714 return true;
715 }
716
717 override bool CanDisplayCargo()
718 {
719 if ( !super.CanDisplayCargo() )
720 return false;
721
722 if ( GetCarDoorsState("Hatchback_02_Trunk") == CarDoorState.DOORS_CLOSED )
723 return false;
724
725 return true;
726 }
727
728 override int GetCarDoorsState(string slotType)
729 {
731
732 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
733 if (!carDoor)
734 {
735 return CarDoorState.DOORS_MISSING;
736 }
737
738 switch (slotType)
739 {
740 case "Hatchback_02_Door_1_1":
741 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
742
743 case "Hatchback_02_Door_2_1":
744 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
745
746 case "Hatchback_02_Door_1_2":
747 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
748
749 case "Hatchback_02_Door_2_2":
750 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
751
752 case "Hatchback_02_Hood":
753 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
754
755 case "Hatchback_02_Trunk":
756 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
757 }
758
759 return CarDoorState.DOORS_MISSING;
760 }
761
762
763 override bool CrewCanGetThrough(int posIdx)
764 {
765 switch (posIdx)
766 {
767 case 0:
768 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
769 {
770 return false;
771 }
772
773 return true;
774
775 case 1:
776 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
777 {
778 return false;
779 }
780
781 return true;
782
783 case 2:
784 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
785 {
786 return false;
787 }
788
789 return true;
790
791 case 3:
792 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
793 {
794 return false;
795 }
796
797 return true;
798 }
799
800 return false;
801 }
802
803 override string GetDoorSelectionNameFromSeatPos(int posIdx)
804 {
805 switch( posIdx )
806 {
807 case 0:
808 return "doors_driver";
809 break;
810 case 1:
811 return "doors_codriver";
812 break;
813 case 2:
814 return "doors_cargo1";
815 break;
816 case 3:
817 return "doors_cargo2";
818 break;
819 }
820
821 return super.GetDoorSelectionNameFromSeatPos(posIdx);
822 }
823
824 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
825 {
826 switch( posIdx )
827 {
828 case 0:
829 return "Hatchback_02_Door_1_1";
830 break;
831 case 1:
832 return "Hatchback_02_Door_2_1";
833 break;
834 case 2:
835 return "Hatchback_02_Door_1_2";
836 break;
837 case 3:
838 return "Hatchback_02_Door_2_2";
839 break;
840 }
841
842 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
843 }
844
845 override float OnSound(CarSoundCtrl ctrl, float oldValue)
846 {
847 switch (ctrl)
848 {
849 case CarSoundCtrl.DOORS:
850 float newValue = 0;
851 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
852 {
853 newValue += 0.25;
854 }
855
856 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
857 {
858 newValue += 0.25;
859 }
860
861 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
862 {
863 newValue += 0.25;
864 }
865
866 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
867 {
868 newValue += 0.25;
869 }
870
871 return Math.Clamp(newValue, 0, 1);
872 break;
873 }
874
875 return super.OnSound(ctrl, oldValue);
876 }
877
878 override string GetAnimSourceFromSelection( string selection )
879 {
880 switch( selection )
881 {
882 case "doors_driver":
883 return "DoorsDriver";
884 case "doors_codriver":
885 return "DoorsCoDriver";
886 case "doors_cargo1":
887 return "DoorsCargo1";
888 case "doors_cargo2":
889 return "DoorsCargo2";
890 case "doors_hood":
891 return "DoorsHood";
892 case "doors_trunk":
893 return "DoorsTrunk";
894 }
895
896 return "";
897 }
898
899
900 override bool IsVitalTruckBattery()
901 {
902 return false;
903 }
904
905 override bool IsVitalGlowPlug()
906 {
907 return false;
908 }
909
910 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
911 {
912 switch (currentSeat)
913 {
914 case 0:
915 return nextSeat == 1;
916 case 1:
917 return nextSeat == 0;
918 case 2:
919 return nextSeat == 3;
920 case 3:
921 return nextSeat == 2;
922 }
923
924 return false;
925 }
926
927 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
928 {
929 switch (pCurrentSeat)
930 {
931 case 0:
932 return pDoorsSelection == "DoorsDriver";
933 case 1:
934 return pDoorsSelection == "DoorsCoDriver";
935 case 2:
936 return pDoorsSelection == "DoorsCargo1";
937 case 3:
938 return pDoorsSelection == "DoorsCargo2";
939 }
940
941 return false;
942 }
943
944 override void OnDebugSpawn()
945 {
949
950 GetInventory().CreateInInventory("Hatchback_02_Wheel");
951 GetInventory().CreateInInventory("Hatchback_02_Wheel");
952 GetInventory().CreateInInventory("Hatchback_02_Wheel");
953 GetInventory().CreateInInventory("Hatchback_02_Wheel");
954
955 GetInventory().CreateInInventory("Hatchback_02_Door_1_1");
956 GetInventory().CreateInInventory("Hatchback_02_Door_1_2");
957 GetInventory().CreateInInventory("Hatchback_02_Door_2_1");
958 GetInventory().CreateInInventory("Hatchback_02_Door_2_2");
959 GetInventory().CreateInInventory("Hatchback_02_Hood");
960 GetInventory().CreateInInventory("Hatchback_02_Trunk");
961
962 //-----IN CAR CARGO
963 GetInventory().CreateInInventory("Hatchback_02_Wheel");
964 GetInventory().CreateInInventory("Hatchback_02_Wheel");
965 }
966}
967
969{
970 override void OnDebugSpawn()
971 {
975
976 GetInventory().CreateInInventory("Hatchback_02_Wheel");
977 GetInventory().CreateInInventory("Hatchback_02_Wheel");
978 GetInventory().CreateInInventory("Hatchback_02_Wheel");
979 GetInventory().CreateInInventory("Hatchback_02_Wheel");
980
981 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Black");
982 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Black");
983 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Black");
984 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Black");
985 GetInventory().CreateInInventory("Hatchback_02_Hood_Black");
986 GetInventory().CreateInInventory("Hatchback_02_Trunk_Black");
987
988 //-----IN CAR CARGO
989 GetInventory().CreateInInventory("Hatchback_02_Wheel");
990 GetInventory().CreateInInventory("Hatchback_02_Wheel");
991 }
992};
993
995{
996 override void OnDebugSpawn()
997 {
1001
1002 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1003 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1004 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1005 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1006
1007 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Blue");
1008 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Blue");
1009 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Blue");
1010 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Blue");
1011 GetInventory().CreateInInventory("Hatchback_02_Hood_Blue");
1012 GetInventory().CreateInInventory("Hatchback_02_Trunk_Blue");
1013
1014 //-----IN CAR CARGO
1015 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1016 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1017 }
1018}

Используется в CarScript::CanDisplayAttachmentCategory(), CarScript::CanDisplayCargo(), CarScript::CanManipulateSpareWheel(), CarScript::CanReleaseAttachment(), CarScript::CrewCanGetThrough() и CarScript::OnSound().

◆ GetDoorInvSlotNameFromSeatPos()

override string GetDoorInvSlotNameFromSeatPos ( int posIdx)
protected
663{
667
668 void Hatchback_02()
669 {
670 //m_dmgContactCoef = 0.070;
671
672 m_EngineStartOK = "Hatchback_02_engine_start_SoundSet";
673 m_EngineStartBattery = "Hatchback_02_engine_failed_start_battery_SoundSet";
674 m_EngineStartPlug = "Hatchback_02_engine_failed_start_sparkplugs_SoundSet";
675 m_EngineStartFuel = "Hatchback_02_engine_failed_start_fuel_SoundSet";
676 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
677
678 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
679 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
680
681 m_CarHornShortSoundName = "Hatchback_02_Horn_Short_SoundSet";
682 m_CarHornLongSoundName = "Hatchback_02_Horn_SoundSet";
683
684 SetEnginePos("0 0.7 1.4");
685 }
686
687 override void EEInit()
688 {
689 super.EEInit();
690
691 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
692 {
694 m_UTSSettings.m_ManualUpdate = true;
695 m_UTSSettings.m_TemperatureMin = 0;
696 m_UTSSettings.m_TemperatureMax = 30;
698 m_UTSSettings.m_TemperatureCap = 0;
699 m_UTSSettings.m_RangeFull = 0.5;
700 m_UTSSettings.m_RangeMax = 2;
701
704 }
705 }
706
707 override void OnEngineStart()
708 {
709 super.OnEngineStart();
710
711 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
712 {
713 m_UTSource.SetDefferedActive(true, 20.0);
714 }
715 }
716
717 override void OnEngineStop()
718 {
719 super.OnEngineStop();
720
721 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
722 {
723 m_UTSource.SetDefferedActive(false, 10.0);
724 }
725 }
726
727 override void EOnPostSimulate(IEntity other, float timeSlice)
728 {
729 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
730 {
731 if (m_UTSource.IsActive())
732 {
734 }
735 }
736 }
737
738 override int GetAnimInstance()
739 {
740 return VehicleAnimInstances.GOLF;
741 }
742
743 override int GetSeatAnimationType(int posIdx)
744 {
745 switch (posIdx)
746 {
747 case 0:
748 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
749 case 1:
750 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
751 case 2:
752 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
753 case 3:
754 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
755 }
756
757 return 0;
758 }
759
760 // Override for car-specific light type
762 {
763 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02RearLight));
764 }
765
766 // Override for car-specific light type
768 {
769 return CarLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02FrontLight));
770 }
771
773 {
774 if (!super.CanReleaseAttachment(attachment))
775 {
776 return false;
777 }
778
779 if (EngineIsOn() || GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED)
780 {
781 string attType = attachment.GetType();
782 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
783 {
784 return false;
785 }
786 }
787
788 return true;
789 }
790
791 override protected bool CanManipulateSpareWheel(string slotSelectionName)
792 {
793 return GetCarDoorsState("Hatchback_02_Trunk") != CarDoorState.DOORS_CLOSED;
794 }
795
796 override bool CanDisplayAttachmentCategory( string category_name )
797 {
798 //super
799 if ( !super.CanDisplayAttachmentCategory( category_name ) )
800 return false;
801 //
802
803 category_name.ToLower();
804 if ( category_name.Contains("engine") )
805 {
806 if ( GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED )
807 return false;
808 }
809
810 return true;
811 }
812
813 override bool CanDisplayCargo()
814 {
815 if ( !super.CanDisplayCargo() )
816 return false;
817
818 if ( GetCarDoorsState("Hatchback_02_Trunk") == CarDoorState.DOORS_CLOSED )
819 return false;
820
821 return true;
822 }
823
824 override int GetCarDoorsState(string slotType)
825 {
827
828 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
829 if (!carDoor)
830 {
831 return CarDoorState.DOORS_MISSING;
832 }
833
834 switch (slotType)
835 {
836 case "Hatchback_02_Door_1_1":
837 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
838
839 case "Hatchback_02_Door_2_1":
840 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
841
842 case "Hatchback_02_Door_1_2":
843 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
844
845 case "Hatchback_02_Door_2_2":
846 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
847
848 case "Hatchback_02_Hood":
849 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
850
851 case "Hatchback_02_Trunk":
852 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
853 }
854
855 return CarDoorState.DOORS_MISSING;
856 }
857
858
859 override bool CrewCanGetThrough(int posIdx)
860 {
861 switch (posIdx)
862 {
863 case 0:
864 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
865 {
866 return false;
867 }
868
869 return true;
870
871 case 1:
872 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
873 {
874 return false;
875 }
876
877 return true;
878
879 case 2:
880 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
881 {
882 return false;
883 }
884
885 return true;
886
887 case 3:
888 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
889 {
890 return false;
891 }
892
893 return true;
894 }
895
896 return false;
897 }
898
899 override string GetDoorSelectionNameFromSeatPos(int posIdx)
900 {
901 switch( posIdx )
902 {
903 case 0:
904 return "doors_driver";
905 break;
906 case 1:
907 return "doors_codriver";
908 break;
909 case 2:
910 return "doors_cargo1";
911 break;
912 case 3:
913 return "doors_cargo2";
914 break;
915 }
916
917 return super.GetDoorSelectionNameFromSeatPos(posIdx);
918 }
919
920 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
921 {
922 switch( posIdx )
923 {
924 case 0:
925 return "Hatchback_02_Door_1_1";
926 break;
927 case 1:
928 return "Hatchback_02_Door_2_1";
929 break;
930 case 2:
931 return "Hatchback_02_Door_1_2";
932 break;
933 case 3:
934 return "Hatchback_02_Door_2_2";
935 break;
936 }
937
938 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
939 }
940
941 override float OnSound(CarSoundCtrl ctrl, float oldValue)
942 {
943 switch (ctrl)
944 {
945 case CarSoundCtrl.DOORS:
946 float newValue = 0;
947 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
948 {
949 newValue += 0.25;
950 }
951
952 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
953 {
954 newValue += 0.25;
955 }
956
957 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
958 {
959 newValue += 0.25;
960 }
961
962 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
963 {
964 newValue += 0.25;
965 }
966
967 return Math.Clamp(newValue, 0, 1);
968 break;
969 }
970
971 return super.OnSound(ctrl, oldValue);
972 }
973
974 override string GetAnimSourceFromSelection( string selection )
975 {
976 switch( selection )
977 {
978 case "doors_driver":
979 return "DoorsDriver";
980 case "doors_codriver":
981 return "DoorsCoDriver";
982 case "doors_cargo1":
983 return "DoorsCargo1";
984 case "doors_cargo2":
985 return "DoorsCargo2";
986 case "doors_hood":
987 return "DoorsHood";
988 case "doors_trunk":
989 return "DoorsTrunk";
990 }
991
992 return "";
993 }
994
995
996 override bool IsVitalTruckBattery()
997 {
998 return false;
999 }
1000
1001 override bool IsVitalGlowPlug()
1002 {
1003 return false;
1004 }
1005
1006 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
1007 {
1008 switch (currentSeat)
1009 {
1010 case 0:
1011 return nextSeat == 1;
1012 case 1:
1013 return nextSeat == 0;
1014 case 2:
1015 return nextSeat == 3;
1016 case 3:
1017 return nextSeat == 2;
1018 }
1019
1020 return false;
1021 }
1022
1023 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
1024 {
1025 switch (pCurrentSeat)
1026 {
1027 case 0:
1028 return pDoorsSelection == "DoorsDriver";
1029 case 1:
1030 return pDoorsSelection == "DoorsCoDriver";
1031 case 2:
1032 return pDoorsSelection == "DoorsCargo1";
1033 case 3:
1034 return pDoorsSelection == "DoorsCargo2";
1035 }
1036
1037 return false;
1038 }
1039
1040 override void OnDebugSpawn()
1041 {
1045
1046 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1047 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1048 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1049 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1050
1051 GetInventory().CreateInInventory("Hatchback_02_Door_1_1");
1052 GetInventory().CreateInInventory("Hatchback_02_Door_1_2");
1053 GetInventory().CreateInInventory("Hatchback_02_Door_2_1");
1054 GetInventory().CreateInInventory("Hatchback_02_Door_2_2");
1055 GetInventory().CreateInInventory("Hatchback_02_Hood");
1056 GetInventory().CreateInInventory("Hatchback_02_Trunk");
1057
1058 //-----IN CAR CARGO
1059 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1060 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1061 }
1062}
1063
1064class Hatchback_02_Black extends Hatchback_02
1065{
1066 override void OnDebugSpawn()
1067 {
1071
1072 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1073 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1074 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1075 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1076
1077 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Black");
1078 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Black");
1079 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Black");
1080 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Black");
1081 GetInventory().CreateInInventory("Hatchback_02_Hood_Black");
1082 GetInventory().CreateInInventory("Hatchback_02_Trunk_Black");
1083
1084 //-----IN CAR CARGO
1085 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1086 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1087 }
1088};
1089
1090class Hatchback_02_Blue extends Hatchback_02
1091{
1092 override void OnDebugSpawn()
1093 {
1097
1098 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1099 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1100 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1101 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1102
1103 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Blue");
1104 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Blue");
1105 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Blue");
1106 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Blue");
1107 GetInventory().CreateInInventory("Hatchback_02_Hood_Blue");
1108 GetInventory().CreateInInventory("Hatchback_02_Trunk_Blue");
1109
1110 //-----IN CAR CARGO
1111 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1112 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1113 }
1114}

◆ GetDoorSelectionNameFromSeatPos()

override string GetDoorSelectionNameFromSeatPos ( int posIdx)
protected
642{
646
647 void Hatchback_02()
648 {
649 //m_dmgContactCoef = 0.070;
650
651 m_EngineStartOK = "Hatchback_02_engine_start_SoundSet";
652 m_EngineStartBattery = "Hatchback_02_engine_failed_start_battery_SoundSet";
653 m_EngineStartPlug = "Hatchback_02_engine_failed_start_sparkplugs_SoundSet";
654 m_EngineStartFuel = "Hatchback_02_engine_failed_start_fuel_SoundSet";
655 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
656
657 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
658 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
659
660 m_CarHornShortSoundName = "Hatchback_02_Horn_Short_SoundSet";
661 m_CarHornLongSoundName = "Hatchback_02_Horn_SoundSet";
662
663 SetEnginePos("0 0.7 1.4");
664 }
665
666 override void EEInit()
667 {
668 super.EEInit();
669
670 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
671 {
673 m_UTSSettings.m_ManualUpdate = true;
674 m_UTSSettings.m_TemperatureMin = 0;
675 m_UTSSettings.m_TemperatureMax = 30;
677 m_UTSSettings.m_TemperatureCap = 0;
678 m_UTSSettings.m_RangeFull = 0.5;
679 m_UTSSettings.m_RangeMax = 2;
680
683 }
684 }
685
686 override void OnEngineStart()
687 {
688 super.OnEngineStart();
689
690 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
691 {
692 m_UTSource.SetDefferedActive(true, 20.0);
693 }
694 }
695
696 override void OnEngineStop()
697 {
698 super.OnEngineStop();
699
700 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
701 {
702 m_UTSource.SetDefferedActive(false, 10.0);
703 }
704 }
705
706 override void EOnPostSimulate(IEntity other, float timeSlice)
707 {
708 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
709 {
710 if (m_UTSource.IsActive())
711 {
713 }
714 }
715 }
716
717 override int GetAnimInstance()
718 {
719 return VehicleAnimInstances.GOLF;
720 }
721
722 override int GetSeatAnimationType(int posIdx)
723 {
724 switch (posIdx)
725 {
726 case 0:
727 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
728 case 1:
729 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
730 case 2:
731 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
732 case 3:
733 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
734 }
735
736 return 0;
737 }
738
739 // Override for car-specific light type
741 {
742 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02RearLight));
743 }
744
745 // Override for car-specific light type
747 {
748 return CarLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02FrontLight));
749 }
750
752 {
753 if (!super.CanReleaseAttachment(attachment))
754 {
755 return false;
756 }
757
758 if (EngineIsOn() || GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED)
759 {
760 string attType = attachment.GetType();
761 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
762 {
763 return false;
764 }
765 }
766
767 return true;
768 }
769
770 override protected bool CanManipulateSpareWheel(string slotSelectionName)
771 {
772 return GetCarDoorsState("Hatchback_02_Trunk") != CarDoorState.DOORS_CLOSED;
773 }
774
775 override bool CanDisplayAttachmentCategory( string category_name )
776 {
777 //super
778 if ( !super.CanDisplayAttachmentCategory( category_name ) )
779 return false;
780 //
781
782 category_name.ToLower();
783 if ( category_name.Contains("engine") )
784 {
785 if ( GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED )
786 return false;
787 }
788
789 return true;
790 }
791
792 override bool CanDisplayCargo()
793 {
794 if ( !super.CanDisplayCargo() )
795 return false;
796
797 if ( GetCarDoorsState("Hatchback_02_Trunk") == CarDoorState.DOORS_CLOSED )
798 return false;
799
800 return true;
801 }
802
803 override int GetCarDoorsState(string slotType)
804 {
806
807 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
808 if (!carDoor)
809 {
810 return CarDoorState.DOORS_MISSING;
811 }
812
813 switch (slotType)
814 {
815 case "Hatchback_02_Door_1_1":
816 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
817
818 case "Hatchback_02_Door_2_1":
819 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
820
821 case "Hatchback_02_Door_1_2":
822 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
823
824 case "Hatchback_02_Door_2_2":
825 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
826
827 case "Hatchback_02_Hood":
828 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
829
830 case "Hatchback_02_Trunk":
831 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
832 }
833
834 return CarDoorState.DOORS_MISSING;
835 }
836
837
838 override bool CrewCanGetThrough(int posIdx)
839 {
840 switch (posIdx)
841 {
842 case 0:
843 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
844 {
845 return false;
846 }
847
848 return true;
849
850 case 1:
851 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
852 {
853 return false;
854 }
855
856 return true;
857
858 case 2:
859 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
860 {
861 return false;
862 }
863
864 return true;
865
866 case 3:
867 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
868 {
869 return false;
870 }
871
872 return true;
873 }
874
875 return false;
876 }
877
878 override string GetDoorSelectionNameFromSeatPos(int posIdx)
879 {
880 switch( posIdx )
881 {
882 case 0:
883 return "doors_driver";
884 break;
885 case 1:
886 return "doors_codriver";
887 break;
888 case 2:
889 return "doors_cargo1";
890 break;
891 case 3:
892 return "doors_cargo2";
893 break;
894 }
895
896 return super.GetDoorSelectionNameFromSeatPos(posIdx);
897 }
898
899 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
900 {
901 switch( posIdx )
902 {
903 case 0:
904 return "Hatchback_02_Door_1_1";
905 break;
906 case 1:
907 return "Hatchback_02_Door_2_1";
908 break;
909 case 2:
910 return "Hatchback_02_Door_1_2";
911 break;
912 case 3:
913 return "Hatchback_02_Door_2_2";
914 break;
915 }
916
917 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
918 }
919
920 override float OnSound(CarSoundCtrl ctrl, float oldValue)
921 {
922 switch (ctrl)
923 {
924 case CarSoundCtrl.DOORS:
925 float newValue = 0;
926 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
927 {
928 newValue += 0.25;
929 }
930
931 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
932 {
933 newValue += 0.25;
934 }
935
936 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
937 {
938 newValue += 0.25;
939 }
940
941 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
942 {
943 newValue += 0.25;
944 }
945
946 return Math.Clamp(newValue, 0, 1);
947 break;
948 }
949
950 return super.OnSound(ctrl, oldValue);
951 }
952
953 override string GetAnimSourceFromSelection( string selection )
954 {
955 switch( selection )
956 {
957 case "doors_driver":
958 return "DoorsDriver";
959 case "doors_codriver":
960 return "DoorsCoDriver";
961 case "doors_cargo1":
962 return "DoorsCargo1";
963 case "doors_cargo2":
964 return "DoorsCargo2";
965 case "doors_hood":
966 return "DoorsHood";
967 case "doors_trunk":
968 return "DoorsTrunk";
969 }
970
971 return "";
972 }
973
974
975 override bool IsVitalTruckBattery()
976 {
977 return false;
978 }
979
980 override bool IsVitalGlowPlug()
981 {
982 return false;
983 }
984
985 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
986 {
987 switch (currentSeat)
988 {
989 case 0:
990 return nextSeat == 1;
991 case 1:
992 return nextSeat == 0;
993 case 2:
994 return nextSeat == 3;
995 case 3:
996 return nextSeat == 2;
997 }
998
999 return false;
1000 }
1001
1002 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
1003 {
1004 switch (pCurrentSeat)
1005 {
1006 case 0:
1007 return pDoorsSelection == "DoorsDriver";
1008 case 1:
1009 return pDoorsSelection == "DoorsCoDriver";
1010 case 2:
1011 return pDoorsSelection == "DoorsCargo1";
1012 case 3:
1013 return pDoorsSelection == "DoorsCargo2";
1014 }
1015
1016 return false;
1017 }
1018
1019 override void OnDebugSpawn()
1020 {
1024
1025 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1026 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1027 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1028 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1029
1030 GetInventory().CreateInInventory("Hatchback_02_Door_1_1");
1031 GetInventory().CreateInInventory("Hatchback_02_Door_1_2");
1032 GetInventory().CreateInInventory("Hatchback_02_Door_2_1");
1033 GetInventory().CreateInInventory("Hatchback_02_Door_2_2");
1034 GetInventory().CreateInInventory("Hatchback_02_Hood");
1035 GetInventory().CreateInInventory("Hatchback_02_Trunk");
1036
1037 //-----IN CAR CARGO
1038 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1039 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1040 }
1041}
1042
1043class Hatchback_02_Black extends Hatchback_02
1044{
1045 override void OnDebugSpawn()
1046 {
1050
1051 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1052 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1053 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1054 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1055
1056 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Black");
1057 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Black");
1058 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Black");
1059 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Black");
1060 GetInventory().CreateInInventory("Hatchback_02_Hood_Black");
1061 GetInventory().CreateInInventory("Hatchback_02_Trunk_Black");
1062
1063 //-----IN CAR CARGO
1064 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1065 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1066 }
1067};
1068
1069class Hatchback_02_Blue extends Hatchback_02
1070{
1071 override void OnDebugSpawn()
1072 {
1076
1077 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1078 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1079 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1080 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1081
1082 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Blue");
1083 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Blue");
1084 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Blue");
1085 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Blue");
1086 GetInventory().CreateInInventory("Hatchback_02_Hood_Blue");
1087 GetInventory().CreateInInventory("Hatchback_02_Trunk_Blue");
1088
1089 //-----IN CAR CARGO
1090 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1091 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1092 }
1093}

◆ GetSeatAnimationType()

override int GetSeatAnimationType ( int posIdx)
protected
486{
490
491 void Hatchback_02()
492 {
493 //m_dmgContactCoef = 0.070;
494
495 m_EngineStartOK = "Hatchback_02_engine_start_SoundSet";
496 m_EngineStartBattery = "Hatchback_02_engine_failed_start_battery_SoundSet";
497 m_EngineStartPlug = "Hatchback_02_engine_failed_start_sparkplugs_SoundSet";
498 m_EngineStartFuel = "Hatchback_02_engine_failed_start_fuel_SoundSet";
499 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
500
501 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
502 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
503
504 m_CarHornShortSoundName = "Hatchback_02_Horn_Short_SoundSet";
505 m_CarHornLongSoundName = "Hatchback_02_Horn_SoundSet";
506
507 SetEnginePos("0 0.7 1.4");
508 }
509
510 override void EEInit()
511 {
512 super.EEInit();
513
514 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
515 {
517 m_UTSSettings.m_ManualUpdate = true;
518 m_UTSSettings.m_TemperatureMin = 0;
519 m_UTSSettings.m_TemperatureMax = 30;
521 m_UTSSettings.m_TemperatureCap = 0;
522 m_UTSSettings.m_RangeFull = 0.5;
523 m_UTSSettings.m_RangeMax = 2;
524
527 }
528 }
529
530 override void OnEngineStart()
531 {
532 super.OnEngineStart();
533
534 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
535 {
536 m_UTSource.SetDefferedActive(true, 20.0);
537 }
538 }
539
540 override void OnEngineStop()
541 {
542 super.OnEngineStop();
543
544 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
545 {
546 m_UTSource.SetDefferedActive(false, 10.0);
547 }
548 }
549
550 override void EOnPostSimulate(IEntity other, float timeSlice)
551 {
552 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
553 {
554 if (m_UTSource.IsActive())
555 {
557 }
558 }
559 }
560
561 override int GetAnimInstance()
562 {
563 return VehicleAnimInstances.GOLF;
564 }
565
566 override int GetSeatAnimationType(int posIdx)
567 {
568 switch (posIdx)
569 {
570 case 0:
571 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
572 case 1:
573 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
574 case 2:
575 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
576 case 3:
577 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
578 }
579
580 return 0;
581 }
582
583 // Override for car-specific light type
585 {
586 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02RearLight));
587 }
588
589 // Override for car-specific light type
591 {
592 return CarLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02FrontLight));
593 }
594
596 {
597 if (!super.CanReleaseAttachment(attachment))
598 {
599 return false;
600 }
601
602 if (EngineIsOn() || GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED)
603 {
604 string attType = attachment.GetType();
605 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
606 {
607 return false;
608 }
609 }
610
611 return true;
612 }
613
614 override protected bool CanManipulateSpareWheel(string slotSelectionName)
615 {
616 return GetCarDoorsState("Hatchback_02_Trunk") != CarDoorState.DOORS_CLOSED;
617 }
618
619 override bool CanDisplayAttachmentCategory( string category_name )
620 {
621 //super
622 if ( !super.CanDisplayAttachmentCategory( category_name ) )
623 return false;
624 //
625
626 category_name.ToLower();
627 if ( category_name.Contains("engine") )
628 {
629 if ( GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED )
630 return false;
631 }
632
633 return true;
634 }
635
636 override bool CanDisplayCargo()
637 {
638 if ( !super.CanDisplayCargo() )
639 return false;
640
641 if ( GetCarDoorsState("Hatchback_02_Trunk") == CarDoorState.DOORS_CLOSED )
642 return false;
643
644 return true;
645 }
646
647 override int GetCarDoorsState(string slotType)
648 {
650
651 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
652 if (!carDoor)
653 {
654 return CarDoorState.DOORS_MISSING;
655 }
656
657 switch (slotType)
658 {
659 case "Hatchback_02_Door_1_1":
660 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
661
662 case "Hatchback_02_Door_2_1":
663 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
664
665 case "Hatchback_02_Door_1_2":
666 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
667
668 case "Hatchback_02_Door_2_2":
669 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
670
671 case "Hatchback_02_Hood":
672 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
673
674 case "Hatchback_02_Trunk":
675 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
676 }
677
678 return CarDoorState.DOORS_MISSING;
679 }
680
681
682 override bool CrewCanGetThrough(int posIdx)
683 {
684 switch (posIdx)
685 {
686 case 0:
687 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
688 {
689 return false;
690 }
691
692 return true;
693
694 case 1:
695 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
696 {
697 return false;
698 }
699
700 return true;
701
702 case 2:
703 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
704 {
705 return false;
706 }
707
708 return true;
709
710 case 3:
711 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
712 {
713 return false;
714 }
715
716 return true;
717 }
718
719 return false;
720 }
721
722 override string GetDoorSelectionNameFromSeatPos(int posIdx)
723 {
724 switch( posIdx )
725 {
726 case 0:
727 return "doors_driver";
728 break;
729 case 1:
730 return "doors_codriver";
731 break;
732 case 2:
733 return "doors_cargo1";
734 break;
735 case 3:
736 return "doors_cargo2";
737 break;
738 }
739
740 return super.GetDoorSelectionNameFromSeatPos(posIdx);
741 }
742
743 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
744 {
745 switch( posIdx )
746 {
747 case 0:
748 return "Hatchback_02_Door_1_1";
749 break;
750 case 1:
751 return "Hatchback_02_Door_2_1";
752 break;
753 case 2:
754 return "Hatchback_02_Door_1_2";
755 break;
756 case 3:
757 return "Hatchback_02_Door_2_2";
758 break;
759 }
760
761 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
762 }
763
764 override float OnSound(CarSoundCtrl ctrl, float oldValue)
765 {
766 switch (ctrl)
767 {
768 case CarSoundCtrl.DOORS:
769 float newValue = 0;
770 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
771 {
772 newValue += 0.25;
773 }
774
775 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
776 {
777 newValue += 0.25;
778 }
779
780 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
781 {
782 newValue += 0.25;
783 }
784
785 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
786 {
787 newValue += 0.25;
788 }
789
790 return Math.Clamp(newValue, 0, 1);
791 break;
792 }
793
794 return super.OnSound(ctrl, oldValue);
795 }
796
797 override string GetAnimSourceFromSelection( string selection )
798 {
799 switch( selection )
800 {
801 case "doors_driver":
802 return "DoorsDriver";
803 case "doors_codriver":
804 return "DoorsCoDriver";
805 case "doors_cargo1":
806 return "DoorsCargo1";
807 case "doors_cargo2":
808 return "DoorsCargo2";
809 case "doors_hood":
810 return "DoorsHood";
811 case "doors_trunk":
812 return "DoorsTrunk";
813 }
814
815 return "";
816 }
817
818
819 override bool IsVitalTruckBattery()
820 {
821 return false;
822 }
823
824 override bool IsVitalGlowPlug()
825 {
826 return false;
827 }
828
829 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
830 {
831 switch (currentSeat)
832 {
833 case 0:
834 return nextSeat == 1;
835 case 1:
836 return nextSeat == 0;
837 case 2:
838 return nextSeat == 3;
839 case 3:
840 return nextSeat == 2;
841 }
842
843 return false;
844 }
845
846 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
847 {
848 switch (pCurrentSeat)
849 {
850 case 0:
851 return pDoorsSelection == "DoorsDriver";
852 case 1:
853 return pDoorsSelection == "DoorsCoDriver";
854 case 2:
855 return pDoorsSelection == "DoorsCargo1";
856 case 3:
857 return pDoorsSelection == "DoorsCargo2";
858 }
859
860 return false;
861 }
862
863 override void OnDebugSpawn()
864 {
868
869 GetInventory().CreateInInventory("Hatchback_02_Wheel");
870 GetInventory().CreateInInventory("Hatchback_02_Wheel");
871 GetInventory().CreateInInventory("Hatchback_02_Wheel");
872 GetInventory().CreateInInventory("Hatchback_02_Wheel");
873
874 GetInventory().CreateInInventory("Hatchback_02_Door_1_1");
875 GetInventory().CreateInInventory("Hatchback_02_Door_1_2");
876 GetInventory().CreateInInventory("Hatchback_02_Door_2_1");
877 GetInventory().CreateInInventory("Hatchback_02_Door_2_2");
878 GetInventory().CreateInInventory("Hatchback_02_Hood");
879 GetInventory().CreateInInventory("Hatchback_02_Trunk");
880
881 //-----IN CAR CARGO
882 GetInventory().CreateInInventory("Hatchback_02_Wheel");
883 GetInventory().CreateInInventory("Hatchback_02_Wheel");
884 }
885}
886
888{
889 override void OnDebugSpawn()
890 {
894
895 GetInventory().CreateInInventory("Hatchback_02_Wheel");
896 GetInventory().CreateInInventory("Hatchback_02_Wheel");
897 GetInventory().CreateInInventory("Hatchback_02_Wheel");
898 GetInventory().CreateInInventory("Hatchback_02_Wheel");
899
900 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Black");
901 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Black");
902 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Black");
903 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Black");
904 GetInventory().CreateInInventory("Hatchback_02_Hood_Black");
905 GetInventory().CreateInInventory("Hatchback_02_Trunk_Black");
906
907 //-----IN CAR CARGO
908 GetInventory().CreateInInventory("Hatchback_02_Wheel");
909 GetInventory().CreateInInventory("Hatchback_02_Wheel");
910 }
911};
912
914{
915 override void OnDebugSpawn()
916 {
920
921 GetInventory().CreateInInventory("Hatchback_02_Wheel");
922 GetInventory().CreateInInventory("Hatchback_02_Wheel");
923 GetInventory().CreateInInventory("Hatchback_02_Wheel");
924 GetInventory().CreateInInventory("Hatchback_02_Wheel");
925
926 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Blue");
927 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Blue");
928 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Blue");
929 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Blue");
930 GetInventory().CreateInInventory("Hatchback_02_Hood_Blue");
931 GetInventory().CreateInInventory("Hatchback_02_Trunk_Blue");
932
933 //-----IN CAR CARGO
934 GetInventory().CreateInInventory("Hatchback_02_Wheel");
935 GetInventory().CreateInInventory("Hatchback_02_Wheel");
936 }
937}

◆ Hatchback_02()

void Hatchback_02 ( )
protected

◆ IsVitalGlowPlug()

override bool IsVitalGlowPlug ( )
protected
744{
748
749 void Hatchback_02()
750 {
751 //m_dmgContactCoef = 0.070;
752
753 m_EngineStartOK = "Hatchback_02_engine_start_SoundSet";
754 m_EngineStartBattery = "Hatchback_02_engine_failed_start_battery_SoundSet";
755 m_EngineStartPlug = "Hatchback_02_engine_failed_start_sparkplugs_SoundSet";
756 m_EngineStartFuel = "Hatchback_02_engine_failed_start_fuel_SoundSet";
757 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
758
759 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
760 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
761
762 m_CarHornShortSoundName = "Hatchback_02_Horn_Short_SoundSet";
763 m_CarHornLongSoundName = "Hatchback_02_Horn_SoundSet";
764
765 SetEnginePos("0 0.7 1.4");
766 }
767
768 override void EEInit()
769 {
770 super.EEInit();
771
772 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
773 {
775 m_UTSSettings.m_ManualUpdate = true;
776 m_UTSSettings.m_TemperatureMin = 0;
777 m_UTSSettings.m_TemperatureMax = 30;
779 m_UTSSettings.m_TemperatureCap = 0;
780 m_UTSSettings.m_RangeFull = 0.5;
781 m_UTSSettings.m_RangeMax = 2;
782
785 }
786 }
787
788 override void OnEngineStart()
789 {
790 super.OnEngineStart();
791
792 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
793 {
794 m_UTSource.SetDefferedActive(true, 20.0);
795 }
796 }
797
798 override void OnEngineStop()
799 {
800 super.OnEngineStop();
801
802 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
803 {
804 m_UTSource.SetDefferedActive(false, 10.0);
805 }
806 }
807
808 override void EOnPostSimulate(IEntity other, float timeSlice)
809 {
810 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
811 {
812 if (m_UTSource.IsActive())
813 {
815 }
816 }
817 }
818
819 override int GetAnimInstance()
820 {
821 return VehicleAnimInstances.GOLF;
822 }
823
824 override int GetSeatAnimationType(int posIdx)
825 {
826 switch (posIdx)
827 {
828 case 0:
829 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
830 case 1:
831 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
832 case 2:
833 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
834 case 3:
835 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
836 }
837
838 return 0;
839 }
840
841 // Override for car-specific light type
843 {
844 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02RearLight));
845 }
846
847 // Override for car-specific light type
849 {
850 return CarLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02FrontLight));
851 }
852
854 {
855 if (!super.CanReleaseAttachment(attachment))
856 {
857 return false;
858 }
859
860 if (EngineIsOn() || GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED)
861 {
862 string attType = attachment.GetType();
863 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
864 {
865 return false;
866 }
867 }
868
869 return true;
870 }
871
872 override protected bool CanManipulateSpareWheel(string slotSelectionName)
873 {
874 return GetCarDoorsState("Hatchback_02_Trunk") != CarDoorState.DOORS_CLOSED;
875 }
876
877 override bool CanDisplayAttachmentCategory( string category_name )
878 {
879 //super
880 if ( !super.CanDisplayAttachmentCategory( category_name ) )
881 return false;
882 //
883
884 category_name.ToLower();
885 if ( category_name.Contains("engine") )
886 {
887 if ( GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED )
888 return false;
889 }
890
891 return true;
892 }
893
894 override bool CanDisplayCargo()
895 {
896 if ( !super.CanDisplayCargo() )
897 return false;
898
899 if ( GetCarDoorsState("Hatchback_02_Trunk") == CarDoorState.DOORS_CLOSED )
900 return false;
901
902 return true;
903 }
904
905 override int GetCarDoorsState(string slotType)
906 {
908
909 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
910 if (!carDoor)
911 {
912 return CarDoorState.DOORS_MISSING;
913 }
914
915 switch (slotType)
916 {
917 case "Hatchback_02_Door_1_1":
918 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
919
920 case "Hatchback_02_Door_2_1":
921 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
922
923 case "Hatchback_02_Door_1_2":
924 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
925
926 case "Hatchback_02_Door_2_2":
927 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
928
929 case "Hatchback_02_Hood":
930 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
931
932 case "Hatchback_02_Trunk":
933 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
934 }
935
936 return CarDoorState.DOORS_MISSING;
937 }
938
939
940 override bool CrewCanGetThrough(int posIdx)
941 {
942 switch (posIdx)
943 {
944 case 0:
945 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
946 {
947 return false;
948 }
949
950 return true;
951
952 case 1:
953 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
954 {
955 return false;
956 }
957
958 return true;
959
960 case 2:
961 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
962 {
963 return false;
964 }
965
966 return true;
967
968 case 3:
969 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
970 {
971 return false;
972 }
973
974 return true;
975 }
976
977 return false;
978 }
979
980 override string GetDoorSelectionNameFromSeatPos(int posIdx)
981 {
982 switch( posIdx )
983 {
984 case 0:
985 return "doors_driver";
986 break;
987 case 1:
988 return "doors_codriver";
989 break;
990 case 2:
991 return "doors_cargo1";
992 break;
993 case 3:
994 return "doors_cargo2";
995 break;
996 }
997
998 return super.GetDoorSelectionNameFromSeatPos(posIdx);
999 }
1000
1001 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
1002 {
1003 switch( posIdx )
1004 {
1005 case 0:
1006 return "Hatchback_02_Door_1_1";
1007 break;
1008 case 1:
1009 return "Hatchback_02_Door_2_1";
1010 break;
1011 case 2:
1012 return "Hatchback_02_Door_1_2";
1013 break;
1014 case 3:
1015 return "Hatchback_02_Door_2_2";
1016 break;
1017 }
1018
1019 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
1020 }
1021
1022 override float OnSound(CarSoundCtrl ctrl, float oldValue)
1023 {
1024 switch (ctrl)
1025 {
1026 case CarSoundCtrl.DOORS:
1027 float newValue = 0;
1028 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
1029 {
1030 newValue += 0.25;
1031 }
1032
1033 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
1034 {
1035 newValue += 0.25;
1036 }
1037
1038 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
1039 {
1040 newValue += 0.25;
1041 }
1042
1043 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
1044 {
1045 newValue += 0.25;
1046 }
1047
1048 return Math.Clamp(newValue, 0, 1);
1049 break;
1050 }
1051
1052 return super.OnSound(ctrl, oldValue);
1053 }
1054
1055 override string GetAnimSourceFromSelection( string selection )
1056 {
1057 switch( selection )
1058 {
1059 case "doors_driver":
1060 return "DoorsDriver";
1061 case "doors_codriver":
1062 return "DoorsCoDriver";
1063 case "doors_cargo1":
1064 return "DoorsCargo1";
1065 case "doors_cargo2":
1066 return "DoorsCargo2";
1067 case "doors_hood":
1068 return "DoorsHood";
1069 case "doors_trunk":
1070 return "DoorsTrunk";
1071 }
1072
1073 return "";
1074 }
1075
1076
1077 override bool IsVitalTruckBattery()
1078 {
1079 return false;
1080 }
1081
1082 override bool IsVitalGlowPlug()
1083 {
1084 return false;
1085 }
1086
1087 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
1088 {
1089 switch (currentSeat)
1090 {
1091 case 0:
1092 return nextSeat == 1;
1093 case 1:
1094 return nextSeat == 0;
1095 case 2:
1096 return nextSeat == 3;
1097 case 3:
1098 return nextSeat == 2;
1099 }
1100
1101 return false;
1102 }
1103
1104 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
1105 {
1106 switch (pCurrentSeat)
1107 {
1108 case 0:
1109 return pDoorsSelection == "DoorsDriver";
1110 case 1:
1111 return pDoorsSelection == "DoorsCoDriver";
1112 case 2:
1113 return pDoorsSelection == "DoorsCargo1";
1114 case 3:
1115 return pDoorsSelection == "DoorsCargo2";
1116 }
1117
1118 return false;
1119 }
1120
1121 override void OnDebugSpawn()
1122 {
1126
1127 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1128 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1129 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1130 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1131
1132 GetInventory().CreateInInventory("Hatchback_02_Door_1_1");
1133 GetInventory().CreateInInventory("Hatchback_02_Door_1_2");
1134 GetInventory().CreateInInventory("Hatchback_02_Door_2_1");
1135 GetInventory().CreateInInventory("Hatchback_02_Door_2_2");
1136 GetInventory().CreateInInventory("Hatchback_02_Hood");
1137 GetInventory().CreateInInventory("Hatchback_02_Trunk");
1138
1139 //-----IN CAR CARGO
1140 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1141 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1142 }
1143}
1144
1145class Hatchback_02_Black extends Hatchback_02
1146{
1147 override void OnDebugSpawn()
1148 {
1152
1153 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1154 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1155 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1156 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1157
1158 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Black");
1159 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Black");
1160 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Black");
1161 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Black");
1162 GetInventory().CreateInInventory("Hatchback_02_Hood_Black");
1163 GetInventory().CreateInInventory("Hatchback_02_Trunk_Black");
1164
1165 //-----IN CAR CARGO
1166 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1167 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1168 }
1169};
1170
1171class Hatchback_02_Blue extends Hatchback_02
1172{
1173 override void OnDebugSpawn()
1174 {
1178
1179 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1180 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1181 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1182 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1183
1184 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Blue");
1185 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Blue");
1186 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Blue");
1187 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Blue");
1188 GetInventory().CreateInInventory("Hatchback_02_Hood_Blue");
1189 GetInventory().CreateInInventory("Hatchback_02_Trunk_Blue");
1190
1191 //-----IN CAR CARGO
1192 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1193 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1194 }
1195}

◆ IsVitalTruckBattery()

override bool IsVitalTruckBattery ( )
protected
739{
743
744 void Hatchback_02()
745 {
746 //m_dmgContactCoef = 0.070;
747
748 m_EngineStartOK = "Hatchback_02_engine_start_SoundSet";
749 m_EngineStartBattery = "Hatchback_02_engine_failed_start_battery_SoundSet";
750 m_EngineStartPlug = "Hatchback_02_engine_failed_start_sparkplugs_SoundSet";
751 m_EngineStartFuel = "Hatchback_02_engine_failed_start_fuel_SoundSet";
752 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
753
754 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
755 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
756
757 m_CarHornShortSoundName = "Hatchback_02_Horn_Short_SoundSet";
758 m_CarHornLongSoundName = "Hatchback_02_Horn_SoundSet";
759
760 SetEnginePos("0 0.7 1.4");
761 }
762
763 override void EEInit()
764 {
765 super.EEInit();
766
767 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
768 {
770 m_UTSSettings.m_ManualUpdate = true;
771 m_UTSSettings.m_TemperatureMin = 0;
772 m_UTSSettings.m_TemperatureMax = 30;
774 m_UTSSettings.m_TemperatureCap = 0;
775 m_UTSSettings.m_RangeFull = 0.5;
776 m_UTSSettings.m_RangeMax = 2;
777
780 }
781 }
782
783 override void OnEngineStart()
784 {
785 super.OnEngineStart();
786
787 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
788 {
789 m_UTSource.SetDefferedActive(true, 20.0);
790 }
791 }
792
793 override void OnEngineStop()
794 {
795 super.OnEngineStop();
796
797 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
798 {
799 m_UTSource.SetDefferedActive(false, 10.0);
800 }
801 }
802
803 override void EOnPostSimulate(IEntity other, float timeSlice)
804 {
805 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
806 {
807 if (m_UTSource.IsActive())
808 {
810 }
811 }
812 }
813
814 override int GetAnimInstance()
815 {
816 return VehicleAnimInstances.GOLF;
817 }
818
819 override int GetSeatAnimationType(int posIdx)
820 {
821 switch (posIdx)
822 {
823 case 0:
824 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
825 case 1:
826 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
827 case 2:
828 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
829 case 3:
830 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
831 }
832
833 return 0;
834 }
835
836 // Override for car-specific light type
838 {
839 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02RearLight));
840 }
841
842 // Override for car-specific light type
844 {
845 return CarLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02FrontLight));
846 }
847
849 {
850 if (!super.CanReleaseAttachment(attachment))
851 {
852 return false;
853 }
854
855 if (EngineIsOn() || GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED)
856 {
857 string attType = attachment.GetType();
858 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
859 {
860 return false;
861 }
862 }
863
864 return true;
865 }
866
867 override protected bool CanManipulateSpareWheel(string slotSelectionName)
868 {
869 return GetCarDoorsState("Hatchback_02_Trunk") != CarDoorState.DOORS_CLOSED;
870 }
871
872 override bool CanDisplayAttachmentCategory( string category_name )
873 {
874 //super
875 if ( !super.CanDisplayAttachmentCategory( category_name ) )
876 return false;
877 //
878
879 category_name.ToLower();
880 if ( category_name.Contains("engine") )
881 {
882 if ( GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED )
883 return false;
884 }
885
886 return true;
887 }
888
889 override bool CanDisplayCargo()
890 {
891 if ( !super.CanDisplayCargo() )
892 return false;
893
894 if ( GetCarDoorsState("Hatchback_02_Trunk") == CarDoorState.DOORS_CLOSED )
895 return false;
896
897 return true;
898 }
899
900 override int GetCarDoorsState(string slotType)
901 {
903
904 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
905 if (!carDoor)
906 {
907 return CarDoorState.DOORS_MISSING;
908 }
909
910 switch (slotType)
911 {
912 case "Hatchback_02_Door_1_1":
913 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
914
915 case "Hatchback_02_Door_2_1":
916 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
917
918 case "Hatchback_02_Door_1_2":
919 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
920
921 case "Hatchback_02_Door_2_2":
922 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
923
924 case "Hatchback_02_Hood":
925 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
926
927 case "Hatchback_02_Trunk":
928 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
929 }
930
931 return CarDoorState.DOORS_MISSING;
932 }
933
934
935 override bool CrewCanGetThrough(int posIdx)
936 {
937 switch (posIdx)
938 {
939 case 0:
940 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
941 {
942 return false;
943 }
944
945 return true;
946
947 case 1:
948 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
949 {
950 return false;
951 }
952
953 return true;
954
955 case 2:
956 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
957 {
958 return false;
959 }
960
961 return true;
962
963 case 3:
964 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
965 {
966 return false;
967 }
968
969 return true;
970 }
971
972 return false;
973 }
974
975 override string GetDoorSelectionNameFromSeatPos(int posIdx)
976 {
977 switch( posIdx )
978 {
979 case 0:
980 return "doors_driver";
981 break;
982 case 1:
983 return "doors_codriver";
984 break;
985 case 2:
986 return "doors_cargo1";
987 break;
988 case 3:
989 return "doors_cargo2";
990 break;
991 }
992
993 return super.GetDoorSelectionNameFromSeatPos(posIdx);
994 }
995
996 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
997 {
998 switch( posIdx )
999 {
1000 case 0:
1001 return "Hatchback_02_Door_1_1";
1002 break;
1003 case 1:
1004 return "Hatchback_02_Door_2_1";
1005 break;
1006 case 2:
1007 return "Hatchback_02_Door_1_2";
1008 break;
1009 case 3:
1010 return "Hatchback_02_Door_2_2";
1011 break;
1012 }
1013
1014 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
1015 }
1016
1017 override float OnSound(CarSoundCtrl ctrl, float oldValue)
1018 {
1019 switch (ctrl)
1020 {
1021 case CarSoundCtrl.DOORS:
1022 float newValue = 0;
1023 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
1024 {
1025 newValue += 0.25;
1026 }
1027
1028 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
1029 {
1030 newValue += 0.25;
1031 }
1032
1033 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
1034 {
1035 newValue += 0.25;
1036 }
1037
1038 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
1039 {
1040 newValue += 0.25;
1041 }
1042
1043 return Math.Clamp(newValue, 0, 1);
1044 break;
1045 }
1046
1047 return super.OnSound(ctrl, oldValue);
1048 }
1049
1050 override string GetAnimSourceFromSelection( string selection )
1051 {
1052 switch( selection )
1053 {
1054 case "doors_driver":
1055 return "DoorsDriver";
1056 case "doors_codriver":
1057 return "DoorsCoDriver";
1058 case "doors_cargo1":
1059 return "DoorsCargo1";
1060 case "doors_cargo2":
1061 return "DoorsCargo2";
1062 case "doors_hood":
1063 return "DoorsHood";
1064 case "doors_trunk":
1065 return "DoorsTrunk";
1066 }
1067
1068 return "";
1069 }
1070
1071
1072 override bool IsVitalTruckBattery()
1073 {
1074 return false;
1075 }
1076
1077 override bool IsVitalGlowPlug()
1078 {
1079 return false;
1080 }
1081
1082 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
1083 {
1084 switch (currentSeat)
1085 {
1086 case 0:
1087 return nextSeat == 1;
1088 case 1:
1089 return nextSeat == 0;
1090 case 2:
1091 return nextSeat == 3;
1092 case 3:
1093 return nextSeat == 2;
1094 }
1095
1096 return false;
1097 }
1098
1099 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
1100 {
1101 switch (pCurrentSeat)
1102 {
1103 case 0:
1104 return pDoorsSelection == "DoorsDriver";
1105 case 1:
1106 return pDoorsSelection == "DoorsCoDriver";
1107 case 2:
1108 return pDoorsSelection == "DoorsCargo1";
1109 case 3:
1110 return pDoorsSelection == "DoorsCargo2";
1111 }
1112
1113 return false;
1114 }
1115
1116 override void OnDebugSpawn()
1117 {
1121
1122 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1123 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1124 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1125 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1126
1127 GetInventory().CreateInInventory("Hatchback_02_Door_1_1");
1128 GetInventory().CreateInInventory("Hatchback_02_Door_1_2");
1129 GetInventory().CreateInInventory("Hatchback_02_Door_2_1");
1130 GetInventory().CreateInInventory("Hatchback_02_Door_2_2");
1131 GetInventory().CreateInInventory("Hatchback_02_Hood");
1132 GetInventory().CreateInInventory("Hatchback_02_Trunk");
1133
1134 //-----IN CAR CARGO
1135 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1136 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1137 }
1138}
1139
1140class Hatchback_02_Black extends Hatchback_02
1141{
1142 override void OnDebugSpawn()
1143 {
1147
1148 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1149 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1150 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1151 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1152
1153 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Black");
1154 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Black");
1155 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Black");
1156 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Black");
1157 GetInventory().CreateInInventory("Hatchback_02_Hood_Black");
1158 GetInventory().CreateInInventory("Hatchback_02_Trunk_Black");
1159
1160 //-----IN CAR CARGO
1161 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1162 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1163 }
1164};
1165
1166class Hatchback_02_Blue extends Hatchback_02
1167{
1168 override void OnDebugSpawn()
1169 {
1173
1174 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1175 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1176 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1177 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1178
1179 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Blue");
1180 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Blue");
1181 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Blue");
1182 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Blue");
1183 GetInventory().CreateInInventory("Hatchback_02_Hood_Blue");
1184 GetInventory().CreateInInventory("Hatchback_02_Trunk_Blue");
1185
1186 //-----IN CAR CARGO
1187 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1188 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1189 }
1190}

◆ OnEngineStart()

override void OnEngineStart ( )
protected

◆ OnEngineStop()

override void OnEngineStop ( )
protected
460{
464
465 void Hatchback_02()
466 {
467 //m_dmgContactCoef = 0.070;
468
469 m_EngineStartOK = "Hatchback_02_engine_start_SoundSet";
470 m_EngineStartBattery = "Hatchback_02_engine_failed_start_battery_SoundSet";
471 m_EngineStartPlug = "Hatchback_02_engine_failed_start_sparkplugs_SoundSet";
472 m_EngineStartFuel = "Hatchback_02_engine_failed_start_fuel_SoundSet";
473 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
474
475 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
476 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
477
478 m_CarHornShortSoundName = "Hatchback_02_Horn_Short_SoundSet";
479 m_CarHornLongSoundName = "Hatchback_02_Horn_SoundSet";
480
481 SetEnginePos("0 0.7 1.4");
482 }
483
484 override void EEInit()
485 {
486 super.EEInit();
487
488 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
489 {
491 m_UTSSettings.m_ManualUpdate = true;
492 m_UTSSettings.m_TemperatureMin = 0;
493 m_UTSSettings.m_TemperatureMax = 30;
495 m_UTSSettings.m_TemperatureCap = 0;
496 m_UTSSettings.m_RangeFull = 0.5;
497 m_UTSSettings.m_RangeMax = 2;
498
501 }
502 }
503
504 override void OnEngineStart()
505 {
506 super.OnEngineStart();
507
508 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
509 {
510 m_UTSource.SetDefferedActive(true, 20.0);
511 }
512 }
513
514 override void OnEngineStop()
515 {
516 super.OnEngineStop();
517
518 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
519 {
520 m_UTSource.SetDefferedActive(false, 10.0);
521 }
522 }
523
524 override void EOnPostSimulate(IEntity other, float timeSlice)
525 {
526 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
527 {
528 if (m_UTSource.IsActive())
529 {
531 }
532 }
533 }
534
535 override int GetAnimInstance()
536 {
537 return VehicleAnimInstances.GOLF;
538 }
539
540 override int GetSeatAnimationType(int posIdx)
541 {
542 switch (posIdx)
543 {
544 case 0:
545 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
546 case 1:
547 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
548 case 2:
549 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
550 case 3:
551 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
552 }
553
554 return 0;
555 }
556
557 // Override for car-specific light type
559 {
560 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02RearLight));
561 }
562
563 // Override for car-specific light type
565 {
566 return CarLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02FrontLight));
567 }
568
570 {
571 if (!super.CanReleaseAttachment(attachment))
572 {
573 return false;
574 }
575
576 if (EngineIsOn() || GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED)
577 {
578 string attType = attachment.GetType();
579 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
580 {
581 return false;
582 }
583 }
584
585 return true;
586 }
587
588 override protected bool CanManipulateSpareWheel(string slotSelectionName)
589 {
590 return GetCarDoorsState("Hatchback_02_Trunk") != CarDoorState.DOORS_CLOSED;
591 }
592
593 override bool CanDisplayAttachmentCategory( string category_name )
594 {
595 //super
596 if ( !super.CanDisplayAttachmentCategory( category_name ) )
597 return false;
598 //
599
600 category_name.ToLower();
601 if ( category_name.Contains("engine") )
602 {
603 if ( GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED )
604 return false;
605 }
606
607 return true;
608 }
609
610 override bool CanDisplayCargo()
611 {
612 if ( !super.CanDisplayCargo() )
613 return false;
614
615 if ( GetCarDoorsState("Hatchback_02_Trunk") == CarDoorState.DOORS_CLOSED )
616 return false;
617
618 return true;
619 }
620
621 override int GetCarDoorsState(string slotType)
622 {
624
625 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
626 if (!carDoor)
627 {
628 return CarDoorState.DOORS_MISSING;
629 }
630
631 switch (slotType)
632 {
633 case "Hatchback_02_Door_1_1":
634 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
635
636 case "Hatchback_02_Door_2_1":
637 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
638
639 case "Hatchback_02_Door_1_2":
640 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
641
642 case "Hatchback_02_Door_2_2":
643 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
644
645 case "Hatchback_02_Hood":
646 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
647
648 case "Hatchback_02_Trunk":
649 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
650 }
651
652 return CarDoorState.DOORS_MISSING;
653 }
654
655
656 override bool CrewCanGetThrough(int posIdx)
657 {
658 switch (posIdx)
659 {
660 case 0:
661 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
662 {
663 return false;
664 }
665
666 return true;
667
668 case 1:
669 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
670 {
671 return false;
672 }
673
674 return true;
675
676 case 2:
677 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
678 {
679 return false;
680 }
681
682 return true;
683
684 case 3:
685 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
686 {
687 return false;
688 }
689
690 return true;
691 }
692
693 return false;
694 }
695
696 override string GetDoorSelectionNameFromSeatPos(int posIdx)
697 {
698 switch( posIdx )
699 {
700 case 0:
701 return "doors_driver";
702 break;
703 case 1:
704 return "doors_codriver";
705 break;
706 case 2:
707 return "doors_cargo1";
708 break;
709 case 3:
710 return "doors_cargo2";
711 break;
712 }
713
714 return super.GetDoorSelectionNameFromSeatPos(posIdx);
715 }
716
717 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
718 {
719 switch( posIdx )
720 {
721 case 0:
722 return "Hatchback_02_Door_1_1";
723 break;
724 case 1:
725 return "Hatchback_02_Door_2_1";
726 break;
727 case 2:
728 return "Hatchback_02_Door_1_2";
729 break;
730 case 3:
731 return "Hatchback_02_Door_2_2";
732 break;
733 }
734
735 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
736 }
737
738 override float OnSound(CarSoundCtrl ctrl, float oldValue)
739 {
740 switch (ctrl)
741 {
742 case CarSoundCtrl.DOORS:
743 float newValue = 0;
744 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
745 {
746 newValue += 0.25;
747 }
748
749 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
750 {
751 newValue += 0.25;
752 }
753
754 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
755 {
756 newValue += 0.25;
757 }
758
759 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
760 {
761 newValue += 0.25;
762 }
763
764 return Math.Clamp(newValue, 0, 1);
765 break;
766 }
767
768 return super.OnSound(ctrl, oldValue);
769 }
770
771 override string GetAnimSourceFromSelection( string selection )
772 {
773 switch( selection )
774 {
775 case "doors_driver":
776 return "DoorsDriver";
777 case "doors_codriver":
778 return "DoorsCoDriver";
779 case "doors_cargo1":
780 return "DoorsCargo1";
781 case "doors_cargo2":
782 return "DoorsCargo2";
783 case "doors_hood":
784 return "DoorsHood";
785 case "doors_trunk":
786 return "DoorsTrunk";
787 }
788
789 return "";
790 }
791
792
793 override bool IsVitalTruckBattery()
794 {
795 return false;
796 }
797
798 override bool IsVitalGlowPlug()
799 {
800 return false;
801 }
802
803 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
804 {
805 switch (currentSeat)
806 {
807 case 0:
808 return nextSeat == 1;
809 case 1:
810 return nextSeat == 0;
811 case 2:
812 return nextSeat == 3;
813 case 3:
814 return nextSeat == 2;
815 }
816
817 return false;
818 }
819
820 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
821 {
822 switch (pCurrentSeat)
823 {
824 case 0:
825 return pDoorsSelection == "DoorsDriver";
826 case 1:
827 return pDoorsSelection == "DoorsCoDriver";
828 case 2:
829 return pDoorsSelection == "DoorsCargo1";
830 case 3:
831 return pDoorsSelection == "DoorsCargo2";
832 }
833
834 return false;
835 }
836
837 override void OnDebugSpawn()
838 {
842
843 GetInventory().CreateInInventory("Hatchback_02_Wheel");
844 GetInventory().CreateInInventory("Hatchback_02_Wheel");
845 GetInventory().CreateInInventory("Hatchback_02_Wheel");
846 GetInventory().CreateInInventory("Hatchback_02_Wheel");
847
848 GetInventory().CreateInInventory("Hatchback_02_Door_1_1");
849 GetInventory().CreateInInventory("Hatchback_02_Door_1_2");
850 GetInventory().CreateInInventory("Hatchback_02_Door_2_1");
851 GetInventory().CreateInInventory("Hatchback_02_Door_2_2");
852 GetInventory().CreateInInventory("Hatchback_02_Hood");
853 GetInventory().CreateInInventory("Hatchback_02_Trunk");
854
855 //-----IN CAR CARGO
856 GetInventory().CreateInInventory("Hatchback_02_Wheel");
857 GetInventory().CreateInInventory("Hatchback_02_Wheel");
858 }
859}
860
862{
863 override void OnDebugSpawn()
864 {
868
869 GetInventory().CreateInInventory("Hatchback_02_Wheel");
870 GetInventory().CreateInInventory("Hatchback_02_Wheel");
871 GetInventory().CreateInInventory("Hatchback_02_Wheel");
872 GetInventory().CreateInInventory("Hatchback_02_Wheel");
873
874 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Black");
875 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Black");
876 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Black");
877 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Black");
878 GetInventory().CreateInInventory("Hatchback_02_Hood_Black");
879 GetInventory().CreateInInventory("Hatchback_02_Trunk_Black");
880
881 //-----IN CAR CARGO
882 GetInventory().CreateInInventory("Hatchback_02_Wheel");
883 GetInventory().CreateInInventory("Hatchback_02_Wheel");
884 }
885};
886
888{
889 override void OnDebugSpawn()
890 {
894
895 GetInventory().CreateInInventory("Hatchback_02_Wheel");
896 GetInventory().CreateInInventory("Hatchback_02_Wheel");
897 GetInventory().CreateInInventory("Hatchback_02_Wheel");
898 GetInventory().CreateInInventory("Hatchback_02_Wheel");
899
900 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Blue");
901 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Blue");
902 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Blue");
903 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Blue");
904 GetInventory().CreateInInventory("Hatchback_02_Hood_Blue");
905 GetInventory().CreateInInventory("Hatchback_02_Trunk_Blue");
906
907 //-----IN CAR CARGO
908 GetInventory().CreateInInventory("Hatchback_02_Wheel");
909 GetInventory().CreateInInventory("Hatchback_02_Wheel");
910 }
911}

◆ OnSound()

override float OnSound ( CarSoundCtrl ctrl,
float oldValue )
protected
684{
688
689 void Hatchback_02()
690 {
691 //m_dmgContactCoef = 0.070;
692
693 m_EngineStartOK = "Hatchback_02_engine_start_SoundSet";
694 m_EngineStartBattery = "Hatchback_02_engine_failed_start_battery_SoundSet";
695 m_EngineStartPlug = "Hatchback_02_engine_failed_start_sparkplugs_SoundSet";
696 m_EngineStartFuel = "Hatchback_02_engine_failed_start_fuel_SoundSet";
697 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
698
699 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
700 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
701
702 m_CarHornShortSoundName = "Hatchback_02_Horn_Short_SoundSet";
703 m_CarHornLongSoundName = "Hatchback_02_Horn_SoundSet";
704
705 SetEnginePos("0 0.7 1.4");
706 }
707
708 override void EEInit()
709 {
710 super.EEInit();
711
712 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
713 {
715 m_UTSSettings.m_ManualUpdate = true;
716 m_UTSSettings.m_TemperatureMin = 0;
717 m_UTSSettings.m_TemperatureMax = 30;
719 m_UTSSettings.m_TemperatureCap = 0;
720 m_UTSSettings.m_RangeFull = 0.5;
721 m_UTSSettings.m_RangeMax = 2;
722
725 }
726 }
727
728 override void OnEngineStart()
729 {
730 super.OnEngineStart();
731
732 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
733 {
734 m_UTSource.SetDefferedActive(true, 20.0);
735 }
736 }
737
738 override void OnEngineStop()
739 {
740 super.OnEngineStop();
741
742 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
743 {
744 m_UTSource.SetDefferedActive(false, 10.0);
745 }
746 }
747
748 override void EOnPostSimulate(IEntity other, float timeSlice)
749 {
750 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
751 {
752 if (m_UTSource.IsActive())
753 {
755 }
756 }
757 }
758
759 override int GetAnimInstance()
760 {
761 return VehicleAnimInstances.GOLF;
762 }
763
764 override int GetSeatAnimationType(int posIdx)
765 {
766 switch (posIdx)
767 {
768 case 0:
769 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
770 case 1:
771 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
772 case 2:
773 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
774 case 3:
775 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
776 }
777
778 return 0;
779 }
780
781 // Override for car-specific light type
783 {
784 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02RearLight));
785 }
786
787 // Override for car-specific light type
789 {
790 return CarLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02FrontLight));
791 }
792
794 {
795 if (!super.CanReleaseAttachment(attachment))
796 {
797 return false;
798 }
799
800 if (EngineIsOn() || GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED)
801 {
802 string attType = attachment.GetType();
803 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
804 {
805 return false;
806 }
807 }
808
809 return true;
810 }
811
812 override protected bool CanManipulateSpareWheel(string slotSelectionName)
813 {
814 return GetCarDoorsState("Hatchback_02_Trunk") != CarDoorState.DOORS_CLOSED;
815 }
816
817 override bool CanDisplayAttachmentCategory( string category_name )
818 {
819 //super
820 if ( !super.CanDisplayAttachmentCategory( category_name ) )
821 return false;
822 //
823
824 category_name.ToLower();
825 if ( category_name.Contains("engine") )
826 {
827 if ( GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED )
828 return false;
829 }
830
831 return true;
832 }
833
834 override bool CanDisplayCargo()
835 {
836 if ( !super.CanDisplayCargo() )
837 return false;
838
839 if ( GetCarDoorsState("Hatchback_02_Trunk") == CarDoorState.DOORS_CLOSED )
840 return false;
841
842 return true;
843 }
844
845 override int GetCarDoorsState(string slotType)
846 {
848
849 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
850 if (!carDoor)
851 {
852 return CarDoorState.DOORS_MISSING;
853 }
854
855 switch (slotType)
856 {
857 case "Hatchback_02_Door_1_1":
858 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
859
860 case "Hatchback_02_Door_2_1":
861 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
862
863 case "Hatchback_02_Door_1_2":
864 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
865
866 case "Hatchback_02_Door_2_2":
867 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
868
869 case "Hatchback_02_Hood":
870 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
871
872 case "Hatchback_02_Trunk":
873 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
874 }
875
876 return CarDoorState.DOORS_MISSING;
877 }
878
879
880 override bool CrewCanGetThrough(int posIdx)
881 {
882 switch (posIdx)
883 {
884 case 0:
885 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
886 {
887 return false;
888 }
889
890 return true;
891
892 case 1:
893 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
894 {
895 return false;
896 }
897
898 return true;
899
900 case 2:
901 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
902 {
903 return false;
904 }
905
906 return true;
907
908 case 3:
909 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
910 {
911 return false;
912 }
913
914 return true;
915 }
916
917 return false;
918 }
919
920 override string GetDoorSelectionNameFromSeatPos(int posIdx)
921 {
922 switch( posIdx )
923 {
924 case 0:
925 return "doors_driver";
926 break;
927 case 1:
928 return "doors_codriver";
929 break;
930 case 2:
931 return "doors_cargo1";
932 break;
933 case 3:
934 return "doors_cargo2";
935 break;
936 }
937
938 return super.GetDoorSelectionNameFromSeatPos(posIdx);
939 }
940
941 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
942 {
943 switch( posIdx )
944 {
945 case 0:
946 return "Hatchback_02_Door_1_1";
947 break;
948 case 1:
949 return "Hatchback_02_Door_2_1";
950 break;
951 case 2:
952 return "Hatchback_02_Door_1_2";
953 break;
954 case 3:
955 return "Hatchback_02_Door_2_2";
956 break;
957 }
958
959 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
960 }
961
962 override float OnSound(CarSoundCtrl ctrl, float oldValue)
963 {
964 switch (ctrl)
965 {
966 case CarSoundCtrl.DOORS:
967 float newValue = 0;
968 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
969 {
970 newValue += 0.25;
971 }
972
973 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
974 {
975 newValue += 0.25;
976 }
977
978 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
979 {
980 newValue += 0.25;
981 }
982
983 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
984 {
985 newValue += 0.25;
986 }
987
988 return Math.Clamp(newValue, 0, 1);
989 break;
990 }
991
992 return super.OnSound(ctrl, oldValue);
993 }
994
995 override string GetAnimSourceFromSelection( string selection )
996 {
997 switch( selection )
998 {
999 case "doors_driver":
1000 return "DoorsDriver";
1001 case "doors_codriver":
1002 return "DoorsCoDriver";
1003 case "doors_cargo1":
1004 return "DoorsCargo1";
1005 case "doors_cargo2":
1006 return "DoorsCargo2";
1007 case "doors_hood":
1008 return "DoorsHood";
1009 case "doors_trunk":
1010 return "DoorsTrunk";
1011 }
1012
1013 return "";
1014 }
1015
1016
1017 override bool IsVitalTruckBattery()
1018 {
1019 return false;
1020 }
1021
1022 override bool IsVitalGlowPlug()
1023 {
1024 return false;
1025 }
1026
1027 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
1028 {
1029 switch (currentSeat)
1030 {
1031 case 0:
1032 return nextSeat == 1;
1033 case 1:
1034 return nextSeat == 0;
1035 case 2:
1036 return nextSeat == 3;
1037 case 3:
1038 return nextSeat == 2;
1039 }
1040
1041 return false;
1042 }
1043
1044 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
1045 {
1046 switch (pCurrentSeat)
1047 {
1048 case 0:
1049 return pDoorsSelection == "DoorsDriver";
1050 case 1:
1051 return pDoorsSelection == "DoorsCoDriver";
1052 case 2:
1053 return pDoorsSelection == "DoorsCargo1";
1054 case 3:
1055 return pDoorsSelection == "DoorsCargo2";
1056 }
1057
1058 return false;
1059 }
1060
1061 override void OnDebugSpawn()
1062 {
1066
1067 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1068 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1069 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1070 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1071
1072 GetInventory().CreateInInventory("Hatchback_02_Door_1_1");
1073 GetInventory().CreateInInventory("Hatchback_02_Door_1_2");
1074 GetInventory().CreateInInventory("Hatchback_02_Door_2_1");
1075 GetInventory().CreateInInventory("Hatchback_02_Door_2_2");
1076 GetInventory().CreateInInventory("Hatchback_02_Hood");
1077 GetInventory().CreateInInventory("Hatchback_02_Trunk");
1078
1079 //-----IN CAR CARGO
1080 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1081 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1082 }
1083}
1084
1085class Hatchback_02_Black extends Hatchback_02
1086{
1087 override void OnDebugSpawn()
1088 {
1092
1093 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1094 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1095 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1096 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1097
1098 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Black");
1099 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Black");
1100 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Black");
1101 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Black");
1102 GetInventory().CreateInInventory("Hatchback_02_Hood_Black");
1103 GetInventory().CreateInInventory("Hatchback_02_Trunk_Black");
1104
1105 //-----IN CAR CARGO
1106 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1107 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1108 }
1109};
1110
1111class Hatchback_02_Blue extends Hatchback_02
1112{
1113 override void OnDebugSpawn()
1114 {
1118
1119 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1120 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1121 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1122 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1123
1124 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Blue");
1125 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Blue");
1126 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Blue");
1127 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Blue");
1128 GetInventory().CreateInInventory("Hatchback_02_Hood_Blue");
1129 GetInventory().CreateInInventory("Hatchback_02_Trunk_Blue");
1130
1131 //-----IN CAR CARGO
1132 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1133 GetInventory().CreateInInventory("Hatchback_02_Wheel");
1134 }
1135}

Переменные

◆ m_UTSLEngine

Используется в CarScript::EEInit() и CarScript::EOnPostSimulate().

◆ m_UTSource

◆ m_UTSSettings

ref UniversalTemperatureSourceSettings m_UTSSettings
protected

Используется в CarScript::EEInit() и CarScript::EOnPostSimulate().

◆ OnDebugSpawn

override void OnDebugSpawn
406 {
410
411 GetInventory().CreateInInventory("Hatchback_02_Wheel");
412 GetInventory().CreateInInventory("Hatchback_02_Wheel");
413 GetInventory().CreateInInventory("Hatchback_02_Wheel");
414 GetInventory().CreateInInventory("Hatchback_02_Wheel");
415
416 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Black");
417 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Black");
418 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Black");
419 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Black");
420 GetInventory().CreateInInventory("Hatchback_02_Hood_Black");
421 GetInventory().CreateInInventory("Hatchback_02_Trunk_Black");
422
423 //-----IN CAR CARGO
424 GetInventory().CreateInInventory("Hatchback_02_Wheel");
425 GetInventory().CreateInInventory("Hatchback_02_Wheel");
426 }

Используется в Entity::OnDebugSpawnEx().