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

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

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

class  CarScript
 
class  Sedan_02
 

Функции

class Sedan_02 extends CarScript OnDebugSpawn ()
 
void Sedan_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 CarLightBase CreateFrontLight ()
 
override CarRearLightBase CreateRearLight ()
 
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
 

Функции

◆ CanDisplayAttachmentCategory()

override bool CanDisplayAttachmentCategory ( string category_name)
protected

◆ CanDisplayCargo()

override bool CanDisplayCargo ( )
protected
611{
615
616 void Sedan_02()
617 {
618 m_dmgContactCoef = 0.0790;
619
620 m_EngineStartOK = "Sedan_02_engine_start_SoundSet";
621 m_EngineStartBattery = "Sedan_02_engine_failed_start_battery_SoundSet";
622 m_EngineStartPlug = "Sedan_02_engine_failed_start_sparkplugs_SoundSet";
623 m_EngineStartFuel = "Sedan_02_engine_failed_start_fuel_SoundSet";
624 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
625
626 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
627 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
628
629 m_CarHornShortSoundName = "Sedan_02_Horn_Short_SoundSet";
630 m_CarHornLongSoundName = "Sedan_02_Horn_SoundSet";
631
632 SetEnginePos("0 0.7 -1.7");
633 }
634
635 override void EEInit()
636 {
637 super.EEInit();
638
639 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
640 {
642 m_UTSSettings.m_ManualUpdate = true;
643 m_UTSSettings.m_TemperatureMin = 0;
644 m_UTSSettings.m_TemperatureMax = 30;
646 m_UTSSettings.m_TemperatureCap = 0;
647 m_UTSSettings.m_RangeFull = 0.5;
648 m_UTSSettings.m_RangeMax = 2;
649
652 }
653 }
654
655 override void OnEngineStart()
656 {
657 super.OnEngineStart();
658
659 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
660 {
661 m_UTSource.SetDefferedActive(true, 20.0);
662 }
663 }
664
665 override void OnEngineStop()
666 {
667 super.OnEngineStop();
668
669 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
670 {
671 m_UTSource.SetDefferedActive(false, 10.0);
672 }
673 }
674
675 override void EOnPostSimulate(IEntity other, float timeSlice)
676 {
677 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
678 {
679 if (m_UTSource.IsActive())
680 {
682 }
683 }
684 }
685
686 override int GetAnimInstance()
687 {
688 return VehicleAnimInstances.S120;
689 }
690
691 override int GetSeatAnimationType(int posIdx)
692 {
693 switch (posIdx)
694 {
695 case 0:
696 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
697 case 1:
698 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
699 case 2:
700 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
701 case 3:
702 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
703 }
704
705 return 0;
706 }
707
708 // Override for car-specific light type
710 {
711 return CarLightBase.Cast(ScriptedLightBase.CreateLight(Sedan_02FrontLight));
712 }
713
714 // Override for car-specific light type
716 {
717 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(Sedan_02RearLight));
718 }
719
721 {
722 if (!super.CanReleaseAttachment(attachment))
723 {
724 return false;
725 }
726
727 string attType = attachment.GetType();
728 switch (attType)
729 {
730 case "CarBattery":
731 if (GetCarDoorsState("Sedan_02_Trunk") == CarDoorState.DOORS_CLOSED || EngineIsOn())
732 {
733 return false;
734 }
735 break;
736
737 case "SparkPlug":
738 if (GetCarDoorsState("Sedan_02_Trunk") == CarDoorState.DOORS_CLOSED || EngineIsOn())
739 {
740 return false;
741 }
742 break;
743
744 case "CarRadiator":
745 if (GetCarDoorsState("Sedan_02_Hood") == CarDoorState.DOORS_CLOSED || EngineIsOn())
746 {
747 return false;
748 }
749 break;
750 }
751
752 return true;
753 }
754
755 override protected bool CanManipulateSpareWheel(string slotSelectionName)
756 {
757 return GetCarDoorsState("Sedan_02_Hood") != CarDoorState.DOORS_CLOSED;
758 }
759
760 override bool CanDisplayAttachmentCategory(string category_name)
761 {
762 if ( !super.CanDisplayAttachmentCategory(category_name))
763 {
764 return false;
765 }
766
767 category_name.ToLower();
768 if (category_name.Contains("engine"))
769 {
770 if (GetCarDoorsState("Sedan_02_Trunk") == CarDoorState.DOORS_CLOSED)
771 {
772 return false;
773 }
774 }
775
776 if (category_name.Contains("trunk"))
777 {
778 if (GetCarDoorsState("Sedan_02_Hood") == CarDoorState.DOORS_CLOSED)
779 {
780 return false;
781 }
782 }
783
784 return true;
785 }
786
787 override bool CanDisplayCargo()
788 {
789 if ( !super.CanDisplayCargo() )
790 return false;
791
792 if ( GetCarDoorsState("Sedan_02_Hood") == CarDoorState.DOORS_CLOSED )
793 return false;
794
795 return true;
796 }
797
798 override int GetCarDoorsState(string slotType)
799 {
801
802 Class.CastTo( carDoor, FindAttachmentBySlotName( slotType ) );
803 if (!carDoor)
804 {
805 return CarDoorState.DOORS_MISSING;
806 }
807
808 switch (slotType)
809 {
810 case "Sedan_02_Door_1_1":
811 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
812
813 case "Sedan_02_Door_2_1":
814 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
815
816 case "Sedan_02_Door_1_2":
817 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
818
819 case "Sedan_02_Door_2_2":
820 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
821
822 case "Sedan_02_Hood":
823 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
824
825 case "Sedan_02_Trunk":
826 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
827 }
828
829 return CarDoorState.DOORS_MISSING;
830 }
831
832
833 override bool CrewCanGetThrough( int posIdx )
834 {
835 switch( posIdx )
836 {
837 case 0:
838 if ( GetCarDoorsState("Sedan_02_Door_1_1") == CarDoorState.DOORS_CLOSED )
839 return false;
840
841 return true;
842 break;
843
844 case 1:
845 if ( GetCarDoorsState("Sedan_02_Door_2_1") == CarDoorState.DOORS_CLOSED )
846 return false;
847
848 return true;
849 break;
850
851 case 2:
852 if ( GetCarDoorsState("Sedan_02_Door_1_2") == CarDoorState.DOORS_CLOSED )
853 return false;
854
855 return true;
856 break;
857
858 case 3:
859 if ( GetCarDoorsState("Sedan_02_Door_2_2") == CarDoorState.DOORS_CLOSED )
860 return false;
861
862 return true;
863 break;
864 }
865
866 return false;
867 }
868
869 override string GetDoorSelectionNameFromSeatPos(int posIdx)
870 {
871 switch( posIdx )
872 {
873 case 0:
874 return "doors_driver";
875 break;
876 case 1:
877 return "doors_codriver";
878 break;
879 case 2:
880 return "doors_cargo1";
881 break;
882 case 3:
883 return "doors_cargo2";
884 break;
885 }
886
887 return super.GetDoorSelectionNameFromSeatPos(posIdx);
888 }
889
890 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
891 {
892 switch( posIdx )
893 {
894 case 0:
895 return "Sedan_02_Door_1_1";
896 break;
897 case 1:
898 return "Sedan_02_Door_2_1";
899 break;
900 case 2:
901 return "Sedan_02_Door_1_2";
902 break;
903 case 3:
904 return "Sedan_02_Door_2_2";
905 break;
906 }
907
908 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
909 }
910
911 override float OnSound(CarSoundCtrl ctrl, float oldValue)
912 {
913 switch ( ctrl )
914 {
915 case CarSoundCtrl.DOORS:
916 float newValue = 0;
917 if (GetCarDoorsState("Sedan_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
918 {
919 newValue += 0.25;
920 }
921
922 if (GetCarDoorsState("Sedan_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
923 {
924 newValue += 0.25;
925 }
926
927 if (GetCarDoorsState("Sedan_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
928 {
929 newValue += 0.25;
930 }
931
932 if (GetCarDoorsState("Sedan_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
933 {
934 newValue += 0.25;
935 }
936
937 return Math.Clamp(newValue, 0, 1);
938 break;
939 }
940
941 return super.OnSound(ctrl, oldValue);
942 }
943
944 override string GetAnimSourceFromSelection( string selection )
945 {
946 switch( selection )
947 {
948 case "doors_driver":
949 return "DoorsDriver";
950 case "doors_codriver":
951 return "DoorsCoDriver";
952 case "doors_cargo1":
953 return "DoorsCargo1";
954 case "doors_cargo2":
955 return "DoorsCargo2";
956 case "doors_hood":
957 return "DoorsHood";
958 case "doors_trunk":
959 return "DoorsTrunk";
960 }
961
962 return "";
963 }
964
965
966 override bool IsVitalTruckBattery()
967 {
968 return false;
969 }
970
971 override bool IsVitalGlowPlug()
972 {
973 return false;
974 }
975
976 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
977 {
978 switch (currentSeat)
979 {
980 case 0:
981 return nextSeat == 1;
982
983 case 1:
984 return nextSeat == 0;
985
986 case 2:
987 return nextSeat == 3;
988
989 case 3:
990 return nextSeat == 2;
991 }
992
993 return false;
994 }
995
996 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
997 {
998 switch (pCurrentSeat)
999 {
1000 case 0:
1001 return pDoorsSelection == "DoorsDriver";
1002
1003 case 1:
1004 return pDoorsSelection == "DoorsCoDriver";
1005
1006 case 2:
1007 return pDoorsSelection == "DoorsCargo1";
1008
1009 case 3:
1010 return pDoorsSelection == "DoorsCargo2";
1011 }
1012
1013 return false;
1014 }
1015
1016 override void OnDebugSpawn()
1017 {
1021
1022 GetInventory().CreateInInventory("Sedan_02_Wheel");
1023 GetInventory().CreateInInventory("Sedan_02_Wheel");
1024 GetInventory().CreateInInventory("Sedan_02_Wheel");
1025 GetInventory().CreateInInventory("Sedan_02_Wheel");
1026 GetInventory().CreateInInventory("Sedan_02_Wheel");
1027
1028 GetInventory().CreateInInventory("Sedan_02_Door_1_1");
1029 GetInventory().CreateInInventory("Sedan_02_Door_1_2");
1030 GetInventory().CreateInInventory("Sedan_02_Door_2_1");
1031 GetInventory().CreateInInventory("Sedan_02_Door_2_2");
1032 GetInventory().CreateInInventory("Sedan_02_Hood");
1033 GetInventory().CreateInInventory("Sedan_02_Trunk");
1034
1035 //-----IN CAR CARGO
1036 GetInventory().CreateInInventory("Sedan_02_Wheel");
1037 GetInventory().CreateInInventory("Sedan_02_Wheel");
1038 }
1039}
1040
1041class Sedan_02_Red extends Sedan_02
1042{
1043 override void OnDebugSpawn()
1044 {
1048
1049 GetInventory().CreateInInventory("Sedan_02_Wheel");
1050 GetInventory().CreateInInventory("Sedan_02_Wheel");
1051 GetInventory().CreateInInventory("Sedan_02_Wheel");
1052 GetInventory().CreateInInventory("Sedan_02_Wheel");
1053
1054 GetInventory().CreateInInventory("Sedan_02_Door_1_1_Red");
1055 GetInventory().CreateInInventory("Sedan_02_Door_1_2_Red");
1056 GetInventory().CreateInInventory("Sedan_02_Door_2_1_Red");
1057 GetInventory().CreateInInventory("Sedan_02_Door_2_2_Red");
1058 GetInventory().CreateInInventory("Sedan_02_Hood_Red");
1059 GetInventory().CreateInInventory("Sedan_02_Trunk_Red");
1060
1061 //-----IN CAR CARGO
1062 GetInventory().CreateInInventory("Sedan_02_Wheel");
1063 GetInventory().CreateInInventory("Sedan_02_Wheel");
1064 }
1065}
1066
1067class Sedan_02_Grey extends Sedan_02
1068{
1069 override void OnDebugSpawn()
1070 {
1074
1075 GetInventory().CreateInInventory("Sedan_02_Wheel");
1076 GetInventory().CreateInInventory("Sedan_02_Wheel");
1077 GetInventory().CreateInInventory("Sedan_02_Wheel");
1078 GetInventory().CreateInInventory("Sedan_02_Wheel");
1079
1080 GetInventory().CreateInInventory("Sedan_02_Door_1_1_Grey");
1081 GetInventory().CreateInInventory("Sedan_02_Door_1_2_Grey");
1082 GetInventory().CreateInInventory("Sedan_02_Door_2_1_Grey");
1083 GetInventory().CreateInInventory("Sedan_02_Door_2_2_Grey");
1084 GetInventory().CreateInInventory("Sedan_02_Hood_Grey");
1085 GetInventory().CreateInInventory("Sedan_02_Trunk_Grey");
1086
1087 //-----IN CAR CARGO
1088 GetInventory().CreateInInventory("Sedan_02_Wheel");
1089 GetInventory().CreateInInventory("Sedan_02_Wheel");
1090 }
1091}
CarSoundCtrl
Car's sound controller list. (native, do not change or extend)
Definition Car.c:4
void SpawnUniversalParts()
Definition CarScript.c:2761
CarDoorState TranslateAnimationPhaseToCarDoorState(string animation)
Definition CarScript.c:2474
CarDoorState
Definition CarScript.c:2
void SpawnAdditionalItems()
Definition CarScript.c:2799
string m_EngineStartOK
Sounds.
Definition CarScript.c:207
string m_CarDoorCloseSound
Definition CarScript.c:214
string m_EngineStartBattery
Definition CarScript.c:208
string m_EngineStartPlug
Definition CarScript.c:209
string m_EngineStartFuel
Definition CarScript.c:210
string m_CarHornShortSoundName
Definition CarScript.c:218
void FillUpCarFluids()
Definition CarScript.c:2829
string m_CarHornLongSoundName
Definition CarScript.c:219
string m_EngineStopFuel
Definition CarScript.c:211
float m_dmgContactCoef
Definition CarScript.c:161
string m_CarDoorOpenSound
Definition CarScript.c:213
class Hatchback_02_Blue extends Hatchback_02 OnDebugSpawn
Definition Hatchback_02.c:405
override int GetCarDoorsState(string slotType)
Definition Sedan_02.c:621
override bool CanDisplayAttachmentCategory(string category_name)
Definition Sedan_02.c:583
override void EOnPostSimulate(IEntity other, float timeSlice)
Definition Sedan_02.c:498
ref UniversalTemperatureSourceSettings m_UTSSettings
Definition Sedan_02.c:436
override bool IsVitalGlowPlug()
Definition Sedan_02.c:794
class Sedan_02 extends CarScript OnDebugSpawn()
Definition Sedan_02.c:434
override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
Definition Sedan_02.c:819
override bool CanDisplayCargo()
Definition Sedan_02.c:610
override int GetAnimInstance()
Definition Sedan_02.c:509
override bool CrewCanGetThrough(int posIdx)
Definition Sedan_02.c:656
override CarLightBase CreateFrontLight()
Definition Sedan_02.c:532
override CarRearLightBase CreateRearLight()
Definition Sedan_02.c:538
override void EEInit()
Definition Sedan_02.c:458
void Sedan_02()
Definition Sedan_02.c:439
ref UniversalTemperatureSourceLambdaEngine m_UTSLEngine
Definition Sedan_02.c:437
override float OnSound(CarSoundCtrl ctrl, float oldValue)
Definition Sedan_02.c:734
override bool IsVitalTruckBattery()
Definition Sedan_02.c:789
override bool CanReleaseAttachment(EntityAI attachment)
Definition Sedan_02.c:543
override void OnEngineStart()
Definition Sedan_02.c:478
override string GetAnimSourceFromSelection(string selection)
Definition Sedan_02.c:767
override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
Definition Sedan_02.c:799
override string GetDoorSelectionNameFromSeatPos(int posIdx)
Definition Sedan_02.c:692
override int GetSeatAnimationType(int posIdx)
Definition Sedan_02.c:514
ref UniversalTemperatureSource m_UTSource
Definition Sedan_02.c:435
override string GetDoorInvSlotNameFromSeatPos(int posIdx)
Definition Sedan_02.c:713
bool CanManipulateSpareWheel(string slotSelectionName)
Definition Sedan_02.c:578
override void OnEngineStop()
Definition Sedan_02.c:488
UniversalTemperatureSourceLambdaBaseImpl UniversalTemperatureSourceLambdaBase UniversalTemperatureSourceLambdaEngine()
Definition UniversalTemperatureSourceLambdaBaseImpl.c:175
VehicleAnimInstances
Definition VehicleAnimInstances.c:2
Definition InventoryItem.c:496
Definition CarRearLightBase.c:2
Definition CivilianSedanRearLight.c:2
Super root of all classes in Enforce script.
Definition EnScript.c:11
Definition Building.c:6
Definition constants.c:638
Definition EnEntity.c:165
Definition EnMath.c:7
Definition EntityAI.c:95
Definition PointLightBase.c:2
Definition Sedan_02.c:459
original Timer deletes m_params which is unwanted
Definition UniversalTemperatureSource.c:28
Definition UniversalTemperatureSource.c:2
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
Definition constants.c:777
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.

◆ CanManipulateSpareWheel()

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

◆ CanReachDoorsFromSeat()

override bool CanReachDoorsFromSeat ( string pDoorsSelection,
int pCurrentSeat )
protected
820{
824
825 void Sedan_02()
826 {
827 m_dmgContactCoef = 0.0790;
828
829 m_EngineStartOK = "Sedan_02_engine_start_SoundSet";
830 m_EngineStartBattery = "Sedan_02_engine_failed_start_battery_SoundSet";
831 m_EngineStartPlug = "Sedan_02_engine_failed_start_sparkplugs_SoundSet";
832 m_EngineStartFuel = "Sedan_02_engine_failed_start_fuel_SoundSet";
833 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
834
835 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
836 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
837
838 m_CarHornShortSoundName = "Sedan_02_Horn_Short_SoundSet";
839 m_CarHornLongSoundName = "Sedan_02_Horn_SoundSet";
840
841 SetEnginePos("0 0.7 -1.7");
842 }
843
844 override void EEInit()
845 {
846 super.EEInit();
847
848 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
849 {
851 m_UTSSettings.m_ManualUpdate = true;
852 m_UTSSettings.m_TemperatureMin = 0;
853 m_UTSSettings.m_TemperatureMax = 30;
855 m_UTSSettings.m_TemperatureCap = 0;
856 m_UTSSettings.m_RangeFull = 0.5;
857 m_UTSSettings.m_RangeMax = 2;
858
861 }
862 }
863
864 override void OnEngineStart()
865 {
866 super.OnEngineStart();
867
868 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
869 {
870 m_UTSource.SetDefferedActive(true, 20.0);
871 }
872 }
873
874 override void OnEngineStop()
875 {
876 super.OnEngineStop();
877
878 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
879 {
880 m_UTSource.SetDefferedActive(false, 10.0);
881 }
882 }
883
884 override void EOnPostSimulate(IEntity other, float timeSlice)
885 {
886 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
887 {
888 if (m_UTSource.IsActive())
889 {
891 }
892 }
893 }
894
895 override int GetAnimInstance()
896 {
897 return VehicleAnimInstances.S120;
898 }
899
900 override int GetSeatAnimationType(int posIdx)
901 {
902 switch (posIdx)
903 {
904 case 0:
905 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
906 case 1:
907 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
908 case 2:
909 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
910 case 3:
911 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
912 }
913
914 return 0;
915 }
916
917 // Override for car-specific light type
919 {
920 return CarLightBase.Cast(ScriptedLightBase.CreateLight(Sedan_02FrontLight));
921 }
922
923 // Override for car-specific light type
925 {
926 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(Sedan_02RearLight));
927 }
928
930 {
931 if (!super.CanReleaseAttachment(attachment))
932 {
933 return false;
934 }
935
936 string attType = attachment.GetType();
937 switch (attType)
938 {
939 case "CarBattery":
940 if (GetCarDoorsState("Sedan_02_Trunk") == CarDoorState.DOORS_CLOSED || EngineIsOn())
941 {
942 return false;
943 }
944 break;
945
946 case "SparkPlug":
947 if (GetCarDoorsState("Sedan_02_Trunk") == CarDoorState.DOORS_CLOSED || EngineIsOn())
948 {
949 return false;
950 }
951 break;
952
953 case "CarRadiator":
954 if (GetCarDoorsState("Sedan_02_Hood") == CarDoorState.DOORS_CLOSED || EngineIsOn())
955 {
956 return false;
957 }
958 break;
959 }
960
961 return true;
962 }
963
964 override protected bool CanManipulateSpareWheel(string slotSelectionName)
965 {
966 return GetCarDoorsState("Sedan_02_Hood") != CarDoorState.DOORS_CLOSED;
967 }
968
969 override bool CanDisplayAttachmentCategory(string category_name)
970 {
971 if ( !super.CanDisplayAttachmentCategory(category_name))
972 {
973 return false;
974 }
975
976 category_name.ToLower();
977 if (category_name.Contains("engine"))
978 {
979 if (GetCarDoorsState("Sedan_02_Trunk") == CarDoorState.DOORS_CLOSED)
980 {
981 return false;
982 }
983 }
984
985 if (category_name.Contains("trunk"))
986 {
987 if (GetCarDoorsState("Sedan_02_Hood") == CarDoorState.DOORS_CLOSED)
988 {
989 return false;
990 }
991 }
992
993 return true;
994 }
995
996 override bool CanDisplayCargo()
997 {
998 if ( !super.CanDisplayCargo() )
999 return false;
1000
1001 if ( GetCarDoorsState("Sedan_02_Hood") == CarDoorState.DOORS_CLOSED )
1002 return false;
1003
1004 return true;
1005 }
1006
1007 override int GetCarDoorsState(string slotType)
1008 {
1010
1011 Class.CastTo( carDoor, FindAttachmentBySlotName( slotType ) );
1012 if (!carDoor)
1013 {
1014 return CarDoorState.DOORS_MISSING;
1015 }
1016
1017 switch (slotType)
1018 {
1019 case "Sedan_02_Door_1_1":
1020 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
1021
1022 case "Sedan_02_Door_2_1":
1023 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
1024
1025 case "Sedan_02_Door_1_2":
1026 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
1027
1028 case "Sedan_02_Door_2_2":
1029 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
1030
1031 case "Sedan_02_Hood":
1032 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
1033
1034 case "Sedan_02_Trunk":
1035 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
1036 }
1037
1038 return CarDoorState.DOORS_MISSING;
1039 }
1040
1041
1042 override bool CrewCanGetThrough( int posIdx )
1043 {
1044 switch( posIdx )
1045 {
1046 case 0:
1047 if ( GetCarDoorsState("Sedan_02_Door_1_1") == CarDoorState.DOORS_CLOSED )
1048 return false;
1049
1050 return true;
1051 break;
1052
1053 case 1:
1054 if ( GetCarDoorsState("Sedan_02_Door_2_1") == CarDoorState.DOORS_CLOSED )
1055 return false;
1056
1057 return true;
1058 break;
1059
1060 case 2:
1061 if ( GetCarDoorsState("Sedan_02_Door_1_2") == CarDoorState.DOORS_CLOSED )
1062 return false;
1063
1064 return true;
1065 break;
1066
1067 case 3:
1068 if ( GetCarDoorsState("Sedan_02_Door_2_2") == CarDoorState.DOORS_CLOSED )
1069 return false;
1070
1071 return true;
1072 break;
1073 }
1074
1075 return false;
1076 }
1077
1078 override string GetDoorSelectionNameFromSeatPos(int posIdx)
1079 {
1080 switch( posIdx )
1081 {
1082 case 0:
1083 return "doors_driver";
1084 break;
1085 case 1:
1086 return "doors_codriver";
1087 break;
1088 case 2:
1089 return "doors_cargo1";
1090 break;
1091 case 3:
1092 return "doors_cargo2";
1093 break;
1094 }
1095
1096 return super.GetDoorSelectionNameFromSeatPos(posIdx);
1097 }
1098
1099 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
1100 {
1101 switch( posIdx )
1102 {
1103 case 0:
1104 return "Sedan_02_Door_1_1";
1105 break;
1106 case 1:
1107 return "Sedan_02_Door_2_1";
1108 break;
1109 case 2:
1110 return "Sedan_02_Door_1_2";
1111 break;
1112 case 3:
1113 return "Sedan_02_Door_2_2";
1114 break;
1115 }
1116
1117 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
1118 }
1119
1120 override float OnSound(CarSoundCtrl ctrl, float oldValue)
1121 {
1122 switch ( ctrl )
1123 {
1124 case CarSoundCtrl.DOORS:
1125 float newValue = 0;
1126 if (GetCarDoorsState("Sedan_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
1127 {
1128 newValue += 0.25;
1129 }
1130
1131 if (GetCarDoorsState("Sedan_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
1132 {
1133 newValue += 0.25;
1134 }
1135
1136 if (GetCarDoorsState("Sedan_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
1137 {
1138 newValue += 0.25;
1139 }
1140
1141 if (GetCarDoorsState("Sedan_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
1142 {
1143 newValue += 0.25;
1144 }
1145
1146 return Math.Clamp(newValue, 0, 1);
1147 break;
1148 }
1149
1150 return super.OnSound(ctrl, oldValue);
1151 }
1152
1153 override string GetAnimSourceFromSelection( string selection )
1154 {
1155 switch( selection )
1156 {
1157 case "doors_driver":
1158 return "DoorsDriver";
1159 case "doors_codriver":
1160 return "DoorsCoDriver";
1161 case "doors_cargo1":
1162 return "DoorsCargo1";
1163 case "doors_cargo2":
1164 return "DoorsCargo2";
1165 case "doors_hood":
1166 return "DoorsHood";
1167 case "doors_trunk":
1168 return "DoorsTrunk";
1169 }
1170
1171 return "";
1172 }
1173
1174
1175 override bool IsVitalTruckBattery()
1176 {
1177 return false;
1178 }
1179
1180 override bool IsVitalGlowPlug()
1181 {
1182 return false;
1183 }
1184
1185 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
1186 {
1187 switch (currentSeat)
1188 {
1189 case 0:
1190 return nextSeat == 1;
1191
1192 case 1:
1193 return nextSeat == 0;
1194
1195 case 2:
1196 return nextSeat == 3;
1197
1198 case 3:
1199 return nextSeat == 2;
1200 }
1201
1202 return false;
1203 }
1204
1205 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
1206 {
1207 switch (pCurrentSeat)
1208 {
1209 case 0:
1210 return pDoorsSelection == "DoorsDriver";
1211
1212 case 1:
1213 return pDoorsSelection == "DoorsCoDriver";
1214
1215 case 2:
1216 return pDoorsSelection == "DoorsCargo1";
1217
1218 case 3:
1219 return pDoorsSelection == "DoorsCargo2";
1220 }
1221
1222 return false;
1223 }
1224
1225 override void OnDebugSpawn()
1226 {
1230
1231 GetInventory().CreateInInventory("Sedan_02_Wheel");
1232 GetInventory().CreateInInventory("Sedan_02_Wheel");
1233 GetInventory().CreateInInventory("Sedan_02_Wheel");
1234 GetInventory().CreateInInventory("Sedan_02_Wheel");
1235 GetInventory().CreateInInventory("Sedan_02_Wheel");
1236
1237 GetInventory().CreateInInventory("Sedan_02_Door_1_1");
1238 GetInventory().CreateInInventory("Sedan_02_Door_1_2");
1239 GetInventory().CreateInInventory("Sedan_02_Door_2_1");
1240 GetInventory().CreateInInventory("Sedan_02_Door_2_2");
1241 GetInventory().CreateInInventory("Sedan_02_Hood");
1242 GetInventory().CreateInInventory("Sedan_02_Trunk");
1243
1244 //-----IN CAR CARGO
1245 GetInventory().CreateInInventory("Sedan_02_Wheel");
1246 GetInventory().CreateInInventory("Sedan_02_Wheel");
1247 }
1248}
1249
1250class Sedan_02_Red extends Sedan_02
1251{
1252 override void OnDebugSpawn()
1253 {
1257
1258 GetInventory().CreateInInventory("Sedan_02_Wheel");
1259 GetInventory().CreateInInventory("Sedan_02_Wheel");
1260 GetInventory().CreateInInventory("Sedan_02_Wheel");
1261 GetInventory().CreateInInventory("Sedan_02_Wheel");
1262
1263 GetInventory().CreateInInventory("Sedan_02_Door_1_1_Red");
1264 GetInventory().CreateInInventory("Sedan_02_Door_1_2_Red");
1265 GetInventory().CreateInInventory("Sedan_02_Door_2_1_Red");
1266 GetInventory().CreateInInventory("Sedan_02_Door_2_2_Red");
1267 GetInventory().CreateInInventory("Sedan_02_Hood_Red");
1268 GetInventory().CreateInInventory("Sedan_02_Trunk_Red");
1269
1270 //-----IN CAR CARGO
1271 GetInventory().CreateInInventory("Sedan_02_Wheel");
1272 GetInventory().CreateInInventory("Sedan_02_Wheel");
1273 }
1274}
1275
1276class Sedan_02_Grey extends Sedan_02
1277{
1278 override void OnDebugSpawn()
1279 {
1283
1284 GetInventory().CreateInInventory("Sedan_02_Wheel");
1285 GetInventory().CreateInInventory("Sedan_02_Wheel");
1286 GetInventory().CreateInInventory("Sedan_02_Wheel");
1287 GetInventory().CreateInInventory("Sedan_02_Wheel");
1288
1289 GetInventory().CreateInInventory("Sedan_02_Door_1_1_Grey");
1290 GetInventory().CreateInInventory("Sedan_02_Door_1_2_Grey");
1291 GetInventory().CreateInInventory("Sedan_02_Door_2_1_Grey");
1292 GetInventory().CreateInInventory("Sedan_02_Door_2_2_Grey");
1293 GetInventory().CreateInInventory("Sedan_02_Hood_Grey");
1294 GetInventory().CreateInInventory("Sedan_02_Trunk_Grey");
1295
1296 //-----IN CAR CARGO
1297 GetInventory().CreateInInventory("Sedan_02_Wheel");
1298 GetInventory().CreateInInventory("Sedan_02_Wheel");
1299 }
1300}

◆ CanReachSeatFromSeat()

override bool CanReachSeatFromSeat ( int currentSeat,
int nextSeat )
protected
800{
804
805 void Sedan_02()
806 {
807 m_dmgContactCoef = 0.0790;
808
809 m_EngineStartOK = "Sedan_02_engine_start_SoundSet";
810 m_EngineStartBattery = "Sedan_02_engine_failed_start_battery_SoundSet";
811 m_EngineStartPlug = "Sedan_02_engine_failed_start_sparkplugs_SoundSet";
812 m_EngineStartFuel = "Sedan_02_engine_failed_start_fuel_SoundSet";
813 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
814
815 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
816 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
817
818 m_CarHornShortSoundName = "Sedan_02_Horn_Short_SoundSet";
819 m_CarHornLongSoundName = "Sedan_02_Horn_SoundSet";
820
821 SetEnginePos("0 0.7 -1.7");
822 }
823
824 override void EEInit()
825 {
826 super.EEInit();
827
828 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
829 {
831 m_UTSSettings.m_ManualUpdate = true;
832 m_UTSSettings.m_TemperatureMin = 0;
833 m_UTSSettings.m_TemperatureMax = 30;
835 m_UTSSettings.m_TemperatureCap = 0;
836 m_UTSSettings.m_RangeFull = 0.5;
837 m_UTSSettings.m_RangeMax = 2;
838
841 }
842 }
843
844 override void OnEngineStart()
845 {
846 super.OnEngineStart();
847
848 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
849 {
850 m_UTSource.SetDefferedActive(true, 20.0);
851 }
852 }
853
854 override void OnEngineStop()
855 {
856 super.OnEngineStop();
857
858 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
859 {
860 m_UTSource.SetDefferedActive(false, 10.0);
861 }
862 }
863
864 override void EOnPostSimulate(IEntity other, float timeSlice)
865 {
866 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
867 {
868 if (m_UTSource.IsActive())
869 {
871 }
872 }
873 }
874
875 override int GetAnimInstance()
876 {
877 return VehicleAnimInstances.S120;
878 }
879
880 override int GetSeatAnimationType(int posIdx)
881 {
882 switch (posIdx)
883 {
884 case 0:
885 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
886 case 1:
887 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
888 case 2:
889 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
890 case 3:
891 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
892 }
893
894 return 0;
895 }
896
897 // Override for car-specific light type
899 {
900 return CarLightBase.Cast(ScriptedLightBase.CreateLight(Sedan_02FrontLight));
901 }
902
903 // Override for car-specific light type
905 {
906 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(Sedan_02RearLight));
907 }
908
910 {
911 if (!super.CanReleaseAttachment(attachment))
912 {
913 return false;
914 }
915
916 string attType = attachment.GetType();
917 switch (attType)
918 {
919 case "CarBattery":
920 if (GetCarDoorsState("Sedan_02_Trunk") == CarDoorState.DOORS_CLOSED || EngineIsOn())
921 {
922 return false;
923 }
924 break;
925
926 case "SparkPlug":
927 if (GetCarDoorsState("Sedan_02_Trunk") == CarDoorState.DOORS_CLOSED || EngineIsOn())
928 {
929 return false;
930 }
931 break;
932
933 case "CarRadiator":
934 if (GetCarDoorsState("Sedan_02_Hood") == CarDoorState.DOORS_CLOSED || EngineIsOn())
935 {
936 return false;
937 }
938 break;
939 }
940
941 return true;
942 }
943
944 override protected bool CanManipulateSpareWheel(string slotSelectionName)
945 {
946 return GetCarDoorsState("Sedan_02_Hood") != CarDoorState.DOORS_CLOSED;
947 }
948
949 override bool CanDisplayAttachmentCategory(string category_name)
950 {
951 if ( !super.CanDisplayAttachmentCategory(category_name))
952 {
953 return false;
954 }
955
956 category_name.ToLower();
957 if (category_name.Contains("engine"))
958 {
959 if (GetCarDoorsState("Sedan_02_Trunk") == CarDoorState.DOORS_CLOSED)
960 {
961 return false;
962 }
963 }
964
965 if (category_name.Contains("trunk"))
966 {
967 if (GetCarDoorsState("Sedan_02_Hood") == CarDoorState.DOORS_CLOSED)
968 {
969 return false;
970 }
971 }
972
973 return true;
974 }
975
976 override bool CanDisplayCargo()
977 {
978 if ( !super.CanDisplayCargo() )
979 return false;
980
981 if ( GetCarDoorsState("Sedan_02_Hood") == CarDoorState.DOORS_CLOSED )
982 return false;
983
984 return true;
985 }
986
987 override int GetCarDoorsState(string slotType)
988 {
990
991 Class.CastTo( carDoor, FindAttachmentBySlotName( slotType ) );
992 if (!carDoor)
993 {
994 return CarDoorState.DOORS_MISSING;
995 }
996
997 switch (slotType)
998 {
999 case "Sedan_02_Door_1_1":
1000 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
1001
1002 case "Sedan_02_Door_2_1":
1003 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
1004
1005 case "Sedan_02_Door_1_2":
1006 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
1007
1008 case "Sedan_02_Door_2_2":
1009 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
1010
1011 case "Sedan_02_Hood":
1012 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
1013
1014 case "Sedan_02_Trunk":
1015 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
1016 }
1017
1018 return CarDoorState.DOORS_MISSING;
1019 }
1020
1021
1022 override bool CrewCanGetThrough( int posIdx )
1023 {
1024 switch( posIdx )
1025 {
1026 case 0:
1027 if ( GetCarDoorsState("Sedan_02_Door_1_1") == CarDoorState.DOORS_CLOSED )
1028 return false;
1029
1030 return true;
1031 break;
1032
1033 case 1:
1034 if ( GetCarDoorsState("Sedan_02_Door_2_1") == CarDoorState.DOORS_CLOSED )
1035 return false;
1036
1037 return true;
1038 break;
1039
1040 case 2:
1041 if ( GetCarDoorsState("Sedan_02_Door_1_2") == CarDoorState.DOORS_CLOSED )
1042 return false;
1043
1044 return true;
1045 break;
1046
1047 case 3:
1048 if ( GetCarDoorsState("Sedan_02_Door_2_2") == CarDoorState.DOORS_CLOSED )
1049 return false;
1050
1051 return true;
1052 break;
1053 }
1054
1055 return false;
1056 }
1057
1058 override string GetDoorSelectionNameFromSeatPos(int posIdx)
1059 {
1060 switch( posIdx )
1061 {
1062 case 0:
1063 return "doors_driver";
1064 break;
1065 case 1:
1066 return "doors_codriver";
1067 break;
1068 case 2:
1069 return "doors_cargo1";
1070 break;
1071 case 3:
1072 return "doors_cargo2";
1073 break;
1074 }
1075
1076 return super.GetDoorSelectionNameFromSeatPos(posIdx);
1077 }
1078
1079 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
1080 {
1081 switch( posIdx )
1082 {
1083 case 0:
1084 return "Sedan_02_Door_1_1";
1085 break;
1086 case 1:
1087 return "Sedan_02_Door_2_1";
1088 break;
1089 case 2:
1090 return "Sedan_02_Door_1_2";
1091 break;
1092 case 3:
1093 return "Sedan_02_Door_2_2";
1094 break;
1095 }
1096
1097 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
1098 }
1099
1100 override float OnSound(CarSoundCtrl ctrl, float oldValue)
1101 {
1102 switch ( ctrl )
1103 {
1104 case CarSoundCtrl.DOORS:
1105 float newValue = 0;
1106 if (GetCarDoorsState("Sedan_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
1107 {
1108 newValue += 0.25;
1109 }
1110
1111 if (GetCarDoorsState("Sedan_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
1112 {
1113 newValue += 0.25;
1114 }
1115
1116 if (GetCarDoorsState("Sedan_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
1117 {
1118 newValue += 0.25;
1119 }
1120
1121 if (GetCarDoorsState("Sedan_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
1122 {
1123 newValue += 0.25;
1124 }
1125
1126 return Math.Clamp(newValue, 0, 1);
1127 break;
1128 }
1129
1130 return super.OnSound(ctrl, oldValue);
1131 }
1132
1133 override string GetAnimSourceFromSelection( string selection )
1134 {
1135 switch( selection )
1136 {
1137 case "doors_driver":
1138 return "DoorsDriver";
1139 case "doors_codriver":
1140 return "DoorsCoDriver";
1141 case "doors_cargo1":
1142 return "DoorsCargo1";
1143 case "doors_cargo2":
1144 return "DoorsCargo2";
1145 case "doors_hood":
1146 return "DoorsHood";
1147 case "doors_trunk":
1148 return "DoorsTrunk";
1149 }
1150
1151 return "";
1152 }
1153
1154
1155 override bool IsVitalTruckBattery()
1156 {
1157 return false;
1158 }
1159
1160 override bool IsVitalGlowPlug()
1161 {
1162 return false;
1163 }
1164
1165 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
1166 {
1167 switch (currentSeat)
1168 {
1169 case 0:
1170 return nextSeat == 1;
1171
1172 case 1:
1173 return nextSeat == 0;
1174
1175 case 2:
1176 return nextSeat == 3;
1177
1178 case 3:
1179 return nextSeat == 2;
1180 }
1181
1182 return false;
1183 }
1184
1185 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
1186 {
1187 switch (pCurrentSeat)
1188 {
1189 case 0:
1190 return pDoorsSelection == "DoorsDriver";
1191
1192 case 1:
1193 return pDoorsSelection == "DoorsCoDriver";
1194
1195 case 2:
1196 return pDoorsSelection == "DoorsCargo1";
1197
1198 case 3:
1199 return pDoorsSelection == "DoorsCargo2";
1200 }
1201
1202 return false;
1203 }
1204
1205 override void OnDebugSpawn()
1206 {
1210
1211 GetInventory().CreateInInventory("Sedan_02_Wheel");
1212 GetInventory().CreateInInventory("Sedan_02_Wheel");
1213 GetInventory().CreateInInventory("Sedan_02_Wheel");
1214 GetInventory().CreateInInventory("Sedan_02_Wheel");
1215 GetInventory().CreateInInventory("Sedan_02_Wheel");
1216
1217 GetInventory().CreateInInventory("Sedan_02_Door_1_1");
1218 GetInventory().CreateInInventory("Sedan_02_Door_1_2");
1219 GetInventory().CreateInInventory("Sedan_02_Door_2_1");
1220 GetInventory().CreateInInventory("Sedan_02_Door_2_2");
1221 GetInventory().CreateInInventory("Sedan_02_Hood");
1222 GetInventory().CreateInInventory("Sedan_02_Trunk");
1223
1224 //-----IN CAR CARGO
1225 GetInventory().CreateInInventory("Sedan_02_Wheel");
1226 GetInventory().CreateInInventory("Sedan_02_Wheel");
1227 }
1228}
1229
1230class Sedan_02_Red extends Sedan_02
1231{
1232 override void OnDebugSpawn()
1233 {
1237
1238 GetInventory().CreateInInventory("Sedan_02_Wheel");
1239 GetInventory().CreateInInventory("Sedan_02_Wheel");
1240 GetInventory().CreateInInventory("Sedan_02_Wheel");
1241 GetInventory().CreateInInventory("Sedan_02_Wheel");
1242
1243 GetInventory().CreateInInventory("Sedan_02_Door_1_1_Red");
1244 GetInventory().CreateInInventory("Sedan_02_Door_1_2_Red");
1245 GetInventory().CreateInInventory("Sedan_02_Door_2_1_Red");
1246 GetInventory().CreateInInventory("Sedan_02_Door_2_2_Red");
1247 GetInventory().CreateInInventory("Sedan_02_Hood_Red");
1248 GetInventory().CreateInInventory("Sedan_02_Trunk_Red");
1249
1250 //-----IN CAR CARGO
1251 GetInventory().CreateInInventory("Sedan_02_Wheel");
1252 GetInventory().CreateInInventory("Sedan_02_Wheel");
1253 }
1254}
1255
1256class Sedan_02_Grey extends Sedan_02
1257{
1258 override void OnDebugSpawn()
1259 {
1263
1264 GetInventory().CreateInInventory("Sedan_02_Wheel");
1265 GetInventory().CreateInInventory("Sedan_02_Wheel");
1266 GetInventory().CreateInInventory("Sedan_02_Wheel");
1267 GetInventory().CreateInInventory("Sedan_02_Wheel");
1268
1269 GetInventory().CreateInInventory("Sedan_02_Door_1_1_Grey");
1270 GetInventory().CreateInInventory("Sedan_02_Door_1_2_Grey");
1271 GetInventory().CreateInInventory("Sedan_02_Door_2_1_Grey");
1272 GetInventory().CreateInInventory("Sedan_02_Door_2_2_Grey");
1273 GetInventory().CreateInInventory("Sedan_02_Hood_Grey");
1274 GetInventory().CreateInInventory("Sedan_02_Trunk_Grey");
1275
1276 //-----IN CAR CARGO
1277 GetInventory().CreateInInventory("Sedan_02_Wheel");
1278 GetInventory().CreateInInventory("Sedan_02_Wheel");
1279 }
1280}

◆ CanReleaseAttachment()

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

◆ CreateFrontLight()

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

◆ CreateRearLight()

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

◆ CrewCanGetThrough()

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

◆ EEInit()

override void EEInit ( )
protected
459{
460 override void OnDebugSpawn()
461 {
465
466 GetInventory().CreateInInventory("Sedan_02_Wheel");
467 GetInventory().CreateInInventory("Sedan_02_Wheel");
468 GetInventory().CreateInInventory("Sedan_02_Wheel");
469 GetInventory().CreateInInventory("Sedan_02_Wheel");
470
471 GetInventory().CreateInInventory("Sedan_02_Door_1_1_Grey");
472 GetInventory().CreateInInventory("Sedan_02_Door_1_2_Grey");
473 GetInventory().CreateInInventory("Sedan_02_Door_2_1_Grey");
474 GetInventory().CreateInInventory("Sedan_02_Door_2_2_Grey");
475 GetInventory().CreateInInventory("Sedan_02_Hood_Grey");
476 GetInventory().CreateInInventory("Sedan_02_Trunk_Grey");

◆ EOnPostSimulate()

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

◆ GetAnimInstance()

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

◆ GetAnimSourceFromSelection()

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

◆ GetCarDoorsState()

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

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

◆ GetDoorInvSlotNameFromSeatPos()

override string GetDoorInvSlotNameFromSeatPos ( int posIdx)
protected
714{
718
719 void Sedan_02()
720 {
721 m_dmgContactCoef = 0.0790;
722
723 m_EngineStartOK = "Sedan_02_engine_start_SoundSet";
724 m_EngineStartBattery = "Sedan_02_engine_failed_start_battery_SoundSet";
725 m_EngineStartPlug = "Sedan_02_engine_failed_start_sparkplugs_SoundSet";
726 m_EngineStartFuel = "Sedan_02_engine_failed_start_fuel_SoundSet";
727 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
728
729 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
730 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
731
732 m_CarHornShortSoundName = "Sedan_02_Horn_Short_SoundSet";
733 m_CarHornLongSoundName = "Sedan_02_Horn_SoundSet";
734
735 SetEnginePos("0 0.7 -1.7");
736 }
737
738 override void EEInit()
739 {
740 super.EEInit();
741
742 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
743 {
745 m_UTSSettings.m_ManualUpdate = true;
746 m_UTSSettings.m_TemperatureMin = 0;
747 m_UTSSettings.m_TemperatureMax = 30;
749 m_UTSSettings.m_TemperatureCap = 0;
750 m_UTSSettings.m_RangeFull = 0.5;
751 m_UTSSettings.m_RangeMax = 2;
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.S120;
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 CarLightBase.Cast(ScriptedLightBase.CreateLight(Sedan_02FrontLight));
815 }
816
817 // Override for car-specific light type
819 {
820 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(Sedan_02RearLight));
821 }
822
824 {
825 if (!super.CanReleaseAttachment(attachment))
826 {
827 return false;
828 }
829
830 string attType = attachment.GetType();
831 switch (attType)
832 {
833 case "CarBattery":
834 if (GetCarDoorsState("Sedan_02_Trunk") == CarDoorState.DOORS_CLOSED || EngineIsOn())
835 {
836 return false;
837 }
838 break;
839
840 case "SparkPlug":
841 if (GetCarDoorsState("Sedan_02_Trunk") == CarDoorState.DOORS_CLOSED || EngineIsOn())
842 {
843 return false;
844 }
845 break;
846
847 case "CarRadiator":
848 if (GetCarDoorsState("Sedan_02_Hood") == CarDoorState.DOORS_CLOSED || EngineIsOn())
849 {
850 return false;
851 }
852 break;
853 }
854
855 return true;
856 }
857
858 override protected bool CanManipulateSpareWheel(string slotSelectionName)
859 {
860 return GetCarDoorsState("Sedan_02_Hood") != CarDoorState.DOORS_CLOSED;
861 }
862
863 override bool CanDisplayAttachmentCategory(string category_name)
864 {
865 if ( !super.CanDisplayAttachmentCategory(category_name))
866 {
867 return false;
868 }
869
870 category_name.ToLower();
871 if (category_name.Contains("engine"))
872 {
873 if (GetCarDoorsState("Sedan_02_Trunk") == CarDoorState.DOORS_CLOSED)
874 {
875 return false;
876 }
877 }
878
879 if (category_name.Contains("trunk"))
880 {
881 if (GetCarDoorsState("Sedan_02_Hood") == CarDoorState.DOORS_CLOSED)
882 {
883 return false;
884 }
885 }
886
887 return true;
888 }
889
890 override bool CanDisplayCargo()
891 {
892 if ( !super.CanDisplayCargo() )
893 return false;
894
895 if ( GetCarDoorsState("Sedan_02_Hood") == CarDoorState.DOORS_CLOSED )
896 return false;
897
898 return true;
899 }
900
901 override int GetCarDoorsState(string slotType)
902 {
904
905 Class.CastTo( carDoor, FindAttachmentBySlotName( slotType ) );
906 if (!carDoor)
907 {
908 return CarDoorState.DOORS_MISSING;
909 }
910
911 switch (slotType)
912 {
913 case "Sedan_02_Door_1_1":
914 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
915
916 case "Sedan_02_Door_2_1":
917 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
918
919 case "Sedan_02_Door_1_2":
920 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
921
922 case "Sedan_02_Door_2_2":
923 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
924
925 case "Sedan_02_Hood":
926 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
927
928 case "Sedan_02_Trunk":
929 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
930 }
931
932 return CarDoorState.DOORS_MISSING;
933 }
934
935
936 override bool CrewCanGetThrough( int posIdx )
937 {
938 switch( posIdx )
939 {
940 case 0:
941 if ( GetCarDoorsState("Sedan_02_Door_1_1") == CarDoorState.DOORS_CLOSED )
942 return false;
943
944 return true;
945 break;
946
947 case 1:
948 if ( GetCarDoorsState("Sedan_02_Door_2_1") == CarDoorState.DOORS_CLOSED )
949 return false;
950
951 return true;
952 break;
953
954 case 2:
955 if ( GetCarDoorsState("Sedan_02_Door_1_2") == CarDoorState.DOORS_CLOSED )
956 return false;
957
958 return true;
959 break;
960
961 case 3:
962 if ( GetCarDoorsState("Sedan_02_Door_2_2") == CarDoorState.DOORS_CLOSED )
963 return false;
964
965 return true;
966 break;
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 "Sedan_02_Door_1_1";
999 break;
1000 case 1:
1001 return "Sedan_02_Door_2_1";
1002 break;
1003 case 2:
1004 return "Sedan_02_Door_1_2";
1005 break;
1006 case 3:
1007 return "Sedan_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("Sedan_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
1021 {
1022 newValue += 0.25;
1023 }
1024
1025 if (GetCarDoorsState("Sedan_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
1026 {
1027 newValue += 0.25;
1028 }
1029
1030 if (GetCarDoorsState("Sedan_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
1031 {
1032 newValue += 0.25;
1033 }
1034
1035 if (GetCarDoorsState("Sedan_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
1086 case 1:
1087 return nextSeat == 0;
1088
1089 case 2:
1090 return nextSeat == 3;
1091
1092 case 3:
1093 return nextSeat == 2;
1094 }
1095
1096 return false;
1097 }
1098
1099 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
1100 {
1101 switch (pCurrentSeat)
1102 {
1103 case 0:
1104 return pDoorsSelection == "DoorsDriver";
1105
1106 case 1:
1107 return pDoorsSelection == "DoorsCoDriver";
1108
1109 case 2:
1110 return pDoorsSelection == "DoorsCargo1";
1111
1112 case 3:
1113 return pDoorsSelection == "DoorsCargo2";
1114 }
1115
1116 return false;
1117 }
1118
1119 override void OnDebugSpawn()
1120 {
1124
1125 GetInventory().CreateInInventory("Sedan_02_Wheel");
1126 GetInventory().CreateInInventory("Sedan_02_Wheel");
1127 GetInventory().CreateInInventory("Sedan_02_Wheel");
1128 GetInventory().CreateInInventory("Sedan_02_Wheel");
1129 GetInventory().CreateInInventory("Sedan_02_Wheel");
1130
1131 GetInventory().CreateInInventory("Sedan_02_Door_1_1");
1132 GetInventory().CreateInInventory("Sedan_02_Door_1_2");
1133 GetInventory().CreateInInventory("Sedan_02_Door_2_1");
1134 GetInventory().CreateInInventory("Sedan_02_Door_2_2");
1135 GetInventory().CreateInInventory("Sedan_02_Hood");
1136 GetInventory().CreateInInventory("Sedan_02_Trunk");
1137
1138 //-----IN CAR CARGO
1139 GetInventory().CreateInInventory("Sedan_02_Wheel");
1140 GetInventory().CreateInInventory("Sedan_02_Wheel");
1141 }
1142}
1143
1144class Sedan_02_Red extends Sedan_02
1145{
1146 override void OnDebugSpawn()
1147 {
1151
1152 GetInventory().CreateInInventory("Sedan_02_Wheel");
1153 GetInventory().CreateInInventory("Sedan_02_Wheel");
1154 GetInventory().CreateInInventory("Sedan_02_Wheel");
1155 GetInventory().CreateInInventory("Sedan_02_Wheel");
1156
1157 GetInventory().CreateInInventory("Sedan_02_Door_1_1_Red");
1158 GetInventory().CreateInInventory("Sedan_02_Door_1_2_Red");
1159 GetInventory().CreateInInventory("Sedan_02_Door_2_1_Red");
1160 GetInventory().CreateInInventory("Sedan_02_Door_2_2_Red");
1161 GetInventory().CreateInInventory("Sedan_02_Hood_Red");
1162 GetInventory().CreateInInventory("Sedan_02_Trunk_Red");
1163
1164 //-----IN CAR CARGO
1165 GetInventory().CreateInInventory("Sedan_02_Wheel");
1166 GetInventory().CreateInInventory("Sedan_02_Wheel");
1167 }
1168}
1169
1170class Sedan_02_Grey extends Sedan_02
1171{
1172 override void OnDebugSpawn()
1173 {
1177
1178 GetInventory().CreateInInventory("Sedan_02_Wheel");
1179 GetInventory().CreateInInventory("Sedan_02_Wheel");
1180 GetInventory().CreateInInventory("Sedan_02_Wheel");
1181 GetInventory().CreateInInventory("Sedan_02_Wheel");
1182
1183 GetInventory().CreateInInventory("Sedan_02_Door_1_1_Grey");
1184 GetInventory().CreateInInventory("Sedan_02_Door_1_2_Grey");
1185 GetInventory().CreateInInventory("Sedan_02_Door_2_1_Grey");
1186 GetInventory().CreateInInventory("Sedan_02_Door_2_2_Grey");
1187 GetInventory().CreateInInventory("Sedan_02_Hood_Grey");
1188 GetInventory().CreateInInventory("Sedan_02_Trunk_Grey");
1189
1190 //-----IN CAR CARGO
1191 GetInventory().CreateInInventory("Sedan_02_Wheel");
1192 GetInventory().CreateInInventory("Sedan_02_Wheel");
1193 }
1194}

◆ GetDoorSelectionNameFromSeatPos()

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

◆ GetSeatAnimationType()

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

◆ IsVitalGlowPlug()

override bool IsVitalGlowPlug ( )
protected
795{
799
800 void Sedan_02()
801 {
802 m_dmgContactCoef = 0.0790;
803
804 m_EngineStartOK = "Sedan_02_engine_start_SoundSet";
805 m_EngineStartBattery = "Sedan_02_engine_failed_start_battery_SoundSet";
806 m_EngineStartPlug = "Sedan_02_engine_failed_start_sparkplugs_SoundSet";
807 m_EngineStartFuel = "Sedan_02_engine_failed_start_fuel_SoundSet";
808 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
809
810 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
811 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
812
813 m_CarHornShortSoundName = "Sedan_02_Horn_Short_SoundSet";
814 m_CarHornLongSoundName = "Sedan_02_Horn_SoundSet";
815
816 SetEnginePos("0 0.7 -1.7");
817 }
818
819 override void EEInit()
820 {
821 super.EEInit();
822
823 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
824 {
826 m_UTSSettings.m_ManualUpdate = true;
827 m_UTSSettings.m_TemperatureMin = 0;
828 m_UTSSettings.m_TemperatureMax = 30;
830 m_UTSSettings.m_TemperatureCap = 0;
831 m_UTSSettings.m_RangeFull = 0.5;
832 m_UTSSettings.m_RangeMax = 2;
833
836 }
837 }
838
839 override void OnEngineStart()
840 {
841 super.OnEngineStart();
842
843 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
844 {
845 m_UTSource.SetDefferedActive(true, 20.0);
846 }
847 }
848
849 override void OnEngineStop()
850 {
851 super.OnEngineStop();
852
853 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
854 {
855 m_UTSource.SetDefferedActive(false, 10.0);
856 }
857 }
858
859 override void EOnPostSimulate(IEntity other, float timeSlice)
860 {
861 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
862 {
863 if (m_UTSource.IsActive())
864 {
866 }
867 }
868 }
869
870 override int GetAnimInstance()
871 {
872 return VehicleAnimInstances.S120;
873 }
874
875 override int GetSeatAnimationType(int posIdx)
876 {
877 switch (posIdx)
878 {
879 case 0:
880 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
881 case 1:
882 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
883 case 2:
884 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
885 case 3:
886 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
887 }
888
889 return 0;
890 }
891
892 // Override for car-specific light type
894 {
895 return CarLightBase.Cast(ScriptedLightBase.CreateLight(Sedan_02FrontLight));
896 }
897
898 // Override for car-specific light type
900 {
901 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(Sedan_02RearLight));
902 }
903
905 {
906 if (!super.CanReleaseAttachment(attachment))
907 {
908 return false;
909 }
910
911 string attType = attachment.GetType();
912 switch (attType)
913 {
914 case "CarBattery":
915 if (GetCarDoorsState("Sedan_02_Trunk") == CarDoorState.DOORS_CLOSED || EngineIsOn())
916 {
917 return false;
918 }
919 break;
920
921 case "SparkPlug":
922 if (GetCarDoorsState("Sedan_02_Trunk") == CarDoorState.DOORS_CLOSED || EngineIsOn())
923 {
924 return false;
925 }
926 break;
927
928 case "CarRadiator":
929 if (GetCarDoorsState("Sedan_02_Hood") == CarDoorState.DOORS_CLOSED || EngineIsOn())
930 {
931 return false;
932 }
933 break;
934 }
935
936 return true;
937 }
938
939 override protected bool CanManipulateSpareWheel(string slotSelectionName)
940 {
941 return GetCarDoorsState("Sedan_02_Hood") != CarDoorState.DOORS_CLOSED;
942 }
943
944 override bool CanDisplayAttachmentCategory(string category_name)
945 {
946 if ( !super.CanDisplayAttachmentCategory(category_name))
947 {
948 return false;
949 }
950
951 category_name.ToLower();
952 if (category_name.Contains("engine"))
953 {
954 if (GetCarDoorsState("Sedan_02_Trunk") == CarDoorState.DOORS_CLOSED)
955 {
956 return false;
957 }
958 }
959
960 if (category_name.Contains("trunk"))
961 {
962 if (GetCarDoorsState("Sedan_02_Hood") == CarDoorState.DOORS_CLOSED)
963 {
964 return false;
965 }
966 }
967
968 return true;
969 }
970
971 override bool CanDisplayCargo()
972 {
973 if ( !super.CanDisplayCargo() )
974 return false;
975
976 if ( GetCarDoorsState("Sedan_02_Hood") == CarDoorState.DOORS_CLOSED )
977 return false;
978
979 return true;
980 }
981
982 override int GetCarDoorsState(string slotType)
983 {
985
986 Class.CastTo( carDoor, FindAttachmentBySlotName( slotType ) );
987 if (!carDoor)
988 {
989 return CarDoorState.DOORS_MISSING;
990 }
991
992 switch (slotType)
993 {
994 case "Sedan_02_Door_1_1":
995 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
996
997 case "Sedan_02_Door_2_1":
998 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
999
1000 case "Sedan_02_Door_1_2":
1001 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
1002
1003 case "Sedan_02_Door_2_2":
1004 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
1005
1006 case "Sedan_02_Hood":
1007 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
1008
1009 case "Sedan_02_Trunk":
1010 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
1011 }
1012
1013 return CarDoorState.DOORS_MISSING;
1014 }
1015
1016
1017 override bool CrewCanGetThrough( int posIdx )
1018 {
1019 switch( posIdx )
1020 {
1021 case 0:
1022 if ( GetCarDoorsState("Sedan_02_Door_1_1") == CarDoorState.DOORS_CLOSED )
1023 return false;
1024
1025 return true;
1026 break;
1027
1028 case 1:
1029 if ( GetCarDoorsState("Sedan_02_Door_2_1") == CarDoorState.DOORS_CLOSED )
1030 return false;
1031
1032 return true;
1033 break;
1034
1035 case 2:
1036 if ( GetCarDoorsState("Sedan_02_Door_1_2") == CarDoorState.DOORS_CLOSED )
1037 return false;
1038
1039 return true;
1040 break;
1041
1042 case 3:
1043 if ( GetCarDoorsState("Sedan_02_Door_2_2") == CarDoorState.DOORS_CLOSED )
1044 return false;
1045
1046 return true;
1047 break;
1048 }
1049
1050 return false;
1051 }
1052
1053 override string GetDoorSelectionNameFromSeatPos(int posIdx)
1054 {
1055 switch( posIdx )
1056 {
1057 case 0:
1058 return "doors_driver";
1059 break;
1060 case 1:
1061 return "doors_codriver";
1062 break;
1063 case 2:
1064 return "doors_cargo1";
1065 break;
1066 case 3:
1067 return "doors_cargo2";
1068 break;
1069 }
1070
1071 return super.GetDoorSelectionNameFromSeatPos(posIdx);
1072 }
1073
1074 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
1075 {
1076 switch( posIdx )
1077 {
1078 case 0:
1079 return "Sedan_02_Door_1_1";
1080 break;
1081 case 1:
1082 return "Sedan_02_Door_2_1";
1083 break;
1084 case 2:
1085 return "Sedan_02_Door_1_2";
1086 break;
1087 case 3:
1088 return "Sedan_02_Door_2_2";
1089 break;
1090 }
1091
1092 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
1093 }
1094
1095 override float OnSound(CarSoundCtrl ctrl, float oldValue)
1096 {
1097 switch ( ctrl )
1098 {
1099 case CarSoundCtrl.DOORS:
1100 float newValue = 0;
1101 if (GetCarDoorsState("Sedan_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
1102 {
1103 newValue += 0.25;
1104 }
1105
1106 if (GetCarDoorsState("Sedan_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
1107 {
1108 newValue += 0.25;
1109 }
1110
1111 if (GetCarDoorsState("Sedan_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
1112 {
1113 newValue += 0.25;
1114 }
1115
1116 if (GetCarDoorsState("Sedan_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
1117 {
1118 newValue += 0.25;
1119 }
1120
1121 return Math.Clamp(newValue, 0, 1);
1122 break;
1123 }
1124
1125 return super.OnSound(ctrl, oldValue);
1126 }
1127
1128 override string GetAnimSourceFromSelection( string selection )
1129 {
1130 switch( selection )
1131 {
1132 case "doors_driver":
1133 return "DoorsDriver";
1134 case "doors_codriver":
1135 return "DoorsCoDriver";
1136 case "doors_cargo1":
1137 return "DoorsCargo1";
1138 case "doors_cargo2":
1139 return "DoorsCargo2";
1140 case "doors_hood":
1141 return "DoorsHood";
1142 case "doors_trunk":
1143 return "DoorsTrunk";
1144 }
1145
1146 return "";
1147 }
1148
1149
1150 override bool IsVitalTruckBattery()
1151 {
1152 return false;
1153 }
1154
1155 override bool IsVitalGlowPlug()
1156 {
1157 return false;
1158 }
1159
1160 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
1161 {
1162 switch (currentSeat)
1163 {
1164 case 0:
1165 return nextSeat == 1;
1166
1167 case 1:
1168 return nextSeat == 0;
1169
1170 case 2:
1171 return nextSeat == 3;
1172
1173 case 3:
1174 return nextSeat == 2;
1175 }
1176
1177 return false;
1178 }
1179
1180 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
1181 {
1182 switch (pCurrentSeat)
1183 {
1184 case 0:
1185 return pDoorsSelection == "DoorsDriver";
1186
1187 case 1:
1188 return pDoorsSelection == "DoorsCoDriver";
1189
1190 case 2:
1191 return pDoorsSelection == "DoorsCargo1";
1192
1193 case 3:
1194 return pDoorsSelection == "DoorsCargo2";
1195 }
1196
1197 return false;
1198 }
1199
1200 override void OnDebugSpawn()
1201 {
1205
1206 GetInventory().CreateInInventory("Sedan_02_Wheel");
1207 GetInventory().CreateInInventory("Sedan_02_Wheel");
1208 GetInventory().CreateInInventory("Sedan_02_Wheel");
1209 GetInventory().CreateInInventory("Sedan_02_Wheel");
1210 GetInventory().CreateInInventory("Sedan_02_Wheel");
1211
1212 GetInventory().CreateInInventory("Sedan_02_Door_1_1");
1213 GetInventory().CreateInInventory("Sedan_02_Door_1_2");
1214 GetInventory().CreateInInventory("Sedan_02_Door_2_1");
1215 GetInventory().CreateInInventory("Sedan_02_Door_2_2");
1216 GetInventory().CreateInInventory("Sedan_02_Hood");
1217 GetInventory().CreateInInventory("Sedan_02_Trunk");
1218
1219 //-----IN CAR CARGO
1220 GetInventory().CreateInInventory("Sedan_02_Wheel");
1221 GetInventory().CreateInInventory("Sedan_02_Wheel");
1222 }
1223}
1224
1225class Sedan_02_Red extends Sedan_02
1226{
1227 override void OnDebugSpawn()
1228 {
1232
1233 GetInventory().CreateInInventory("Sedan_02_Wheel");
1234 GetInventory().CreateInInventory("Sedan_02_Wheel");
1235 GetInventory().CreateInInventory("Sedan_02_Wheel");
1236 GetInventory().CreateInInventory("Sedan_02_Wheel");
1237
1238 GetInventory().CreateInInventory("Sedan_02_Door_1_1_Red");
1239 GetInventory().CreateInInventory("Sedan_02_Door_1_2_Red");
1240 GetInventory().CreateInInventory("Sedan_02_Door_2_1_Red");
1241 GetInventory().CreateInInventory("Sedan_02_Door_2_2_Red");
1242 GetInventory().CreateInInventory("Sedan_02_Hood_Red");
1243 GetInventory().CreateInInventory("Sedan_02_Trunk_Red");
1244
1245 //-----IN CAR CARGO
1246 GetInventory().CreateInInventory("Sedan_02_Wheel");
1247 GetInventory().CreateInInventory("Sedan_02_Wheel");
1248 }
1249}
1250
1251class Sedan_02_Grey extends Sedan_02
1252{
1253 override void OnDebugSpawn()
1254 {
1258
1259 GetInventory().CreateInInventory("Sedan_02_Wheel");
1260 GetInventory().CreateInInventory("Sedan_02_Wheel");
1261 GetInventory().CreateInInventory("Sedan_02_Wheel");
1262 GetInventory().CreateInInventory("Sedan_02_Wheel");
1263
1264 GetInventory().CreateInInventory("Sedan_02_Door_1_1_Grey");
1265 GetInventory().CreateInInventory("Sedan_02_Door_1_2_Grey");
1266 GetInventory().CreateInInventory("Sedan_02_Door_2_1_Grey");
1267 GetInventory().CreateInInventory("Sedan_02_Door_2_2_Grey");
1268 GetInventory().CreateInInventory("Sedan_02_Hood_Grey");
1269 GetInventory().CreateInInventory("Sedan_02_Trunk_Grey");
1270
1271 //-----IN CAR CARGO
1272 GetInventory().CreateInInventory("Sedan_02_Wheel");
1273 GetInventory().CreateInInventory("Sedan_02_Wheel");
1274 }
1275}

◆ IsVitalTruckBattery()

override bool IsVitalTruckBattery ( )
protected
790{
794
795 void Sedan_02()
796 {
797 m_dmgContactCoef = 0.0790;
798
799 m_EngineStartOK = "Sedan_02_engine_start_SoundSet";
800 m_EngineStartBattery = "Sedan_02_engine_failed_start_battery_SoundSet";
801 m_EngineStartPlug = "Sedan_02_engine_failed_start_sparkplugs_SoundSet";
802 m_EngineStartFuel = "Sedan_02_engine_failed_start_fuel_SoundSet";
803 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
804
805 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
806 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
807
808 m_CarHornShortSoundName = "Sedan_02_Horn_Short_SoundSet";
809 m_CarHornLongSoundName = "Sedan_02_Horn_SoundSet";
810
811 SetEnginePos("0 0.7 -1.7");
812 }
813
814 override void EEInit()
815 {
816 super.EEInit();
817
818 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
819 {
821 m_UTSSettings.m_ManualUpdate = true;
822 m_UTSSettings.m_TemperatureMin = 0;
823 m_UTSSettings.m_TemperatureMax = 30;
825 m_UTSSettings.m_TemperatureCap = 0;
826 m_UTSSettings.m_RangeFull = 0.5;
827 m_UTSSettings.m_RangeMax = 2;
828
831 }
832 }
833
834 override void OnEngineStart()
835 {
836 super.OnEngineStart();
837
838 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
839 {
840 m_UTSource.SetDefferedActive(true, 20.0);
841 }
842 }
843
844 override void OnEngineStop()
845 {
846 super.OnEngineStop();
847
848 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
849 {
850 m_UTSource.SetDefferedActive(false, 10.0);
851 }
852 }
853
854 override void EOnPostSimulate(IEntity other, float timeSlice)
855 {
856 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
857 {
858 if (m_UTSource.IsActive())
859 {
861 }
862 }
863 }
864
865 override int GetAnimInstance()
866 {
867 return VehicleAnimInstances.S120;
868 }
869
870 override int GetSeatAnimationType(int posIdx)
871 {
872 switch (posIdx)
873 {
874 case 0:
875 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
876 case 1:
877 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
878 case 2:
879 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
880 case 3:
881 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
882 }
883
884 return 0;
885 }
886
887 // Override for car-specific light type
889 {
890 return CarLightBase.Cast(ScriptedLightBase.CreateLight(Sedan_02FrontLight));
891 }
892
893 // Override for car-specific light type
895 {
896 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(Sedan_02RearLight));
897 }
898
900 {
901 if (!super.CanReleaseAttachment(attachment))
902 {
903 return false;
904 }
905
906 string attType = attachment.GetType();
907 switch (attType)
908 {
909 case "CarBattery":
910 if (GetCarDoorsState("Sedan_02_Trunk") == CarDoorState.DOORS_CLOSED || EngineIsOn())
911 {
912 return false;
913 }
914 break;
915
916 case "SparkPlug":
917 if (GetCarDoorsState("Sedan_02_Trunk") == CarDoorState.DOORS_CLOSED || EngineIsOn())
918 {
919 return false;
920 }
921 break;
922
923 case "CarRadiator":
924 if (GetCarDoorsState("Sedan_02_Hood") == CarDoorState.DOORS_CLOSED || EngineIsOn())
925 {
926 return false;
927 }
928 break;
929 }
930
931 return true;
932 }
933
934 override protected bool CanManipulateSpareWheel(string slotSelectionName)
935 {
936 return GetCarDoorsState("Sedan_02_Hood") != CarDoorState.DOORS_CLOSED;
937 }
938
939 override bool CanDisplayAttachmentCategory(string category_name)
940 {
941 if ( !super.CanDisplayAttachmentCategory(category_name))
942 {
943 return false;
944 }
945
946 category_name.ToLower();
947 if (category_name.Contains("engine"))
948 {
949 if (GetCarDoorsState("Sedan_02_Trunk") == CarDoorState.DOORS_CLOSED)
950 {
951 return false;
952 }
953 }
954
955 if (category_name.Contains("trunk"))
956 {
957 if (GetCarDoorsState("Sedan_02_Hood") == CarDoorState.DOORS_CLOSED)
958 {
959 return false;
960 }
961 }
962
963 return true;
964 }
965
966 override bool CanDisplayCargo()
967 {
968 if ( !super.CanDisplayCargo() )
969 return false;
970
971 if ( GetCarDoorsState("Sedan_02_Hood") == CarDoorState.DOORS_CLOSED )
972 return false;
973
974 return true;
975 }
976
977 override int GetCarDoorsState(string slotType)
978 {
980
981 Class.CastTo( carDoor, FindAttachmentBySlotName( slotType ) );
982 if (!carDoor)
983 {
984 return CarDoorState.DOORS_MISSING;
985 }
986
987 switch (slotType)
988 {
989 case "Sedan_02_Door_1_1":
990 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
991
992 case "Sedan_02_Door_2_1":
993 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
994
995 case "Sedan_02_Door_1_2":
996 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
997
998 case "Sedan_02_Door_2_2":
999 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
1000
1001 case "Sedan_02_Hood":
1002 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
1003
1004 case "Sedan_02_Trunk":
1005 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
1006 }
1007
1008 return CarDoorState.DOORS_MISSING;
1009 }
1010
1011
1012 override bool CrewCanGetThrough( int posIdx )
1013 {
1014 switch( posIdx )
1015 {
1016 case 0:
1017 if ( GetCarDoorsState("Sedan_02_Door_1_1") == CarDoorState.DOORS_CLOSED )
1018 return false;
1019
1020 return true;
1021 break;
1022
1023 case 1:
1024 if ( GetCarDoorsState("Sedan_02_Door_2_1") == CarDoorState.DOORS_CLOSED )
1025 return false;
1026
1027 return true;
1028 break;
1029
1030 case 2:
1031 if ( GetCarDoorsState("Sedan_02_Door_1_2") == CarDoorState.DOORS_CLOSED )
1032 return false;
1033
1034 return true;
1035 break;
1036
1037 case 3:
1038 if ( GetCarDoorsState("Sedan_02_Door_2_2") == CarDoorState.DOORS_CLOSED )
1039 return false;
1040
1041 return true;
1042 break;
1043 }
1044
1045 return false;
1046 }
1047
1048 override string GetDoorSelectionNameFromSeatPos(int posIdx)
1049 {
1050 switch( posIdx )
1051 {
1052 case 0:
1053 return "doors_driver";
1054 break;
1055 case 1:
1056 return "doors_codriver";
1057 break;
1058 case 2:
1059 return "doors_cargo1";
1060 break;
1061 case 3:
1062 return "doors_cargo2";
1063 break;
1064 }
1065
1066 return super.GetDoorSelectionNameFromSeatPos(posIdx);
1067 }
1068
1069 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
1070 {
1071 switch( posIdx )
1072 {
1073 case 0:
1074 return "Sedan_02_Door_1_1";
1075 break;
1076 case 1:
1077 return "Sedan_02_Door_2_1";
1078 break;
1079 case 2:
1080 return "Sedan_02_Door_1_2";
1081 break;
1082 case 3:
1083 return "Sedan_02_Door_2_2";
1084 break;
1085 }
1086
1087 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
1088 }
1089
1090 override float OnSound(CarSoundCtrl ctrl, float oldValue)
1091 {
1092 switch ( ctrl )
1093 {
1094 case CarSoundCtrl.DOORS:
1095 float newValue = 0;
1096 if (GetCarDoorsState("Sedan_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
1097 {
1098 newValue += 0.25;
1099 }
1100
1101 if (GetCarDoorsState("Sedan_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
1102 {
1103 newValue += 0.25;
1104 }
1105
1106 if (GetCarDoorsState("Sedan_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
1107 {
1108 newValue += 0.25;
1109 }
1110
1111 if (GetCarDoorsState("Sedan_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
1112 {
1113 newValue += 0.25;
1114 }
1115
1116 return Math.Clamp(newValue, 0, 1);
1117 break;
1118 }
1119
1120 return super.OnSound(ctrl, oldValue);
1121 }
1122
1123 override string GetAnimSourceFromSelection( string selection )
1124 {
1125 switch( selection )
1126 {
1127 case "doors_driver":
1128 return "DoorsDriver";
1129 case "doors_codriver":
1130 return "DoorsCoDriver";
1131 case "doors_cargo1":
1132 return "DoorsCargo1";
1133 case "doors_cargo2":
1134 return "DoorsCargo2";
1135 case "doors_hood":
1136 return "DoorsHood";
1137 case "doors_trunk":
1138 return "DoorsTrunk";
1139 }
1140
1141 return "";
1142 }
1143
1144
1145 override bool IsVitalTruckBattery()
1146 {
1147 return false;
1148 }
1149
1150 override bool IsVitalGlowPlug()
1151 {
1152 return false;
1153 }
1154
1155 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
1156 {
1157 switch (currentSeat)
1158 {
1159 case 0:
1160 return nextSeat == 1;
1161
1162 case 1:
1163 return nextSeat == 0;
1164
1165 case 2:
1166 return nextSeat == 3;
1167
1168 case 3:
1169 return nextSeat == 2;
1170 }
1171
1172 return false;
1173 }
1174
1175 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
1176 {
1177 switch (pCurrentSeat)
1178 {
1179 case 0:
1180 return pDoorsSelection == "DoorsDriver";
1181
1182 case 1:
1183 return pDoorsSelection == "DoorsCoDriver";
1184
1185 case 2:
1186 return pDoorsSelection == "DoorsCargo1";
1187
1188 case 3:
1189 return pDoorsSelection == "DoorsCargo2";
1190 }
1191
1192 return false;
1193 }
1194
1195 override void OnDebugSpawn()
1196 {
1200
1201 GetInventory().CreateInInventory("Sedan_02_Wheel");
1202 GetInventory().CreateInInventory("Sedan_02_Wheel");
1203 GetInventory().CreateInInventory("Sedan_02_Wheel");
1204 GetInventory().CreateInInventory("Sedan_02_Wheel");
1205 GetInventory().CreateInInventory("Sedan_02_Wheel");
1206
1207 GetInventory().CreateInInventory("Sedan_02_Door_1_1");
1208 GetInventory().CreateInInventory("Sedan_02_Door_1_2");
1209 GetInventory().CreateInInventory("Sedan_02_Door_2_1");
1210 GetInventory().CreateInInventory("Sedan_02_Door_2_2");
1211 GetInventory().CreateInInventory("Sedan_02_Hood");
1212 GetInventory().CreateInInventory("Sedan_02_Trunk");
1213
1214 //-----IN CAR CARGO
1215 GetInventory().CreateInInventory("Sedan_02_Wheel");
1216 GetInventory().CreateInInventory("Sedan_02_Wheel");
1217 }
1218}
1219
1220class Sedan_02_Red extends Sedan_02
1221{
1222 override void OnDebugSpawn()
1223 {
1227
1228 GetInventory().CreateInInventory("Sedan_02_Wheel");
1229 GetInventory().CreateInInventory("Sedan_02_Wheel");
1230 GetInventory().CreateInInventory("Sedan_02_Wheel");
1231 GetInventory().CreateInInventory("Sedan_02_Wheel");
1232
1233 GetInventory().CreateInInventory("Sedan_02_Door_1_1_Red");
1234 GetInventory().CreateInInventory("Sedan_02_Door_1_2_Red");
1235 GetInventory().CreateInInventory("Sedan_02_Door_2_1_Red");
1236 GetInventory().CreateInInventory("Sedan_02_Door_2_2_Red");
1237 GetInventory().CreateInInventory("Sedan_02_Hood_Red");
1238 GetInventory().CreateInInventory("Sedan_02_Trunk_Red");
1239
1240 //-----IN CAR CARGO
1241 GetInventory().CreateInInventory("Sedan_02_Wheel");
1242 GetInventory().CreateInInventory("Sedan_02_Wheel");
1243 }
1244}
1245
1246class Sedan_02_Grey extends Sedan_02
1247{
1248 override void OnDebugSpawn()
1249 {
1253
1254 GetInventory().CreateInInventory("Sedan_02_Wheel");
1255 GetInventory().CreateInInventory("Sedan_02_Wheel");
1256 GetInventory().CreateInInventory("Sedan_02_Wheel");
1257 GetInventory().CreateInInventory("Sedan_02_Wheel");
1258
1259 GetInventory().CreateInInventory("Sedan_02_Door_1_1_Grey");
1260 GetInventory().CreateInInventory("Sedan_02_Door_1_2_Grey");
1261 GetInventory().CreateInInventory("Sedan_02_Door_2_1_Grey");
1262 GetInventory().CreateInInventory("Sedan_02_Door_2_2_Grey");
1263 GetInventory().CreateInInventory("Sedan_02_Hood_Grey");
1264 GetInventory().CreateInInventory("Sedan_02_Trunk_Grey");
1265
1266 //-----IN CAR CARGO
1267 GetInventory().CreateInInventory("Sedan_02_Wheel");
1268 GetInventory().CreateInInventory("Sedan_02_Wheel");
1269 }
1270}

◆ OnDebugSpawn()

class Sedan_02 extends CarScript OnDebugSpawn ( )
435 {
439
440 GetInventory().CreateInInventory("Sedan_02_Wheel");
441 GetInventory().CreateInInventory("Sedan_02_Wheel");
442 GetInventory().CreateInInventory("Sedan_02_Wheel");
443 GetInventory().CreateInInventory("Sedan_02_Wheel");
444
445 GetInventory().CreateInInventory("Sedan_02_Door_1_1_Red");
446 GetInventory().CreateInInventory("Sedan_02_Door_1_2_Red");
447 GetInventory().CreateInInventory("Sedan_02_Door_2_1_Red");
448 GetInventory().CreateInInventory("Sedan_02_Door_2_2_Red");
449 GetInventory().CreateInInventory("Sedan_02_Hood_Red");
450 GetInventory().CreateInInventory("Sedan_02_Trunk_Red");
451
452 //-----IN CAR CARGO
453 GetInventory().CreateInInventory("Sedan_02_Wheel");
454 GetInventory().CreateInInventory("Sedan_02_Wheel");
455 }

Перекрестные ссылки m_UTSLEngine, m_UTSource, m_UTSSettings и UniversalTemperatureSourceLambdaEngine().

◆ OnEngineStart()

override void OnEngineStart ( )
protected

◆ OnEngineStop()

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

◆ OnSound()

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

◆ Sedan_02()

void Sedan_02 ( )
protected

Переменные

◆ m_UTSLEngine

◆ m_UTSource

◆ m_UTSSettings