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

◆ CanReachDoorsFromSeat()

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

◆ CanReachSeatFromSeat()

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

◆ CanReleaseAttachment()

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

◆ CreateFrontLight()

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

◆ CreateRearLight()

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

◆ CrewCanGetThrough()

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

◆ EEInit()

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

◆ EOnPostSimulate()

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

◆ GetAnimInstance()

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

◆ GetAnimSourceFromSelection()

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

◆ GetCarDoorsState()

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

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

◆ GetDoorInvSlotNameFromSeatPos()

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

◆ GetDoorSelectionNameFromSeatPos()

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

◆ GetSeatAnimationType()

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

◆ Hatchback_02()

void Hatchback_02 ( )
protected

◆ IsVitalGlowPlug()

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

◆ IsVitalTruckBattery()

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

◆ OnEngineStart()

override void OnEngineStart ( )
protected

◆ OnEngineStop()

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

◆ OnSound()

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

Переменные

◆ m_UTSLEngine

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

◆ m_UTSource

◆ m_UTSSettings

ref UniversalTemperatureSourceSettings m_UTSSettings
protected

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

◆ OnDebugSpawn

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

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