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

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

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

class  CarScript
 
class  CivilianSedan
 

Функции

class CivilianSedan extends CarScript OnDebugSpawn ()
 
void CivilianSedan ()
 
override void EEInit ()
 
override void OnEngineStart ()
 
override void OnEngineStop ()
 
override void EOnPostSimulate (IEntity other, float timeSlice)
 
override int GetAnimInstance ()
 
override float GetTransportCameraDistance ()
 
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)
 
override float GetPushForceCoefficientMultiplier ()
 

Переменные

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
584{
588
589 void CivilianSedan()
590 {
591 //m_dmgContactCoef = 0.065;
592
593 m_EngineStartOK = "CivilianSedan_engine_start_SoundSet";
594 m_EngineStartBattery = "CivilianSedan_engine_failed_start_battery_SoundSet";
595 m_EngineStartPlug = "CivilianSedan_engine_failed_start_sparkplugs_SoundSet";
596 m_EngineStartFuel = "CivilianSedan_engine_failed_start_fuel_SoundSet";
597 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
598
599 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
600 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
601
602 m_CarHornShortSoundName = "CivilianSedan_Horn_Short_SoundSet";
603 m_CarHornLongSoundName = "CivilianSedan_Horn_SoundSet";
604
605 SetEnginePos("0 0.7 1.6");
606 }
607
608 override void EEInit()
609 {
610 super.EEInit();
611
612 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
613 {
615 m_UTSSettings.m_ManualUpdate = true;
616 m_UTSSettings.m_TemperatureMin = 0;
617 m_UTSSettings.m_TemperatureMax = 30;
619 m_UTSSettings.m_TemperatureCap = 0;
620 m_UTSSettings.m_RangeFull = 0.5;
621 m_UTSSettings.m_RangeMax = 2;
622
625 }
626 }
627
628 override void OnEngineStart()
629 {
630 super.OnEngineStart();
631
632 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
633 {
634 m_UTSource.SetDefferedActive(true, 20.0);
635 }
636 }
637
638 override void OnEngineStop()
639 {
640 super.OnEngineStop();
641
642 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
643 {
644 m_UTSource.SetDefferedActive(false, 10.0);
645 }
646 }
647
648 override void EOnPostSimulate(IEntity other, float timeSlice)
649 {
650 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
651 {
652 if (m_UTSource.IsActive())
653 {
655 }
656 }
657 }
658
659 override int GetAnimInstance()
660 {
661 return VehicleAnimInstances.SEDAN;
662 }
663
664 override float GetTransportCameraDistance()
665 {
666 return 4.5;
667 }
668
669 override int GetSeatAnimationType(int posIdx)
670 {
671 switch (posIdx)
672 {
673 case 0:
674 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
675 case 1:
676 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
677 case 2:
678 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
679 case 3:
680 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
681 }
682
683 return 0;
684 }
685
686 // Override for car-specific light type
688 {
689 return CarLightBase.Cast( ScriptedLightBase.CreateLight(CivilianSedanFrontLight) );
690 }
691
692 // Override for car-specific light type
694 {
695 return CarRearLightBase.Cast( ScriptedLightBase.CreateLight(CivilianSedanRearLight) );
696 }
697
699 {
700 if( !super.CanReleaseAttachment( attachment ) )
701 return false;
702
703 string attType = attachment.GetType();
704
705 if ( EngineIsOn() || GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED )
706 {
707 if ( attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
708 return false;
709 }
710
711 return true;
712 }
713
714 override protected bool CanManipulateSpareWheel(string slotSelectionName)
715 {
716 return GetCarDoorsState("CivSedanTrunk") != CarDoorState.DOORS_CLOSED;
717 }
718
719 override bool CanDisplayAttachmentCategory(string category_name)
720 {
721 //super
722 if (!super.CanDisplayAttachmentCategory(category_name))
723 return false;
724 //
725
726 category_name.ToLower();
727 if (category_name.Contains("engine"))
728 {
729 if (GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED)
730 return false;
731 }
732
733 return true;
734 }
735
736 override bool CanDisplayCargo()
737 {
738 if ( !super.CanDisplayCargo() )
739 return false;
740
741 if ( GetCarDoorsState("CivSedanTrunk") == CarDoorState.DOORS_CLOSED )
742 return false;
743
744 return true;
745 }
746
747 override int GetCarDoorsState( string slotType )
748 {
750
751 Class.CastTo( carDoor, FindAttachmentBySlotName( slotType ) );
752 if (!carDoor)
753 {
754 return CarDoorState.DOORS_MISSING;
755 }
756
757 switch (slotType)
758 {
759 case "CivSedanDriverDoors":
760 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
761 break;
762
763 case "CivSedanCoDriverDoors":
764 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
765 break;
766
767 case "CivSedanCargo1Doors":
768 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
769 break;
770
771 case "CivSedanCargo2Doors":
772 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
773 break;
774
775 case "CivSedanTrunk":
776 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
777 break;
778
779 case "CivSedanHood":
780 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
781 break;
782 }
783
784 return CarDoorState.DOORS_MISSING;
785 }
786
787
788 override bool CrewCanGetThrough( int posIdx )
789 {
790 switch( posIdx )
791 {
792 case 0:
793 if ( GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED )
794 return false;
795
796 return true;
797 break;
798
799 case 1:
800 if ( GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED )
801 return false;
802
803 return true;
804 break;
805
806 case 2:
807 if ( GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED )
808 return false;
809
810 return true;
811 break;
812
813 case 3:
814 if ( GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED )
815 return false;
816
817 return true;
818 break;
819 }
820
821 return false;
822 }
823
824 override string GetDoorSelectionNameFromSeatPos(int posIdx)
825 {
826 switch( posIdx )
827 {
828 case 0:
829 return "doors_driver";
830 break;
831 case 1:
832 return "doors_codriver";
833 break;
834 case 2:
835 return "doors_cargo1";
836 break;
837 case 3:
838 return "doors_cargo2";
839 break;
840 }
841
842 return super.GetDoorSelectionNameFromSeatPos(posIdx);
843 }
844
845 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
846 {
847 switch( posIdx )
848 {
849 case 0:
850 return "CivSedanDriverDoors";
851 break;
852 case 1:
853 return "CivSedanCoDriverDoors";
854 break;
855 case 2:
856 return "CivSedanCargo1Doors";
857 break;
858 case 3:
859 return "CivSedanCargo2Doors";
860 break;
861 }
862
863 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
864 }
865
866 // 0 full ambient and engine sound
867 // 1 zero ambient and engine sound
868 override float OnSound(CarSoundCtrl ctrl, float oldValue)
869 {
870 switch (ctrl)
871 {
872 case CarSoundCtrl.DOORS:
873 float newValue = 0;
874 if (GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED)
875 {
876 newValue += 0.25;
877 }
878
879 if (GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED)
880 {
881 newValue += 0.25;
882 }
883
884 if (GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED)
885 {
886 newValue += 0.25;
887 }
888
889 if (GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED)
890 {
891 newValue += 0.25;
892 }
893
894 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
895 {
896 newValue -= 0.6;
897 }
898
899 if (GetHealthLevel("WindowBack") == GameConstants.STATE_RUINED)
900 {
901 newValue -= 0.6;
902 }
903
904 return Math.Clamp(newValue, 0, 1);
905 break;
906 }
907
908 return super.OnSound(ctrl, oldValue);
909 }
910
911 override string GetAnimSourceFromSelection(string selection)
912 {
913 switch (selection)
914 {
915 case "doors_driver":
916 return "DoorsDriver";
917 case "doors_codriver":
918 return "DoorsCoDriver";
919 case "doors_cargo1":
920 return "DoorsCargo1";
921 case "doors_cargo2":
922 return "DoorsCargo2";
923 case "doors_hood":
924 return "DoorsHood";
925 case "doors_trunk":
926 return "DoorsTrunk";
927 }
928
929 return "";
930 }
931
932 override bool IsVitalTruckBattery()
933 {
934 return false;
935 }
936
937 override bool IsVitalGlowPlug()
938 {
939 return false;
940 }
941
942 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
943 {
944 switch (currentSeat)
945 {
946 case 0:
947 return nextSeat == 1;
948
949 case 1:
950 return nextSeat == 0;
951
952 case 2:
953 return nextSeat == 3;
954
955 case 3:
956 return nextSeat == 2;
957 }
958
959 return false;
960 }
961
962 override bool CanReachDoorsFromSeat( string pDoorsSelection, int pCurrentSeat )
963 {
964 switch (pCurrentSeat)
965 {
966 case 0:
967 return pDoorsSelection == "DoorsDriver";
968
969 case 1:
970 return pDoorsSelection == "DoorsCoDriver";
971
972 case 2:
973 return pDoorsSelection == "DoorsCargo1";
974
975 case 3:
976 return pDoorsSelection == "DoorsCargo2";
977 }
978
979 return false;
980 }
981
982 override void OnDebugSpawn()
983 {
987
988 GetInventory().CreateInInventory("CivSedanWheel");
989 GetInventory().CreateInInventory("CivSedanWheel");
990 GetInventory().CreateInInventory("CivSedanWheel");
991 GetInventory().CreateInInventory("CivSedanWheel");
992
993 GetInventory().CreateInInventory("CivSedanDoors_Driver");
994 GetInventory().CreateInInventory("CivSedanDoors_CoDriver");
995 GetInventory().CreateInInventory("CivSedanDoors_BackLeft");
996 GetInventory().CreateInInventory("CivSedanDoors_BackRight");
997 GetInventory().CreateInInventory("CivSedanHood");
998 GetInventory().CreateInInventory("CivSedanTrunk");
999
1000 //-----IN CAR CARGO
1001 GetInventory().CreateInInventory("CivSedanWheel");
1002 GetInventory().CreateInInventory("CivSedanWheel");
1003 }
1004
1005 override float GetPushForceCoefficientMultiplier()
1006 {
1007 return 1.5;
1008 }
1009}
1010
1012{
1013 override void OnDebugSpawn()
1014 {
1018
1019 GetInventory().CreateInInventory("CivSedanWheel");
1020 GetInventory().CreateInInventory("CivSedanWheel");
1021 GetInventory().CreateInInventory("CivSedanWheel");
1022 GetInventory().CreateInInventory("CivSedanWheel");
1023
1024 GetInventory().CreateInInventory("CivSedanDoors_Driver_Wine");
1025 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Wine");
1026 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Wine");
1027 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Wine");
1028 GetInventory().CreateInInventory("CivSedanHood_Wine");
1029 GetInventory().CreateInInventory("CivSedanTrunk_Wine");
1030
1031 //-----IN CAR CARGO
1032 GetInventory().CreateInInventory("CivSedanWheel");
1033 GetInventory().CreateInInventory("CivSedanWheel");
1034 }
1035}
1036
1038{
1039 override void OnDebugSpawn()
1040 {
1044
1045 GetInventory().CreateInInventory("CivSedanWheel");
1046 GetInventory().CreateInInventory("CivSedanWheel");
1047 GetInventory().CreateInInventory("CivSedanWheel");
1048 GetInventory().CreateInInventory("CivSedanWheel");
1049
1050 GetInventory().CreateInInventory("CivSedanDoors_Driver_Black");
1051 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Black");
1052 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Black");
1053 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Black");
1054 GetInventory().CreateInInventory("CivSedanHood_Black");
1055 GetInventory().CreateInInventory("CivSedanTrunk_Black");
1056
1057 //-----IN CAR CARGO
1058 GetInventory().CreateInInventory("CivSedanWheel");
1059 GetInventory().CreateInInventory("CivSedanWheel");
1060 }
1061}
CarSoundCtrl
Car's sound controller list. (native, do not change or extend)
Definition Car.c:4
void SpawnUniversalParts()
Definition CarScript.c:2761
CarDoorState TranslateAnimationPhaseToCarDoorState(string animation)
Definition CarScript.c:2474
CarDoorState
Definition CarScript.c:2
void SpawnAdditionalItems()
Definition CarScript.c:2799
string m_EngineStartOK
Sounds.
Definition CarScript.c:207
string m_CarDoorCloseSound
Definition CarScript.c:214
string m_EngineStartBattery
Definition CarScript.c:208
string m_EngineStartPlug
Definition CarScript.c:209
string m_EngineStartFuel
Definition CarScript.c:210
string m_CarHornShortSoundName
Definition CarScript.c:218
void FillUpCarFluids()
Definition CarScript.c:2829
string m_CarHornLongSoundName
Definition CarScript.c:219
string m_EngineStopFuel
Definition CarScript.c:211
string m_CarDoorOpenSound
Definition CarScript.c:213
override int GetCarDoorsState(string slotType)
Definition CivilianSedan.c:594
override bool CanDisplayAttachmentCategory(string category_name)
Definition CivilianSedan.c:566
override void EOnPostSimulate(IEntity other, float timeSlice)
Definition CivilianSedan.c:495
ref UniversalTemperatureSourceSettings m_UTSSettings
Definition CivilianSedan.c:433
class CivilianSedan extends CarScript OnDebugSpawn()
Definition CivilianSedan.c:431
override float GetTransportCameraDistance()
Definition CivilianSedan.c:511
override bool IsVitalGlowPlug()
Definition CivilianSedan.c:784
override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
Definition CivilianSedan.c:809
override bool CanDisplayCargo()
Definition CivilianSedan.c:583
override int GetAnimInstance()
Definition CivilianSedan.c:506
override bool CrewCanGetThrough(int posIdx)
Definition CivilianSedan.c:635
override CarLightBase CreateFrontLight()
Definition CivilianSedan.c:534
override CarRearLightBase CreateRearLight()
Definition CivilianSedan.c:540
override void EEInit()
Definition CivilianSedan.c:455
ref UniversalTemperatureSourceLambdaEngine m_UTSLEngine
Definition CivilianSedan.c:434
override float OnSound(CarSoundCtrl ctrl, float oldValue)
Definition CivilianSedan.c:715
override bool IsVitalTruckBattery()
Definition CivilianSedan.c:779
override bool CanReleaseAttachment(EntityAI attachment)
Definition CivilianSedan.c:545
override void OnEngineStart()
Definition CivilianSedan.c:475
override string GetAnimSourceFromSelection(string selection)
Definition CivilianSedan.c:758
override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
Definition CivilianSedan.c:789
override float GetPushForceCoefficientMultiplier()
Definition CivilianSedan.c:852
override string GetDoorSelectionNameFromSeatPos(int posIdx)
Definition CivilianSedan.c:671
override int GetSeatAnimationType(int posIdx)
Definition CivilianSedan.c:516
ref UniversalTemperatureSource m_UTSource
Definition CivilianSedan.c:432
override string GetDoorInvSlotNameFromSeatPos(int posIdx)
Definition CivilianSedan.c:692
bool CanManipulateSpareWheel(string slotSelectionName)
Definition CivilianSedan.c:561
override void OnEngineStop()
Definition CivilianSedan.c:485
void CivilianSedan()
Definition CivilianSedan.c:436
class Hatchback_02_Blue extends Hatchback_02 OnDebugSpawn
Definition Hatchback_02.c:405
UniversalTemperatureSourceLambdaBaseImpl UniversalTemperatureSourceLambdaBase UniversalTemperatureSourceLambdaEngine()
Definition UniversalTemperatureSourceLambdaBaseImpl.c:175
VehicleAnimInstances
Definition VehicleAnimInstances.c:2
Definition InventoryItem.c:496
Definition CarRearLightBase.c:2
Definition CivilianSedanRearLight.c:2
Definition CivilianSedan.c:456
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
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
const int STATE_RUINED
Definition constants.c:807
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
562{
566
567 void CivilianSedan()
568 {
569 //m_dmgContactCoef = 0.065;
570
571 m_EngineStartOK = "CivilianSedan_engine_start_SoundSet";
572 m_EngineStartBattery = "CivilianSedan_engine_failed_start_battery_SoundSet";
573 m_EngineStartPlug = "CivilianSedan_engine_failed_start_sparkplugs_SoundSet";
574 m_EngineStartFuel = "CivilianSedan_engine_failed_start_fuel_SoundSet";
575 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
576
577 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
578 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
579
580 m_CarHornShortSoundName = "CivilianSedan_Horn_Short_SoundSet";
581 m_CarHornLongSoundName = "CivilianSedan_Horn_SoundSet";
582
583 SetEnginePos("0 0.7 1.6");
584 }
585
586 override void EEInit()
587 {
588 super.EEInit();
589
590 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
591 {
593 m_UTSSettings.m_ManualUpdate = true;
594 m_UTSSettings.m_TemperatureMin = 0;
595 m_UTSSettings.m_TemperatureMax = 30;
597 m_UTSSettings.m_TemperatureCap = 0;
598 m_UTSSettings.m_RangeFull = 0.5;
599 m_UTSSettings.m_RangeMax = 2;
600
603 }
604 }
605
606 override void OnEngineStart()
607 {
608 super.OnEngineStart();
609
610 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
611 {
612 m_UTSource.SetDefferedActive(true, 20.0);
613 }
614 }
615
616 override void OnEngineStop()
617 {
618 super.OnEngineStop();
619
620 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
621 {
622 m_UTSource.SetDefferedActive(false, 10.0);
623 }
624 }
625
626 override void EOnPostSimulate(IEntity other, float timeSlice)
627 {
628 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
629 {
630 if (m_UTSource.IsActive())
631 {
633 }
634 }
635 }
636
637 override int GetAnimInstance()
638 {
639 return VehicleAnimInstances.SEDAN;
640 }
641
642 override float GetTransportCameraDistance()
643 {
644 return 4.5;
645 }
646
647 override int GetSeatAnimationType(int posIdx)
648 {
649 switch (posIdx)
650 {
651 case 0:
652 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
653 case 1:
654 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
655 case 2:
656 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
657 case 3:
658 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
659 }
660
661 return 0;
662 }
663
664 // Override for car-specific light type
666 {
667 return CarLightBase.Cast( ScriptedLightBase.CreateLight(CivilianSedanFrontLight) );
668 }
669
670 // Override for car-specific light type
672 {
673 return CarRearLightBase.Cast( ScriptedLightBase.CreateLight(CivilianSedanRearLight) );
674 }
675
677 {
678 if( !super.CanReleaseAttachment( attachment ) )
679 return false;
680
681 string attType = attachment.GetType();
682
683 if ( EngineIsOn() || GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED )
684 {
685 if ( attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
686 return false;
687 }
688
689 return true;
690 }
691
692 override protected bool CanManipulateSpareWheel(string slotSelectionName)
693 {
694 return GetCarDoorsState("CivSedanTrunk") != CarDoorState.DOORS_CLOSED;
695 }
696
697 override bool CanDisplayAttachmentCategory(string category_name)
698 {
699 //super
700 if (!super.CanDisplayAttachmentCategory(category_name))
701 return false;
702 //
703
704 category_name.ToLower();
705 if (category_name.Contains("engine"))
706 {
707 if (GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED)
708 return false;
709 }
710
711 return true;
712 }
713
714 override bool CanDisplayCargo()
715 {
716 if ( !super.CanDisplayCargo() )
717 return false;
718
719 if ( GetCarDoorsState("CivSedanTrunk") == CarDoorState.DOORS_CLOSED )
720 return false;
721
722 return true;
723 }
724
725 override int GetCarDoorsState( string slotType )
726 {
728
729 Class.CastTo( carDoor, FindAttachmentBySlotName( slotType ) );
730 if (!carDoor)
731 {
732 return CarDoorState.DOORS_MISSING;
733 }
734
735 switch (slotType)
736 {
737 case "CivSedanDriverDoors":
738 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
739 break;
740
741 case "CivSedanCoDriverDoors":
742 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
743 break;
744
745 case "CivSedanCargo1Doors":
746 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
747 break;
748
749 case "CivSedanCargo2Doors":
750 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
751 break;
752
753 case "CivSedanTrunk":
754 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
755 break;
756
757 case "CivSedanHood":
758 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
759 break;
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("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED )
772 return false;
773
774 return true;
775 break;
776
777 case 1:
778 if ( GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED )
779 return false;
780
781 return true;
782 break;
783
784 case 2:
785 if ( GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED )
786 return false;
787
788 return true;
789 break;
790
791 case 3:
792 if ( GetCarDoorsState("CivSedanCargo2Doors") == 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 "CivSedanDriverDoors";
829 break;
830 case 1:
831 return "CivSedanCoDriverDoors";
832 break;
833 case 2:
834 return "CivSedanCargo1Doors";
835 break;
836 case 3:
837 return "CivSedanCargo2Doors";
838 break;
839 }
840
841 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
842 }
843
844 // 0 full ambient and engine sound
845 // 1 zero ambient and engine sound
846 override float OnSound(CarSoundCtrl ctrl, float oldValue)
847 {
848 switch (ctrl)
849 {
850 case CarSoundCtrl.DOORS:
851 float newValue = 0;
852 if (GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED)
853 {
854 newValue += 0.25;
855 }
856
857 if (GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED)
858 {
859 newValue += 0.25;
860 }
861
862 if (GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED)
863 {
864 newValue += 0.25;
865 }
866
867 if (GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED)
868 {
869 newValue += 0.25;
870 }
871
872 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
873 {
874 newValue -= 0.6;
875 }
876
877 if (GetHealthLevel("WindowBack") == GameConstants.STATE_RUINED)
878 {
879 newValue -= 0.6;
880 }
881
882 return Math.Clamp(newValue, 0, 1);
883 break;
884 }
885
886 return super.OnSound(ctrl, oldValue);
887 }
888
889 override string GetAnimSourceFromSelection(string selection)
890 {
891 switch (selection)
892 {
893 case "doors_driver":
894 return "DoorsDriver";
895 case "doors_codriver":
896 return "DoorsCoDriver";
897 case "doors_cargo1":
898 return "DoorsCargo1";
899 case "doors_cargo2":
900 return "DoorsCargo2";
901 case "doors_hood":
902 return "DoorsHood";
903 case "doors_trunk":
904 return "DoorsTrunk";
905 }
906
907 return "";
908 }
909
910 override bool IsVitalTruckBattery()
911 {
912 return false;
913 }
914
915 override bool IsVitalGlowPlug()
916 {
917 return false;
918 }
919
920 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
921 {
922 switch (currentSeat)
923 {
924 case 0:
925 return nextSeat == 1;
926
927 case 1:
928 return nextSeat == 0;
929
930 case 2:
931 return nextSeat == 3;
932
933 case 3:
934 return nextSeat == 2;
935 }
936
937 return false;
938 }
939
940 override bool CanReachDoorsFromSeat( string pDoorsSelection, int pCurrentSeat )
941 {
942 switch (pCurrentSeat)
943 {
944 case 0:
945 return pDoorsSelection == "DoorsDriver";
946
947 case 1:
948 return pDoorsSelection == "DoorsCoDriver";
949
950 case 2:
951 return pDoorsSelection == "DoorsCargo1";
952
953 case 3:
954 return pDoorsSelection == "DoorsCargo2";
955 }
956
957 return false;
958 }
959
960 override void OnDebugSpawn()
961 {
965
966 GetInventory().CreateInInventory("CivSedanWheel");
967 GetInventory().CreateInInventory("CivSedanWheel");
968 GetInventory().CreateInInventory("CivSedanWheel");
969 GetInventory().CreateInInventory("CivSedanWheel");
970
971 GetInventory().CreateInInventory("CivSedanDoors_Driver");
972 GetInventory().CreateInInventory("CivSedanDoors_CoDriver");
973 GetInventory().CreateInInventory("CivSedanDoors_BackLeft");
974 GetInventory().CreateInInventory("CivSedanDoors_BackRight");
975 GetInventory().CreateInInventory("CivSedanHood");
976 GetInventory().CreateInInventory("CivSedanTrunk");
977
978 //-----IN CAR CARGO
979 GetInventory().CreateInInventory("CivSedanWheel");
980 GetInventory().CreateInInventory("CivSedanWheel");
981 }
982
983 override float GetPushForceCoefficientMultiplier()
984 {
985 return 1.5;
986 }
987}
988
990{
991 override void OnDebugSpawn()
992 {
996
997 GetInventory().CreateInInventory("CivSedanWheel");
998 GetInventory().CreateInInventory("CivSedanWheel");
999 GetInventory().CreateInInventory("CivSedanWheel");
1000 GetInventory().CreateInInventory("CivSedanWheel");
1001
1002 GetInventory().CreateInInventory("CivSedanDoors_Driver_Wine");
1003 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Wine");
1004 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Wine");
1005 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Wine");
1006 GetInventory().CreateInInventory("CivSedanHood_Wine");
1007 GetInventory().CreateInInventory("CivSedanTrunk_Wine");
1008
1009 //-----IN CAR CARGO
1010 GetInventory().CreateInInventory("CivSedanWheel");
1011 GetInventory().CreateInInventory("CivSedanWheel");
1012 }
1013}
1014
1016{
1017 override void OnDebugSpawn()
1018 {
1022
1023 GetInventory().CreateInInventory("CivSedanWheel");
1024 GetInventory().CreateInInventory("CivSedanWheel");
1025 GetInventory().CreateInInventory("CivSedanWheel");
1026 GetInventory().CreateInInventory("CivSedanWheel");
1027
1028 GetInventory().CreateInInventory("CivSedanDoors_Driver_Black");
1029 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Black");
1030 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Black");
1031 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Black");
1032 GetInventory().CreateInInventory("CivSedanHood_Black");
1033 GetInventory().CreateInInventory("CivSedanTrunk_Black");
1034
1035 //-----IN CAR CARGO
1036 GetInventory().CreateInInventory("CivSedanWheel");
1037 GetInventory().CreateInInventory("CivSedanWheel");
1038 }
1039}

◆ CanReachDoorsFromSeat()

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

◆ CanReachSeatFromSeat()

override bool CanReachSeatFromSeat ( int currentSeat,
int nextSeat )
protected
790{
794
795 void CivilianSedan()
796 {
797 //m_dmgContactCoef = 0.065;
798
799 m_EngineStartOK = "CivilianSedan_engine_start_SoundSet";
800 m_EngineStartBattery = "CivilianSedan_engine_failed_start_battery_SoundSet";
801 m_EngineStartPlug = "CivilianSedan_engine_failed_start_sparkplugs_SoundSet";
802 m_EngineStartFuel = "CivilianSedan_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 = "CivilianSedan_Horn_Short_SoundSet";
809 m_CarHornLongSoundName = "CivilianSedan_Horn_SoundSet";
810
811 SetEnginePos("0 0.7 1.6");
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.SEDAN;
868 }
869
870 override float GetTransportCameraDistance()
871 {
872 return 4.5;
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(CivilianSedanFrontLight) );
896 }
897
898 // Override for car-specific light type
900 {
901 return CarRearLightBase.Cast( ScriptedLightBase.CreateLight(CivilianSedanRearLight) );
902 }
903
905 {
906 if( !super.CanReleaseAttachment( attachment ) )
907 return false;
908
909 string attType = attachment.GetType();
910
911 if ( EngineIsOn() || GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED )
912 {
913 if ( attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
914 return false;
915 }
916
917 return true;
918 }
919
920 override protected bool CanManipulateSpareWheel(string slotSelectionName)
921 {
922 return GetCarDoorsState("CivSedanTrunk") != CarDoorState.DOORS_CLOSED;
923 }
924
925 override bool CanDisplayAttachmentCategory(string category_name)
926 {
927 //super
928 if (!super.CanDisplayAttachmentCategory(category_name))
929 return false;
930 //
931
932 category_name.ToLower();
933 if (category_name.Contains("engine"))
934 {
935 if (GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED)
936 return false;
937 }
938
939 return true;
940 }
941
942 override bool CanDisplayCargo()
943 {
944 if ( !super.CanDisplayCargo() )
945 return false;
946
947 if ( GetCarDoorsState("CivSedanTrunk") == CarDoorState.DOORS_CLOSED )
948 return false;
949
950 return true;
951 }
952
953 override int GetCarDoorsState( string slotType )
954 {
956
957 Class.CastTo( carDoor, FindAttachmentBySlotName( slotType ) );
958 if (!carDoor)
959 {
960 return CarDoorState.DOORS_MISSING;
961 }
962
963 switch (slotType)
964 {
965 case "CivSedanDriverDoors":
966 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
967 break;
968
969 case "CivSedanCoDriverDoors":
970 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
971 break;
972
973 case "CivSedanCargo1Doors":
974 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
975 break;
976
977 case "CivSedanCargo2Doors":
978 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
979 break;
980
981 case "CivSedanTrunk":
982 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
983 break;
984
985 case "CivSedanHood":
986 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
987 break;
988 }
989
990 return CarDoorState.DOORS_MISSING;
991 }
992
993
994 override bool CrewCanGetThrough( int posIdx )
995 {
996 switch( posIdx )
997 {
998 case 0:
999 if ( GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED )
1000 return false;
1001
1002 return true;
1003 break;
1004
1005 case 1:
1006 if ( GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED )
1007 return false;
1008
1009 return true;
1010 break;
1011
1012 case 2:
1013 if ( GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED )
1014 return false;
1015
1016 return true;
1017 break;
1018
1019 case 3:
1020 if ( GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED )
1021 return false;
1022
1023 return true;
1024 break;
1025 }
1026
1027 return false;
1028 }
1029
1030 override string GetDoorSelectionNameFromSeatPos(int posIdx)
1031 {
1032 switch( posIdx )
1033 {
1034 case 0:
1035 return "doors_driver";
1036 break;
1037 case 1:
1038 return "doors_codriver";
1039 break;
1040 case 2:
1041 return "doors_cargo1";
1042 break;
1043 case 3:
1044 return "doors_cargo2";
1045 break;
1046 }
1047
1048 return super.GetDoorSelectionNameFromSeatPos(posIdx);
1049 }
1050
1051 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
1052 {
1053 switch( posIdx )
1054 {
1055 case 0:
1056 return "CivSedanDriverDoors";
1057 break;
1058 case 1:
1059 return "CivSedanCoDriverDoors";
1060 break;
1061 case 2:
1062 return "CivSedanCargo1Doors";
1063 break;
1064 case 3:
1065 return "CivSedanCargo2Doors";
1066 break;
1067 }
1068
1069 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
1070 }
1071
1072 // 0 full ambient and engine sound
1073 // 1 zero ambient and engine sound
1074 override float OnSound(CarSoundCtrl ctrl, float oldValue)
1075 {
1076 switch (ctrl)
1077 {
1078 case CarSoundCtrl.DOORS:
1079 float newValue = 0;
1080 if (GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED)
1081 {
1082 newValue += 0.25;
1083 }
1084
1085 if (GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED)
1086 {
1087 newValue += 0.25;
1088 }
1089
1090 if (GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED)
1091 {
1092 newValue += 0.25;
1093 }
1094
1095 if (GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED)
1096 {
1097 newValue += 0.25;
1098 }
1099
1100 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
1101 {
1102 newValue -= 0.6;
1103 }
1104
1105 if (GetHealthLevel("WindowBack") == GameConstants.STATE_RUINED)
1106 {
1107 newValue -= 0.6;
1108 }
1109
1110 return Math.Clamp(newValue, 0, 1);
1111 break;
1112 }
1113
1114 return super.OnSound(ctrl, oldValue);
1115 }
1116
1117 override string GetAnimSourceFromSelection(string selection)
1118 {
1119 switch (selection)
1120 {
1121 case "doors_driver":
1122 return "DoorsDriver";
1123 case "doors_codriver":
1124 return "DoorsCoDriver";
1125 case "doors_cargo1":
1126 return "DoorsCargo1";
1127 case "doors_cargo2":
1128 return "DoorsCargo2";
1129 case "doors_hood":
1130 return "DoorsHood";
1131 case "doors_trunk":
1132 return "DoorsTrunk";
1133 }
1134
1135 return "";
1136 }
1137
1138 override bool IsVitalTruckBattery()
1139 {
1140 return false;
1141 }
1142
1143 override bool IsVitalGlowPlug()
1144 {
1145 return false;
1146 }
1147
1148 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
1149 {
1150 switch (currentSeat)
1151 {
1152 case 0:
1153 return nextSeat == 1;
1154
1155 case 1:
1156 return nextSeat == 0;
1157
1158 case 2:
1159 return nextSeat == 3;
1160
1161 case 3:
1162 return nextSeat == 2;
1163 }
1164
1165 return false;
1166 }
1167
1168 override bool CanReachDoorsFromSeat( string pDoorsSelection, int pCurrentSeat )
1169 {
1170 switch (pCurrentSeat)
1171 {
1172 case 0:
1173 return pDoorsSelection == "DoorsDriver";
1174
1175 case 1:
1176 return pDoorsSelection == "DoorsCoDriver";
1177
1178 case 2:
1179 return pDoorsSelection == "DoorsCargo1";
1180
1181 case 3:
1182 return pDoorsSelection == "DoorsCargo2";
1183 }
1184
1185 return false;
1186 }
1187
1188 override void OnDebugSpawn()
1189 {
1193
1194 GetInventory().CreateInInventory("CivSedanWheel");
1195 GetInventory().CreateInInventory("CivSedanWheel");
1196 GetInventory().CreateInInventory("CivSedanWheel");
1197 GetInventory().CreateInInventory("CivSedanWheel");
1198
1199 GetInventory().CreateInInventory("CivSedanDoors_Driver");
1200 GetInventory().CreateInInventory("CivSedanDoors_CoDriver");
1201 GetInventory().CreateInInventory("CivSedanDoors_BackLeft");
1202 GetInventory().CreateInInventory("CivSedanDoors_BackRight");
1203 GetInventory().CreateInInventory("CivSedanHood");
1204 GetInventory().CreateInInventory("CivSedanTrunk");
1205
1206 //-----IN CAR CARGO
1207 GetInventory().CreateInInventory("CivSedanWheel");
1208 GetInventory().CreateInInventory("CivSedanWheel");
1209 }
1210
1211 override float GetPushForceCoefficientMultiplier()
1212 {
1213 return 1.5;
1214 }
1215}
1216
1218{
1219 override void OnDebugSpawn()
1220 {
1224
1225 GetInventory().CreateInInventory("CivSedanWheel");
1226 GetInventory().CreateInInventory("CivSedanWheel");
1227 GetInventory().CreateInInventory("CivSedanWheel");
1228 GetInventory().CreateInInventory("CivSedanWheel");
1229
1230 GetInventory().CreateInInventory("CivSedanDoors_Driver_Wine");
1231 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Wine");
1232 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Wine");
1233 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Wine");
1234 GetInventory().CreateInInventory("CivSedanHood_Wine");
1235 GetInventory().CreateInInventory("CivSedanTrunk_Wine");
1236
1237 //-----IN CAR CARGO
1238 GetInventory().CreateInInventory("CivSedanWheel");
1239 GetInventory().CreateInInventory("CivSedanWheel");
1240 }
1241}
1242
1244{
1245 override void OnDebugSpawn()
1246 {
1250
1251 GetInventory().CreateInInventory("CivSedanWheel");
1252 GetInventory().CreateInInventory("CivSedanWheel");
1253 GetInventory().CreateInInventory("CivSedanWheel");
1254 GetInventory().CreateInInventory("CivSedanWheel");
1255
1256 GetInventory().CreateInInventory("CivSedanDoors_Driver_Black");
1257 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Black");
1258 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Black");
1259 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Black");
1260 GetInventory().CreateInInventory("CivSedanHood_Black");
1261 GetInventory().CreateInInventory("CivSedanTrunk_Black");
1262
1263 //-----IN CAR CARGO
1264 GetInventory().CreateInInventory("CivSedanWheel");
1265 GetInventory().CreateInInventory("CivSedanWheel");
1266 }
1267}

◆ CanReleaseAttachment()

override bool CanReleaseAttachment ( EntityAI attachment)
protected
546{
550
551 void CivilianSedan()
552 {
553 //m_dmgContactCoef = 0.065;
554
555 m_EngineStartOK = "CivilianSedan_engine_start_SoundSet";
556 m_EngineStartBattery = "CivilianSedan_engine_failed_start_battery_SoundSet";
557 m_EngineStartPlug = "CivilianSedan_engine_failed_start_sparkplugs_SoundSet";
558 m_EngineStartFuel = "CivilianSedan_engine_failed_start_fuel_SoundSet";
559 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
560
561 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
562 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
563
564 m_CarHornShortSoundName = "CivilianSedan_Horn_Short_SoundSet";
565 m_CarHornLongSoundName = "CivilianSedan_Horn_SoundSet";
566
567 SetEnginePos("0 0.7 1.6");
568 }
569
570 override void EEInit()
571 {
572 super.EEInit();
573
574 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
575 {
577 m_UTSSettings.m_ManualUpdate = true;
578 m_UTSSettings.m_TemperatureMin = 0;
579 m_UTSSettings.m_TemperatureMax = 30;
581 m_UTSSettings.m_TemperatureCap = 0;
582 m_UTSSettings.m_RangeFull = 0.5;
583 m_UTSSettings.m_RangeMax = 2;
584
587 }
588 }
589
590 override void OnEngineStart()
591 {
592 super.OnEngineStart();
593
594 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
595 {
596 m_UTSource.SetDefferedActive(true, 20.0);
597 }
598 }
599
600 override void OnEngineStop()
601 {
602 super.OnEngineStop();
603
604 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
605 {
606 m_UTSource.SetDefferedActive(false, 10.0);
607 }
608 }
609
610 override void EOnPostSimulate(IEntity other, float timeSlice)
611 {
612 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
613 {
614 if (m_UTSource.IsActive())
615 {
617 }
618 }
619 }
620
621 override int GetAnimInstance()
622 {
623 return VehicleAnimInstances.SEDAN;
624 }
625
626 override float GetTransportCameraDistance()
627 {
628 return 4.5;
629 }
630
631 override int GetSeatAnimationType(int posIdx)
632 {
633 switch (posIdx)
634 {
635 case 0:
636 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
637 case 1:
638 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
639 case 2:
640 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
641 case 3:
642 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
643 }
644
645 return 0;
646 }
647
648 // Override for car-specific light type
650 {
651 return CarLightBase.Cast( ScriptedLightBase.CreateLight(CivilianSedanFrontLight) );
652 }
653
654 // Override for car-specific light type
656 {
657 return CarRearLightBase.Cast( ScriptedLightBase.CreateLight(CivilianSedanRearLight) );
658 }
659
661 {
662 if( !super.CanReleaseAttachment( attachment ) )
663 return false;
664
665 string attType = attachment.GetType();
666
667 if ( EngineIsOn() || GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED )
668 {
669 if ( attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
670 return false;
671 }
672
673 return true;
674 }
675
676 override protected bool CanManipulateSpareWheel(string slotSelectionName)
677 {
678 return GetCarDoorsState("CivSedanTrunk") != CarDoorState.DOORS_CLOSED;
679 }
680
681 override bool CanDisplayAttachmentCategory(string category_name)
682 {
683 //super
684 if (!super.CanDisplayAttachmentCategory(category_name))
685 return false;
686 //
687
688 category_name.ToLower();
689 if (category_name.Contains("engine"))
690 {
691 if (GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED)
692 return false;
693 }
694
695 return true;
696 }
697
698 override bool CanDisplayCargo()
699 {
700 if ( !super.CanDisplayCargo() )
701 return false;
702
703 if ( GetCarDoorsState("CivSedanTrunk") == CarDoorState.DOORS_CLOSED )
704 return false;
705
706 return true;
707 }
708
709 override int GetCarDoorsState( string slotType )
710 {
712
713 Class.CastTo( carDoor, FindAttachmentBySlotName( slotType ) );
714 if (!carDoor)
715 {
716 return CarDoorState.DOORS_MISSING;
717 }
718
719 switch (slotType)
720 {
721 case "CivSedanDriverDoors":
722 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
723 break;
724
725 case "CivSedanCoDriverDoors":
726 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
727 break;
728
729 case "CivSedanCargo1Doors":
730 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
731 break;
732
733 case "CivSedanCargo2Doors":
734 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
735 break;
736
737 case "CivSedanTrunk":
738 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
739 break;
740
741 case "CivSedanHood":
742 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
743 break;
744 }
745
746 return CarDoorState.DOORS_MISSING;
747 }
748
749
750 override bool CrewCanGetThrough( int posIdx )
751 {
752 switch( posIdx )
753 {
754 case 0:
755 if ( GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED )
756 return false;
757
758 return true;
759 break;
760
761 case 1:
762 if ( GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED )
763 return false;
764
765 return true;
766 break;
767
768 case 2:
769 if ( GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED )
770 return false;
771
772 return true;
773 break;
774
775 case 3:
776 if ( GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED )
777 return false;
778
779 return true;
780 break;
781 }
782
783 return false;
784 }
785
786 override string GetDoorSelectionNameFromSeatPos(int posIdx)
787 {
788 switch( posIdx )
789 {
790 case 0:
791 return "doors_driver";
792 break;
793 case 1:
794 return "doors_codriver";
795 break;
796 case 2:
797 return "doors_cargo1";
798 break;
799 case 3:
800 return "doors_cargo2";
801 break;
802 }
803
804 return super.GetDoorSelectionNameFromSeatPos(posIdx);
805 }
806
807 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
808 {
809 switch( posIdx )
810 {
811 case 0:
812 return "CivSedanDriverDoors";
813 break;
814 case 1:
815 return "CivSedanCoDriverDoors";
816 break;
817 case 2:
818 return "CivSedanCargo1Doors";
819 break;
820 case 3:
821 return "CivSedanCargo2Doors";
822 break;
823 }
824
825 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
826 }
827
828 // 0 full ambient and engine sound
829 // 1 zero ambient and engine sound
830 override float OnSound(CarSoundCtrl ctrl, float oldValue)
831 {
832 switch (ctrl)
833 {
834 case CarSoundCtrl.DOORS:
835 float newValue = 0;
836 if (GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED)
837 {
838 newValue += 0.25;
839 }
840
841 if (GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED)
842 {
843 newValue += 0.25;
844 }
845
846 if (GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED)
847 {
848 newValue += 0.25;
849 }
850
851 if (GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED)
852 {
853 newValue += 0.25;
854 }
855
856 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
857 {
858 newValue -= 0.6;
859 }
860
861 if (GetHealthLevel("WindowBack") == GameConstants.STATE_RUINED)
862 {
863 newValue -= 0.6;
864 }
865
866 return Math.Clamp(newValue, 0, 1);
867 break;
868 }
869
870 return super.OnSound(ctrl, oldValue);
871 }
872
873 override string GetAnimSourceFromSelection(string selection)
874 {
875 switch (selection)
876 {
877 case "doors_driver":
878 return "DoorsDriver";
879 case "doors_codriver":
880 return "DoorsCoDriver";
881 case "doors_cargo1":
882 return "DoorsCargo1";
883 case "doors_cargo2":
884 return "DoorsCargo2";
885 case "doors_hood":
886 return "DoorsHood";
887 case "doors_trunk":
888 return "DoorsTrunk";
889 }
890
891 return "";
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("CivSedanWheel");
951 GetInventory().CreateInInventory("CivSedanWheel");
952 GetInventory().CreateInInventory("CivSedanWheel");
953 GetInventory().CreateInInventory("CivSedanWheel");
954
955 GetInventory().CreateInInventory("CivSedanDoors_Driver");
956 GetInventory().CreateInInventory("CivSedanDoors_CoDriver");
957 GetInventory().CreateInInventory("CivSedanDoors_BackLeft");
958 GetInventory().CreateInInventory("CivSedanDoors_BackRight");
959 GetInventory().CreateInInventory("CivSedanHood");
960 GetInventory().CreateInInventory("CivSedanTrunk");
961
962 //-----IN CAR CARGO
963 GetInventory().CreateInInventory("CivSedanWheel");
964 GetInventory().CreateInInventory("CivSedanWheel");
965 }
966
967 override float GetPushForceCoefficientMultiplier()
968 {
969 return 1.5;
970 }
971}
972
974{
975 override void OnDebugSpawn()
976 {
980
981 GetInventory().CreateInInventory("CivSedanWheel");
982 GetInventory().CreateInInventory("CivSedanWheel");
983 GetInventory().CreateInInventory("CivSedanWheel");
984 GetInventory().CreateInInventory("CivSedanWheel");
985
986 GetInventory().CreateInInventory("CivSedanDoors_Driver_Wine");
987 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Wine");
988 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Wine");
989 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Wine");
990 GetInventory().CreateInInventory("CivSedanHood_Wine");
991 GetInventory().CreateInInventory("CivSedanTrunk_Wine");
992
993 //-----IN CAR CARGO
994 GetInventory().CreateInInventory("CivSedanWheel");
995 GetInventory().CreateInInventory("CivSedanWheel");
996 }
997}
998
1000{
1001 override void OnDebugSpawn()
1002 {
1006
1007 GetInventory().CreateInInventory("CivSedanWheel");
1008 GetInventory().CreateInInventory("CivSedanWheel");
1009 GetInventory().CreateInInventory("CivSedanWheel");
1010 GetInventory().CreateInInventory("CivSedanWheel");
1011
1012 GetInventory().CreateInInventory("CivSedanDoors_Driver_Black");
1013 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Black");
1014 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Black");
1015 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Black");
1016 GetInventory().CreateInInventory("CivSedanHood_Black");
1017 GetInventory().CreateInInventory("CivSedanTrunk_Black");
1018
1019 //-----IN CAR CARGO
1020 GetInventory().CreateInInventory("CivSedanWheel");
1021 GetInventory().CreateInInventory("CivSedanWheel");
1022 }
1023}

◆ CivilianSedan()

void CivilianSedan ( )
protected

◆ CreateFrontLight()

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

◆ CreateRearLight()

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

◆ CrewCanGetThrough()

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

◆ EEInit()

override void EEInit ( )
protected
456{
457 override void OnDebugSpawn()
458 {
462
463 GetInventory().CreateInInventory("CivSedanWheel");
464 GetInventory().CreateInInventory("CivSedanWheel");
465 GetInventory().CreateInInventory("CivSedanWheel");
466 GetInventory().CreateInInventory("CivSedanWheel");
467
468 GetInventory().CreateInInventory("CivSedanDoors_Driver_Black");
469 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Black");
470 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Black");
471 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Black");
472 GetInventory().CreateInInventory("CivSedanHood_Black");
473 GetInventory().CreateInInventory("CivSedanTrunk_Black");

◆ EOnPostSimulate()

override void EOnPostSimulate ( IEntity other,
float timeSlice )
protected
496{
500
501 void CivilianSedan()
502 {
503 //m_dmgContactCoef = 0.065;
504
505 m_EngineStartOK = "CivilianSedan_engine_start_SoundSet";
506 m_EngineStartBattery = "CivilianSedan_engine_failed_start_battery_SoundSet";
507 m_EngineStartPlug = "CivilianSedan_engine_failed_start_sparkplugs_SoundSet";
508 m_EngineStartFuel = "CivilianSedan_engine_failed_start_fuel_SoundSet";
509 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
510
511 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
512 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
513
514 m_CarHornShortSoundName = "CivilianSedan_Horn_Short_SoundSet";
515 m_CarHornLongSoundName = "CivilianSedan_Horn_SoundSet";
516
517 SetEnginePos("0 0.7 1.6");
518 }
519
520 override void EEInit()
521 {
522 super.EEInit();
523
524 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
525 {
527 m_UTSSettings.m_ManualUpdate = true;
528 m_UTSSettings.m_TemperatureMin = 0;
529 m_UTSSettings.m_TemperatureMax = 30;
531 m_UTSSettings.m_TemperatureCap = 0;
532 m_UTSSettings.m_RangeFull = 0.5;
533 m_UTSSettings.m_RangeMax = 2;
534
537 }
538 }
539
540 override void OnEngineStart()
541 {
542 super.OnEngineStart();
543
544 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
545 {
546 m_UTSource.SetDefferedActive(true, 20.0);
547 }
548 }
549
550 override void OnEngineStop()
551 {
552 super.OnEngineStop();
553
554 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
555 {
556 m_UTSource.SetDefferedActive(false, 10.0);
557 }
558 }
559
560 override void EOnPostSimulate(IEntity other, float timeSlice)
561 {
562 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
563 {
564 if (m_UTSource.IsActive())
565 {
567 }
568 }
569 }
570
571 override int GetAnimInstance()
572 {
573 return VehicleAnimInstances.SEDAN;
574 }
575
576 override float GetTransportCameraDistance()
577 {
578 return 4.5;
579 }
580
581 override int GetSeatAnimationType(int posIdx)
582 {
583 switch (posIdx)
584 {
585 case 0:
586 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
587 case 1:
588 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
589 case 2:
590 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
591 case 3:
592 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
593 }
594
595 return 0;
596 }
597
598 // Override for car-specific light type
600 {
601 return CarLightBase.Cast( ScriptedLightBase.CreateLight(CivilianSedanFrontLight) );
602 }
603
604 // Override for car-specific light type
606 {
607 return CarRearLightBase.Cast( ScriptedLightBase.CreateLight(CivilianSedanRearLight) );
608 }
609
611 {
612 if( !super.CanReleaseAttachment( attachment ) )
613 return false;
614
615 string attType = attachment.GetType();
616
617 if ( EngineIsOn() || GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED )
618 {
619 if ( attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
620 return false;
621 }
622
623 return true;
624 }
625
626 override protected bool CanManipulateSpareWheel(string slotSelectionName)
627 {
628 return GetCarDoorsState("CivSedanTrunk") != CarDoorState.DOORS_CLOSED;
629 }
630
631 override bool CanDisplayAttachmentCategory(string category_name)
632 {
633 //super
634 if (!super.CanDisplayAttachmentCategory(category_name))
635 return false;
636 //
637
638 category_name.ToLower();
639 if (category_name.Contains("engine"))
640 {
641 if (GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED)
642 return false;
643 }
644
645 return true;
646 }
647
648 override bool CanDisplayCargo()
649 {
650 if ( !super.CanDisplayCargo() )
651 return false;
652
653 if ( GetCarDoorsState("CivSedanTrunk") == CarDoorState.DOORS_CLOSED )
654 return false;
655
656 return true;
657 }
658
659 override int GetCarDoorsState( string slotType )
660 {
662
663 Class.CastTo( carDoor, FindAttachmentBySlotName( slotType ) );
664 if (!carDoor)
665 {
666 return CarDoorState.DOORS_MISSING;
667 }
668
669 switch (slotType)
670 {
671 case "CivSedanDriverDoors":
672 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
673 break;
674
675 case "CivSedanCoDriverDoors":
676 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
677 break;
678
679 case "CivSedanCargo1Doors":
680 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
681 break;
682
683 case "CivSedanCargo2Doors":
684 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
685 break;
686
687 case "CivSedanTrunk":
688 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
689 break;
690
691 case "CivSedanHood":
692 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
693 break;
694 }
695
696 return CarDoorState.DOORS_MISSING;
697 }
698
699
700 override bool CrewCanGetThrough( int posIdx )
701 {
702 switch( posIdx )
703 {
704 case 0:
705 if ( GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED )
706 return false;
707
708 return true;
709 break;
710
711 case 1:
712 if ( GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED )
713 return false;
714
715 return true;
716 break;
717
718 case 2:
719 if ( GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED )
720 return false;
721
722 return true;
723 break;
724
725 case 3:
726 if ( GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED )
727 return false;
728
729 return true;
730 break;
731 }
732
733 return false;
734 }
735
736 override string GetDoorSelectionNameFromSeatPos(int posIdx)
737 {
738 switch( posIdx )
739 {
740 case 0:
741 return "doors_driver";
742 break;
743 case 1:
744 return "doors_codriver";
745 break;
746 case 2:
747 return "doors_cargo1";
748 break;
749 case 3:
750 return "doors_cargo2";
751 break;
752 }
753
754 return super.GetDoorSelectionNameFromSeatPos(posIdx);
755 }
756
757 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
758 {
759 switch( posIdx )
760 {
761 case 0:
762 return "CivSedanDriverDoors";
763 break;
764 case 1:
765 return "CivSedanCoDriverDoors";
766 break;
767 case 2:
768 return "CivSedanCargo1Doors";
769 break;
770 case 3:
771 return "CivSedanCargo2Doors";
772 break;
773 }
774
775 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
776 }
777
778 // 0 full ambient and engine sound
779 // 1 zero ambient and engine sound
780 override float OnSound(CarSoundCtrl ctrl, float oldValue)
781 {
782 switch (ctrl)
783 {
784 case CarSoundCtrl.DOORS:
785 float newValue = 0;
786 if (GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED)
787 {
788 newValue += 0.25;
789 }
790
791 if (GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED)
792 {
793 newValue += 0.25;
794 }
795
796 if (GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED)
797 {
798 newValue += 0.25;
799 }
800
801 if (GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED)
802 {
803 newValue += 0.25;
804 }
805
806 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
807 {
808 newValue -= 0.6;
809 }
810
811 if (GetHealthLevel("WindowBack") == GameConstants.STATE_RUINED)
812 {
813 newValue -= 0.6;
814 }
815
816 return Math.Clamp(newValue, 0, 1);
817 break;
818 }
819
820 return super.OnSound(ctrl, oldValue);
821 }
822
823 override string GetAnimSourceFromSelection(string selection)
824 {
825 switch (selection)
826 {
827 case "doors_driver":
828 return "DoorsDriver";
829 case "doors_codriver":
830 return "DoorsCoDriver";
831 case "doors_cargo1":
832 return "DoorsCargo1";
833 case "doors_cargo2":
834 return "DoorsCargo2";
835 case "doors_hood":
836 return "DoorsHood";
837 case "doors_trunk":
838 return "DoorsTrunk";
839 }
840
841 return "";
842 }
843
844 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("CivSedanWheel");
901 GetInventory().CreateInInventory("CivSedanWheel");
902 GetInventory().CreateInInventory("CivSedanWheel");
903 GetInventory().CreateInInventory("CivSedanWheel");
904
905 GetInventory().CreateInInventory("CivSedanDoors_Driver");
906 GetInventory().CreateInInventory("CivSedanDoors_CoDriver");
907 GetInventory().CreateInInventory("CivSedanDoors_BackLeft");
908 GetInventory().CreateInInventory("CivSedanDoors_BackRight");
909 GetInventory().CreateInInventory("CivSedanHood");
910 GetInventory().CreateInInventory("CivSedanTrunk");
911
912 //-----IN CAR CARGO
913 GetInventory().CreateInInventory("CivSedanWheel");
914 GetInventory().CreateInInventory("CivSedanWheel");
915 }
916
917 override float GetPushForceCoefficientMultiplier()
918 {
919 return 1.5;
920 }
921}
922
924{
925 override void OnDebugSpawn()
926 {
930
931 GetInventory().CreateInInventory("CivSedanWheel");
932 GetInventory().CreateInInventory("CivSedanWheel");
933 GetInventory().CreateInInventory("CivSedanWheel");
934 GetInventory().CreateInInventory("CivSedanWheel");
935
936 GetInventory().CreateInInventory("CivSedanDoors_Driver_Wine");
937 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Wine");
938 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Wine");
939 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Wine");
940 GetInventory().CreateInInventory("CivSedanHood_Wine");
941 GetInventory().CreateInInventory("CivSedanTrunk_Wine");
942
943 //-----IN CAR CARGO
944 GetInventory().CreateInInventory("CivSedanWheel");
945 GetInventory().CreateInInventory("CivSedanWheel");
946 }
947}
948
950{
951 override void OnDebugSpawn()
952 {
956
957 GetInventory().CreateInInventory("CivSedanWheel");
958 GetInventory().CreateInInventory("CivSedanWheel");
959 GetInventory().CreateInInventory("CivSedanWheel");
960 GetInventory().CreateInInventory("CivSedanWheel");
961
962 GetInventory().CreateInInventory("CivSedanDoors_Driver_Black");
963 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Black");
964 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Black");
965 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Black");
966 GetInventory().CreateInInventory("CivSedanHood_Black");
967 GetInventory().CreateInInventory("CivSedanTrunk_Black");
968
969 //-----IN CAR CARGO
970 GetInventory().CreateInInventory("CivSedanWheel");
971 GetInventory().CreateInInventory("CivSedanWheel");
972 }
973}

◆ GetAnimInstance()

override int GetAnimInstance ( )
protected
507{
511
512 void CivilianSedan()
513 {
514 //m_dmgContactCoef = 0.065;
515
516 m_EngineStartOK = "CivilianSedan_engine_start_SoundSet";
517 m_EngineStartBattery = "CivilianSedan_engine_failed_start_battery_SoundSet";
518 m_EngineStartPlug = "CivilianSedan_engine_failed_start_sparkplugs_SoundSet";
519 m_EngineStartFuel = "CivilianSedan_engine_failed_start_fuel_SoundSet";
520 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
521
522 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
523 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
524
525 m_CarHornShortSoundName = "CivilianSedan_Horn_Short_SoundSet";
526 m_CarHornLongSoundName = "CivilianSedan_Horn_SoundSet";
527
528 SetEnginePos("0 0.7 1.6");
529 }
530
531 override void EEInit()
532 {
533 super.EEInit();
534
535 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
536 {
538 m_UTSSettings.m_ManualUpdate = true;
539 m_UTSSettings.m_TemperatureMin = 0;
540 m_UTSSettings.m_TemperatureMax = 30;
542 m_UTSSettings.m_TemperatureCap = 0;
543 m_UTSSettings.m_RangeFull = 0.5;
544 m_UTSSettings.m_RangeMax = 2;
545
548 }
549 }
550
551 override void OnEngineStart()
552 {
553 super.OnEngineStart();
554
555 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
556 {
557 m_UTSource.SetDefferedActive(true, 20.0);
558 }
559 }
560
561 override void OnEngineStop()
562 {
563 super.OnEngineStop();
564
565 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
566 {
567 m_UTSource.SetDefferedActive(false, 10.0);
568 }
569 }
570
571 override void EOnPostSimulate(IEntity other, float timeSlice)
572 {
573 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
574 {
575 if (m_UTSource.IsActive())
576 {
578 }
579 }
580 }
581
582 override int GetAnimInstance()
583 {
584 return VehicleAnimInstances.SEDAN;
585 }
586
587 override float GetTransportCameraDistance()
588 {
589 return 4.5;
590 }
591
592 override int GetSeatAnimationType(int posIdx)
593 {
594 switch (posIdx)
595 {
596 case 0:
597 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
598 case 1:
599 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
600 case 2:
601 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
602 case 3:
603 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
604 }
605
606 return 0;
607 }
608
609 // Override for car-specific light type
611 {
612 return CarLightBase.Cast( ScriptedLightBase.CreateLight(CivilianSedanFrontLight) );
613 }
614
615 // Override for car-specific light type
617 {
618 return CarRearLightBase.Cast( ScriptedLightBase.CreateLight(CivilianSedanRearLight) );
619 }
620
622 {
623 if( !super.CanReleaseAttachment( attachment ) )
624 return false;
625
626 string attType = attachment.GetType();
627
628 if ( EngineIsOn() || GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED )
629 {
630 if ( attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
631 return false;
632 }
633
634 return true;
635 }
636
637 override protected bool CanManipulateSpareWheel(string slotSelectionName)
638 {
639 return GetCarDoorsState("CivSedanTrunk") != CarDoorState.DOORS_CLOSED;
640 }
641
642 override bool CanDisplayAttachmentCategory(string category_name)
643 {
644 //super
645 if (!super.CanDisplayAttachmentCategory(category_name))
646 return false;
647 //
648
649 category_name.ToLower();
650 if (category_name.Contains("engine"))
651 {
652 if (GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED)
653 return false;
654 }
655
656 return true;
657 }
658
659 override bool CanDisplayCargo()
660 {
661 if ( !super.CanDisplayCargo() )
662 return false;
663
664 if ( GetCarDoorsState("CivSedanTrunk") == CarDoorState.DOORS_CLOSED )
665 return false;
666
667 return true;
668 }
669
670 override int GetCarDoorsState( string slotType )
671 {
673
674 Class.CastTo( carDoor, FindAttachmentBySlotName( slotType ) );
675 if (!carDoor)
676 {
677 return CarDoorState.DOORS_MISSING;
678 }
679
680 switch (slotType)
681 {
682 case "CivSedanDriverDoors":
683 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
684 break;
685
686 case "CivSedanCoDriverDoors":
687 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
688 break;
689
690 case "CivSedanCargo1Doors":
691 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
692 break;
693
694 case "CivSedanCargo2Doors":
695 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
696 break;
697
698 case "CivSedanTrunk":
699 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
700 break;
701
702 case "CivSedanHood":
703 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
704 break;
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("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED )
717 return false;
718
719 return true;
720 break;
721
722 case 1:
723 if ( GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED )
724 return false;
725
726 return true;
727 break;
728
729 case 2:
730 if ( GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED )
731 return false;
732
733 return true;
734 break;
735
736 case 3:
737 if ( GetCarDoorsState("CivSedanCargo2Doors") == 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 "CivSedanDriverDoors";
774 break;
775 case 1:
776 return "CivSedanCoDriverDoors";
777 break;
778 case 2:
779 return "CivSedanCargo1Doors";
780 break;
781 case 3:
782 return "CivSedanCargo2Doors";
783 break;
784 }
785
786 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
787 }
788
789 // 0 full ambient and engine sound
790 // 1 zero ambient and engine sound
791 override float OnSound(CarSoundCtrl ctrl, float oldValue)
792 {
793 switch (ctrl)
794 {
795 case CarSoundCtrl.DOORS:
796 float newValue = 0;
797 if (GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED)
798 {
799 newValue += 0.25;
800 }
801
802 if (GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED)
803 {
804 newValue += 0.25;
805 }
806
807 if (GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED)
808 {
809 newValue += 0.25;
810 }
811
812 if (GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED)
813 {
814 newValue += 0.25;
815 }
816
817 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
818 {
819 newValue -= 0.6;
820 }
821
822 if (GetHealthLevel("WindowBack") == GameConstants.STATE_RUINED)
823 {
824 newValue -= 0.6;
825 }
826
827 return Math.Clamp(newValue, 0, 1);
828 break;
829 }
830
831 return super.OnSound(ctrl, oldValue);
832 }
833
834 override string GetAnimSourceFromSelection(string selection)
835 {
836 switch (selection)
837 {
838 case "doors_driver":
839 return "DoorsDriver";
840 case "doors_codriver":
841 return "DoorsCoDriver";
842 case "doors_cargo1":
843 return "DoorsCargo1";
844 case "doors_cargo2":
845 return "DoorsCargo2";
846 case "doors_hood":
847 return "DoorsHood";
848 case "doors_trunk":
849 return "DoorsTrunk";
850 }
851
852 return "";
853 }
854
855 override bool IsVitalTruckBattery()
856 {
857 return false;
858 }
859
860 override bool IsVitalGlowPlug()
861 {
862 return false;
863 }
864
865 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
866 {
867 switch (currentSeat)
868 {
869 case 0:
870 return nextSeat == 1;
871
872 case 1:
873 return nextSeat == 0;
874
875 case 2:
876 return nextSeat == 3;
877
878 case 3:
879 return nextSeat == 2;
880 }
881
882 return false;
883 }
884
885 override bool CanReachDoorsFromSeat( string pDoorsSelection, int pCurrentSeat )
886 {
887 switch (pCurrentSeat)
888 {
889 case 0:
890 return pDoorsSelection == "DoorsDriver";
891
892 case 1:
893 return pDoorsSelection == "DoorsCoDriver";
894
895 case 2:
896 return pDoorsSelection == "DoorsCargo1";
897
898 case 3:
899 return pDoorsSelection == "DoorsCargo2";
900 }
901
902 return false;
903 }
904
905 override void OnDebugSpawn()
906 {
910
911 GetInventory().CreateInInventory("CivSedanWheel");
912 GetInventory().CreateInInventory("CivSedanWheel");
913 GetInventory().CreateInInventory("CivSedanWheel");
914 GetInventory().CreateInInventory("CivSedanWheel");
915
916 GetInventory().CreateInInventory("CivSedanDoors_Driver");
917 GetInventory().CreateInInventory("CivSedanDoors_CoDriver");
918 GetInventory().CreateInInventory("CivSedanDoors_BackLeft");
919 GetInventory().CreateInInventory("CivSedanDoors_BackRight");
920 GetInventory().CreateInInventory("CivSedanHood");
921 GetInventory().CreateInInventory("CivSedanTrunk");
922
923 //-----IN CAR CARGO
924 GetInventory().CreateInInventory("CivSedanWheel");
925 GetInventory().CreateInInventory("CivSedanWheel");
926 }
927
928 override float GetPushForceCoefficientMultiplier()
929 {
930 return 1.5;
931 }
932}
933
935{
936 override void OnDebugSpawn()
937 {
941
942 GetInventory().CreateInInventory("CivSedanWheel");
943 GetInventory().CreateInInventory("CivSedanWheel");
944 GetInventory().CreateInInventory("CivSedanWheel");
945 GetInventory().CreateInInventory("CivSedanWheel");
946
947 GetInventory().CreateInInventory("CivSedanDoors_Driver_Wine");
948 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Wine");
949 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Wine");
950 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Wine");
951 GetInventory().CreateInInventory("CivSedanHood_Wine");
952 GetInventory().CreateInInventory("CivSedanTrunk_Wine");
953
954 //-----IN CAR CARGO
955 GetInventory().CreateInInventory("CivSedanWheel");
956 GetInventory().CreateInInventory("CivSedanWheel");
957 }
958}
959
961{
962 override void OnDebugSpawn()
963 {
967
968 GetInventory().CreateInInventory("CivSedanWheel");
969 GetInventory().CreateInInventory("CivSedanWheel");
970 GetInventory().CreateInInventory("CivSedanWheel");
971 GetInventory().CreateInInventory("CivSedanWheel");
972
973 GetInventory().CreateInInventory("CivSedanDoors_Driver_Black");
974 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Black");
975 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Black");
976 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Black");
977 GetInventory().CreateInInventory("CivSedanHood_Black");
978 GetInventory().CreateInInventory("CivSedanTrunk_Black");
979
980 //-----IN CAR CARGO
981 GetInventory().CreateInInventory("CivSedanWheel");
982 GetInventory().CreateInInventory("CivSedanWheel");
983 }
984}

◆ GetAnimSourceFromSelection()

override string GetAnimSourceFromSelection ( string selection)
protected
759{
763
764 void CivilianSedan()
765 {
766 //m_dmgContactCoef = 0.065;
767
768 m_EngineStartOK = "CivilianSedan_engine_start_SoundSet";
769 m_EngineStartBattery = "CivilianSedan_engine_failed_start_battery_SoundSet";
770 m_EngineStartPlug = "CivilianSedan_engine_failed_start_sparkplugs_SoundSet";
771 m_EngineStartFuel = "CivilianSedan_engine_failed_start_fuel_SoundSet";
772 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
773
774 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
775 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
776
777 m_CarHornShortSoundName = "CivilianSedan_Horn_Short_SoundSet";
778 m_CarHornLongSoundName = "CivilianSedan_Horn_SoundSet";
779
780 SetEnginePos("0 0.7 1.6");
781 }
782
783 override void EEInit()
784 {
785 super.EEInit();
786
787 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
788 {
790 m_UTSSettings.m_ManualUpdate = true;
791 m_UTSSettings.m_TemperatureMin = 0;
792 m_UTSSettings.m_TemperatureMax = 30;
794 m_UTSSettings.m_TemperatureCap = 0;
795 m_UTSSettings.m_RangeFull = 0.5;
796 m_UTSSettings.m_RangeMax = 2;
797
800 }
801 }
802
803 override void OnEngineStart()
804 {
805 super.OnEngineStart();
806
807 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
808 {
809 m_UTSource.SetDefferedActive(true, 20.0);
810 }
811 }
812
813 override void OnEngineStop()
814 {
815 super.OnEngineStop();
816
817 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
818 {
819 m_UTSource.SetDefferedActive(false, 10.0);
820 }
821 }
822
823 override void EOnPostSimulate(IEntity other, float timeSlice)
824 {
825 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
826 {
827 if (m_UTSource.IsActive())
828 {
830 }
831 }
832 }
833
834 override int GetAnimInstance()
835 {
836 return VehicleAnimInstances.SEDAN;
837 }
838
839 override float GetTransportCameraDistance()
840 {
841 return 4.5;
842 }
843
844 override int GetSeatAnimationType(int posIdx)
845 {
846 switch (posIdx)
847 {
848 case 0:
849 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
850 case 1:
851 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
852 case 2:
853 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
854 case 3:
855 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
856 }
857
858 return 0;
859 }
860
861 // Override for car-specific light type
863 {
864 return CarLightBase.Cast( ScriptedLightBase.CreateLight(CivilianSedanFrontLight) );
865 }
866
867 // Override for car-specific light type
869 {
870 return CarRearLightBase.Cast( ScriptedLightBase.CreateLight(CivilianSedanRearLight) );
871 }
872
874 {
875 if( !super.CanReleaseAttachment( attachment ) )
876 return false;
877
878 string attType = attachment.GetType();
879
880 if ( EngineIsOn() || GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED )
881 {
882 if ( attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
883 return false;
884 }
885
886 return true;
887 }
888
889 override protected bool CanManipulateSpareWheel(string slotSelectionName)
890 {
891 return GetCarDoorsState("CivSedanTrunk") != CarDoorState.DOORS_CLOSED;
892 }
893
894 override bool CanDisplayAttachmentCategory(string category_name)
895 {
896 //super
897 if (!super.CanDisplayAttachmentCategory(category_name))
898 return false;
899 //
900
901 category_name.ToLower();
902 if (category_name.Contains("engine"))
903 {
904 if (GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED)
905 return false;
906 }
907
908 return true;
909 }
910
911 override bool CanDisplayCargo()
912 {
913 if ( !super.CanDisplayCargo() )
914 return false;
915
916 if ( GetCarDoorsState("CivSedanTrunk") == 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 "CivSedanDriverDoors":
935 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
936 break;
937
938 case "CivSedanCoDriverDoors":
939 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
940 break;
941
942 case "CivSedanCargo1Doors":
943 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
944 break;
945
946 case "CivSedanCargo2Doors":
947 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
948 break;
949
950 case "CivSedanTrunk":
951 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
952 break;
953
954 case "CivSedanHood":
955 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
956 break;
957 }
958
959 return CarDoorState.DOORS_MISSING;
960 }
961
962
963 override bool CrewCanGetThrough( int posIdx )
964 {
965 switch( posIdx )
966 {
967 case 0:
968 if ( GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED )
969 return false;
970
971 return true;
972 break;
973
974 case 1:
975 if ( GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED )
976 return false;
977
978 return true;
979 break;
980
981 case 2:
982 if ( GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED )
983 return false;
984
985 return true;
986 break;
987
988 case 3:
989 if ( GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED )
990 return false;
991
992 return true;
993 break;
994 }
995
996 return false;
997 }
998
999 override string GetDoorSelectionNameFromSeatPos(int posIdx)
1000 {
1001 switch( posIdx )
1002 {
1003 case 0:
1004 return "doors_driver";
1005 break;
1006 case 1:
1007 return "doors_codriver";
1008 break;
1009 case 2:
1010 return "doors_cargo1";
1011 break;
1012 case 3:
1013 return "doors_cargo2";
1014 break;
1015 }
1016
1017 return super.GetDoorSelectionNameFromSeatPos(posIdx);
1018 }
1019
1020 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
1021 {
1022 switch( posIdx )
1023 {
1024 case 0:
1025 return "CivSedanDriverDoors";
1026 break;
1027 case 1:
1028 return "CivSedanCoDriverDoors";
1029 break;
1030 case 2:
1031 return "CivSedanCargo1Doors";
1032 break;
1033 case 3:
1034 return "CivSedanCargo2Doors";
1035 break;
1036 }
1037
1038 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
1039 }
1040
1041 // 0 full ambient and engine sound
1042 // 1 zero ambient and engine sound
1043 override float OnSound(CarSoundCtrl ctrl, float oldValue)
1044 {
1045 switch (ctrl)
1046 {
1047 case CarSoundCtrl.DOORS:
1048 float newValue = 0;
1049 if (GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED)
1050 {
1051 newValue += 0.25;
1052 }
1053
1054 if (GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED)
1055 {
1056 newValue += 0.25;
1057 }
1058
1059 if (GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED)
1060 {
1061 newValue += 0.25;
1062 }
1063
1064 if (GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED)
1065 {
1066 newValue += 0.25;
1067 }
1068
1069 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
1070 {
1071 newValue -= 0.6;
1072 }
1073
1074 if (GetHealthLevel("WindowBack") == GameConstants.STATE_RUINED)
1075 {
1076 newValue -= 0.6;
1077 }
1078
1079 return Math.Clamp(newValue, 0, 1);
1080 break;
1081 }
1082
1083 return super.OnSound(ctrl, oldValue);
1084 }
1085
1086 override string GetAnimSourceFromSelection(string selection)
1087 {
1088 switch (selection)
1089 {
1090 case "doors_driver":
1091 return "DoorsDriver";
1092 case "doors_codriver":
1093 return "DoorsCoDriver";
1094 case "doors_cargo1":
1095 return "DoorsCargo1";
1096 case "doors_cargo2":
1097 return "DoorsCargo2";
1098 case "doors_hood":
1099 return "DoorsHood";
1100 case "doors_trunk":
1101 return "DoorsTrunk";
1102 }
1103
1104 return "";
1105 }
1106
1107 override bool IsVitalTruckBattery()
1108 {
1109 return false;
1110 }
1111
1112 override bool IsVitalGlowPlug()
1113 {
1114 return false;
1115 }
1116
1117 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
1118 {
1119 switch (currentSeat)
1120 {
1121 case 0:
1122 return nextSeat == 1;
1123
1124 case 1:
1125 return nextSeat == 0;
1126
1127 case 2:
1128 return nextSeat == 3;
1129
1130 case 3:
1131 return nextSeat == 2;
1132 }
1133
1134 return false;
1135 }
1136
1137 override bool CanReachDoorsFromSeat( string pDoorsSelection, int pCurrentSeat )
1138 {
1139 switch (pCurrentSeat)
1140 {
1141 case 0:
1142 return pDoorsSelection == "DoorsDriver";
1143
1144 case 1:
1145 return pDoorsSelection == "DoorsCoDriver";
1146
1147 case 2:
1148 return pDoorsSelection == "DoorsCargo1";
1149
1150 case 3:
1151 return pDoorsSelection == "DoorsCargo2";
1152 }
1153
1154 return false;
1155 }
1156
1157 override void OnDebugSpawn()
1158 {
1162
1163 GetInventory().CreateInInventory("CivSedanWheel");
1164 GetInventory().CreateInInventory("CivSedanWheel");
1165 GetInventory().CreateInInventory("CivSedanWheel");
1166 GetInventory().CreateInInventory("CivSedanWheel");
1167
1168 GetInventory().CreateInInventory("CivSedanDoors_Driver");
1169 GetInventory().CreateInInventory("CivSedanDoors_CoDriver");
1170 GetInventory().CreateInInventory("CivSedanDoors_BackLeft");
1171 GetInventory().CreateInInventory("CivSedanDoors_BackRight");
1172 GetInventory().CreateInInventory("CivSedanHood");
1173 GetInventory().CreateInInventory("CivSedanTrunk");
1174
1175 //-----IN CAR CARGO
1176 GetInventory().CreateInInventory("CivSedanWheel");
1177 GetInventory().CreateInInventory("CivSedanWheel");
1178 }
1179
1180 override float GetPushForceCoefficientMultiplier()
1181 {
1182 return 1.5;
1183 }
1184}
1185
1187{
1188 override void OnDebugSpawn()
1189 {
1193
1194 GetInventory().CreateInInventory("CivSedanWheel");
1195 GetInventory().CreateInInventory("CivSedanWheel");
1196 GetInventory().CreateInInventory("CivSedanWheel");
1197 GetInventory().CreateInInventory("CivSedanWheel");
1198
1199 GetInventory().CreateInInventory("CivSedanDoors_Driver_Wine");
1200 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Wine");
1201 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Wine");
1202 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Wine");
1203 GetInventory().CreateInInventory("CivSedanHood_Wine");
1204 GetInventory().CreateInInventory("CivSedanTrunk_Wine");
1205
1206 //-----IN CAR CARGO
1207 GetInventory().CreateInInventory("CivSedanWheel");
1208 GetInventory().CreateInInventory("CivSedanWheel");
1209 }
1210}
1211
1213{
1214 override void OnDebugSpawn()
1215 {
1219
1220 GetInventory().CreateInInventory("CivSedanWheel");
1221 GetInventory().CreateInInventory("CivSedanWheel");
1222 GetInventory().CreateInInventory("CivSedanWheel");
1223 GetInventory().CreateInInventory("CivSedanWheel");
1224
1225 GetInventory().CreateInInventory("CivSedanDoors_Driver_Black");
1226 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Black");
1227 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Black");
1228 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Black");
1229 GetInventory().CreateInInventory("CivSedanHood_Black");
1230 GetInventory().CreateInInventory("CivSedanTrunk_Black");
1231
1232 //-----IN CAR CARGO
1233 GetInventory().CreateInInventory("CivSedanWheel");
1234 GetInventory().CreateInInventory("CivSedanWheel");
1235 }
1236}

◆ GetCarDoorsState()

override int GetCarDoorsState ( string slotType)
protected
595{
599
600 void CivilianSedan()
601 {
602 //m_dmgContactCoef = 0.065;
603
604 m_EngineStartOK = "CivilianSedan_engine_start_SoundSet";
605 m_EngineStartBattery = "CivilianSedan_engine_failed_start_battery_SoundSet";
606 m_EngineStartPlug = "CivilianSedan_engine_failed_start_sparkplugs_SoundSet";
607 m_EngineStartFuel = "CivilianSedan_engine_failed_start_fuel_SoundSet";
608 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
609
610 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
611 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
612
613 m_CarHornShortSoundName = "CivilianSedan_Horn_Short_SoundSet";
614 m_CarHornLongSoundName = "CivilianSedan_Horn_SoundSet";
615
616 SetEnginePos("0 0.7 1.6");
617 }
618
619 override void EEInit()
620 {
621 super.EEInit();
622
623 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
624 {
626 m_UTSSettings.m_ManualUpdate = true;
627 m_UTSSettings.m_TemperatureMin = 0;
628 m_UTSSettings.m_TemperatureMax = 30;
630 m_UTSSettings.m_TemperatureCap = 0;
631 m_UTSSettings.m_RangeFull = 0.5;
632 m_UTSSettings.m_RangeMax = 2;
633
636 }
637 }
638
639 override void OnEngineStart()
640 {
641 super.OnEngineStart();
642
643 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
644 {
645 m_UTSource.SetDefferedActive(true, 20.0);
646 }
647 }
648
649 override void OnEngineStop()
650 {
651 super.OnEngineStop();
652
653 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
654 {
655 m_UTSource.SetDefferedActive(false, 10.0);
656 }
657 }
658
659 override void EOnPostSimulate(IEntity other, float timeSlice)
660 {
661 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
662 {
663 if (m_UTSource.IsActive())
664 {
666 }
667 }
668 }
669
670 override int GetAnimInstance()
671 {
672 return VehicleAnimInstances.SEDAN;
673 }
674
675 override float GetTransportCameraDistance()
676 {
677 return 4.5;
678 }
679
680 override int GetSeatAnimationType(int posIdx)
681 {
682 switch (posIdx)
683 {
684 case 0:
685 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
686 case 1:
687 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
688 case 2:
689 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
690 case 3:
691 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
692 }
693
694 return 0;
695 }
696
697 // Override for car-specific light type
699 {
700 return CarLightBase.Cast( ScriptedLightBase.CreateLight(CivilianSedanFrontLight) );
701 }
702
703 // Override for car-specific light type
705 {
706 return CarRearLightBase.Cast( ScriptedLightBase.CreateLight(CivilianSedanRearLight) );
707 }
708
710 {
711 if( !super.CanReleaseAttachment( attachment ) )
712 return false;
713
714 string attType = attachment.GetType();
715
716 if ( EngineIsOn() || GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED )
717 {
718 if ( attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
719 return false;
720 }
721
722 return true;
723 }
724
725 override protected bool CanManipulateSpareWheel(string slotSelectionName)
726 {
727 return GetCarDoorsState("CivSedanTrunk") != CarDoorState.DOORS_CLOSED;
728 }
729
730 override bool CanDisplayAttachmentCategory(string category_name)
731 {
732 //super
733 if (!super.CanDisplayAttachmentCategory(category_name))
734 return false;
735 //
736
737 category_name.ToLower();
738 if (category_name.Contains("engine"))
739 {
740 if (GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED)
741 return false;
742 }
743
744 return true;
745 }
746
747 override bool CanDisplayCargo()
748 {
749 if ( !super.CanDisplayCargo() )
750 return false;
751
752 if ( GetCarDoorsState("CivSedanTrunk") == CarDoorState.DOORS_CLOSED )
753 return false;
754
755 return true;
756 }
757
758 override int GetCarDoorsState( string slotType )
759 {
761
762 Class.CastTo( carDoor, FindAttachmentBySlotName( slotType ) );
763 if (!carDoor)
764 {
765 return CarDoorState.DOORS_MISSING;
766 }
767
768 switch (slotType)
769 {
770 case "CivSedanDriverDoors":
771 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
772 break;
773
774 case "CivSedanCoDriverDoors":
775 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
776 break;
777
778 case "CivSedanCargo1Doors":
779 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
780 break;
781
782 case "CivSedanCargo2Doors":
783 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
784 break;
785
786 case "CivSedanTrunk":
787 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
788 break;
789
790 case "CivSedanHood":
791 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
792 break;
793 }
794
795 return CarDoorState.DOORS_MISSING;
796 }
797
798
799 override bool CrewCanGetThrough( int posIdx )
800 {
801 switch( posIdx )
802 {
803 case 0:
804 if ( GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED )
805 return false;
806
807 return true;
808 break;
809
810 case 1:
811 if ( GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED )
812 return false;
813
814 return true;
815 break;
816
817 case 2:
818 if ( GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED )
819 return false;
820
821 return true;
822 break;
823
824 case 3:
825 if ( GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED )
826 return false;
827
828 return true;
829 break;
830 }
831
832 return false;
833 }
834
835 override string GetDoorSelectionNameFromSeatPos(int posIdx)
836 {
837 switch( posIdx )
838 {
839 case 0:
840 return "doors_driver";
841 break;
842 case 1:
843 return "doors_codriver";
844 break;
845 case 2:
846 return "doors_cargo1";
847 break;
848 case 3:
849 return "doors_cargo2";
850 break;
851 }
852
853 return super.GetDoorSelectionNameFromSeatPos(posIdx);
854 }
855
856 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
857 {
858 switch( posIdx )
859 {
860 case 0:
861 return "CivSedanDriverDoors";
862 break;
863 case 1:
864 return "CivSedanCoDriverDoors";
865 break;
866 case 2:
867 return "CivSedanCargo1Doors";
868 break;
869 case 3:
870 return "CivSedanCargo2Doors";
871 break;
872 }
873
874 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
875 }
876
877 // 0 full ambient and engine sound
878 // 1 zero ambient and engine sound
879 override float OnSound(CarSoundCtrl ctrl, float oldValue)
880 {
881 switch (ctrl)
882 {
883 case CarSoundCtrl.DOORS:
884 float newValue = 0;
885 if (GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED)
886 {
887 newValue += 0.25;
888 }
889
890 if (GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED)
891 {
892 newValue += 0.25;
893 }
894
895 if (GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED)
896 {
897 newValue += 0.25;
898 }
899
900 if (GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED)
901 {
902 newValue += 0.25;
903 }
904
905 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
906 {
907 newValue -= 0.6;
908 }
909
910 if (GetHealthLevel("WindowBack") == GameConstants.STATE_RUINED)
911 {
912 newValue -= 0.6;
913 }
914
915 return Math.Clamp(newValue, 0, 1);
916 break;
917 }
918
919 return super.OnSound(ctrl, oldValue);
920 }
921
922 override string GetAnimSourceFromSelection(string selection)
923 {
924 switch (selection)
925 {
926 case "doors_driver":
927 return "DoorsDriver";
928 case "doors_codriver":
929 return "DoorsCoDriver";
930 case "doors_cargo1":
931 return "DoorsCargo1";
932 case "doors_cargo2":
933 return "DoorsCargo2";
934 case "doors_hood":
935 return "DoorsHood";
936 case "doors_trunk":
937 return "DoorsTrunk";
938 }
939
940 return "";
941 }
942
943 override bool IsVitalTruckBattery()
944 {
945 return false;
946 }
947
948 override bool IsVitalGlowPlug()
949 {
950 return false;
951 }
952
953 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
954 {
955 switch (currentSeat)
956 {
957 case 0:
958 return nextSeat == 1;
959
960 case 1:
961 return nextSeat == 0;
962
963 case 2:
964 return nextSeat == 3;
965
966 case 3:
967 return nextSeat == 2;
968 }
969
970 return false;
971 }
972
973 override bool CanReachDoorsFromSeat( string pDoorsSelection, int pCurrentSeat )
974 {
975 switch (pCurrentSeat)
976 {
977 case 0:
978 return pDoorsSelection == "DoorsDriver";
979
980 case 1:
981 return pDoorsSelection == "DoorsCoDriver";
982
983 case 2:
984 return pDoorsSelection == "DoorsCargo1";
985
986 case 3:
987 return pDoorsSelection == "DoorsCargo2";
988 }
989
990 return false;
991 }
992
993 override void OnDebugSpawn()
994 {
998
999 GetInventory().CreateInInventory("CivSedanWheel");
1000 GetInventory().CreateInInventory("CivSedanWheel");
1001 GetInventory().CreateInInventory("CivSedanWheel");
1002 GetInventory().CreateInInventory("CivSedanWheel");
1003
1004 GetInventory().CreateInInventory("CivSedanDoors_Driver");
1005 GetInventory().CreateInInventory("CivSedanDoors_CoDriver");
1006 GetInventory().CreateInInventory("CivSedanDoors_BackLeft");
1007 GetInventory().CreateInInventory("CivSedanDoors_BackRight");
1008 GetInventory().CreateInInventory("CivSedanHood");
1009 GetInventory().CreateInInventory("CivSedanTrunk");
1010
1011 //-----IN CAR CARGO
1012 GetInventory().CreateInInventory("CivSedanWheel");
1013 GetInventory().CreateInInventory("CivSedanWheel");
1014 }
1015
1016 override float GetPushForceCoefficientMultiplier()
1017 {
1018 return 1.5;
1019 }
1020}
1021
1023{
1024 override void OnDebugSpawn()
1025 {
1029
1030 GetInventory().CreateInInventory("CivSedanWheel");
1031 GetInventory().CreateInInventory("CivSedanWheel");
1032 GetInventory().CreateInInventory("CivSedanWheel");
1033 GetInventory().CreateInInventory("CivSedanWheel");
1034
1035 GetInventory().CreateInInventory("CivSedanDoors_Driver_Wine");
1036 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Wine");
1037 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Wine");
1038 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Wine");
1039 GetInventory().CreateInInventory("CivSedanHood_Wine");
1040 GetInventory().CreateInInventory("CivSedanTrunk_Wine");
1041
1042 //-----IN CAR CARGO
1043 GetInventory().CreateInInventory("CivSedanWheel");
1044 GetInventory().CreateInInventory("CivSedanWheel");
1045 }
1046}
1047
1049{
1050 override void OnDebugSpawn()
1051 {
1055
1056 GetInventory().CreateInInventory("CivSedanWheel");
1057 GetInventory().CreateInInventory("CivSedanWheel");
1058 GetInventory().CreateInInventory("CivSedanWheel");
1059 GetInventory().CreateInInventory("CivSedanWheel");
1060
1061 GetInventory().CreateInInventory("CivSedanDoors_Driver_Black");
1062 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Black");
1063 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Black");
1064 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Black");
1065 GetInventory().CreateInInventory("CivSedanHood_Black");
1066 GetInventory().CreateInInventory("CivSedanTrunk_Black");
1067
1068 //-----IN CAR CARGO
1069 GetInventory().CreateInInventory("CivSedanWheel");
1070 GetInventory().CreateInInventory("CivSedanWheel");
1071 }
1072}

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

◆ GetDoorInvSlotNameFromSeatPos()

override string GetDoorInvSlotNameFromSeatPos ( int posIdx)
protected
693{
697
698 void CivilianSedan()
699 {
700 //m_dmgContactCoef = 0.065;
701
702 m_EngineStartOK = "CivilianSedan_engine_start_SoundSet";
703 m_EngineStartBattery = "CivilianSedan_engine_failed_start_battery_SoundSet";
704 m_EngineStartPlug = "CivilianSedan_engine_failed_start_sparkplugs_SoundSet";
705 m_EngineStartFuel = "CivilianSedan_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 = "CivilianSedan_Horn_Short_SoundSet";
712 m_CarHornLongSoundName = "CivilianSedan_Horn_SoundSet";
713
714 SetEnginePos("0 0.7 1.6");
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.SEDAN;
771 }
772
773 override float GetTransportCameraDistance()
774 {
775 return 4.5;
776 }
777
778 override int GetSeatAnimationType(int posIdx)
779 {
780 switch (posIdx)
781 {
782 case 0:
783 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
784 case 1:
785 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
786 case 2:
787 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
788 case 3:
789 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
790 }
791
792 return 0;
793 }
794
795 // Override for car-specific light type
797 {
798 return CarLightBase.Cast( ScriptedLightBase.CreateLight(CivilianSedanFrontLight) );
799 }
800
801 // Override for car-specific light type
803 {
804 return CarRearLightBase.Cast( ScriptedLightBase.CreateLight(CivilianSedanRearLight) );
805 }
806
808 {
809 if( !super.CanReleaseAttachment( attachment ) )
810 return false;
811
812 string attType = attachment.GetType();
813
814 if ( EngineIsOn() || GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED )
815 {
816 if ( attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
817 return false;
818 }
819
820 return true;
821 }
822
823 override protected bool CanManipulateSpareWheel(string slotSelectionName)
824 {
825 return GetCarDoorsState("CivSedanTrunk") != CarDoorState.DOORS_CLOSED;
826 }
827
828 override bool CanDisplayAttachmentCategory(string category_name)
829 {
830 //super
831 if (!super.CanDisplayAttachmentCategory(category_name))
832 return false;
833 //
834
835 category_name.ToLower();
836 if (category_name.Contains("engine"))
837 {
838 if (GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED)
839 return false;
840 }
841
842 return true;
843 }
844
845 override bool CanDisplayCargo()
846 {
847 if ( !super.CanDisplayCargo() )
848 return false;
849
850 if ( GetCarDoorsState("CivSedanTrunk") == CarDoorState.DOORS_CLOSED )
851 return false;
852
853 return true;
854 }
855
856 override int GetCarDoorsState( string slotType )
857 {
859
860 Class.CastTo( carDoor, FindAttachmentBySlotName( slotType ) );
861 if (!carDoor)
862 {
863 return CarDoorState.DOORS_MISSING;
864 }
865
866 switch (slotType)
867 {
868 case "CivSedanDriverDoors":
869 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
870 break;
871
872 case "CivSedanCoDriverDoors":
873 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
874 break;
875
876 case "CivSedanCargo1Doors":
877 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
878 break;
879
880 case "CivSedanCargo2Doors":
881 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
882 break;
883
884 case "CivSedanTrunk":
885 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
886 break;
887
888 case "CivSedanHood":
889 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
890 break;
891 }
892
893 return CarDoorState.DOORS_MISSING;
894 }
895
896
897 override bool CrewCanGetThrough( int posIdx )
898 {
899 switch( posIdx )
900 {
901 case 0:
902 if ( GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED )
903 return false;
904
905 return true;
906 break;
907
908 case 1:
909 if ( GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED )
910 return false;
911
912 return true;
913 break;
914
915 case 2:
916 if ( GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED )
917 return false;
918
919 return true;
920 break;
921
922 case 3:
923 if ( GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED )
924 return false;
925
926 return true;
927 break;
928 }
929
930 return false;
931 }
932
933 override string GetDoorSelectionNameFromSeatPos(int posIdx)
934 {
935 switch( posIdx )
936 {
937 case 0:
938 return "doors_driver";
939 break;
940 case 1:
941 return "doors_codriver";
942 break;
943 case 2:
944 return "doors_cargo1";
945 break;
946 case 3:
947 return "doors_cargo2";
948 break;
949 }
950
951 return super.GetDoorSelectionNameFromSeatPos(posIdx);
952 }
953
954 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
955 {
956 switch( posIdx )
957 {
958 case 0:
959 return "CivSedanDriverDoors";
960 break;
961 case 1:
962 return "CivSedanCoDriverDoors";
963 break;
964 case 2:
965 return "CivSedanCargo1Doors";
966 break;
967 case 3:
968 return "CivSedanCargo2Doors";
969 break;
970 }
971
972 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
973 }
974
975 // 0 full ambient and engine sound
976 // 1 zero ambient and engine sound
977 override float OnSound(CarSoundCtrl ctrl, float oldValue)
978 {
979 switch (ctrl)
980 {
981 case CarSoundCtrl.DOORS:
982 float newValue = 0;
983 if (GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED)
984 {
985 newValue += 0.25;
986 }
987
988 if (GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED)
989 {
990 newValue += 0.25;
991 }
992
993 if (GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED)
994 {
995 newValue += 0.25;
996 }
997
998 if (GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED)
999 {
1000 newValue += 0.25;
1001 }
1002
1003 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
1004 {
1005 newValue -= 0.6;
1006 }
1007
1008 if (GetHealthLevel("WindowBack") == GameConstants.STATE_RUINED)
1009 {
1010 newValue -= 0.6;
1011 }
1012
1013 return Math.Clamp(newValue, 0, 1);
1014 break;
1015 }
1016
1017 return super.OnSound(ctrl, oldValue);
1018 }
1019
1020 override string GetAnimSourceFromSelection(string selection)
1021 {
1022 switch (selection)
1023 {
1024 case "doors_driver":
1025 return "DoorsDriver";
1026 case "doors_codriver":
1027 return "DoorsCoDriver";
1028 case "doors_cargo1":
1029 return "DoorsCargo1";
1030 case "doors_cargo2":
1031 return "DoorsCargo2";
1032 case "doors_hood":
1033 return "DoorsHood";
1034 case "doors_trunk":
1035 return "DoorsTrunk";
1036 }
1037
1038 return "";
1039 }
1040
1041 override bool IsVitalTruckBattery()
1042 {
1043 return false;
1044 }
1045
1046 override bool IsVitalGlowPlug()
1047 {
1048 return false;
1049 }
1050
1051 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
1052 {
1053 switch (currentSeat)
1054 {
1055 case 0:
1056 return nextSeat == 1;
1057
1058 case 1:
1059 return nextSeat == 0;
1060
1061 case 2:
1062 return nextSeat == 3;
1063
1064 case 3:
1065 return nextSeat == 2;
1066 }
1067
1068 return false;
1069 }
1070
1071 override bool CanReachDoorsFromSeat( string pDoorsSelection, int pCurrentSeat )
1072 {
1073 switch (pCurrentSeat)
1074 {
1075 case 0:
1076 return pDoorsSelection == "DoorsDriver";
1077
1078 case 1:
1079 return pDoorsSelection == "DoorsCoDriver";
1080
1081 case 2:
1082 return pDoorsSelection == "DoorsCargo1";
1083
1084 case 3:
1085 return pDoorsSelection == "DoorsCargo2";
1086 }
1087
1088 return false;
1089 }
1090
1091 override void OnDebugSpawn()
1092 {
1096
1097 GetInventory().CreateInInventory("CivSedanWheel");
1098 GetInventory().CreateInInventory("CivSedanWheel");
1099 GetInventory().CreateInInventory("CivSedanWheel");
1100 GetInventory().CreateInInventory("CivSedanWheel");
1101
1102 GetInventory().CreateInInventory("CivSedanDoors_Driver");
1103 GetInventory().CreateInInventory("CivSedanDoors_CoDriver");
1104 GetInventory().CreateInInventory("CivSedanDoors_BackLeft");
1105 GetInventory().CreateInInventory("CivSedanDoors_BackRight");
1106 GetInventory().CreateInInventory("CivSedanHood");
1107 GetInventory().CreateInInventory("CivSedanTrunk");
1108
1109 //-----IN CAR CARGO
1110 GetInventory().CreateInInventory("CivSedanWheel");
1111 GetInventory().CreateInInventory("CivSedanWheel");
1112 }
1113
1114 override float GetPushForceCoefficientMultiplier()
1115 {
1116 return 1.5;
1117 }
1118}
1119
1121{
1122 override void OnDebugSpawn()
1123 {
1127
1128 GetInventory().CreateInInventory("CivSedanWheel");
1129 GetInventory().CreateInInventory("CivSedanWheel");
1130 GetInventory().CreateInInventory("CivSedanWheel");
1131 GetInventory().CreateInInventory("CivSedanWheel");
1132
1133 GetInventory().CreateInInventory("CivSedanDoors_Driver_Wine");
1134 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Wine");
1135 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Wine");
1136 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Wine");
1137 GetInventory().CreateInInventory("CivSedanHood_Wine");
1138 GetInventory().CreateInInventory("CivSedanTrunk_Wine");
1139
1140 //-----IN CAR CARGO
1141 GetInventory().CreateInInventory("CivSedanWheel");
1142 GetInventory().CreateInInventory("CivSedanWheel");
1143 }
1144}
1145
1147{
1148 override void OnDebugSpawn()
1149 {
1153
1154 GetInventory().CreateInInventory("CivSedanWheel");
1155 GetInventory().CreateInInventory("CivSedanWheel");
1156 GetInventory().CreateInInventory("CivSedanWheel");
1157 GetInventory().CreateInInventory("CivSedanWheel");
1158
1159 GetInventory().CreateInInventory("CivSedanDoors_Driver_Black");
1160 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Black");
1161 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Black");
1162 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Black");
1163 GetInventory().CreateInInventory("CivSedanHood_Black");
1164 GetInventory().CreateInInventory("CivSedanTrunk_Black");
1165
1166 //-----IN CAR CARGO
1167 GetInventory().CreateInInventory("CivSedanWheel");
1168 GetInventory().CreateInInventory("CivSedanWheel");
1169 }
1170}

◆ GetDoorSelectionNameFromSeatPos()

override string GetDoorSelectionNameFromSeatPos ( int posIdx)
protected
672{
676
677 void CivilianSedan()
678 {
679 //m_dmgContactCoef = 0.065;
680
681 m_EngineStartOK = "CivilianSedan_engine_start_SoundSet";
682 m_EngineStartBattery = "CivilianSedan_engine_failed_start_battery_SoundSet";
683 m_EngineStartPlug = "CivilianSedan_engine_failed_start_sparkplugs_SoundSet";
684 m_EngineStartFuel = "CivilianSedan_engine_failed_start_fuel_SoundSet";
685 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
686
687 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
688 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
689
690 m_CarHornShortSoundName = "CivilianSedan_Horn_Short_SoundSet";
691 m_CarHornLongSoundName = "CivilianSedan_Horn_SoundSet";
692
693 SetEnginePos("0 0.7 1.6");
694 }
695
696 override void EEInit()
697 {
698 super.EEInit();
699
700 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
701 {
703 m_UTSSettings.m_ManualUpdate = true;
704 m_UTSSettings.m_TemperatureMin = 0;
705 m_UTSSettings.m_TemperatureMax = 30;
707 m_UTSSettings.m_TemperatureCap = 0;
708 m_UTSSettings.m_RangeFull = 0.5;
709 m_UTSSettings.m_RangeMax = 2;
710
713 }
714 }
715
716 override void OnEngineStart()
717 {
718 super.OnEngineStart();
719
720 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
721 {
722 m_UTSource.SetDefferedActive(true, 20.0);
723 }
724 }
725
726 override void OnEngineStop()
727 {
728 super.OnEngineStop();
729
730 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
731 {
732 m_UTSource.SetDefferedActive(false, 10.0);
733 }
734 }
735
736 override void EOnPostSimulate(IEntity other, float timeSlice)
737 {
738 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
739 {
740 if (m_UTSource.IsActive())
741 {
743 }
744 }
745 }
746
747 override int GetAnimInstance()
748 {
749 return VehicleAnimInstances.SEDAN;
750 }
751
752 override float GetTransportCameraDistance()
753 {
754 return 4.5;
755 }
756
757 override int GetSeatAnimationType(int posIdx)
758 {
759 switch (posIdx)
760 {
761 case 0:
762 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
763 case 1:
764 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
765 case 2:
766 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
767 case 3:
768 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
769 }
770
771 return 0;
772 }
773
774 // Override for car-specific light type
776 {
777 return CarLightBase.Cast( ScriptedLightBase.CreateLight(CivilianSedanFrontLight) );
778 }
779
780 // Override for car-specific light type
782 {
783 return CarRearLightBase.Cast( ScriptedLightBase.CreateLight(CivilianSedanRearLight) );
784 }
785
787 {
788 if( !super.CanReleaseAttachment( attachment ) )
789 return false;
790
791 string attType = attachment.GetType();
792
793 if ( EngineIsOn() || GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED )
794 {
795 if ( attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
796 return false;
797 }
798
799 return true;
800 }
801
802 override protected bool CanManipulateSpareWheel(string slotSelectionName)
803 {
804 return GetCarDoorsState("CivSedanTrunk") != CarDoorState.DOORS_CLOSED;
805 }
806
807 override bool CanDisplayAttachmentCategory(string category_name)
808 {
809 //super
810 if (!super.CanDisplayAttachmentCategory(category_name))
811 return false;
812 //
813
814 category_name.ToLower();
815 if (category_name.Contains("engine"))
816 {
817 if (GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED)
818 return false;
819 }
820
821 return true;
822 }
823
824 override bool CanDisplayCargo()
825 {
826 if ( !super.CanDisplayCargo() )
827 return false;
828
829 if ( GetCarDoorsState("CivSedanTrunk") == CarDoorState.DOORS_CLOSED )
830 return false;
831
832 return true;
833 }
834
835 override int GetCarDoorsState( string slotType )
836 {
838
839 Class.CastTo( carDoor, FindAttachmentBySlotName( slotType ) );
840 if (!carDoor)
841 {
842 return CarDoorState.DOORS_MISSING;
843 }
844
845 switch (slotType)
846 {
847 case "CivSedanDriverDoors":
848 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
849 break;
850
851 case "CivSedanCoDriverDoors":
852 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
853 break;
854
855 case "CivSedanCargo1Doors":
856 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
857 break;
858
859 case "CivSedanCargo2Doors":
860 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
861 break;
862
863 case "CivSedanTrunk":
864 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
865 break;
866
867 case "CivSedanHood":
868 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
869 break;
870 }
871
872 return CarDoorState.DOORS_MISSING;
873 }
874
875
876 override bool CrewCanGetThrough( int posIdx )
877 {
878 switch( posIdx )
879 {
880 case 0:
881 if ( GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED )
882 return false;
883
884 return true;
885 break;
886
887 case 1:
888 if ( GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED )
889 return false;
890
891 return true;
892 break;
893
894 case 2:
895 if ( GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED )
896 return false;
897
898 return true;
899 break;
900
901 case 3:
902 if ( GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED )
903 return false;
904
905 return true;
906 break;
907 }
908
909 return false;
910 }
911
912 override string GetDoorSelectionNameFromSeatPos(int posIdx)
913 {
914 switch( posIdx )
915 {
916 case 0:
917 return "doors_driver";
918 break;
919 case 1:
920 return "doors_codriver";
921 break;
922 case 2:
923 return "doors_cargo1";
924 break;
925 case 3:
926 return "doors_cargo2";
927 break;
928 }
929
930 return super.GetDoorSelectionNameFromSeatPos(posIdx);
931 }
932
933 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
934 {
935 switch( posIdx )
936 {
937 case 0:
938 return "CivSedanDriverDoors";
939 break;
940 case 1:
941 return "CivSedanCoDriverDoors";
942 break;
943 case 2:
944 return "CivSedanCargo1Doors";
945 break;
946 case 3:
947 return "CivSedanCargo2Doors";
948 break;
949 }
950
951 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
952 }
953
954 // 0 full ambient and engine sound
955 // 1 zero ambient and engine sound
956 override float OnSound(CarSoundCtrl ctrl, float oldValue)
957 {
958 switch (ctrl)
959 {
960 case CarSoundCtrl.DOORS:
961 float newValue = 0;
962 if (GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED)
963 {
964 newValue += 0.25;
965 }
966
967 if (GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED)
968 {
969 newValue += 0.25;
970 }
971
972 if (GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED)
973 {
974 newValue += 0.25;
975 }
976
977 if (GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED)
978 {
979 newValue += 0.25;
980 }
981
982 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
983 {
984 newValue -= 0.6;
985 }
986
987 if (GetHealthLevel("WindowBack") == GameConstants.STATE_RUINED)
988 {
989 newValue -= 0.6;
990 }
991
992 return Math.Clamp(newValue, 0, 1);
993 break;
994 }
995
996 return super.OnSound(ctrl, oldValue);
997 }
998
999 override string GetAnimSourceFromSelection(string selection)
1000 {
1001 switch (selection)
1002 {
1003 case "doors_driver":
1004 return "DoorsDriver";
1005 case "doors_codriver":
1006 return "DoorsCoDriver";
1007 case "doors_cargo1":
1008 return "DoorsCargo1";
1009 case "doors_cargo2":
1010 return "DoorsCargo2";
1011 case "doors_hood":
1012 return "DoorsHood";
1013 case "doors_trunk":
1014 return "DoorsTrunk";
1015 }
1016
1017 return "";
1018 }
1019
1020 override bool IsVitalTruckBattery()
1021 {
1022 return false;
1023 }
1024
1025 override bool IsVitalGlowPlug()
1026 {
1027 return false;
1028 }
1029
1030 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
1031 {
1032 switch (currentSeat)
1033 {
1034 case 0:
1035 return nextSeat == 1;
1036
1037 case 1:
1038 return nextSeat == 0;
1039
1040 case 2:
1041 return nextSeat == 3;
1042
1043 case 3:
1044 return nextSeat == 2;
1045 }
1046
1047 return false;
1048 }
1049
1050 override bool CanReachDoorsFromSeat( string pDoorsSelection, int pCurrentSeat )
1051 {
1052 switch (pCurrentSeat)
1053 {
1054 case 0:
1055 return pDoorsSelection == "DoorsDriver";
1056
1057 case 1:
1058 return pDoorsSelection == "DoorsCoDriver";
1059
1060 case 2:
1061 return pDoorsSelection == "DoorsCargo1";
1062
1063 case 3:
1064 return pDoorsSelection == "DoorsCargo2";
1065 }
1066
1067 return false;
1068 }
1069
1070 override void OnDebugSpawn()
1071 {
1075
1076 GetInventory().CreateInInventory("CivSedanWheel");
1077 GetInventory().CreateInInventory("CivSedanWheel");
1078 GetInventory().CreateInInventory("CivSedanWheel");
1079 GetInventory().CreateInInventory("CivSedanWheel");
1080
1081 GetInventory().CreateInInventory("CivSedanDoors_Driver");
1082 GetInventory().CreateInInventory("CivSedanDoors_CoDriver");
1083 GetInventory().CreateInInventory("CivSedanDoors_BackLeft");
1084 GetInventory().CreateInInventory("CivSedanDoors_BackRight");
1085 GetInventory().CreateInInventory("CivSedanHood");
1086 GetInventory().CreateInInventory("CivSedanTrunk");
1087
1088 //-----IN CAR CARGO
1089 GetInventory().CreateInInventory("CivSedanWheel");
1090 GetInventory().CreateInInventory("CivSedanWheel");
1091 }
1092
1093 override float GetPushForceCoefficientMultiplier()
1094 {
1095 return 1.5;
1096 }
1097}
1098
1100{
1101 override void OnDebugSpawn()
1102 {
1106
1107 GetInventory().CreateInInventory("CivSedanWheel");
1108 GetInventory().CreateInInventory("CivSedanWheel");
1109 GetInventory().CreateInInventory("CivSedanWheel");
1110 GetInventory().CreateInInventory("CivSedanWheel");
1111
1112 GetInventory().CreateInInventory("CivSedanDoors_Driver_Wine");
1113 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Wine");
1114 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Wine");
1115 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Wine");
1116 GetInventory().CreateInInventory("CivSedanHood_Wine");
1117 GetInventory().CreateInInventory("CivSedanTrunk_Wine");
1118
1119 //-----IN CAR CARGO
1120 GetInventory().CreateInInventory("CivSedanWheel");
1121 GetInventory().CreateInInventory("CivSedanWheel");
1122 }
1123}
1124
1126{
1127 override void OnDebugSpawn()
1128 {
1132
1133 GetInventory().CreateInInventory("CivSedanWheel");
1134 GetInventory().CreateInInventory("CivSedanWheel");
1135 GetInventory().CreateInInventory("CivSedanWheel");
1136 GetInventory().CreateInInventory("CivSedanWheel");
1137
1138 GetInventory().CreateInInventory("CivSedanDoors_Driver_Black");
1139 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Black");
1140 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Black");
1141 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Black");
1142 GetInventory().CreateInInventory("CivSedanHood_Black");
1143 GetInventory().CreateInInventory("CivSedanTrunk_Black");
1144
1145 //-----IN CAR CARGO
1146 GetInventory().CreateInInventory("CivSedanWheel");
1147 GetInventory().CreateInInventory("CivSedanWheel");
1148 }
1149}

◆ GetPushForceCoefficientMultiplier()

override float GetPushForceCoefficientMultiplier ( )
protected
853{
857
858 void CivilianSedan()
859 {
860 //m_dmgContactCoef = 0.065;
861
862 m_EngineStartOK = "CivilianSedan_engine_start_SoundSet";
863 m_EngineStartBattery = "CivilianSedan_engine_failed_start_battery_SoundSet";
864 m_EngineStartPlug = "CivilianSedan_engine_failed_start_sparkplugs_SoundSet";
865 m_EngineStartFuel = "CivilianSedan_engine_failed_start_fuel_SoundSet";
866 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
867
868 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
869 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
870
871 m_CarHornShortSoundName = "CivilianSedan_Horn_Short_SoundSet";
872 m_CarHornLongSoundName = "CivilianSedan_Horn_SoundSet";
873
874 SetEnginePos("0 0.7 1.6");
875 }
876
877 override void EEInit()
878 {
879 super.EEInit();
880
881 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
882 {
884 m_UTSSettings.m_ManualUpdate = true;
885 m_UTSSettings.m_TemperatureMin = 0;
886 m_UTSSettings.m_TemperatureMax = 30;
888 m_UTSSettings.m_TemperatureCap = 0;
889 m_UTSSettings.m_RangeFull = 0.5;
890 m_UTSSettings.m_RangeMax = 2;
891
894 }
895 }
896
897 override void OnEngineStart()
898 {
899 super.OnEngineStart();
900
901 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
902 {
903 m_UTSource.SetDefferedActive(true, 20.0);
904 }
905 }
906
907 override void OnEngineStop()
908 {
909 super.OnEngineStop();
910
911 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
912 {
913 m_UTSource.SetDefferedActive(false, 10.0);
914 }
915 }
916
917 override void EOnPostSimulate(IEntity other, float timeSlice)
918 {
919 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
920 {
921 if (m_UTSource.IsActive())
922 {
924 }
925 }
926 }
927
928 override int GetAnimInstance()
929 {
930 return VehicleAnimInstances.SEDAN;
931 }
932
933 override float GetTransportCameraDistance()
934 {
935 return 4.5;
936 }
937
938 override int GetSeatAnimationType(int posIdx)
939 {
940 switch (posIdx)
941 {
942 case 0:
943 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
944 case 1:
945 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
946 case 2:
947 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
948 case 3:
949 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
950 }
951
952 return 0;
953 }
954
955 // Override for car-specific light type
957 {
958 return CarLightBase.Cast( ScriptedLightBase.CreateLight(CivilianSedanFrontLight) );
959 }
960
961 // Override for car-specific light type
963 {
964 return CarRearLightBase.Cast( ScriptedLightBase.CreateLight(CivilianSedanRearLight) );
965 }
966
968 {
969 if( !super.CanReleaseAttachment( attachment ) )
970 return false;
971
972 string attType = attachment.GetType();
973
974 if ( EngineIsOn() || GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED )
975 {
976 if ( attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
977 return false;
978 }
979
980 return true;
981 }
982
983 override protected bool CanManipulateSpareWheel(string slotSelectionName)
984 {
985 return GetCarDoorsState("CivSedanTrunk") != CarDoorState.DOORS_CLOSED;
986 }
987
988 override bool CanDisplayAttachmentCategory(string category_name)
989 {
990 //super
991 if (!super.CanDisplayAttachmentCategory(category_name))
992 return false;
993 //
994
995 category_name.ToLower();
996 if (category_name.Contains("engine"))
997 {
998 if (GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED)
999 return false;
1000 }
1001
1002 return true;
1003 }
1004
1005 override bool CanDisplayCargo()
1006 {
1007 if ( !super.CanDisplayCargo() )
1008 return false;
1009
1010 if ( GetCarDoorsState("CivSedanTrunk") == CarDoorState.DOORS_CLOSED )
1011 return false;
1012
1013 return true;
1014 }
1015
1016 override int GetCarDoorsState( string slotType )
1017 {
1019
1020 Class.CastTo( carDoor, FindAttachmentBySlotName( slotType ) );
1021 if (!carDoor)
1022 {
1023 return CarDoorState.DOORS_MISSING;
1024 }
1025
1026 switch (slotType)
1027 {
1028 case "CivSedanDriverDoors":
1029 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
1030 break;
1031
1032 case "CivSedanCoDriverDoors":
1033 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
1034 break;
1035
1036 case "CivSedanCargo1Doors":
1037 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
1038 break;
1039
1040 case "CivSedanCargo2Doors":
1041 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
1042 break;
1043
1044 case "CivSedanTrunk":
1045 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
1046 break;
1047
1048 case "CivSedanHood":
1049 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
1050 break;
1051 }
1052
1053 return CarDoorState.DOORS_MISSING;
1054 }
1055
1056
1057 override bool CrewCanGetThrough( int posIdx )
1058 {
1059 switch( posIdx )
1060 {
1061 case 0:
1062 if ( GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED )
1063 return false;
1064
1065 return true;
1066 break;
1067
1068 case 1:
1069 if ( GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED )
1070 return false;
1071
1072 return true;
1073 break;
1074
1075 case 2:
1076 if ( GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED )
1077 return false;
1078
1079 return true;
1080 break;
1081
1082 case 3:
1083 if ( GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED )
1084 return false;
1085
1086 return true;
1087 break;
1088 }
1089
1090 return false;
1091 }
1092
1093 override string GetDoorSelectionNameFromSeatPos(int posIdx)
1094 {
1095 switch( posIdx )
1096 {
1097 case 0:
1098 return "doors_driver";
1099 break;
1100 case 1:
1101 return "doors_codriver";
1102 break;
1103 case 2:
1104 return "doors_cargo1";
1105 break;
1106 case 3:
1107 return "doors_cargo2";
1108 break;
1109 }
1110
1111 return super.GetDoorSelectionNameFromSeatPos(posIdx);
1112 }
1113
1114 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
1115 {
1116 switch( posIdx )
1117 {
1118 case 0:
1119 return "CivSedanDriverDoors";
1120 break;
1121 case 1:
1122 return "CivSedanCoDriverDoors";
1123 break;
1124 case 2:
1125 return "CivSedanCargo1Doors";
1126 break;
1127 case 3:
1128 return "CivSedanCargo2Doors";
1129 break;
1130 }
1131
1132 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
1133 }
1134
1135 // 0 full ambient and engine sound
1136 // 1 zero ambient and engine sound
1137 override float OnSound(CarSoundCtrl ctrl, float oldValue)
1138 {
1139 switch (ctrl)
1140 {
1141 case CarSoundCtrl.DOORS:
1142 float newValue = 0;
1143 if (GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED)
1144 {
1145 newValue += 0.25;
1146 }
1147
1148 if (GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED)
1149 {
1150 newValue += 0.25;
1151 }
1152
1153 if (GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED)
1154 {
1155 newValue += 0.25;
1156 }
1157
1158 if (GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED)
1159 {
1160 newValue += 0.25;
1161 }
1162
1163 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
1164 {
1165 newValue -= 0.6;
1166 }
1167
1168 if (GetHealthLevel("WindowBack") == GameConstants.STATE_RUINED)
1169 {
1170 newValue -= 0.6;
1171 }
1172
1173 return Math.Clamp(newValue, 0, 1);
1174 break;
1175 }
1176
1177 return super.OnSound(ctrl, oldValue);
1178 }
1179
1180 override string GetAnimSourceFromSelection(string selection)
1181 {
1182 switch (selection)
1183 {
1184 case "doors_driver":
1185 return "DoorsDriver";
1186 case "doors_codriver":
1187 return "DoorsCoDriver";
1188 case "doors_cargo1":
1189 return "DoorsCargo1";
1190 case "doors_cargo2":
1191 return "DoorsCargo2";
1192 case "doors_hood":
1193 return "DoorsHood";
1194 case "doors_trunk":
1195 return "DoorsTrunk";
1196 }
1197
1198 return "";
1199 }
1200
1201 override bool IsVitalTruckBattery()
1202 {
1203 return false;
1204 }
1205
1206 override bool IsVitalGlowPlug()
1207 {
1208 return false;
1209 }
1210
1211 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
1212 {
1213 switch (currentSeat)
1214 {
1215 case 0:
1216 return nextSeat == 1;
1217
1218 case 1:
1219 return nextSeat == 0;
1220
1221 case 2:
1222 return nextSeat == 3;
1223
1224 case 3:
1225 return nextSeat == 2;
1226 }
1227
1228 return false;
1229 }
1230
1231 override bool CanReachDoorsFromSeat( string pDoorsSelection, int pCurrentSeat )
1232 {
1233 switch (pCurrentSeat)
1234 {
1235 case 0:
1236 return pDoorsSelection == "DoorsDriver";
1237
1238 case 1:
1239 return pDoorsSelection == "DoorsCoDriver";
1240
1241 case 2:
1242 return pDoorsSelection == "DoorsCargo1";
1243
1244 case 3:
1245 return pDoorsSelection == "DoorsCargo2";
1246 }
1247
1248 return false;
1249 }
1250
1251 override void OnDebugSpawn()
1252 {
1256
1257 GetInventory().CreateInInventory("CivSedanWheel");
1258 GetInventory().CreateInInventory("CivSedanWheel");
1259 GetInventory().CreateInInventory("CivSedanWheel");
1260 GetInventory().CreateInInventory("CivSedanWheel");
1261
1262 GetInventory().CreateInInventory("CivSedanDoors_Driver");
1263 GetInventory().CreateInInventory("CivSedanDoors_CoDriver");
1264 GetInventory().CreateInInventory("CivSedanDoors_BackLeft");
1265 GetInventory().CreateInInventory("CivSedanDoors_BackRight");
1266 GetInventory().CreateInInventory("CivSedanHood");
1267 GetInventory().CreateInInventory("CivSedanTrunk");
1268
1269 //-----IN CAR CARGO
1270 GetInventory().CreateInInventory("CivSedanWheel");
1271 GetInventory().CreateInInventory("CivSedanWheel");
1272 }
1273
1274 override float GetPushForceCoefficientMultiplier()
1275 {
1276 return 1.5;
1277 }
1278}
1279
1281{
1282 override void OnDebugSpawn()
1283 {
1287
1288 GetInventory().CreateInInventory("CivSedanWheel");
1289 GetInventory().CreateInInventory("CivSedanWheel");
1290 GetInventory().CreateInInventory("CivSedanWheel");
1291 GetInventory().CreateInInventory("CivSedanWheel");
1292
1293 GetInventory().CreateInInventory("CivSedanDoors_Driver_Wine");
1294 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Wine");
1295 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Wine");
1296 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Wine");
1297 GetInventory().CreateInInventory("CivSedanHood_Wine");
1298 GetInventory().CreateInInventory("CivSedanTrunk_Wine");
1299
1300 //-----IN CAR CARGO
1301 GetInventory().CreateInInventory("CivSedanWheel");
1302 GetInventory().CreateInInventory("CivSedanWheel");
1303 }
1304}
1305
1307{
1308 override void OnDebugSpawn()
1309 {
1313
1314 GetInventory().CreateInInventory("CivSedanWheel");
1315 GetInventory().CreateInInventory("CivSedanWheel");
1316 GetInventory().CreateInInventory("CivSedanWheel");
1317 GetInventory().CreateInInventory("CivSedanWheel");
1318
1319 GetInventory().CreateInInventory("CivSedanDoors_Driver_Black");
1320 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Black");
1321 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Black");
1322 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Black");
1323 GetInventory().CreateInInventory("CivSedanHood_Black");
1324 GetInventory().CreateInInventory("CivSedanTrunk_Black");
1325
1326 //-----IN CAR CARGO
1327 GetInventory().CreateInInventory("CivSedanWheel");
1328 GetInventory().CreateInInventory("CivSedanWheel");
1329 }
1330}

◆ GetSeatAnimationType()

override int GetSeatAnimationType ( int posIdx)
protected
517{
521
522 void CivilianSedan()
523 {
524 //m_dmgContactCoef = 0.065;
525
526 m_EngineStartOK = "CivilianSedan_engine_start_SoundSet";
527 m_EngineStartBattery = "CivilianSedan_engine_failed_start_battery_SoundSet";
528 m_EngineStartPlug = "CivilianSedan_engine_failed_start_sparkplugs_SoundSet";
529 m_EngineStartFuel = "CivilianSedan_engine_failed_start_fuel_SoundSet";
530 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
531
532 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
533 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
534
535 m_CarHornShortSoundName = "CivilianSedan_Horn_Short_SoundSet";
536 m_CarHornLongSoundName = "CivilianSedan_Horn_SoundSet";
537
538 SetEnginePos("0 0.7 1.6");
539 }
540
541 override void EEInit()
542 {
543 super.EEInit();
544
545 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
546 {
548 m_UTSSettings.m_ManualUpdate = true;
549 m_UTSSettings.m_TemperatureMin = 0;
550 m_UTSSettings.m_TemperatureMax = 30;
552 m_UTSSettings.m_TemperatureCap = 0;
553 m_UTSSettings.m_RangeFull = 0.5;
554 m_UTSSettings.m_RangeMax = 2;
555
558 }
559 }
560
561 override void OnEngineStart()
562 {
563 super.OnEngineStart();
564
565 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
566 {
567 m_UTSource.SetDefferedActive(true, 20.0);
568 }
569 }
570
571 override void OnEngineStop()
572 {
573 super.OnEngineStop();
574
575 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
576 {
577 m_UTSource.SetDefferedActive(false, 10.0);
578 }
579 }
580
581 override void EOnPostSimulate(IEntity other, float timeSlice)
582 {
583 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
584 {
585 if (m_UTSource.IsActive())
586 {
588 }
589 }
590 }
591
592 override int GetAnimInstance()
593 {
594 return VehicleAnimInstances.SEDAN;
595 }
596
597 override float GetTransportCameraDistance()
598 {
599 return 4.5;
600 }
601
602 override int GetSeatAnimationType(int posIdx)
603 {
604 switch (posIdx)
605 {
606 case 0:
607 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
608 case 1:
609 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
610 case 2:
611 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
612 case 3:
613 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
614 }
615
616 return 0;
617 }
618
619 // Override for car-specific light type
621 {
622 return CarLightBase.Cast( ScriptedLightBase.CreateLight(CivilianSedanFrontLight) );
623 }
624
625 // Override for car-specific light type
627 {
628 return CarRearLightBase.Cast( ScriptedLightBase.CreateLight(CivilianSedanRearLight) );
629 }
630
632 {
633 if( !super.CanReleaseAttachment( attachment ) )
634 return false;
635
636 string attType = attachment.GetType();
637
638 if ( EngineIsOn() || GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED )
639 {
640 if ( attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
641 return false;
642 }
643
644 return true;
645 }
646
647 override protected bool CanManipulateSpareWheel(string slotSelectionName)
648 {
649 return GetCarDoorsState("CivSedanTrunk") != CarDoorState.DOORS_CLOSED;
650 }
651
652 override bool CanDisplayAttachmentCategory(string category_name)
653 {
654 //super
655 if (!super.CanDisplayAttachmentCategory(category_name))
656 return false;
657 //
658
659 category_name.ToLower();
660 if (category_name.Contains("engine"))
661 {
662 if (GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED)
663 return false;
664 }
665
666 return true;
667 }
668
669 override bool CanDisplayCargo()
670 {
671 if ( !super.CanDisplayCargo() )
672 return false;
673
674 if ( GetCarDoorsState("CivSedanTrunk") == CarDoorState.DOORS_CLOSED )
675 return false;
676
677 return true;
678 }
679
680 override int GetCarDoorsState( string slotType )
681 {
683
684 Class.CastTo( carDoor, FindAttachmentBySlotName( slotType ) );
685 if (!carDoor)
686 {
687 return CarDoorState.DOORS_MISSING;
688 }
689
690 switch (slotType)
691 {
692 case "CivSedanDriverDoors":
693 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
694 break;
695
696 case "CivSedanCoDriverDoors":
697 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
698 break;
699
700 case "CivSedanCargo1Doors":
701 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
702 break;
703
704 case "CivSedanCargo2Doors":
705 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
706 break;
707
708 case "CivSedanTrunk":
709 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
710 break;
711
712 case "CivSedanHood":
713 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
714 break;
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("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED )
727 return false;
728
729 return true;
730 break;
731
732 case 1:
733 if ( GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED )
734 return false;
735
736 return true;
737 break;
738
739 case 2:
740 if ( GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED )
741 return false;
742
743 return true;
744 break;
745
746 case 3:
747 if ( GetCarDoorsState("CivSedanCargo2Doors") == 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 "CivSedanDriverDoors";
784 break;
785 case 1:
786 return "CivSedanCoDriverDoors";
787 break;
788 case 2:
789 return "CivSedanCargo1Doors";
790 break;
791 case 3:
792 return "CivSedanCargo2Doors";
793 break;
794 }
795
796 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
797 }
798
799 // 0 full ambient and engine sound
800 // 1 zero ambient and engine sound
801 override float OnSound(CarSoundCtrl ctrl, float oldValue)
802 {
803 switch (ctrl)
804 {
805 case CarSoundCtrl.DOORS:
806 float newValue = 0;
807 if (GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED)
808 {
809 newValue += 0.25;
810 }
811
812 if (GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED)
813 {
814 newValue += 0.25;
815 }
816
817 if (GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED)
818 {
819 newValue += 0.25;
820 }
821
822 if (GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED)
823 {
824 newValue += 0.25;
825 }
826
827 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
828 {
829 newValue -= 0.6;
830 }
831
832 if (GetHealthLevel("WindowBack") == GameConstants.STATE_RUINED)
833 {
834 newValue -= 0.6;
835 }
836
837 return Math.Clamp(newValue, 0, 1);
838 break;
839 }
840
841 return super.OnSound(ctrl, oldValue);
842 }
843
844 override string GetAnimSourceFromSelection(string selection)
845 {
846 switch (selection)
847 {
848 case "doors_driver":
849 return "DoorsDriver";
850 case "doors_codriver":
851 return "DoorsCoDriver";
852 case "doors_cargo1":
853 return "DoorsCargo1";
854 case "doors_cargo2":
855 return "DoorsCargo2";
856 case "doors_hood":
857 return "DoorsHood";
858 case "doors_trunk":
859 return "DoorsTrunk";
860 }
861
862 return "";
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("CivSedanWheel");
922 GetInventory().CreateInInventory("CivSedanWheel");
923 GetInventory().CreateInInventory("CivSedanWheel");
924 GetInventory().CreateInInventory("CivSedanWheel");
925
926 GetInventory().CreateInInventory("CivSedanDoors_Driver");
927 GetInventory().CreateInInventory("CivSedanDoors_CoDriver");
928 GetInventory().CreateInInventory("CivSedanDoors_BackLeft");
929 GetInventory().CreateInInventory("CivSedanDoors_BackRight");
930 GetInventory().CreateInInventory("CivSedanHood");
931 GetInventory().CreateInInventory("CivSedanTrunk");
932
933 //-----IN CAR CARGO
934 GetInventory().CreateInInventory("CivSedanWheel");
935 GetInventory().CreateInInventory("CivSedanWheel");
936 }
937
938 override float GetPushForceCoefficientMultiplier()
939 {
940 return 1.5;
941 }
942}
943
945{
946 override void OnDebugSpawn()
947 {
951
952 GetInventory().CreateInInventory("CivSedanWheel");
953 GetInventory().CreateInInventory("CivSedanWheel");
954 GetInventory().CreateInInventory("CivSedanWheel");
955 GetInventory().CreateInInventory("CivSedanWheel");
956
957 GetInventory().CreateInInventory("CivSedanDoors_Driver_Wine");
958 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Wine");
959 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Wine");
960 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Wine");
961 GetInventory().CreateInInventory("CivSedanHood_Wine");
962 GetInventory().CreateInInventory("CivSedanTrunk_Wine");
963
964 //-----IN CAR CARGO
965 GetInventory().CreateInInventory("CivSedanWheel");
966 GetInventory().CreateInInventory("CivSedanWheel");
967 }
968}
969
971{
972 override void OnDebugSpawn()
973 {
977
978 GetInventory().CreateInInventory("CivSedanWheel");
979 GetInventory().CreateInInventory("CivSedanWheel");
980 GetInventory().CreateInInventory("CivSedanWheel");
981 GetInventory().CreateInInventory("CivSedanWheel");
982
983 GetInventory().CreateInInventory("CivSedanDoors_Driver_Black");
984 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Black");
985 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Black");
986 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Black");
987 GetInventory().CreateInInventory("CivSedanHood_Black");
988 GetInventory().CreateInInventory("CivSedanTrunk_Black");
989
990 //-----IN CAR CARGO
991 GetInventory().CreateInInventory("CivSedanWheel");
992 GetInventory().CreateInInventory("CivSedanWheel");
993 }
994}

◆ GetTransportCameraDistance()

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

◆ IsVitalGlowPlug()

override bool IsVitalGlowPlug ( )
protected
785{
789
790 void CivilianSedan()
791 {
792 //m_dmgContactCoef = 0.065;
793
794 m_EngineStartOK = "CivilianSedan_engine_start_SoundSet";
795 m_EngineStartBattery = "CivilianSedan_engine_failed_start_battery_SoundSet";
796 m_EngineStartPlug = "CivilianSedan_engine_failed_start_sparkplugs_SoundSet";
797 m_EngineStartFuel = "CivilianSedan_engine_failed_start_fuel_SoundSet";
798 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
799
800 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
801 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
802
803 m_CarHornShortSoundName = "CivilianSedan_Horn_Short_SoundSet";
804 m_CarHornLongSoundName = "CivilianSedan_Horn_SoundSet";
805
806 SetEnginePos("0 0.7 1.6");
807 }
808
809 override void EEInit()
810 {
811 super.EEInit();
812
813 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
814 {
816 m_UTSSettings.m_ManualUpdate = true;
817 m_UTSSettings.m_TemperatureMin = 0;
818 m_UTSSettings.m_TemperatureMax = 30;
820 m_UTSSettings.m_TemperatureCap = 0;
821 m_UTSSettings.m_RangeFull = 0.5;
822 m_UTSSettings.m_RangeMax = 2;
823
826 }
827 }
828
829 override void OnEngineStart()
830 {
831 super.OnEngineStart();
832
833 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
834 {
835 m_UTSource.SetDefferedActive(true, 20.0);
836 }
837 }
838
839 override void OnEngineStop()
840 {
841 super.OnEngineStop();
842
843 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
844 {
845 m_UTSource.SetDefferedActive(false, 10.0);
846 }
847 }
848
849 override void EOnPostSimulate(IEntity other, float timeSlice)
850 {
851 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
852 {
853 if (m_UTSource.IsActive())
854 {
856 }
857 }
858 }
859
860 override int GetAnimInstance()
861 {
862 return VehicleAnimInstances.SEDAN;
863 }
864
865 override float GetTransportCameraDistance()
866 {
867 return 4.5;
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(CivilianSedanFrontLight) );
891 }
892
893 // Override for car-specific light type
895 {
896 return CarRearLightBase.Cast( ScriptedLightBase.CreateLight(CivilianSedanRearLight) );
897 }
898
900 {
901 if( !super.CanReleaseAttachment( attachment ) )
902 return false;
903
904 string attType = attachment.GetType();
905
906 if ( EngineIsOn() || GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED )
907 {
908 if ( attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
909 return false;
910 }
911
912 return true;
913 }
914
915 override protected bool CanManipulateSpareWheel(string slotSelectionName)
916 {
917 return GetCarDoorsState("CivSedanTrunk") != CarDoorState.DOORS_CLOSED;
918 }
919
920 override bool CanDisplayAttachmentCategory(string category_name)
921 {
922 //super
923 if (!super.CanDisplayAttachmentCategory(category_name))
924 return false;
925 //
926
927 category_name.ToLower();
928 if (category_name.Contains("engine"))
929 {
930 if (GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED)
931 return false;
932 }
933
934 return true;
935 }
936
937 override bool CanDisplayCargo()
938 {
939 if ( !super.CanDisplayCargo() )
940 return false;
941
942 if ( GetCarDoorsState("CivSedanTrunk") == CarDoorState.DOORS_CLOSED )
943 return false;
944
945 return true;
946 }
947
948 override int GetCarDoorsState( string slotType )
949 {
951
952 Class.CastTo( carDoor, FindAttachmentBySlotName( slotType ) );
953 if (!carDoor)
954 {
955 return CarDoorState.DOORS_MISSING;
956 }
957
958 switch (slotType)
959 {
960 case "CivSedanDriverDoors":
961 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
962 break;
963
964 case "CivSedanCoDriverDoors":
965 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
966 break;
967
968 case "CivSedanCargo1Doors":
969 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
970 break;
971
972 case "CivSedanCargo2Doors":
973 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
974 break;
975
976 case "CivSedanTrunk":
977 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
978 break;
979
980 case "CivSedanHood":
981 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
982 break;
983 }
984
985 return CarDoorState.DOORS_MISSING;
986 }
987
988
989 override bool CrewCanGetThrough( int posIdx )
990 {
991 switch( posIdx )
992 {
993 case 0:
994 if ( GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED )
995 return false;
996
997 return true;
998 break;
999
1000 case 1:
1001 if ( GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED )
1002 return false;
1003
1004 return true;
1005 break;
1006
1007 case 2:
1008 if ( GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED )
1009 return false;
1010
1011 return true;
1012 break;
1013
1014 case 3:
1015 if ( GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED )
1016 return false;
1017
1018 return true;
1019 break;
1020 }
1021
1022 return false;
1023 }
1024
1025 override string GetDoorSelectionNameFromSeatPos(int posIdx)
1026 {
1027 switch( posIdx )
1028 {
1029 case 0:
1030 return "doors_driver";
1031 break;
1032 case 1:
1033 return "doors_codriver";
1034 break;
1035 case 2:
1036 return "doors_cargo1";
1037 break;
1038 case 3:
1039 return "doors_cargo2";
1040 break;
1041 }
1042
1043 return super.GetDoorSelectionNameFromSeatPos(posIdx);
1044 }
1045
1046 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
1047 {
1048 switch( posIdx )
1049 {
1050 case 0:
1051 return "CivSedanDriverDoors";
1052 break;
1053 case 1:
1054 return "CivSedanCoDriverDoors";
1055 break;
1056 case 2:
1057 return "CivSedanCargo1Doors";
1058 break;
1059 case 3:
1060 return "CivSedanCargo2Doors";
1061 break;
1062 }
1063
1064 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
1065 }
1066
1067 // 0 full ambient and engine sound
1068 // 1 zero ambient and engine sound
1069 override float OnSound(CarSoundCtrl ctrl, float oldValue)
1070 {
1071 switch (ctrl)
1072 {
1073 case CarSoundCtrl.DOORS:
1074 float newValue = 0;
1075 if (GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED)
1076 {
1077 newValue += 0.25;
1078 }
1079
1080 if (GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED)
1081 {
1082 newValue += 0.25;
1083 }
1084
1085 if (GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED)
1086 {
1087 newValue += 0.25;
1088 }
1089
1090 if (GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED)
1091 {
1092 newValue += 0.25;
1093 }
1094
1095 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
1096 {
1097 newValue -= 0.6;
1098 }
1099
1100 if (GetHealthLevel("WindowBack") == GameConstants.STATE_RUINED)
1101 {
1102 newValue -= 0.6;
1103 }
1104
1105 return Math.Clamp(newValue, 0, 1);
1106 break;
1107 }
1108
1109 return super.OnSound(ctrl, oldValue);
1110 }
1111
1112 override string GetAnimSourceFromSelection(string selection)
1113 {
1114 switch (selection)
1115 {
1116 case "doors_driver":
1117 return "DoorsDriver";
1118 case "doors_codriver":
1119 return "DoorsCoDriver";
1120 case "doors_cargo1":
1121 return "DoorsCargo1";
1122 case "doors_cargo2":
1123 return "DoorsCargo2";
1124 case "doors_hood":
1125 return "DoorsHood";
1126 case "doors_trunk":
1127 return "DoorsTrunk";
1128 }
1129
1130 return "";
1131 }
1132
1133 override bool IsVitalTruckBattery()
1134 {
1135 return false;
1136 }
1137
1138 override bool IsVitalGlowPlug()
1139 {
1140 return false;
1141 }
1142
1143 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
1144 {
1145 switch (currentSeat)
1146 {
1147 case 0:
1148 return nextSeat == 1;
1149
1150 case 1:
1151 return nextSeat == 0;
1152
1153 case 2:
1154 return nextSeat == 3;
1155
1156 case 3:
1157 return nextSeat == 2;
1158 }
1159
1160 return false;
1161 }
1162
1163 override bool CanReachDoorsFromSeat( string pDoorsSelection, int pCurrentSeat )
1164 {
1165 switch (pCurrentSeat)
1166 {
1167 case 0:
1168 return pDoorsSelection == "DoorsDriver";
1169
1170 case 1:
1171 return pDoorsSelection == "DoorsCoDriver";
1172
1173 case 2:
1174 return pDoorsSelection == "DoorsCargo1";
1175
1176 case 3:
1177 return pDoorsSelection == "DoorsCargo2";
1178 }
1179
1180 return false;
1181 }
1182
1183 override void OnDebugSpawn()
1184 {
1188
1189 GetInventory().CreateInInventory("CivSedanWheel");
1190 GetInventory().CreateInInventory("CivSedanWheel");
1191 GetInventory().CreateInInventory("CivSedanWheel");
1192 GetInventory().CreateInInventory("CivSedanWheel");
1193
1194 GetInventory().CreateInInventory("CivSedanDoors_Driver");
1195 GetInventory().CreateInInventory("CivSedanDoors_CoDriver");
1196 GetInventory().CreateInInventory("CivSedanDoors_BackLeft");
1197 GetInventory().CreateInInventory("CivSedanDoors_BackRight");
1198 GetInventory().CreateInInventory("CivSedanHood");
1199 GetInventory().CreateInInventory("CivSedanTrunk");
1200
1201 //-----IN CAR CARGO
1202 GetInventory().CreateInInventory("CivSedanWheel");
1203 GetInventory().CreateInInventory("CivSedanWheel");
1204 }
1205
1206 override float GetPushForceCoefficientMultiplier()
1207 {
1208 return 1.5;
1209 }
1210}
1211
1213{
1214 override void OnDebugSpawn()
1215 {
1219
1220 GetInventory().CreateInInventory("CivSedanWheel");
1221 GetInventory().CreateInInventory("CivSedanWheel");
1222 GetInventory().CreateInInventory("CivSedanWheel");
1223 GetInventory().CreateInInventory("CivSedanWheel");
1224
1225 GetInventory().CreateInInventory("CivSedanDoors_Driver_Wine");
1226 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Wine");
1227 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Wine");
1228 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Wine");
1229 GetInventory().CreateInInventory("CivSedanHood_Wine");
1230 GetInventory().CreateInInventory("CivSedanTrunk_Wine");
1231
1232 //-----IN CAR CARGO
1233 GetInventory().CreateInInventory("CivSedanWheel");
1234 GetInventory().CreateInInventory("CivSedanWheel");
1235 }
1236}
1237
1239{
1240 override void OnDebugSpawn()
1241 {
1245
1246 GetInventory().CreateInInventory("CivSedanWheel");
1247 GetInventory().CreateInInventory("CivSedanWheel");
1248 GetInventory().CreateInInventory("CivSedanWheel");
1249 GetInventory().CreateInInventory("CivSedanWheel");
1250
1251 GetInventory().CreateInInventory("CivSedanDoors_Driver_Black");
1252 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Black");
1253 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Black");
1254 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Black");
1255 GetInventory().CreateInInventory("CivSedanHood_Black");
1256 GetInventory().CreateInInventory("CivSedanTrunk_Black");
1257
1258 //-----IN CAR CARGO
1259 GetInventory().CreateInInventory("CivSedanWheel");
1260 GetInventory().CreateInInventory("CivSedanWheel");
1261 }
1262}

◆ IsVitalTruckBattery()

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

◆ OnDebugSpawn()

432 {
436
437 GetInventory().CreateInInventory("CivSedanWheel");
438 GetInventory().CreateInInventory("CivSedanWheel");
439 GetInventory().CreateInInventory("CivSedanWheel");
440 GetInventory().CreateInInventory("CivSedanWheel");
441
442 GetInventory().CreateInInventory("CivSedanDoors_Driver_Wine");
443 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Wine");
444 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Wine");
445 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Wine");
446 GetInventory().CreateInInventory("CivSedanHood_Wine");
447 GetInventory().CreateInInventory("CivSedanTrunk_Wine");
448
449 //-----IN CAR CARGO
450 GetInventory().CreateInInventory("CivSedanWheel");
451 GetInventory().CreateInInventory("CivSedanWheel");
452 }

◆ OnEngineStart()

override void OnEngineStart ( )
protected

◆ OnEngineStop()

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

◆ OnSound()

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

Переменные

◆ m_UTSLEngine

◆ m_UTSource

◆ m_UTSSettings

ref UniversalTemperatureSourceSettings m_UTSSettings
protected

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