DayZ 1.24
Loading...
Searching...
No Matches
OffroadHatchback.c File Reference

Go to the source code of this file.

Classes

class  CarScript
 
class  OffroadHatchback
 

Functions

class OffroadHatchback extends CarScript OnDebugSpawn ()
 
void OffroadHatchback ()
 
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 CarRearLightBase CreateRearLight ()
 
override CarLightBase CreateFrontLight ()
 
override bool CanReleaseAttachment (EntityAI attachment)
 
bool CanManipulateSpareWheel (string slotSelectionName)
 
override bool CanDisplayAttachmentCategory (string category_name)
 
override bool CanDisplayCargo ()
 
override int GetCarDoorsState (string slotType)
 
override bool CrewCanGetThrough (int posIdx)
 
override string GetDoorSelectionNameFromSeatPos (int posIdx)
 
override string GetDoorInvSlotNameFromSeatPos (int posIdx)
 
override float OnSound (CarSoundCtrl ctrl, float oldValue)
 
override string GetAnimSourceFromSelection (string selection)
 
override string GetDoorConditionPointFromSelection (string selection)
 
override int GetCrewIndex (string selection)
 
override bool IsVitalTruckBattery ()
 
override bool IsVitalGlowPlug ()
 
override bool CanReachSeatFromSeat (int currentSeat, int nextSeat)
 
override bool CanReachDoorsFromSeat (string pDoorsSelection, int pCurrentSeat)
 
override int GetSeatIndexFromDoor (string pDoorSelection)
 
override void SetActions ()
 

Variables

ref UniversalTemperatureSource m_UTSource
 
ref UniversalTemperatureSourceSettings m_UTSSettings
 
ref UniversalTemperatureSourceLambdaEngine m_UTSLEngine
 

Function Documentation

◆ CanDisplayAttachmentCategory()

override bool OnDebugSpawn::CanDisplayAttachmentCategory ( string category_name)
protected

Definition at line 569 of file OffroadHatchback.c.

◆ CanDisplayCargo()

override bool OnDebugSpawn::CanDisplayCargo ( )
protected

Definition at line 584 of file OffroadHatchback.c.

585{
589
590 void OffroadHatchback()
591 {
592 //m_dmgContactCoef = 0.075;
593
594 m_EngineStartOK = "offroad_engine_start_SoundSet";
595 m_EngineStartBattery = "offroad_engine_failed_start_battery_SoundSet";
596 m_EngineStartPlug = "offroad_engine_failed_start_sparkplugs_SoundSet";
597 m_EngineStartFuel = "offroad_engine_failed_start_fuel_SoundSet";
598 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
599
600 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
601 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
602 m_CarSeatShiftInSound = "Offroad_SeatShiftIn_SoundSet";
603 m_CarSeatShiftOutSound = "Offroad_SeatShiftOut_SoundSet";
604
605 m_CarHornShortSoundName = "Offroad_Horn_Short_SoundSet";
606 m_CarHornLongSoundName = "Offroad_Horn_SoundSet";
607
608 SetEnginePos("0 0.7 1.2");
609 }
610
611 override void EEInit()
612 {
613 super.EEInit();
614
615 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
616 {
618 m_UTSSettings.m_ManualUpdate = true;
619 m_UTSSettings.m_TemperatureMin = 0;
620 m_UTSSettings.m_TemperatureMax = 30;
621 m_UTSSettings.m_RangeFull = 0.5;
622 m_UTSSettings.m_RangeMax = 2;
623 m_UTSSettings.m_TemperatureCap = 25;
624
627 }
628 }
629
630 override void OnEngineStart()
631 {
632 super.OnEngineStart();
633
634 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
635 m_UTSource.SetDefferedActive(true, 20.0);
636 }
637
638 override void OnEngineStop()
639 {
640 super.OnEngineStop();
641
642 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
643 m_UTSource.SetDefferedActive(false, 10.0);
644 }
645
646 override void EOnPostSimulate(IEntity other, float timeSlice)
647 {
648 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
649 {
650 if (m_UTSource.IsActive())
652 }
653 }
654
655 override int GetAnimInstance()
656 {
657 return VehicleAnimInstances.HATCHBACK;
658 }
659
660 override float GetTransportCameraDistance()
661 {
662 return 3.5;
663 }
664
665 override int GetSeatAnimationType(int posIdx)
666 {
667 switch (posIdx)
668 {
669 case 0:
670 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
671 case 1:
672 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
673 case 2:
674 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
675 case 3:
676 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
677 }
678
679 return 0;
680
681 }
682
683
685 {
686 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackRearLight));
687 }
688
690 {
691 return CarLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackFrontLight));
692 }
693
695 {
696 if (!super.CanReleaseAttachment(attachment))
697 return false;
698
699 if (EngineIsOn() || GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
700 {
701 string attType = attachment.GetType();
702 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
703 return false;
704 }
705
706 return true;
707 }
708
709 override protected bool CanManipulateSpareWheel(string slotSelectionName)
710 {
711 return GetCarDoorsState("NivaHood") != CarDoorState.DOORS_CLOSED;
712 }
713
714 override bool CanDisplayAttachmentCategory(string category_name)
715 {
716 if (!super.CanDisplayAttachmentCategory(category_name))
717 return false;
718
719 category_name.ToLower();
720 if (category_name.Contains("engine"))
721 {
722 if (GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
723 return false;
724 }
725
726 return true;
727 }
728
729 override bool CanDisplayCargo()
730 {
731 if (!super.CanDisplayCargo())
732 return false;
733
734 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
735 return false;
736
737 return true;
738 }
739
740 override int GetCarDoorsState(string slotType)
741 {
743
744 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
745 if (!carDoor)
746 return CarDoorState.DOORS_MISSING;
747
748 switch (slotType)
749 {
750 case "NivaDriverDoors":
751 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
752
753 case "NivaCoDriverDoors":
754 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
755
756 case "NivaHood":
757 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
758
759 case "NivaTrunk":
760 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
761 }
762
763 return CarDoorState.DOORS_MISSING;
764 }
765
766 override bool CrewCanGetThrough(int posIdx)
767 {
769 switch (posIdx)
770 {
771 case 0:
772 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
773 return false;
774 else if (GetAnimationPhase("SeatDriver") > 0.5)
775 return false;
776
777 return true;
778
779 case 1:
780 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
781 return false;
782 else if (GetAnimationPhase("SeatCoDriver") > 0.5)
783 return false;
784
785 return true;
786
787 case 2:
788 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
789 return false;
790 else if (GetAnimationPhase("SeatDriver") <= 0.5)
791 return false;
792
793 return true;
794
795 case 3:
796 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
797 return false;
798 else if (GetAnimationPhase("SeatCoDriver") <= 0.5)
799 return false;
800
801 return true;
802 }
803
804 return false;
805 }
806
807 override string GetDoorSelectionNameFromSeatPos(int posIdx)
808 {
809 switch (posIdx)
810 {
811 case 0:
812 case 2:
813 return "doors_driver";
814 case 1:
815 case 3:
816 return "doors_codriver";
817 }
818
819 return super.GetDoorSelectionNameFromSeatPos(posIdx);
820 }
821
822 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
823 {
824 switch (posIdx)
825 {
826 case 0:
827 case 2:
828 return "NivaDriverDoors";
829 case 1:
830 case 3:
831 return "NivaCoDriverDoors";
832 }
833
834 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
835 }
836
837 // 0 full ambient and engine sound
838 // 1 zero ambient and engine sound
839 override float OnSound(CarSoundCtrl ctrl, float oldValue)
840 {
841 float tempCap = 0.0;
842
843 switch (ctrl)
844 {
845 case CarSoundCtrl.DOORS:
846 float newValue = 0;
847 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
848 newValue += 0.5;
849
850 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
851 newValue += 0.5;
852
853 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
854 newValue += 0.3;
855
856 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
857 newValue -= 0.6;
858
859 if (GetHealthLevel("WindowLR") == GameConstants.STATE_RUINED)
860 newValue -= 0.2;
861
862 if (GetHealthLevel("WindowRR") == GameConstants.STATE_RUINED)
863 newValue -= 0.2;
864
865 return Math.Clamp(newValue, 0, 1);
866 break;
867 }
868
869 return super.OnSound(ctrl, oldValue);
870 }
871
872 override string GetAnimSourceFromSelection(string selection)
873 {
874 switch (selection)
875 {
876 case "doors_driver":
877 return "DoorsDriver";
878 case "doors_codriver":
879 return "DoorsCoDriver";
880 case "doors_hood":
881 return "DoorsHood";
882 case "doors_trunk":
883 return "DoorsTrunk";
884 case "seatback_driver":
885 return "SeatDriver";
886 case "seatback_codriver":
887 return "SeatCoDriver";
888 }
889
890 return "";
891 }
892
893 override string GetDoorConditionPointFromSelection(string selection)
894 {
895 switch (selection)
896 {
897 case "seat_driver":
898 case "seatback_driver":
899 case "seat_cargo1":
900 return "seat_con_1_1";
901 case "seat_codriver":
902 case "seatback_codriver":
903 case "seat_cargo2":
904 return "seat_con_2_1";
905 }
906
907 return "";
908 }
909
910 override int GetCrewIndex(string selection)
911 {
912 switch (selection)
913 {
914 case "seatback_driver":
915 return 0;
916 case "seatback_codriver":
917 return 1;
918 }
919
920 return -1;
921 }
922
923 override bool IsVitalTruckBattery()
924 {
925 return false;
926 }
927
928 override bool IsVitalGlowPlug()
929 {
930 return false;
931 }
932
933 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
934 {
935 if (nextSeat == 0 && GetAnimationPhase("SeatDriver") > 0.5)
936 return false;
937
938 if (nextSeat == 1 && GetAnimationPhase("SeatCoDriver") > 0.5)
939 return false;
940
941 switch (currentSeat)
942 {
943 case 0:
944 return nextSeat == 1;
945
946 case 1:
947 return nextSeat == 0;
948
949 case 2:
950 return nextSeat == 3;
951
952 case 3:
953 return nextSeat == 2;
954 }
955
956 return false;
957 }
958
959 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
960 {
961 switch (pCurrentSeat)
962 {
963 case 0:
964 return pDoorsSelection == "DoorsDriver";
965
966 case 1:
967 return pDoorsSelection == "DoorsCoDriver";
968
969 case 2:
970 return pDoorsSelection == "DoorsDriver";
971
972 case 3:
973 return pDoorsSelection == "DoorsCoDriver";
974 }
975
976 return false;
977 }
978
979 override int GetSeatIndexFromDoor(string pDoorSelection)
980 {
981 switch (pDoorSelection)
982 {
983 case "DoorsDriver":
984 return 0;
985 case "DoorsCoDriver":
986 return 1;
987 }
988
989 return -1;
990 }
991
992 override void SetActions()
993 {
994 super.SetActions();
995
997 }
998
999 override void OnDebugSpawn()
1000 {
1004
1005 GetInventory().CreateInInventory("HatchbackWheel");
1006 GetInventory().CreateInInventory("HatchbackWheel");
1007 GetInventory().CreateInInventory("HatchbackWheel");
1008 GetInventory().CreateInInventory("HatchbackWheel");
1009
1010 GetInventory().CreateInInventory("HatchbackDoors_Driver");
1011 GetInventory().CreateInInventory("HatchbackDoors_CoDriver");
1012 GetInventory().CreateInInventory("HatchbackHood");
1013 GetInventory().CreateInInventory("HatchbackTrunk");
1014
1015 //-----IN CAR CARGO
1016 GetInventory().CreateInInventory("HatchbackWheel");
1017 GetInventory().CreateInInventory("HatchbackWheel");
1018 }
1019}
1020
1022{
1023 override void OnDebugSpawn()
1024 {
1028
1029 GetInventory().CreateInInventory("HatchbackWheel");
1030 GetInventory().CreateInInventory("HatchbackWheel");
1031 GetInventory().CreateInInventory("HatchbackWheel");
1032 GetInventory().CreateInInventory("HatchbackWheel");
1033
1034 GetInventory().CreateInInventory("HatchbackDoors_Driver_White");
1035 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_White");
1036 GetInventory().CreateInInventory("HatchbackHood_White");
1037 GetInventory().CreateInInventory("HatchbackTrunk_White");
1038
1039 //-----IN CAR CARGO
1040 GetInventory().CreateInInventory("HatchbackWheel");
1041 GetInventory().CreateInInventory("HatchbackWheel");
1042 }
1043}
1044
1046{
1047 override void OnDebugSpawn()
1048 {
1052
1053 GetInventory().CreateInInventory("HatchbackWheel");
1054 GetInventory().CreateInInventory("HatchbackWheel");
1055 GetInventory().CreateInInventory("HatchbackWheel");
1056 GetInventory().CreateInInventory("HatchbackWheel");
1057
1058 GetInventory().CreateInInventory("HatchbackDoors_Driver_Blue");
1059 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_Blue");
1060 GetInventory().CreateInInventory("HatchbackHood_Blue");
1061 GetInventory().CreateInInventory("HatchbackTrunk_Blue");
1062
1063 //-----IN CAR CARGO
1064 GetInventory().CreateInInventory("HatchbackWheel");
1065 GetInventory().CreateInInventory("HatchbackWheel");
1066 }
1067}
void AddAction(typename actionName)
CarSoundCtrl
Car's sound controller list. (native, do not change or extend)
Definition Car.c:4
void SpawnUniversalParts()
Definition CarScript.c:2516
string m_CarSeatShiftInSound
Definition CarScript.c:215
CarDoorState TranslateAnimationPhaseToCarDoorState(string animation)
Definition CarScript.c:2241
CarDoorState
Definition CarScript.c:2
void SpawnAdditionalItems()
Definition CarScript.c:2554
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:2578
string m_CarHornLongSoundName
Definition CarScript.c:219
string m_EngineStopFuel
Definition CarScript.c:211
string m_CarSeatShiftOutSound
Definition CarScript.c:216
string m_CarDoorOpenSound
Definition CarScript.c:213
class Hatchback_02_Blue extends Hatchback_02 OnDebugSpawn
ref UniversalTemperatureSourceSettings m_UTSSettings
override void SetActions()
override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
override string GetAnimSourceFromSelection(string selection)
override int GetSeatAnimationType(int posIdx)
override string GetDoorConditionPointFromSelection(string selection)
override float OnSound(CarSoundCtrl ctrl, float oldValue)
override string GetDoorInvSlotNameFromSeatPos(int posIdx)
override void EOnPostSimulate(IEntity other, float timeSlice)
override void OnEngineStop()
ref UniversalTemperatureSourceLambdaEngine m_UTSLEngine
override float GetTransportCameraDistance()
override void EEInit()
override bool CanReleaseAttachment(EntityAI attachment)
override bool CanDisplayCargo()
override void OnEngineStart()
override CarLightBase CreateFrontLight()
override int GetAnimInstance()
override bool CrewCanGetThrough(int posIdx)
override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
bool CanManipulateSpareWheel(string slotSelectionName)
override bool IsVitalGlowPlug()
ref UniversalTemperatureSource m_UTSource
override CarRearLightBase CreateRearLight()
class OffroadHatchback extends CarScript OnDebugSpawn()
override int GetSeatIndexFromDoor(string pDoorSelection)
void OffroadHatchback()
override bool IsVitalTruckBattery()
override string GetDoorSelectionNameFromSeatPos(int posIdx)
override int GetCarDoorsState(string slotType)
override int GetCrewIndex(string selection)
override bool CanDisplayAttachmentCategory(string category_name)
VehicleAnimInstances
Super root of all classes in Enforce script.
Definition EnScript.c:11
Definition EnMath.c:7
original Timer deletes m_params which is unwanted
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
const int STATE_RUINED
Definition constants.c:757
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 OnDebugSpawn::CanManipulateSpareWheel ( string slotSelectionName)
protected

Definition at line 564 of file OffroadHatchback.c.

565{
569
570 void OffroadHatchback()
571 {
572 //m_dmgContactCoef = 0.075;
573
574 m_EngineStartOK = "offroad_engine_start_SoundSet";
575 m_EngineStartBattery = "offroad_engine_failed_start_battery_SoundSet";
576 m_EngineStartPlug = "offroad_engine_failed_start_sparkplugs_SoundSet";
577 m_EngineStartFuel = "offroad_engine_failed_start_fuel_SoundSet";
578 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
579
580 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
581 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
582 m_CarSeatShiftInSound = "Offroad_SeatShiftIn_SoundSet";
583 m_CarSeatShiftOutSound = "Offroad_SeatShiftOut_SoundSet";
584
585 m_CarHornShortSoundName = "Offroad_Horn_Short_SoundSet";
586 m_CarHornLongSoundName = "Offroad_Horn_SoundSet";
587
588 SetEnginePos("0 0.7 1.2");
589 }
590
591 override void EEInit()
592 {
593 super.EEInit();
594
595 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
596 {
598 m_UTSSettings.m_ManualUpdate = true;
599 m_UTSSettings.m_TemperatureMin = 0;
600 m_UTSSettings.m_TemperatureMax = 30;
601 m_UTSSettings.m_RangeFull = 0.5;
602 m_UTSSettings.m_RangeMax = 2;
603 m_UTSSettings.m_TemperatureCap = 25;
604
607 }
608 }
609
610 override void OnEngineStart()
611 {
612 super.OnEngineStart();
613
614 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
615 m_UTSource.SetDefferedActive(true, 20.0);
616 }
617
618 override void OnEngineStop()
619 {
620 super.OnEngineStop();
621
622 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
623 m_UTSource.SetDefferedActive(false, 10.0);
624 }
625
626 override void EOnPostSimulate(IEntity other, float timeSlice)
627 {
628 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
629 {
630 if (m_UTSource.IsActive())
632 }
633 }
634
635 override int GetAnimInstance()
636 {
637 return VehicleAnimInstances.HATCHBACK;
638 }
639
640 override float GetTransportCameraDistance()
641 {
642 return 3.5;
643 }
644
645 override int GetSeatAnimationType(int posIdx)
646 {
647 switch (posIdx)
648 {
649 case 0:
650 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
651 case 1:
652 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
653 case 2:
654 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
655 case 3:
656 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
657 }
658
659 return 0;
660
661 }
662
663
665 {
666 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackRearLight));
667 }
668
670 {
671 return CarLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackFrontLight));
672 }
673
675 {
676 if (!super.CanReleaseAttachment(attachment))
677 return false;
678
679 if (EngineIsOn() || GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
680 {
681 string attType = attachment.GetType();
682 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
683 return false;
684 }
685
686 return true;
687 }
688
689 override protected bool CanManipulateSpareWheel(string slotSelectionName)
690 {
691 return GetCarDoorsState("NivaHood") != CarDoorState.DOORS_CLOSED;
692 }
693
694 override bool CanDisplayAttachmentCategory(string category_name)
695 {
696 if (!super.CanDisplayAttachmentCategory(category_name))
697 return false;
698
699 category_name.ToLower();
700 if (category_name.Contains("engine"))
701 {
702 if (GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
703 return false;
704 }
705
706 return true;
707 }
708
709 override bool CanDisplayCargo()
710 {
711 if (!super.CanDisplayCargo())
712 return false;
713
714 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
715 return false;
716
717 return true;
718 }
719
720 override int GetCarDoorsState(string slotType)
721 {
723
724 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
725 if (!carDoor)
726 return CarDoorState.DOORS_MISSING;
727
728 switch (slotType)
729 {
730 case "NivaDriverDoors":
731 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
732
733 case "NivaCoDriverDoors":
734 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
735
736 case "NivaHood":
737 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
738
739 case "NivaTrunk":
740 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
741 }
742
743 return CarDoorState.DOORS_MISSING;
744 }
745
746 override bool CrewCanGetThrough(int posIdx)
747 {
749 switch (posIdx)
750 {
751 case 0:
752 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
753 return false;
754 else if (GetAnimationPhase("SeatDriver") > 0.5)
755 return false;
756
757 return true;
758
759 case 1:
760 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
761 return false;
762 else if (GetAnimationPhase("SeatCoDriver") > 0.5)
763 return false;
764
765 return true;
766
767 case 2:
768 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
769 return false;
770 else if (GetAnimationPhase("SeatDriver") <= 0.5)
771 return false;
772
773 return true;
774
775 case 3:
776 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
777 return false;
778 else if (GetAnimationPhase("SeatCoDriver") <= 0.5)
779 return false;
780
781 return true;
782 }
783
784 return false;
785 }
786
787 override string GetDoorSelectionNameFromSeatPos(int posIdx)
788 {
789 switch (posIdx)
790 {
791 case 0:
792 case 2:
793 return "doors_driver";
794 case 1:
795 case 3:
796 return "doors_codriver";
797 }
798
799 return super.GetDoorSelectionNameFromSeatPos(posIdx);
800 }
801
802 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
803 {
804 switch (posIdx)
805 {
806 case 0:
807 case 2:
808 return "NivaDriverDoors";
809 case 1:
810 case 3:
811 return "NivaCoDriverDoors";
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 float tempCap = 0.0;
822
823 switch (ctrl)
824 {
825 case CarSoundCtrl.DOORS:
826 float newValue = 0;
827 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
828 newValue += 0.5;
829
830 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
831 newValue += 0.5;
832
833 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
834 newValue += 0.3;
835
836 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
837 newValue -= 0.6;
838
839 if (GetHealthLevel("WindowLR") == GameConstants.STATE_RUINED)
840 newValue -= 0.2;
841
842 if (GetHealthLevel("WindowRR") == GameConstants.STATE_RUINED)
843 newValue -= 0.2;
844
845 return Math.Clamp(newValue, 0, 1);
846 break;
847 }
848
849 return super.OnSound(ctrl, oldValue);
850 }
851
852 override string GetAnimSourceFromSelection(string selection)
853 {
854 switch (selection)
855 {
856 case "doors_driver":
857 return "DoorsDriver";
858 case "doors_codriver":
859 return "DoorsCoDriver";
860 case "doors_hood":
861 return "DoorsHood";
862 case "doors_trunk":
863 return "DoorsTrunk";
864 case "seatback_driver":
865 return "SeatDriver";
866 case "seatback_codriver":
867 return "SeatCoDriver";
868 }
869
870 return "";
871 }
872
873 override string GetDoorConditionPointFromSelection(string selection)
874 {
875 switch (selection)
876 {
877 case "seat_driver":
878 case "seatback_driver":
879 case "seat_cargo1":
880 return "seat_con_1_1";
881 case "seat_codriver":
882 case "seatback_codriver":
883 case "seat_cargo2":
884 return "seat_con_2_1";
885 }
886
887 return "";
888 }
889
890 override int GetCrewIndex(string selection)
891 {
892 switch (selection)
893 {
894 case "seatback_driver":
895 return 0;
896 case "seatback_codriver":
897 return 1;
898 }
899
900 return -1;
901 }
902
903 override bool IsVitalTruckBattery()
904 {
905 return false;
906 }
907
908 override bool IsVitalGlowPlug()
909 {
910 return false;
911 }
912
913 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
914 {
915 if (nextSeat == 0 && GetAnimationPhase("SeatDriver") > 0.5)
916 return false;
917
918 if (nextSeat == 1 && GetAnimationPhase("SeatCoDriver") > 0.5)
919 return false;
920
921 switch (currentSeat)
922 {
923 case 0:
924 return nextSeat == 1;
925
926 case 1:
927 return nextSeat == 0;
928
929 case 2:
930 return nextSeat == 3;
931
932 case 3:
933 return nextSeat == 2;
934 }
935
936 return false;
937 }
938
939 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
940 {
941 switch (pCurrentSeat)
942 {
943 case 0:
944 return pDoorsSelection == "DoorsDriver";
945
946 case 1:
947 return pDoorsSelection == "DoorsCoDriver";
948
949 case 2:
950 return pDoorsSelection == "DoorsDriver";
951
952 case 3:
953 return pDoorsSelection == "DoorsCoDriver";
954 }
955
956 return false;
957 }
958
959 override int GetSeatIndexFromDoor(string pDoorSelection)
960 {
961 switch (pDoorSelection)
962 {
963 case "DoorsDriver":
964 return 0;
965 case "DoorsCoDriver":
966 return 1;
967 }
968
969 return -1;
970 }
971
972 override void SetActions()
973 {
974 super.SetActions();
975
977 }
978
979 override void OnDebugSpawn()
980 {
984
985 GetInventory().CreateInInventory("HatchbackWheel");
986 GetInventory().CreateInInventory("HatchbackWheel");
987 GetInventory().CreateInInventory("HatchbackWheel");
988 GetInventory().CreateInInventory("HatchbackWheel");
989
990 GetInventory().CreateInInventory("HatchbackDoors_Driver");
991 GetInventory().CreateInInventory("HatchbackDoors_CoDriver");
992 GetInventory().CreateInInventory("HatchbackHood");
993 GetInventory().CreateInInventory("HatchbackTrunk");
994
995 //-----IN CAR CARGO
996 GetInventory().CreateInInventory("HatchbackWheel");
997 GetInventory().CreateInInventory("HatchbackWheel");
998 }
999}
1000
1002{
1003 override void OnDebugSpawn()
1004 {
1008
1009 GetInventory().CreateInInventory("HatchbackWheel");
1010 GetInventory().CreateInInventory("HatchbackWheel");
1011 GetInventory().CreateInInventory("HatchbackWheel");
1012 GetInventory().CreateInInventory("HatchbackWheel");
1013
1014 GetInventory().CreateInInventory("HatchbackDoors_Driver_White");
1015 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_White");
1016 GetInventory().CreateInInventory("HatchbackHood_White");
1017 GetInventory().CreateInInventory("HatchbackTrunk_White");
1018
1019 //-----IN CAR CARGO
1020 GetInventory().CreateInInventory("HatchbackWheel");
1021 GetInventory().CreateInInventory("HatchbackWheel");
1022 }
1023}
1024
1026{
1027 override void OnDebugSpawn()
1028 {
1032
1033 GetInventory().CreateInInventory("HatchbackWheel");
1034 GetInventory().CreateInInventory("HatchbackWheel");
1035 GetInventory().CreateInInventory("HatchbackWheel");
1036 GetInventory().CreateInInventory("HatchbackWheel");
1037
1038 GetInventory().CreateInInventory("HatchbackDoors_Driver_Blue");
1039 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_Blue");
1040 GetInventory().CreateInInventory("HatchbackHood_Blue");
1041 GetInventory().CreateInInventory("HatchbackTrunk_Blue");
1042
1043 //-----IN CAR CARGO
1044 GetInventory().CreateInInventory("HatchbackWheel");
1045 GetInventory().CreateInInventory("HatchbackWheel");
1046 }
1047}

◆ CanReachDoorsFromSeat()

override bool OnDebugSpawn::CanReachDoorsFromSeat ( string pDoorsSelection,
int pCurrentSeat )
protected

Definition at line 814 of file OffroadHatchback.c.

815{
819
820 void OffroadHatchback()
821 {
822 //m_dmgContactCoef = 0.075;
823
824 m_EngineStartOK = "offroad_engine_start_SoundSet";
825 m_EngineStartBattery = "offroad_engine_failed_start_battery_SoundSet";
826 m_EngineStartPlug = "offroad_engine_failed_start_sparkplugs_SoundSet";
827 m_EngineStartFuel = "offroad_engine_failed_start_fuel_SoundSet";
828 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
829
830 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
831 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
832 m_CarSeatShiftInSound = "Offroad_SeatShiftIn_SoundSet";
833 m_CarSeatShiftOutSound = "Offroad_SeatShiftOut_SoundSet";
834
835 m_CarHornShortSoundName = "Offroad_Horn_Short_SoundSet";
836 m_CarHornLongSoundName = "Offroad_Horn_SoundSet";
837
838 SetEnginePos("0 0.7 1.2");
839 }
840
841 override void EEInit()
842 {
843 super.EEInit();
844
845 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
846 {
848 m_UTSSettings.m_ManualUpdate = true;
849 m_UTSSettings.m_TemperatureMin = 0;
850 m_UTSSettings.m_TemperatureMax = 30;
851 m_UTSSettings.m_RangeFull = 0.5;
852 m_UTSSettings.m_RangeMax = 2;
853 m_UTSSettings.m_TemperatureCap = 25;
854
857 }
858 }
859
860 override void OnEngineStart()
861 {
862 super.OnEngineStart();
863
864 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
865 m_UTSource.SetDefferedActive(true, 20.0);
866 }
867
868 override void OnEngineStop()
869 {
870 super.OnEngineStop();
871
872 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
873 m_UTSource.SetDefferedActive(false, 10.0);
874 }
875
876 override void EOnPostSimulate(IEntity other, float timeSlice)
877 {
878 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
879 {
880 if (m_UTSource.IsActive())
882 }
883 }
884
885 override int GetAnimInstance()
886 {
887 return VehicleAnimInstances.HATCHBACK;
888 }
889
890 override float GetTransportCameraDistance()
891 {
892 return 3.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
913
915 {
916 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackRearLight));
917 }
918
920 {
921 return CarLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackFrontLight));
922 }
923
925 {
926 if (!super.CanReleaseAttachment(attachment))
927 return false;
928
929 if (EngineIsOn() || GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
930 {
931 string attType = attachment.GetType();
932 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
933 return false;
934 }
935
936 return true;
937 }
938
939 override protected bool CanManipulateSpareWheel(string slotSelectionName)
940 {
941 return GetCarDoorsState("NivaHood") != CarDoorState.DOORS_CLOSED;
942 }
943
944 override bool CanDisplayAttachmentCategory(string category_name)
945 {
946 if (!super.CanDisplayAttachmentCategory(category_name))
947 return false;
948
949 category_name.ToLower();
950 if (category_name.Contains("engine"))
951 {
952 if (GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
953 return false;
954 }
955
956 return true;
957 }
958
959 override bool CanDisplayCargo()
960 {
961 if (!super.CanDisplayCargo())
962 return false;
963
964 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
965 return false;
966
967 return true;
968 }
969
970 override int GetCarDoorsState(string slotType)
971 {
973
974 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
975 if (!carDoor)
976 return CarDoorState.DOORS_MISSING;
977
978 switch (slotType)
979 {
980 case "NivaDriverDoors":
981 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
982
983 case "NivaCoDriverDoors":
984 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
985
986 case "NivaHood":
987 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
988
989 case "NivaTrunk":
990 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
991 }
992
993 return CarDoorState.DOORS_MISSING;
994 }
995
996 override bool CrewCanGetThrough(int posIdx)
997 {
999 switch (posIdx)
1000 {
1001 case 0:
1002 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
1003 return false;
1004 else if (GetAnimationPhase("SeatDriver") > 0.5)
1005 return false;
1006
1007 return true;
1008
1009 case 1:
1010 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
1011 return false;
1012 else if (GetAnimationPhase("SeatCoDriver") > 0.5)
1013 return false;
1014
1015 return true;
1016
1017 case 2:
1018 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
1019 return false;
1020 else if (GetAnimationPhase("SeatDriver") <= 0.5)
1021 return false;
1022
1023 return true;
1024
1025 case 3:
1026 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
1027 return false;
1028 else if (GetAnimationPhase("SeatCoDriver") <= 0.5)
1029 return false;
1030
1031 return true;
1032 }
1033
1034 return false;
1035 }
1036
1037 override string GetDoorSelectionNameFromSeatPos(int posIdx)
1038 {
1039 switch (posIdx)
1040 {
1041 case 0:
1042 case 2:
1043 return "doors_driver";
1044 case 1:
1045 case 3:
1046 return "doors_codriver";
1047 }
1048
1049 return super.GetDoorSelectionNameFromSeatPos(posIdx);
1050 }
1051
1052 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
1053 {
1054 switch (posIdx)
1055 {
1056 case 0:
1057 case 2:
1058 return "NivaDriverDoors";
1059 case 1:
1060 case 3:
1061 return "NivaCoDriverDoors";
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 float tempCap = 0.0;
1072
1073 switch (ctrl)
1074 {
1075 case CarSoundCtrl.DOORS:
1076 float newValue = 0;
1077 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
1078 newValue += 0.5;
1079
1080 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
1081 newValue += 0.5;
1082
1083 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
1084 newValue += 0.3;
1085
1086 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
1087 newValue -= 0.6;
1088
1089 if (GetHealthLevel("WindowLR") == GameConstants.STATE_RUINED)
1090 newValue -= 0.2;
1091
1092 if (GetHealthLevel("WindowRR") == GameConstants.STATE_RUINED)
1093 newValue -= 0.2;
1094
1095 return Math.Clamp(newValue, 0, 1);
1096 break;
1097 }
1098
1099 return super.OnSound(ctrl, oldValue);
1100 }
1101
1102 override string GetAnimSourceFromSelection(string selection)
1103 {
1104 switch (selection)
1105 {
1106 case "doors_driver":
1107 return "DoorsDriver";
1108 case "doors_codriver":
1109 return "DoorsCoDriver";
1110 case "doors_hood":
1111 return "DoorsHood";
1112 case "doors_trunk":
1113 return "DoorsTrunk";
1114 case "seatback_driver":
1115 return "SeatDriver";
1116 case "seatback_codriver":
1117 return "SeatCoDriver";
1118 }
1119
1120 return "";
1121 }
1122
1123 override string GetDoorConditionPointFromSelection(string selection)
1124 {
1125 switch (selection)
1126 {
1127 case "seat_driver":
1128 case "seatback_driver":
1129 case "seat_cargo1":
1130 return "seat_con_1_1";
1131 case "seat_codriver":
1132 case "seatback_codriver":
1133 case "seat_cargo2":
1134 return "seat_con_2_1";
1135 }
1136
1137 return "";
1138 }
1139
1140 override int GetCrewIndex(string selection)
1141 {
1142 switch (selection)
1143 {
1144 case "seatback_driver":
1145 return 0;
1146 case "seatback_codriver":
1147 return 1;
1148 }
1149
1150 return -1;
1151 }
1152
1153 override bool IsVitalTruckBattery()
1154 {
1155 return false;
1156 }
1157
1158 override bool IsVitalGlowPlug()
1159 {
1160 return false;
1161 }
1162
1163 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
1164 {
1165 if (nextSeat == 0 && GetAnimationPhase("SeatDriver") > 0.5)
1166 return false;
1167
1168 if (nextSeat == 1 && GetAnimationPhase("SeatCoDriver") > 0.5)
1169 return false;
1170
1171 switch (currentSeat)
1172 {
1173 case 0:
1174 return nextSeat == 1;
1175
1176 case 1:
1177 return nextSeat == 0;
1178
1179 case 2:
1180 return nextSeat == 3;
1181
1182 case 3:
1183 return nextSeat == 2;
1184 }
1185
1186 return false;
1187 }
1188
1189 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
1190 {
1191 switch (pCurrentSeat)
1192 {
1193 case 0:
1194 return pDoorsSelection == "DoorsDriver";
1195
1196 case 1:
1197 return pDoorsSelection == "DoorsCoDriver";
1198
1199 case 2:
1200 return pDoorsSelection == "DoorsDriver";
1201
1202 case 3:
1203 return pDoorsSelection == "DoorsCoDriver";
1204 }
1205
1206 return false;
1207 }
1208
1209 override int GetSeatIndexFromDoor(string pDoorSelection)
1210 {
1211 switch (pDoorSelection)
1212 {
1213 case "DoorsDriver":
1214 return 0;
1215 case "DoorsCoDriver":
1216 return 1;
1217 }
1218
1219 return -1;
1220 }
1221
1222 override void SetActions()
1223 {
1224 super.SetActions();
1225
1227 }
1228
1229 override void OnDebugSpawn()
1230 {
1234
1235 GetInventory().CreateInInventory("HatchbackWheel");
1236 GetInventory().CreateInInventory("HatchbackWheel");
1237 GetInventory().CreateInInventory("HatchbackWheel");
1238 GetInventory().CreateInInventory("HatchbackWheel");
1239
1240 GetInventory().CreateInInventory("HatchbackDoors_Driver");
1241 GetInventory().CreateInInventory("HatchbackDoors_CoDriver");
1242 GetInventory().CreateInInventory("HatchbackHood");
1243 GetInventory().CreateInInventory("HatchbackTrunk");
1244
1245 //-----IN CAR CARGO
1246 GetInventory().CreateInInventory("HatchbackWheel");
1247 GetInventory().CreateInInventory("HatchbackWheel");
1248 }
1249}
1250
1252{
1253 override void OnDebugSpawn()
1254 {
1258
1259 GetInventory().CreateInInventory("HatchbackWheel");
1260 GetInventory().CreateInInventory("HatchbackWheel");
1261 GetInventory().CreateInInventory("HatchbackWheel");
1262 GetInventory().CreateInInventory("HatchbackWheel");
1263
1264 GetInventory().CreateInInventory("HatchbackDoors_Driver_White");
1265 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_White");
1266 GetInventory().CreateInInventory("HatchbackHood_White");
1267 GetInventory().CreateInInventory("HatchbackTrunk_White");
1268
1269 //-----IN CAR CARGO
1270 GetInventory().CreateInInventory("HatchbackWheel");
1271 GetInventory().CreateInInventory("HatchbackWheel");
1272 }
1273}
1274
1276{
1277 override void OnDebugSpawn()
1278 {
1282
1283 GetInventory().CreateInInventory("HatchbackWheel");
1284 GetInventory().CreateInInventory("HatchbackWheel");
1285 GetInventory().CreateInInventory("HatchbackWheel");
1286 GetInventory().CreateInInventory("HatchbackWheel");
1287
1288 GetInventory().CreateInInventory("HatchbackDoors_Driver_Blue");
1289 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_Blue");
1290 GetInventory().CreateInInventory("HatchbackHood_Blue");
1291 GetInventory().CreateInInventory("HatchbackTrunk_Blue");
1292
1293 //-----IN CAR CARGO
1294 GetInventory().CreateInInventory("HatchbackWheel");
1295 GetInventory().CreateInInventory("HatchbackWheel");
1296 }
1297}

◆ CanReachSeatFromSeat()

override bool OnDebugSpawn::CanReachSeatFromSeat ( int currentSeat,
int nextSeat )
protected

Definition at line 788 of file OffroadHatchback.c.

789{
793
794 void OffroadHatchback()
795 {
796 //m_dmgContactCoef = 0.075;
797
798 m_EngineStartOK = "offroad_engine_start_SoundSet";
799 m_EngineStartBattery = "offroad_engine_failed_start_battery_SoundSet";
800 m_EngineStartPlug = "offroad_engine_failed_start_sparkplugs_SoundSet";
801 m_EngineStartFuel = "offroad_engine_failed_start_fuel_SoundSet";
802 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
803
804 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
805 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
806 m_CarSeatShiftInSound = "Offroad_SeatShiftIn_SoundSet";
807 m_CarSeatShiftOutSound = "Offroad_SeatShiftOut_SoundSet";
808
809 m_CarHornShortSoundName = "Offroad_Horn_Short_SoundSet";
810 m_CarHornLongSoundName = "Offroad_Horn_SoundSet";
811
812 SetEnginePos("0 0.7 1.2");
813 }
814
815 override void EEInit()
816 {
817 super.EEInit();
818
819 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
820 {
822 m_UTSSettings.m_ManualUpdate = true;
823 m_UTSSettings.m_TemperatureMin = 0;
824 m_UTSSettings.m_TemperatureMax = 30;
825 m_UTSSettings.m_RangeFull = 0.5;
826 m_UTSSettings.m_RangeMax = 2;
827 m_UTSSettings.m_TemperatureCap = 25;
828
831 }
832 }
833
834 override void OnEngineStart()
835 {
836 super.OnEngineStart();
837
838 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
839 m_UTSource.SetDefferedActive(true, 20.0);
840 }
841
842 override void OnEngineStop()
843 {
844 super.OnEngineStop();
845
846 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
847 m_UTSource.SetDefferedActive(false, 10.0);
848 }
849
850 override void EOnPostSimulate(IEntity other, float timeSlice)
851 {
852 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
853 {
854 if (m_UTSource.IsActive())
856 }
857 }
858
859 override int GetAnimInstance()
860 {
861 return VehicleAnimInstances.HATCHBACK;
862 }
863
864 override float GetTransportCameraDistance()
865 {
866 return 3.5;
867 }
868
869 override int GetSeatAnimationType(int posIdx)
870 {
871 switch (posIdx)
872 {
873 case 0:
874 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
875 case 1:
876 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
877 case 2:
878 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
879 case 3:
880 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
881 }
882
883 return 0;
884
885 }
886
887
889 {
890 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackRearLight));
891 }
892
894 {
895 return CarLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackFrontLight));
896 }
897
899 {
900 if (!super.CanReleaseAttachment(attachment))
901 return false;
902
903 if (EngineIsOn() || GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
904 {
905 string attType = attachment.GetType();
906 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
907 return false;
908 }
909
910 return true;
911 }
912
913 override protected bool CanManipulateSpareWheel(string slotSelectionName)
914 {
915 return GetCarDoorsState("NivaHood") != CarDoorState.DOORS_CLOSED;
916 }
917
918 override bool CanDisplayAttachmentCategory(string category_name)
919 {
920 if (!super.CanDisplayAttachmentCategory(category_name))
921 return false;
922
923 category_name.ToLower();
924 if (category_name.Contains("engine"))
925 {
926 if (GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
927 return false;
928 }
929
930 return true;
931 }
932
933 override bool CanDisplayCargo()
934 {
935 if (!super.CanDisplayCargo())
936 return false;
937
938 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
939 return false;
940
941 return true;
942 }
943
944 override int GetCarDoorsState(string slotType)
945 {
947
948 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
949 if (!carDoor)
950 return CarDoorState.DOORS_MISSING;
951
952 switch (slotType)
953 {
954 case "NivaDriverDoors":
955 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
956
957 case "NivaCoDriverDoors":
958 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
959
960 case "NivaHood":
961 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
962
963 case "NivaTrunk":
964 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
965 }
966
967 return CarDoorState.DOORS_MISSING;
968 }
969
970 override bool CrewCanGetThrough(int posIdx)
971 {
973 switch (posIdx)
974 {
975 case 0:
976 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
977 return false;
978 else if (GetAnimationPhase("SeatDriver") > 0.5)
979 return false;
980
981 return true;
982
983 case 1:
984 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
985 return false;
986 else if (GetAnimationPhase("SeatCoDriver") > 0.5)
987 return false;
988
989 return true;
990
991 case 2:
992 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
993 return false;
994 else if (GetAnimationPhase("SeatDriver") <= 0.5)
995 return false;
996
997 return true;
998
999 case 3:
1000 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
1001 return false;
1002 else if (GetAnimationPhase("SeatCoDriver") <= 0.5)
1003 return false;
1004
1005 return true;
1006 }
1007
1008 return false;
1009 }
1010
1011 override string GetDoorSelectionNameFromSeatPos(int posIdx)
1012 {
1013 switch (posIdx)
1014 {
1015 case 0:
1016 case 2:
1017 return "doors_driver";
1018 case 1:
1019 case 3:
1020 return "doors_codriver";
1021 }
1022
1023 return super.GetDoorSelectionNameFromSeatPos(posIdx);
1024 }
1025
1026 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
1027 {
1028 switch (posIdx)
1029 {
1030 case 0:
1031 case 2:
1032 return "NivaDriverDoors";
1033 case 1:
1034 case 3:
1035 return "NivaCoDriverDoors";
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 float tempCap = 0.0;
1046
1047 switch (ctrl)
1048 {
1049 case CarSoundCtrl.DOORS:
1050 float newValue = 0;
1051 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
1052 newValue += 0.5;
1053
1054 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
1055 newValue += 0.5;
1056
1057 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
1058 newValue += 0.3;
1059
1060 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
1061 newValue -= 0.6;
1062
1063 if (GetHealthLevel("WindowLR") == GameConstants.STATE_RUINED)
1064 newValue -= 0.2;
1065
1066 if (GetHealthLevel("WindowRR") == GameConstants.STATE_RUINED)
1067 newValue -= 0.2;
1068
1069 return Math.Clamp(newValue, 0, 1);
1070 break;
1071 }
1072
1073 return super.OnSound(ctrl, oldValue);
1074 }
1075
1076 override string GetAnimSourceFromSelection(string selection)
1077 {
1078 switch (selection)
1079 {
1080 case "doors_driver":
1081 return "DoorsDriver";
1082 case "doors_codriver":
1083 return "DoorsCoDriver";
1084 case "doors_hood":
1085 return "DoorsHood";
1086 case "doors_trunk":
1087 return "DoorsTrunk";
1088 case "seatback_driver":
1089 return "SeatDriver";
1090 case "seatback_codriver":
1091 return "SeatCoDriver";
1092 }
1093
1094 return "";
1095 }
1096
1097 override string GetDoorConditionPointFromSelection(string selection)
1098 {
1099 switch (selection)
1100 {
1101 case "seat_driver":
1102 case "seatback_driver":
1103 case "seat_cargo1":
1104 return "seat_con_1_1";
1105 case "seat_codriver":
1106 case "seatback_codriver":
1107 case "seat_cargo2":
1108 return "seat_con_2_1";
1109 }
1110
1111 return "";
1112 }
1113
1114 override int GetCrewIndex(string selection)
1115 {
1116 switch (selection)
1117 {
1118 case "seatback_driver":
1119 return 0;
1120 case "seatback_codriver":
1121 return 1;
1122 }
1123
1124 return -1;
1125 }
1126
1127 override bool IsVitalTruckBattery()
1128 {
1129 return false;
1130 }
1131
1132 override bool IsVitalGlowPlug()
1133 {
1134 return false;
1135 }
1136
1137 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
1138 {
1139 if (nextSeat == 0 && GetAnimationPhase("SeatDriver") > 0.5)
1140 return false;
1141
1142 if (nextSeat == 1 && GetAnimationPhase("SeatCoDriver") > 0.5)
1143 return false;
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 == "DoorsDriver";
1175
1176 case 3:
1177 return pDoorsSelection == "DoorsCoDriver";
1178 }
1179
1180 return false;
1181 }
1182
1183 override int GetSeatIndexFromDoor(string pDoorSelection)
1184 {
1185 switch (pDoorSelection)
1186 {
1187 case "DoorsDriver":
1188 return 0;
1189 case "DoorsCoDriver":
1190 return 1;
1191 }
1192
1193 return -1;
1194 }
1195
1196 override void SetActions()
1197 {
1198 super.SetActions();
1199
1201 }
1202
1203 override void OnDebugSpawn()
1204 {
1208
1209 GetInventory().CreateInInventory("HatchbackWheel");
1210 GetInventory().CreateInInventory("HatchbackWheel");
1211 GetInventory().CreateInInventory("HatchbackWheel");
1212 GetInventory().CreateInInventory("HatchbackWheel");
1213
1214 GetInventory().CreateInInventory("HatchbackDoors_Driver");
1215 GetInventory().CreateInInventory("HatchbackDoors_CoDriver");
1216 GetInventory().CreateInInventory("HatchbackHood");
1217 GetInventory().CreateInInventory("HatchbackTrunk");
1218
1219 //-----IN CAR CARGO
1220 GetInventory().CreateInInventory("HatchbackWheel");
1221 GetInventory().CreateInInventory("HatchbackWheel");
1222 }
1223}
1224
1226{
1227 override void OnDebugSpawn()
1228 {
1232
1233 GetInventory().CreateInInventory("HatchbackWheel");
1234 GetInventory().CreateInInventory("HatchbackWheel");
1235 GetInventory().CreateInInventory("HatchbackWheel");
1236 GetInventory().CreateInInventory("HatchbackWheel");
1237
1238 GetInventory().CreateInInventory("HatchbackDoors_Driver_White");
1239 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_White");
1240 GetInventory().CreateInInventory("HatchbackHood_White");
1241 GetInventory().CreateInInventory("HatchbackTrunk_White");
1242
1243 //-----IN CAR CARGO
1244 GetInventory().CreateInInventory("HatchbackWheel");
1245 GetInventory().CreateInInventory("HatchbackWheel");
1246 }
1247}
1248
1250{
1251 override void OnDebugSpawn()
1252 {
1256
1257 GetInventory().CreateInInventory("HatchbackWheel");
1258 GetInventory().CreateInInventory("HatchbackWheel");
1259 GetInventory().CreateInInventory("HatchbackWheel");
1260 GetInventory().CreateInInventory("HatchbackWheel");
1261
1262 GetInventory().CreateInInventory("HatchbackDoors_Driver_Blue");
1263 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_Blue");
1264 GetInventory().CreateInInventory("HatchbackHood_Blue");
1265 GetInventory().CreateInInventory("HatchbackTrunk_Blue");
1266
1267 //-----IN CAR CARGO
1268 GetInventory().CreateInInventory("HatchbackWheel");
1269 GetInventory().CreateInInventory("HatchbackWheel");
1270 }
1271}

◆ CanReleaseAttachment()

override bool OnDebugSpawn::CanReleaseAttachment ( EntityAI attachment)
protected

Definition at line 549 of file OffroadHatchback.c.

550{
554
555 void OffroadHatchback()
556 {
557 //m_dmgContactCoef = 0.075;
558
559 m_EngineStartOK = "offroad_engine_start_SoundSet";
560 m_EngineStartBattery = "offroad_engine_failed_start_battery_SoundSet";
561 m_EngineStartPlug = "offroad_engine_failed_start_sparkplugs_SoundSet";
562 m_EngineStartFuel = "offroad_engine_failed_start_fuel_SoundSet";
563 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
564
565 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
566 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
567 m_CarSeatShiftInSound = "Offroad_SeatShiftIn_SoundSet";
568 m_CarSeatShiftOutSound = "Offroad_SeatShiftOut_SoundSet";
569
570 m_CarHornShortSoundName = "Offroad_Horn_Short_SoundSet";
571 m_CarHornLongSoundName = "Offroad_Horn_SoundSet";
572
573 SetEnginePos("0 0.7 1.2");
574 }
575
576 override void EEInit()
577 {
578 super.EEInit();
579
580 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
581 {
583 m_UTSSettings.m_ManualUpdate = true;
584 m_UTSSettings.m_TemperatureMin = 0;
585 m_UTSSettings.m_TemperatureMax = 30;
586 m_UTSSettings.m_RangeFull = 0.5;
587 m_UTSSettings.m_RangeMax = 2;
588 m_UTSSettings.m_TemperatureCap = 25;
589
592 }
593 }
594
595 override void OnEngineStart()
596 {
597 super.OnEngineStart();
598
599 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
600 m_UTSource.SetDefferedActive(true, 20.0);
601 }
602
603 override void OnEngineStop()
604 {
605 super.OnEngineStop();
606
607 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
608 m_UTSource.SetDefferedActive(false, 10.0);
609 }
610
611 override void EOnPostSimulate(IEntity other, float timeSlice)
612 {
613 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
614 {
615 if (m_UTSource.IsActive())
617 }
618 }
619
620 override int GetAnimInstance()
621 {
622 return VehicleAnimInstances.HATCHBACK;
623 }
624
625 override float GetTransportCameraDistance()
626 {
627 return 3.5;
628 }
629
630 override int GetSeatAnimationType(int posIdx)
631 {
632 switch (posIdx)
633 {
634 case 0:
635 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
636 case 1:
637 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
638 case 2:
639 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
640 case 3:
641 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
642 }
643
644 return 0;
645
646 }
647
648
650 {
651 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackRearLight));
652 }
653
655 {
656 return CarLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackFrontLight));
657 }
658
660 {
661 if (!super.CanReleaseAttachment(attachment))
662 return false;
663
664 if (EngineIsOn() || GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
665 {
666 string attType = attachment.GetType();
667 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
668 return false;
669 }
670
671 return true;
672 }
673
674 override protected bool CanManipulateSpareWheel(string slotSelectionName)
675 {
676 return GetCarDoorsState("NivaHood") != CarDoorState.DOORS_CLOSED;
677 }
678
679 override bool CanDisplayAttachmentCategory(string category_name)
680 {
681 if (!super.CanDisplayAttachmentCategory(category_name))
682 return false;
683
684 category_name.ToLower();
685 if (category_name.Contains("engine"))
686 {
687 if (GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
688 return false;
689 }
690
691 return true;
692 }
693
694 override bool CanDisplayCargo()
695 {
696 if (!super.CanDisplayCargo())
697 return false;
698
699 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
700 return false;
701
702 return true;
703 }
704
705 override int GetCarDoorsState(string slotType)
706 {
708
709 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
710 if (!carDoor)
711 return CarDoorState.DOORS_MISSING;
712
713 switch (slotType)
714 {
715 case "NivaDriverDoors":
716 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
717
718 case "NivaCoDriverDoors":
719 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
720
721 case "NivaHood":
722 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
723
724 case "NivaTrunk":
725 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
726 }
727
728 return CarDoorState.DOORS_MISSING;
729 }
730
731 override bool CrewCanGetThrough(int posIdx)
732 {
734 switch (posIdx)
735 {
736 case 0:
737 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
738 return false;
739 else if (GetAnimationPhase("SeatDriver") > 0.5)
740 return false;
741
742 return true;
743
744 case 1:
745 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
746 return false;
747 else if (GetAnimationPhase("SeatCoDriver") > 0.5)
748 return false;
749
750 return true;
751
752 case 2:
753 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
754 return false;
755 else if (GetAnimationPhase("SeatDriver") <= 0.5)
756 return false;
757
758 return true;
759
760 case 3:
761 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
762 return false;
763 else if (GetAnimationPhase("SeatCoDriver") <= 0.5)
764 return false;
765
766 return true;
767 }
768
769 return false;
770 }
771
772 override string GetDoorSelectionNameFromSeatPos(int posIdx)
773 {
774 switch (posIdx)
775 {
776 case 0:
777 case 2:
778 return "doors_driver";
779 case 1:
780 case 3:
781 return "doors_codriver";
782 }
783
784 return super.GetDoorSelectionNameFromSeatPos(posIdx);
785 }
786
787 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
788 {
789 switch (posIdx)
790 {
791 case 0:
792 case 2:
793 return "NivaDriverDoors";
794 case 1:
795 case 3:
796 return "NivaCoDriverDoors";
797 }
798
799 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
800 }
801
802 // 0 full ambient and engine sound
803 // 1 zero ambient and engine sound
804 override float OnSound(CarSoundCtrl ctrl, float oldValue)
805 {
806 float tempCap = 0.0;
807
808 switch (ctrl)
809 {
810 case CarSoundCtrl.DOORS:
811 float newValue = 0;
812 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
813 newValue += 0.5;
814
815 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
816 newValue += 0.5;
817
818 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
819 newValue += 0.3;
820
821 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
822 newValue -= 0.6;
823
824 if (GetHealthLevel("WindowLR") == GameConstants.STATE_RUINED)
825 newValue -= 0.2;
826
827 if (GetHealthLevel("WindowRR") == GameConstants.STATE_RUINED)
828 newValue -= 0.2;
829
830 return Math.Clamp(newValue, 0, 1);
831 break;
832 }
833
834 return super.OnSound(ctrl, oldValue);
835 }
836
837 override string GetAnimSourceFromSelection(string selection)
838 {
839 switch (selection)
840 {
841 case "doors_driver":
842 return "DoorsDriver";
843 case "doors_codriver":
844 return "DoorsCoDriver";
845 case "doors_hood":
846 return "DoorsHood";
847 case "doors_trunk":
848 return "DoorsTrunk";
849 case "seatback_driver":
850 return "SeatDriver";
851 case "seatback_codriver":
852 return "SeatCoDriver";
853 }
854
855 return "";
856 }
857
858 override string GetDoorConditionPointFromSelection(string selection)
859 {
860 switch (selection)
861 {
862 case "seat_driver":
863 case "seatback_driver":
864 case "seat_cargo1":
865 return "seat_con_1_1";
866 case "seat_codriver":
867 case "seatback_codriver":
868 case "seat_cargo2":
869 return "seat_con_2_1";
870 }
871
872 return "";
873 }
874
875 override int GetCrewIndex(string selection)
876 {
877 switch (selection)
878 {
879 case "seatback_driver":
880 return 0;
881 case "seatback_codriver":
882 return 1;
883 }
884
885 return -1;
886 }
887
888 override bool IsVitalTruckBattery()
889 {
890 return false;
891 }
892
893 override bool IsVitalGlowPlug()
894 {
895 return false;
896 }
897
898 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
899 {
900 if (nextSeat == 0 && GetAnimationPhase("SeatDriver") > 0.5)
901 return false;
902
903 if (nextSeat == 1 && GetAnimationPhase("SeatCoDriver") > 0.5)
904 return false;
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 == "DoorsDriver";
936
937 case 3:
938 return pDoorsSelection == "DoorsCoDriver";
939 }
940
941 return false;
942 }
943
944 override int GetSeatIndexFromDoor(string pDoorSelection)
945 {
946 switch (pDoorSelection)
947 {
948 case "DoorsDriver":
949 return 0;
950 case "DoorsCoDriver":
951 return 1;
952 }
953
954 return -1;
955 }
956
957 override void SetActions()
958 {
959 super.SetActions();
960
962 }
963
964 override void OnDebugSpawn()
965 {
969
970 GetInventory().CreateInInventory("HatchbackWheel");
971 GetInventory().CreateInInventory("HatchbackWheel");
972 GetInventory().CreateInInventory("HatchbackWheel");
973 GetInventory().CreateInInventory("HatchbackWheel");
974
975 GetInventory().CreateInInventory("HatchbackDoors_Driver");
976 GetInventory().CreateInInventory("HatchbackDoors_CoDriver");
977 GetInventory().CreateInInventory("HatchbackHood");
978 GetInventory().CreateInInventory("HatchbackTrunk");
979
980 //-----IN CAR CARGO
981 GetInventory().CreateInInventory("HatchbackWheel");
982 GetInventory().CreateInInventory("HatchbackWheel");
983 }
984}
985
987{
988 override void OnDebugSpawn()
989 {
993
994 GetInventory().CreateInInventory("HatchbackWheel");
995 GetInventory().CreateInInventory("HatchbackWheel");
996 GetInventory().CreateInInventory("HatchbackWheel");
997 GetInventory().CreateInInventory("HatchbackWheel");
998
999 GetInventory().CreateInInventory("HatchbackDoors_Driver_White");
1000 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_White");
1001 GetInventory().CreateInInventory("HatchbackHood_White");
1002 GetInventory().CreateInInventory("HatchbackTrunk_White");
1003
1004 //-----IN CAR CARGO
1005 GetInventory().CreateInInventory("HatchbackWheel");
1006 GetInventory().CreateInInventory("HatchbackWheel");
1007 }
1008}
1009
1011{
1012 override void OnDebugSpawn()
1013 {
1017
1018 GetInventory().CreateInInventory("HatchbackWheel");
1019 GetInventory().CreateInInventory("HatchbackWheel");
1020 GetInventory().CreateInInventory("HatchbackWheel");
1021 GetInventory().CreateInInventory("HatchbackWheel");
1022
1023 GetInventory().CreateInInventory("HatchbackDoors_Driver_Blue");
1024 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_Blue");
1025 GetInventory().CreateInInventory("HatchbackHood_Blue");
1026 GetInventory().CreateInInventory("HatchbackTrunk_Blue");
1027
1028 //-----IN CAR CARGO
1029 GetInventory().CreateInInventory("HatchbackWheel");
1030 GetInventory().CreateInInventory("HatchbackWheel");
1031 }
1032}

◆ CreateFrontLight()

override CarLightBase OnDebugSpawn::CreateFrontLight ( )
protected

Definition at line 544 of file OffroadHatchback.c.

545{
549
550 void OffroadHatchback()
551 {
552 //m_dmgContactCoef = 0.075;
553
554 m_EngineStartOK = "offroad_engine_start_SoundSet";
555 m_EngineStartBattery = "offroad_engine_failed_start_battery_SoundSet";
556 m_EngineStartPlug = "offroad_engine_failed_start_sparkplugs_SoundSet";
557 m_EngineStartFuel = "offroad_engine_failed_start_fuel_SoundSet";
558 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
559
560 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
561 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
562 m_CarSeatShiftInSound = "Offroad_SeatShiftIn_SoundSet";
563 m_CarSeatShiftOutSound = "Offroad_SeatShiftOut_SoundSet";
564
565 m_CarHornShortSoundName = "Offroad_Horn_Short_SoundSet";
566 m_CarHornLongSoundName = "Offroad_Horn_SoundSet";
567
568 SetEnginePos("0 0.7 1.2");
569 }
570
571 override void EEInit()
572 {
573 super.EEInit();
574
575 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
576 {
578 m_UTSSettings.m_ManualUpdate = true;
579 m_UTSSettings.m_TemperatureMin = 0;
580 m_UTSSettings.m_TemperatureMax = 30;
581 m_UTSSettings.m_RangeFull = 0.5;
582 m_UTSSettings.m_RangeMax = 2;
583 m_UTSSettings.m_TemperatureCap = 25;
584
587 }
588 }
589
590 override void OnEngineStart()
591 {
592 super.OnEngineStart();
593
594 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
595 m_UTSource.SetDefferedActive(true, 20.0);
596 }
597
598 override void OnEngineStop()
599 {
600 super.OnEngineStop();
601
602 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
603 m_UTSource.SetDefferedActive(false, 10.0);
604 }
605
606 override void EOnPostSimulate(IEntity other, float timeSlice)
607 {
608 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
609 {
610 if (m_UTSource.IsActive())
612 }
613 }
614
615 override int GetAnimInstance()
616 {
617 return VehicleAnimInstances.HATCHBACK;
618 }
619
620 override float GetTransportCameraDistance()
621 {
622 return 3.5;
623 }
624
625 override int GetSeatAnimationType(int posIdx)
626 {
627 switch (posIdx)
628 {
629 case 0:
630 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
631 case 1:
632 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
633 case 2:
634 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
635 case 3:
636 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
637 }
638
639 return 0;
640
641 }
642
643
645 {
646 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackRearLight));
647 }
648
650 {
651 return CarLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackFrontLight));
652 }
653
655 {
656 if (!super.CanReleaseAttachment(attachment))
657 return false;
658
659 if (EngineIsOn() || GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
660 {
661 string attType = attachment.GetType();
662 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
663 return false;
664 }
665
666 return true;
667 }
668
669 override protected bool CanManipulateSpareWheel(string slotSelectionName)
670 {
671 return GetCarDoorsState("NivaHood") != CarDoorState.DOORS_CLOSED;
672 }
673
674 override bool CanDisplayAttachmentCategory(string category_name)
675 {
676 if (!super.CanDisplayAttachmentCategory(category_name))
677 return false;
678
679 category_name.ToLower();
680 if (category_name.Contains("engine"))
681 {
682 if (GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
683 return false;
684 }
685
686 return true;
687 }
688
689 override bool CanDisplayCargo()
690 {
691 if (!super.CanDisplayCargo())
692 return false;
693
694 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
695 return false;
696
697 return true;
698 }
699
700 override int GetCarDoorsState(string slotType)
701 {
703
704 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
705 if (!carDoor)
706 return CarDoorState.DOORS_MISSING;
707
708 switch (slotType)
709 {
710 case "NivaDriverDoors":
711 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
712
713 case "NivaCoDriverDoors":
714 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
715
716 case "NivaHood":
717 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
718
719 case "NivaTrunk":
720 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
721 }
722
723 return CarDoorState.DOORS_MISSING;
724 }
725
726 override bool CrewCanGetThrough(int posIdx)
727 {
729 switch (posIdx)
730 {
731 case 0:
732 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
733 return false;
734 else if (GetAnimationPhase("SeatDriver") > 0.5)
735 return false;
736
737 return true;
738
739 case 1:
740 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
741 return false;
742 else if (GetAnimationPhase("SeatCoDriver") > 0.5)
743 return false;
744
745 return true;
746
747 case 2:
748 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
749 return false;
750 else if (GetAnimationPhase("SeatDriver") <= 0.5)
751 return false;
752
753 return true;
754
755 case 3:
756 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
757 return false;
758 else if (GetAnimationPhase("SeatCoDriver") <= 0.5)
759 return false;
760
761 return true;
762 }
763
764 return false;
765 }
766
767 override string GetDoorSelectionNameFromSeatPos(int posIdx)
768 {
769 switch (posIdx)
770 {
771 case 0:
772 case 2:
773 return "doors_driver";
774 case 1:
775 case 3:
776 return "doors_codriver";
777 }
778
779 return super.GetDoorSelectionNameFromSeatPos(posIdx);
780 }
781
782 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
783 {
784 switch (posIdx)
785 {
786 case 0:
787 case 2:
788 return "NivaDriverDoors";
789 case 1:
790 case 3:
791 return "NivaCoDriverDoors";
792 }
793
794 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
795 }
796
797 // 0 full ambient and engine sound
798 // 1 zero ambient and engine sound
799 override float OnSound(CarSoundCtrl ctrl, float oldValue)
800 {
801 float tempCap = 0.0;
802
803 switch (ctrl)
804 {
805 case CarSoundCtrl.DOORS:
806 float newValue = 0;
807 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
808 newValue += 0.5;
809
810 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
811 newValue += 0.5;
812
813 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
814 newValue += 0.3;
815
816 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
817 newValue -= 0.6;
818
819 if (GetHealthLevel("WindowLR") == GameConstants.STATE_RUINED)
820 newValue -= 0.2;
821
822 if (GetHealthLevel("WindowRR") == GameConstants.STATE_RUINED)
823 newValue -= 0.2;
824
825 return Math.Clamp(newValue, 0, 1);
826 break;
827 }
828
829 return super.OnSound(ctrl, oldValue);
830 }
831
832 override string GetAnimSourceFromSelection(string selection)
833 {
834 switch (selection)
835 {
836 case "doors_driver":
837 return "DoorsDriver";
838 case "doors_codriver":
839 return "DoorsCoDriver";
840 case "doors_hood":
841 return "DoorsHood";
842 case "doors_trunk":
843 return "DoorsTrunk";
844 case "seatback_driver":
845 return "SeatDriver";
846 case "seatback_codriver":
847 return "SeatCoDriver";
848 }
849
850 return "";
851 }
852
853 override string GetDoorConditionPointFromSelection(string selection)
854 {
855 switch (selection)
856 {
857 case "seat_driver":
858 case "seatback_driver":
859 case "seat_cargo1":
860 return "seat_con_1_1";
861 case "seat_codriver":
862 case "seatback_codriver":
863 case "seat_cargo2":
864 return "seat_con_2_1";
865 }
866
867 return "";
868 }
869
870 override int GetCrewIndex(string selection)
871 {
872 switch (selection)
873 {
874 case "seatback_driver":
875 return 0;
876 case "seatback_codriver":
877 return 1;
878 }
879
880 return -1;
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 if (nextSeat == 0 && GetAnimationPhase("SeatDriver") > 0.5)
896 return false;
897
898 if (nextSeat == 1 && GetAnimationPhase("SeatCoDriver") > 0.5)
899 return false;
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 == "DoorsDriver";
931
932 case 3:
933 return pDoorsSelection == "DoorsCoDriver";
934 }
935
936 return false;
937 }
938
939 override int GetSeatIndexFromDoor(string pDoorSelection)
940 {
941 switch (pDoorSelection)
942 {
943 case "DoorsDriver":
944 return 0;
945 case "DoorsCoDriver":
946 return 1;
947 }
948
949 return -1;
950 }
951
952 override void SetActions()
953 {
954 super.SetActions();
955
957 }
958
959 override void OnDebugSpawn()
960 {
964
965 GetInventory().CreateInInventory("HatchbackWheel");
966 GetInventory().CreateInInventory("HatchbackWheel");
967 GetInventory().CreateInInventory("HatchbackWheel");
968 GetInventory().CreateInInventory("HatchbackWheel");
969
970 GetInventory().CreateInInventory("HatchbackDoors_Driver");
971 GetInventory().CreateInInventory("HatchbackDoors_CoDriver");
972 GetInventory().CreateInInventory("HatchbackHood");
973 GetInventory().CreateInInventory("HatchbackTrunk");
974
975 //-----IN CAR CARGO
976 GetInventory().CreateInInventory("HatchbackWheel");
977 GetInventory().CreateInInventory("HatchbackWheel");
978 }
979}
980
982{
983 override void OnDebugSpawn()
984 {
988
989 GetInventory().CreateInInventory("HatchbackWheel");
990 GetInventory().CreateInInventory("HatchbackWheel");
991 GetInventory().CreateInInventory("HatchbackWheel");
992 GetInventory().CreateInInventory("HatchbackWheel");
993
994 GetInventory().CreateInInventory("HatchbackDoors_Driver_White");
995 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_White");
996 GetInventory().CreateInInventory("HatchbackHood_White");
997 GetInventory().CreateInInventory("HatchbackTrunk_White");
998
999 //-----IN CAR CARGO
1000 GetInventory().CreateInInventory("HatchbackWheel");
1001 GetInventory().CreateInInventory("HatchbackWheel");
1002 }
1003}
1004
1006{
1007 override void OnDebugSpawn()
1008 {
1012
1013 GetInventory().CreateInInventory("HatchbackWheel");
1014 GetInventory().CreateInInventory("HatchbackWheel");
1015 GetInventory().CreateInInventory("HatchbackWheel");
1016 GetInventory().CreateInInventory("HatchbackWheel");
1017
1018 GetInventory().CreateInInventory("HatchbackDoors_Driver_Blue");
1019 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_Blue");
1020 GetInventory().CreateInInventory("HatchbackHood_Blue");
1021 GetInventory().CreateInInventory("HatchbackTrunk_Blue");
1022
1023 //-----IN CAR CARGO
1024 GetInventory().CreateInInventory("HatchbackWheel");
1025 GetInventory().CreateInInventory("HatchbackWheel");
1026 }
1027}

◆ CreateRearLight()

override CarRearLightBase OnDebugSpawn::CreateRearLight ( )
protected

Definition at line 539 of file OffroadHatchback.c.

540{
544
545 void OffroadHatchback()
546 {
547 //m_dmgContactCoef = 0.075;
548
549 m_EngineStartOK = "offroad_engine_start_SoundSet";
550 m_EngineStartBattery = "offroad_engine_failed_start_battery_SoundSet";
551 m_EngineStartPlug = "offroad_engine_failed_start_sparkplugs_SoundSet";
552 m_EngineStartFuel = "offroad_engine_failed_start_fuel_SoundSet";
553 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
554
555 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
556 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
557 m_CarSeatShiftInSound = "Offroad_SeatShiftIn_SoundSet";
558 m_CarSeatShiftOutSound = "Offroad_SeatShiftOut_SoundSet";
559
560 m_CarHornShortSoundName = "Offroad_Horn_Short_SoundSet";
561 m_CarHornLongSoundName = "Offroad_Horn_SoundSet";
562
563 SetEnginePos("0 0.7 1.2");
564 }
565
566 override void EEInit()
567 {
568 super.EEInit();
569
570 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
571 {
573 m_UTSSettings.m_ManualUpdate = true;
574 m_UTSSettings.m_TemperatureMin = 0;
575 m_UTSSettings.m_TemperatureMax = 30;
576 m_UTSSettings.m_RangeFull = 0.5;
577 m_UTSSettings.m_RangeMax = 2;
578 m_UTSSettings.m_TemperatureCap = 25;
579
582 }
583 }
584
585 override void OnEngineStart()
586 {
587 super.OnEngineStart();
588
589 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
590 m_UTSource.SetDefferedActive(true, 20.0);
591 }
592
593 override void OnEngineStop()
594 {
595 super.OnEngineStop();
596
597 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
598 m_UTSource.SetDefferedActive(false, 10.0);
599 }
600
601 override void EOnPostSimulate(IEntity other, float timeSlice)
602 {
603 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
604 {
605 if (m_UTSource.IsActive())
607 }
608 }
609
610 override int GetAnimInstance()
611 {
612 return VehicleAnimInstances.HATCHBACK;
613 }
614
615 override float GetTransportCameraDistance()
616 {
617 return 3.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
638
640 {
641 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackRearLight));
642 }
643
645 {
646 return CarLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackFrontLight));
647 }
648
650 {
651 if (!super.CanReleaseAttachment(attachment))
652 return false;
653
654 if (EngineIsOn() || GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
655 {
656 string attType = attachment.GetType();
657 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
658 return false;
659 }
660
661 return true;
662 }
663
664 override protected bool CanManipulateSpareWheel(string slotSelectionName)
665 {
666 return GetCarDoorsState("NivaHood") != CarDoorState.DOORS_CLOSED;
667 }
668
669 override bool CanDisplayAttachmentCategory(string category_name)
670 {
671 if (!super.CanDisplayAttachmentCategory(category_name))
672 return false;
673
674 category_name.ToLower();
675 if (category_name.Contains("engine"))
676 {
677 if (GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
678 return false;
679 }
680
681 return true;
682 }
683
684 override bool CanDisplayCargo()
685 {
686 if (!super.CanDisplayCargo())
687 return false;
688
689 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
690 return false;
691
692 return true;
693 }
694
695 override int GetCarDoorsState(string slotType)
696 {
698
699 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
700 if (!carDoor)
701 return CarDoorState.DOORS_MISSING;
702
703 switch (slotType)
704 {
705 case "NivaDriverDoors":
706 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
707
708 case "NivaCoDriverDoors":
709 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
710
711 case "NivaHood":
712 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
713
714 case "NivaTrunk":
715 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
716 }
717
718 return CarDoorState.DOORS_MISSING;
719 }
720
721 override bool CrewCanGetThrough(int posIdx)
722 {
724 switch (posIdx)
725 {
726 case 0:
727 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
728 return false;
729 else if (GetAnimationPhase("SeatDriver") > 0.5)
730 return false;
731
732 return true;
733
734 case 1:
735 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
736 return false;
737 else if (GetAnimationPhase("SeatCoDriver") > 0.5)
738 return false;
739
740 return true;
741
742 case 2:
743 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
744 return false;
745 else if (GetAnimationPhase("SeatDriver") <= 0.5)
746 return false;
747
748 return true;
749
750 case 3:
751 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
752 return false;
753 else if (GetAnimationPhase("SeatCoDriver") <= 0.5)
754 return false;
755
756 return true;
757 }
758
759 return false;
760 }
761
762 override string GetDoorSelectionNameFromSeatPos(int posIdx)
763 {
764 switch (posIdx)
765 {
766 case 0:
767 case 2:
768 return "doors_driver";
769 case 1:
770 case 3:
771 return "doors_codriver";
772 }
773
774 return super.GetDoorSelectionNameFromSeatPos(posIdx);
775 }
776
777 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
778 {
779 switch (posIdx)
780 {
781 case 0:
782 case 2:
783 return "NivaDriverDoors";
784 case 1:
785 case 3:
786 return "NivaCoDriverDoors";
787 }
788
789 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
790 }
791
792 // 0 full ambient and engine sound
793 // 1 zero ambient and engine sound
794 override float OnSound(CarSoundCtrl ctrl, float oldValue)
795 {
796 float tempCap = 0.0;
797
798 switch (ctrl)
799 {
800 case CarSoundCtrl.DOORS:
801 float newValue = 0;
802 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
803 newValue += 0.5;
804
805 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
806 newValue += 0.5;
807
808 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
809 newValue += 0.3;
810
811 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
812 newValue -= 0.6;
813
814 if (GetHealthLevel("WindowLR") == GameConstants.STATE_RUINED)
815 newValue -= 0.2;
816
817 if (GetHealthLevel("WindowRR") == GameConstants.STATE_RUINED)
818 newValue -= 0.2;
819
820 return Math.Clamp(newValue, 0, 1);
821 break;
822 }
823
824 return super.OnSound(ctrl, oldValue);
825 }
826
827 override string GetAnimSourceFromSelection(string selection)
828 {
829 switch (selection)
830 {
831 case "doors_driver":
832 return "DoorsDriver";
833 case "doors_codriver":
834 return "DoorsCoDriver";
835 case "doors_hood":
836 return "DoorsHood";
837 case "doors_trunk":
838 return "DoorsTrunk";
839 case "seatback_driver":
840 return "SeatDriver";
841 case "seatback_codriver":
842 return "SeatCoDriver";
843 }
844
845 return "";
846 }
847
848 override string GetDoorConditionPointFromSelection(string selection)
849 {
850 switch (selection)
851 {
852 case "seat_driver":
853 case "seatback_driver":
854 case "seat_cargo1":
855 return "seat_con_1_1";
856 case "seat_codriver":
857 case "seatback_codriver":
858 case "seat_cargo2":
859 return "seat_con_2_1";
860 }
861
862 return "";
863 }
864
865 override int GetCrewIndex(string selection)
866 {
867 switch (selection)
868 {
869 case "seatback_driver":
870 return 0;
871 case "seatback_codriver":
872 return 1;
873 }
874
875 return -1;
876 }
877
878 override bool IsVitalTruckBattery()
879 {
880 return false;
881 }
882
883 override bool IsVitalGlowPlug()
884 {
885 return false;
886 }
887
888 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
889 {
890 if (nextSeat == 0 && GetAnimationPhase("SeatDriver") > 0.5)
891 return false;
892
893 if (nextSeat == 1 && GetAnimationPhase("SeatCoDriver") > 0.5)
894 return false;
895
896 switch (currentSeat)
897 {
898 case 0:
899 return nextSeat == 1;
900
901 case 1:
902 return nextSeat == 0;
903
904 case 2:
905 return nextSeat == 3;
906
907 case 3:
908 return nextSeat == 2;
909 }
910
911 return false;
912 }
913
914 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
915 {
916 switch (pCurrentSeat)
917 {
918 case 0:
919 return pDoorsSelection == "DoorsDriver";
920
921 case 1:
922 return pDoorsSelection == "DoorsCoDriver";
923
924 case 2:
925 return pDoorsSelection == "DoorsDriver";
926
927 case 3:
928 return pDoorsSelection == "DoorsCoDriver";
929 }
930
931 return false;
932 }
933
934 override int GetSeatIndexFromDoor(string pDoorSelection)
935 {
936 switch (pDoorSelection)
937 {
938 case "DoorsDriver":
939 return 0;
940 case "DoorsCoDriver":
941 return 1;
942 }
943
944 return -1;
945 }
946
947 override void SetActions()
948 {
949 super.SetActions();
950
952 }
953
954 override void OnDebugSpawn()
955 {
959
960 GetInventory().CreateInInventory("HatchbackWheel");
961 GetInventory().CreateInInventory("HatchbackWheel");
962 GetInventory().CreateInInventory("HatchbackWheel");
963 GetInventory().CreateInInventory("HatchbackWheel");
964
965 GetInventory().CreateInInventory("HatchbackDoors_Driver");
966 GetInventory().CreateInInventory("HatchbackDoors_CoDriver");
967 GetInventory().CreateInInventory("HatchbackHood");
968 GetInventory().CreateInInventory("HatchbackTrunk");
969
970 //-----IN CAR CARGO
971 GetInventory().CreateInInventory("HatchbackWheel");
972 GetInventory().CreateInInventory("HatchbackWheel");
973 }
974}
975
977{
978 override void OnDebugSpawn()
979 {
983
984 GetInventory().CreateInInventory("HatchbackWheel");
985 GetInventory().CreateInInventory("HatchbackWheel");
986 GetInventory().CreateInInventory("HatchbackWheel");
987 GetInventory().CreateInInventory("HatchbackWheel");
988
989 GetInventory().CreateInInventory("HatchbackDoors_Driver_White");
990 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_White");
991 GetInventory().CreateInInventory("HatchbackHood_White");
992 GetInventory().CreateInInventory("HatchbackTrunk_White");
993
994 //-----IN CAR CARGO
995 GetInventory().CreateInInventory("HatchbackWheel");
996 GetInventory().CreateInInventory("HatchbackWheel");
997 }
998}
999
1001{
1002 override void OnDebugSpawn()
1003 {
1007
1008 GetInventory().CreateInInventory("HatchbackWheel");
1009 GetInventory().CreateInInventory("HatchbackWheel");
1010 GetInventory().CreateInInventory("HatchbackWheel");
1011 GetInventory().CreateInInventory("HatchbackWheel");
1012
1013 GetInventory().CreateInInventory("HatchbackDoors_Driver_Blue");
1014 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_Blue");
1015 GetInventory().CreateInInventory("HatchbackHood_Blue");
1016 GetInventory().CreateInInventory("HatchbackTrunk_Blue");
1017
1018 //-----IN CAR CARGO
1019 GetInventory().CreateInInventory("HatchbackWheel");
1020 GetInventory().CreateInInventory("HatchbackWheel");
1021 }
1022}

◆ CrewCanGetThrough()

override bool OnDebugSpawn::CrewCanGetThrough ( int posIdx)
protected

Definition at line 621 of file OffroadHatchback.c.

622{
626
627 void OffroadHatchback()
628 {
629 //m_dmgContactCoef = 0.075;
630
631 m_EngineStartOK = "offroad_engine_start_SoundSet";
632 m_EngineStartBattery = "offroad_engine_failed_start_battery_SoundSet";
633 m_EngineStartPlug = "offroad_engine_failed_start_sparkplugs_SoundSet";
634 m_EngineStartFuel = "offroad_engine_failed_start_fuel_SoundSet";
635 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
636
637 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
638 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
639 m_CarSeatShiftInSound = "Offroad_SeatShiftIn_SoundSet";
640 m_CarSeatShiftOutSound = "Offroad_SeatShiftOut_SoundSet";
641
642 m_CarHornShortSoundName = "Offroad_Horn_Short_SoundSet";
643 m_CarHornLongSoundName = "Offroad_Horn_SoundSet";
644
645 SetEnginePos("0 0.7 1.2");
646 }
647
648 override void EEInit()
649 {
650 super.EEInit();
651
652 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
653 {
655 m_UTSSettings.m_ManualUpdate = true;
656 m_UTSSettings.m_TemperatureMin = 0;
657 m_UTSSettings.m_TemperatureMax = 30;
658 m_UTSSettings.m_RangeFull = 0.5;
659 m_UTSSettings.m_RangeMax = 2;
660 m_UTSSettings.m_TemperatureCap = 25;
661
664 }
665 }
666
667 override void OnEngineStart()
668 {
669 super.OnEngineStart();
670
671 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
672 m_UTSource.SetDefferedActive(true, 20.0);
673 }
674
675 override void OnEngineStop()
676 {
677 super.OnEngineStop();
678
679 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
680 m_UTSource.SetDefferedActive(false, 10.0);
681 }
682
683 override void EOnPostSimulate(IEntity other, float timeSlice)
684 {
685 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
686 {
687 if (m_UTSource.IsActive())
689 }
690 }
691
692 override int GetAnimInstance()
693 {
694 return VehicleAnimInstances.HATCHBACK;
695 }
696
697 override float GetTransportCameraDistance()
698 {
699 return 3.5;
700 }
701
702 override int GetSeatAnimationType(int posIdx)
703 {
704 switch (posIdx)
705 {
706 case 0:
707 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
708 case 1:
709 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
710 case 2:
711 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
712 case 3:
713 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
714 }
715
716 return 0;
717
718 }
719
720
722 {
723 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackRearLight));
724 }
725
727 {
728 return CarLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackFrontLight));
729 }
730
732 {
733 if (!super.CanReleaseAttachment(attachment))
734 return false;
735
736 if (EngineIsOn() || GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
737 {
738 string attType = attachment.GetType();
739 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
740 return false;
741 }
742
743 return true;
744 }
745
746 override protected bool CanManipulateSpareWheel(string slotSelectionName)
747 {
748 return GetCarDoorsState("NivaHood") != CarDoorState.DOORS_CLOSED;
749 }
750
751 override bool CanDisplayAttachmentCategory(string category_name)
752 {
753 if (!super.CanDisplayAttachmentCategory(category_name))
754 return false;
755
756 category_name.ToLower();
757 if (category_name.Contains("engine"))
758 {
759 if (GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
760 return false;
761 }
762
763 return true;
764 }
765
766 override bool CanDisplayCargo()
767 {
768 if (!super.CanDisplayCargo())
769 return false;
770
771 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
772 return false;
773
774 return true;
775 }
776
777 override int GetCarDoorsState(string slotType)
778 {
780
781 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
782 if (!carDoor)
783 return CarDoorState.DOORS_MISSING;
784
785 switch (slotType)
786 {
787 case "NivaDriverDoors":
788 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
789
790 case "NivaCoDriverDoors":
791 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
792
793 case "NivaHood":
794 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
795
796 case "NivaTrunk":
797 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
798 }
799
800 return CarDoorState.DOORS_MISSING;
801 }
802
803 override bool CrewCanGetThrough(int posIdx)
804 {
806 switch (posIdx)
807 {
808 case 0:
809 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
810 return false;
811 else if (GetAnimationPhase("SeatDriver") > 0.5)
812 return false;
813
814 return true;
815
816 case 1:
817 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
818 return false;
819 else if (GetAnimationPhase("SeatCoDriver") > 0.5)
820 return false;
821
822 return true;
823
824 case 2:
825 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
826 return false;
827 else if (GetAnimationPhase("SeatDriver") <= 0.5)
828 return false;
829
830 return true;
831
832 case 3:
833 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
834 return false;
835 else if (GetAnimationPhase("SeatCoDriver") <= 0.5)
836 return false;
837
838 return true;
839 }
840
841 return false;
842 }
843
844 override string GetDoorSelectionNameFromSeatPos(int posIdx)
845 {
846 switch (posIdx)
847 {
848 case 0:
849 case 2:
850 return "doors_driver";
851 case 1:
852 case 3:
853 return "doors_codriver";
854 }
855
856 return super.GetDoorSelectionNameFromSeatPos(posIdx);
857 }
858
859 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
860 {
861 switch (posIdx)
862 {
863 case 0:
864 case 2:
865 return "NivaDriverDoors";
866 case 1:
867 case 3:
868 return "NivaCoDriverDoors";
869 }
870
871 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
872 }
873
874 // 0 full ambient and engine sound
875 // 1 zero ambient and engine sound
876 override float OnSound(CarSoundCtrl ctrl, float oldValue)
877 {
878 float tempCap = 0.0;
879
880 switch (ctrl)
881 {
882 case CarSoundCtrl.DOORS:
883 float newValue = 0;
884 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
885 newValue += 0.5;
886
887 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
888 newValue += 0.5;
889
890 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
891 newValue += 0.3;
892
893 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
894 newValue -= 0.6;
895
896 if (GetHealthLevel("WindowLR") == GameConstants.STATE_RUINED)
897 newValue -= 0.2;
898
899 if (GetHealthLevel("WindowRR") == GameConstants.STATE_RUINED)
900 newValue -= 0.2;
901
902 return Math.Clamp(newValue, 0, 1);
903 break;
904 }
905
906 return super.OnSound(ctrl, oldValue);
907 }
908
909 override string GetAnimSourceFromSelection(string selection)
910 {
911 switch (selection)
912 {
913 case "doors_driver":
914 return "DoorsDriver";
915 case "doors_codriver":
916 return "DoorsCoDriver";
917 case "doors_hood":
918 return "DoorsHood";
919 case "doors_trunk":
920 return "DoorsTrunk";
921 case "seatback_driver":
922 return "SeatDriver";
923 case "seatback_codriver":
924 return "SeatCoDriver";
925 }
926
927 return "";
928 }
929
930 override string GetDoorConditionPointFromSelection(string selection)
931 {
932 switch (selection)
933 {
934 case "seat_driver":
935 case "seatback_driver":
936 case "seat_cargo1":
937 return "seat_con_1_1";
938 case "seat_codriver":
939 case "seatback_codriver":
940 case "seat_cargo2":
941 return "seat_con_2_1";
942 }
943
944 return "";
945 }
946
947 override int GetCrewIndex(string selection)
948 {
949 switch (selection)
950 {
951 case "seatback_driver":
952 return 0;
953 case "seatback_codriver":
954 return 1;
955 }
956
957 return -1;
958 }
959
960 override bool IsVitalTruckBattery()
961 {
962 return false;
963 }
964
965 override bool IsVitalGlowPlug()
966 {
967 return false;
968 }
969
970 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
971 {
972 if (nextSeat == 0 && GetAnimationPhase("SeatDriver") > 0.5)
973 return false;
974
975 if (nextSeat == 1 && GetAnimationPhase("SeatCoDriver") > 0.5)
976 return false;
977
978 switch (currentSeat)
979 {
980 case 0:
981 return nextSeat == 1;
982
983 case 1:
984 return nextSeat == 0;
985
986 case 2:
987 return nextSeat == 3;
988
989 case 3:
990 return nextSeat == 2;
991 }
992
993 return false;
994 }
995
996 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
997 {
998 switch (pCurrentSeat)
999 {
1000 case 0:
1001 return pDoorsSelection == "DoorsDriver";
1002
1003 case 1:
1004 return pDoorsSelection == "DoorsCoDriver";
1005
1006 case 2:
1007 return pDoorsSelection == "DoorsDriver";
1008
1009 case 3:
1010 return pDoorsSelection == "DoorsCoDriver";
1011 }
1012
1013 return false;
1014 }
1015
1016 override int GetSeatIndexFromDoor(string pDoorSelection)
1017 {
1018 switch (pDoorSelection)
1019 {
1020 case "DoorsDriver":
1021 return 0;
1022 case "DoorsCoDriver":
1023 return 1;
1024 }
1025
1026 return -1;
1027 }
1028
1029 override void SetActions()
1030 {
1031 super.SetActions();
1032
1034 }
1035
1036 override void OnDebugSpawn()
1037 {
1041
1042 GetInventory().CreateInInventory("HatchbackWheel");
1043 GetInventory().CreateInInventory("HatchbackWheel");
1044 GetInventory().CreateInInventory("HatchbackWheel");
1045 GetInventory().CreateInInventory("HatchbackWheel");
1046
1047 GetInventory().CreateInInventory("HatchbackDoors_Driver");
1048 GetInventory().CreateInInventory("HatchbackDoors_CoDriver");
1049 GetInventory().CreateInInventory("HatchbackHood");
1050 GetInventory().CreateInInventory("HatchbackTrunk");
1051
1052 //-----IN CAR CARGO
1053 GetInventory().CreateInInventory("HatchbackWheel");
1054 GetInventory().CreateInInventory("HatchbackWheel");
1055 }
1056}
1057
1059{
1060 override void OnDebugSpawn()
1061 {
1065
1066 GetInventory().CreateInInventory("HatchbackWheel");
1067 GetInventory().CreateInInventory("HatchbackWheel");
1068 GetInventory().CreateInInventory("HatchbackWheel");
1069 GetInventory().CreateInInventory("HatchbackWheel");
1070
1071 GetInventory().CreateInInventory("HatchbackDoors_Driver_White");
1072 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_White");
1073 GetInventory().CreateInInventory("HatchbackHood_White");
1074 GetInventory().CreateInInventory("HatchbackTrunk_White");
1075
1076 //-----IN CAR CARGO
1077 GetInventory().CreateInInventory("HatchbackWheel");
1078 GetInventory().CreateInInventory("HatchbackWheel");
1079 }
1080}
1081
1083{
1084 override void OnDebugSpawn()
1085 {
1089
1090 GetInventory().CreateInInventory("HatchbackWheel");
1091 GetInventory().CreateInInventory("HatchbackWheel");
1092 GetInventory().CreateInInventory("HatchbackWheel");
1093 GetInventory().CreateInInventory("HatchbackWheel");
1094
1095 GetInventory().CreateInInventory("HatchbackDoors_Driver_Blue");
1096 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_Blue");
1097 GetInventory().CreateInInventory("HatchbackHood_Blue");
1098 GetInventory().CreateInInventory("HatchbackTrunk_Blue");
1099
1100 //-----IN CAR CARGO
1101 GetInventory().CreateInInventory("HatchbackWheel");
1102 GetInventory().CreateInInventory("HatchbackWheel");
1103 }
1104}

◆ EEInit()

override void OnDebugSpawn::EEInit ( )
protected

Definition at line 466 of file OffroadHatchback.c.

◆ EOnPostSimulate()

override void OnDebugSpawn::EOnPostSimulate ( IEntity other,
float timeSlice )
protected

Definition at line 501 of file OffroadHatchback.c.

502{
506
507 void OffroadHatchback()
508 {
509 //m_dmgContactCoef = 0.075;
510
511 m_EngineStartOK = "offroad_engine_start_SoundSet";
512 m_EngineStartBattery = "offroad_engine_failed_start_battery_SoundSet";
513 m_EngineStartPlug = "offroad_engine_failed_start_sparkplugs_SoundSet";
514 m_EngineStartFuel = "offroad_engine_failed_start_fuel_SoundSet";
515 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
516
517 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
518 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
519 m_CarSeatShiftInSound = "Offroad_SeatShiftIn_SoundSet";
520 m_CarSeatShiftOutSound = "Offroad_SeatShiftOut_SoundSet";
521
522 m_CarHornShortSoundName = "Offroad_Horn_Short_SoundSet";
523 m_CarHornLongSoundName = "Offroad_Horn_SoundSet";
524
525 SetEnginePos("0 0.7 1.2");
526 }
527
528 override void EEInit()
529 {
530 super.EEInit();
531
532 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
533 {
535 m_UTSSettings.m_ManualUpdate = true;
536 m_UTSSettings.m_TemperatureMin = 0;
537 m_UTSSettings.m_TemperatureMax = 30;
538 m_UTSSettings.m_RangeFull = 0.5;
539 m_UTSSettings.m_RangeMax = 2;
540 m_UTSSettings.m_TemperatureCap = 25;
541
544 }
545 }
546
547 override void OnEngineStart()
548 {
549 super.OnEngineStart();
550
551 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
552 m_UTSource.SetDefferedActive(true, 20.0);
553 }
554
555 override void OnEngineStop()
556 {
557 super.OnEngineStop();
558
559 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
560 m_UTSource.SetDefferedActive(false, 10.0);
561 }
562
563 override void EOnPostSimulate(IEntity other, float timeSlice)
564 {
565 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
566 {
567 if (m_UTSource.IsActive())
569 }
570 }
571
572 override int GetAnimInstance()
573 {
574 return VehicleAnimInstances.HATCHBACK;
575 }
576
577 override float GetTransportCameraDistance()
578 {
579 return 3.5;
580 }
581
582 override int GetSeatAnimationType(int posIdx)
583 {
584 switch (posIdx)
585 {
586 case 0:
587 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
588 case 1:
589 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
590 case 2:
591 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
592 case 3:
593 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
594 }
595
596 return 0;
597
598 }
599
600
602 {
603 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackRearLight));
604 }
605
607 {
608 return CarLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackFrontLight));
609 }
610
612 {
613 if (!super.CanReleaseAttachment(attachment))
614 return false;
615
616 if (EngineIsOn() || GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
617 {
618 string attType = attachment.GetType();
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("NivaHood") != CarDoorState.DOORS_CLOSED;
629 }
630
631 override bool CanDisplayAttachmentCategory(string category_name)
632 {
633 if (!super.CanDisplayAttachmentCategory(category_name))
634 return false;
635
636 category_name.ToLower();
637 if (category_name.Contains("engine"))
638 {
639 if (GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
640 return false;
641 }
642
643 return true;
644 }
645
646 override bool CanDisplayCargo()
647 {
648 if (!super.CanDisplayCargo())
649 return false;
650
651 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
652 return false;
653
654 return true;
655 }
656
657 override int GetCarDoorsState(string slotType)
658 {
660
661 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
662 if (!carDoor)
663 return CarDoorState.DOORS_MISSING;
664
665 switch (slotType)
666 {
667 case "NivaDriverDoors":
668 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
669
670 case "NivaCoDriverDoors":
671 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
672
673 case "NivaHood":
674 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
675
676 case "NivaTrunk":
677 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
678 }
679
680 return CarDoorState.DOORS_MISSING;
681 }
682
683 override bool CrewCanGetThrough(int posIdx)
684 {
686 switch (posIdx)
687 {
688 case 0:
689 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
690 return false;
691 else if (GetAnimationPhase("SeatDriver") > 0.5)
692 return false;
693
694 return true;
695
696 case 1:
697 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
698 return false;
699 else if (GetAnimationPhase("SeatCoDriver") > 0.5)
700 return false;
701
702 return true;
703
704 case 2:
705 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
706 return false;
707 else if (GetAnimationPhase("SeatDriver") <= 0.5)
708 return false;
709
710 return true;
711
712 case 3:
713 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
714 return false;
715 else if (GetAnimationPhase("SeatCoDriver") <= 0.5)
716 return false;
717
718 return true;
719 }
720
721 return false;
722 }
723
724 override string GetDoorSelectionNameFromSeatPos(int posIdx)
725 {
726 switch (posIdx)
727 {
728 case 0:
729 case 2:
730 return "doors_driver";
731 case 1:
732 case 3:
733 return "doors_codriver";
734 }
735
736 return super.GetDoorSelectionNameFromSeatPos(posIdx);
737 }
738
739 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
740 {
741 switch (posIdx)
742 {
743 case 0:
744 case 2:
745 return "NivaDriverDoors";
746 case 1:
747 case 3:
748 return "NivaCoDriverDoors";
749 }
750
751 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
752 }
753
754 // 0 full ambient and engine sound
755 // 1 zero ambient and engine sound
756 override float OnSound(CarSoundCtrl ctrl, float oldValue)
757 {
758 float tempCap = 0.0;
759
760 switch (ctrl)
761 {
762 case CarSoundCtrl.DOORS:
763 float newValue = 0;
764 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
765 newValue += 0.5;
766
767 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
768 newValue += 0.5;
769
770 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
771 newValue += 0.3;
772
773 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
774 newValue -= 0.6;
775
776 if (GetHealthLevel("WindowLR") == GameConstants.STATE_RUINED)
777 newValue -= 0.2;
778
779 if (GetHealthLevel("WindowRR") == GameConstants.STATE_RUINED)
780 newValue -= 0.2;
781
782 return Math.Clamp(newValue, 0, 1);
783 break;
784 }
785
786 return super.OnSound(ctrl, oldValue);
787 }
788
789 override string GetAnimSourceFromSelection(string selection)
790 {
791 switch (selection)
792 {
793 case "doors_driver":
794 return "DoorsDriver";
795 case "doors_codriver":
796 return "DoorsCoDriver";
797 case "doors_hood":
798 return "DoorsHood";
799 case "doors_trunk":
800 return "DoorsTrunk";
801 case "seatback_driver":
802 return "SeatDriver";
803 case "seatback_codriver":
804 return "SeatCoDriver";
805 }
806
807 return "";
808 }
809
810 override string GetDoorConditionPointFromSelection(string selection)
811 {
812 switch (selection)
813 {
814 case "seat_driver":
815 case "seatback_driver":
816 case "seat_cargo1":
817 return "seat_con_1_1";
818 case "seat_codriver":
819 case "seatback_codriver":
820 case "seat_cargo2":
821 return "seat_con_2_1";
822 }
823
824 return "";
825 }
826
827 override int GetCrewIndex(string selection)
828 {
829 switch (selection)
830 {
831 case "seatback_driver":
832 return 0;
833 case "seatback_codriver":
834 return 1;
835 }
836
837 return -1;
838 }
839
840 override bool IsVitalTruckBattery()
841 {
842 return false;
843 }
844
845 override bool IsVitalGlowPlug()
846 {
847 return false;
848 }
849
850 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
851 {
852 if (nextSeat == 0 && GetAnimationPhase("SeatDriver") > 0.5)
853 return false;
854
855 if (nextSeat == 1 && GetAnimationPhase("SeatCoDriver") > 0.5)
856 return false;
857
858 switch (currentSeat)
859 {
860 case 0:
861 return nextSeat == 1;
862
863 case 1:
864 return nextSeat == 0;
865
866 case 2:
867 return nextSeat == 3;
868
869 case 3:
870 return nextSeat == 2;
871 }
872
873 return false;
874 }
875
876 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
877 {
878 switch (pCurrentSeat)
879 {
880 case 0:
881 return pDoorsSelection == "DoorsDriver";
882
883 case 1:
884 return pDoorsSelection == "DoorsCoDriver";
885
886 case 2:
887 return pDoorsSelection == "DoorsDriver";
888
889 case 3:
890 return pDoorsSelection == "DoorsCoDriver";
891 }
892
893 return false;
894 }
895
896 override int GetSeatIndexFromDoor(string pDoorSelection)
897 {
898 switch (pDoorSelection)
899 {
900 case "DoorsDriver":
901 return 0;
902 case "DoorsCoDriver":
903 return 1;
904 }
905
906 return -1;
907 }
908
909 override void SetActions()
910 {
911 super.SetActions();
912
914 }
915
916 override void OnDebugSpawn()
917 {
921
922 GetInventory().CreateInInventory("HatchbackWheel");
923 GetInventory().CreateInInventory("HatchbackWheel");
924 GetInventory().CreateInInventory("HatchbackWheel");
925 GetInventory().CreateInInventory("HatchbackWheel");
926
927 GetInventory().CreateInInventory("HatchbackDoors_Driver");
928 GetInventory().CreateInInventory("HatchbackDoors_CoDriver");
929 GetInventory().CreateInInventory("HatchbackHood");
930 GetInventory().CreateInInventory("HatchbackTrunk");
931
932 //-----IN CAR CARGO
933 GetInventory().CreateInInventory("HatchbackWheel");
934 GetInventory().CreateInInventory("HatchbackWheel");
935 }
936}
937
939{
940 override void OnDebugSpawn()
941 {
945
946 GetInventory().CreateInInventory("HatchbackWheel");
947 GetInventory().CreateInInventory("HatchbackWheel");
948 GetInventory().CreateInInventory("HatchbackWheel");
949 GetInventory().CreateInInventory("HatchbackWheel");
950
951 GetInventory().CreateInInventory("HatchbackDoors_Driver_White");
952 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_White");
953 GetInventory().CreateInInventory("HatchbackHood_White");
954 GetInventory().CreateInInventory("HatchbackTrunk_White");
955
956 //-----IN CAR CARGO
957 GetInventory().CreateInInventory("HatchbackWheel");
958 GetInventory().CreateInInventory("HatchbackWheel");
959 }
960}
961
963{
964 override void OnDebugSpawn()
965 {
969
970 GetInventory().CreateInInventory("HatchbackWheel");
971 GetInventory().CreateInInventory("HatchbackWheel");
972 GetInventory().CreateInInventory("HatchbackWheel");
973 GetInventory().CreateInInventory("HatchbackWheel");
974
975 GetInventory().CreateInInventory("HatchbackDoors_Driver_Blue");
976 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_Blue");
977 GetInventory().CreateInInventory("HatchbackHood_Blue");
978 GetInventory().CreateInInventory("HatchbackTrunk_Blue");
979
980 //-----IN CAR CARGO
981 GetInventory().CreateInInventory("HatchbackWheel");
982 GetInventory().CreateInInventory("HatchbackWheel");
983 }
984}

◆ GetAnimInstance()

override int OnDebugSpawn::GetAnimInstance ( )
protected

Definition at line 510 of file OffroadHatchback.c.

511{
515
516 void OffroadHatchback()
517 {
518 //m_dmgContactCoef = 0.075;
519
520 m_EngineStartOK = "offroad_engine_start_SoundSet";
521 m_EngineStartBattery = "offroad_engine_failed_start_battery_SoundSet";
522 m_EngineStartPlug = "offroad_engine_failed_start_sparkplugs_SoundSet";
523 m_EngineStartFuel = "offroad_engine_failed_start_fuel_SoundSet";
524 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
525
526 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
527 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
528 m_CarSeatShiftInSound = "Offroad_SeatShiftIn_SoundSet";
529 m_CarSeatShiftOutSound = "Offroad_SeatShiftOut_SoundSet";
530
531 m_CarHornShortSoundName = "Offroad_Horn_Short_SoundSet";
532 m_CarHornLongSoundName = "Offroad_Horn_SoundSet";
533
534 SetEnginePos("0 0.7 1.2");
535 }
536
537 override void EEInit()
538 {
539 super.EEInit();
540
541 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
542 {
544 m_UTSSettings.m_ManualUpdate = true;
545 m_UTSSettings.m_TemperatureMin = 0;
546 m_UTSSettings.m_TemperatureMax = 30;
547 m_UTSSettings.m_RangeFull = 0.5;
548 m_UTSSettings.m_RangeMax = 2;
549 m_UTSSettings.m_TemperatureCap = 25;
550
553 }
554 }
555
556 override void OnEngineStart()
557 {
558 super.OnEngineStart();
559
560 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
561 m_UTSource.SetDefferedActive(true, 20.0);
562 }
563
564 override void OnEngineStop()
565 {
566 super.OnEngineStop();
567
568 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
569 m_UTSource.SetDefferedActive(false, 10.0);
570 }
571
572 override void EOnPostSimulate(IEntity other, float timeSlice)
573 {
574 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
575 {
576 if (m_UTSource.IsActive())
578 }
579 }
580
581 override int GetAnimInstance()
582 {
583 return VehicleAnimInstances.HATCHBACK;
584 }
585
586 override float GetTransportCameraDistance()
587 {
588 return 3.5;
589 }
590
591 override int GetSeatAnimationType(int posIdx)
592 {
593 switch (posIdx)
594 {
595 case 0:
596 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
597 case 1:
598 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
599 case 2:
600 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
601 case 3:
602 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
603 }
604
605 return 0;
606
607 }
608
609
611 {
612 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackRearLight));
613 }
614
616 {
617 return CarLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackFrontLight));
618 }
619
621 {
622 if (!super.CanReleaseAttachment(attachment))
623 return false;
624
625 if (EngineIsOn() || GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
626 {
627 string attType = attachment.GetType();
628 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
629 return false;
630 }
631
632 return true;
633 }
634
635 override protected bool CanManipulateSpareWheel(string slotSelectionName)
636 {
637 return GetCarDoorsState("NivaHood") != CarDoorState.DOORS_CLOSED;
638 }
639
640 override bool CanDisplayAttachmentCategory(string category_name)
641 {
642 if (!super.CanDisplayAttachmentCategory(category_name))
643 return false;
644
645 category_name.ToLower();
646 if (category_name.Contains("engine"))
647 {
648 if (GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
649 return false;
650 }
651
652 return true;
653 }
654
655 override bool CanDisplayCargo()
656 {
657 if (!super.CanDisplayCargo())
658 return false;
659
660 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
661 return false;
662
663 return true;
664 }
665
666 override int GetCarDoorsState(string slotType)
667 {
669
670 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
671 if (!carDoor)
672 return CarDoorState.DOORS_MISSING;
673
674 switch (slotType)
675 {
676 case "NivaDriverDoors":
677 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
678
679 case "NivaCoDriverDoors":
680 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
681
682 case "NivaHood":
683 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
684
685 case "NivaTrunk":
686 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
687 }
688
689 return CarDoorState.DOORS_MISSING;
690 }
691
692 override bool CrewCanGetThrough(int posIdx)
693 {
695 switch (posIdx)
696 {
697 case 0:
698 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
699 return false;
700 else if (GetAnimationPhase("SeatDriver") > 0.5)
701 return false;
702
703 return true;
704
705 case 1:
706 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
707 return false;
708 else if (GetAnimationPhase("SeatCoDriver") > 0.5)
709 return false;
710
711 return true;
712
713 case 2:
714 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
715 return false;
716 else if (GetAnimationPhase("SeatDriver") <= 0.5)
717 return false;
718
719 return true;
720
721 case 3:
722 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
723 return false;
724 else if (GetAnimationPhase("SeatCoDriver") <= 0.5)
725 return false;
726
727 return true;
728 }
729
730 return false;
731 }
732
733 override string GetDoorSelectionNameFromSeatPos(int posIdx)
734 {
735 switch (posIdx)
736 {
737 case 0:
738 case 2:
739 return "doors_driver";
740 case 1:
741 case 3:
742 return "doors_codriver";
743 }
744
745 return super.GetDoorSelectionNameFromSeatPos(posIdx);
746 }
747
748 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
749 {
750 switch (posIdx)
751 {
752 case 0:
753 case 2:
754 return "NivaDriverDoors";
755 case 1:
756 case 3:
757 return "NivaCoDriverDoors";
758 }
759
760 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
761 }
762
763 // 0 full ambient and engine sound
764 // 1 zero ambient and engine sound
765 override float OnSound(CarSoundCtrl ctrl, float oldValue)
766 {
767 float tempCap = 0.0;
768
769 switch (ctrl)
770 {
771 case CarSoundCtrl.DOORS:
772 float newValue = 0;
773 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
774 newValue += 0.5;
775
776 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
777 newValue += 0.5;
778
779 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
780 newValue += 0.3;
781
782 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
783 newValue -= 0.6;
784
785 if (GetHealthLevel("WindowLR") == GameConstants.STATE_RUINED)
786 newValue -= 0.2;
787
788 if (GetHealthLevel("WindowRR") == GameConstants.STATE_RUINED)
789 newValue -= 0.2;
790
791 return Math.Clamp(newValue, 0, 1);
792 break;
793 }
794
795 return super.OnSound(ctrl, oldValue);
796 }
797
798 override string GetAnimSourceFromSelection(string selection)
799 {
800 switch (selection)
801 {
802 case "doors_driver":
803 return "DoorsDriver";
804 case "doors_codriver":
805 return "DoorsCoDriver";
806 case "doors_hood":
807 return "DoorsHood";
808 case "doors_trunk":
809 return "DoorsTrunk";
810 case "seatback_driver":
811 return "SeatDriver";
812 case "seatback_codriver":
813 return "SeatCoDriver";
814 }
815
816 return "";
817 }
818
819 override string GetDoorConditionPointFromSelection(string selection)
820 {
821 switch (selection)
822 {
823 case "seat_driver":
824 case "seatback_driver":
825 case "seat_cargo1":
826 return "seat_con_1_1";
827 case "seat_codriver":
828 case "seatback_codriver":
829 case "seat_cargo2":
830 return "seat_con_2_1";
831 }
832
833 return "";
834 }
835
836 override int GetCrewIndex(string selection)
837 {
838 switch (selection)
839 {
840 case "seatback_driver":
841 return 0;
842 case "seatback_codriver":
843 return 1;
844 }
845
846 return -1;
847 }
848
849 override bool IsVitalTruckBattery()
850 {
851 return false;
852 }
853
854 override bool IsVitalGlowPlug()
855 {
856 return false;
857 }
858
859 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
860 {
861 if (nextSeat == 0 && GetAnimationPhase("SeatDriver") > 0.5)
862 return false;
863
864 if (nextSeat == 1 && GetAnimationPhase("SeatCoDriver") > 0.5)
865 return false;
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 == "DoorsDriver";
897
898 case 3:
899 return pDoorsSelection == "DoorsCoDriver";
900 }
901
902 return false;
903 }
904
905 override int GetSeatIndexFromDoor(string pDoorSelection)
906 {
907 switch (pDoorSelection)
908 {
909 case "DoorsDriver":
910 return 0;
911 case "DoorsCoDriver":
912 return 1;
913 }
914
915 return -1;
916 }
917
918 override void SetActions()
919 {
920 super.SetActions();
921
923 }
924
925 override void OnDebugSpawn()
926 {
930
931 GetInventory().CreateInInventory("HatchbackWheel");
932 GetInventory().CreateInInventory("HatchbackWheel");
933 GetInventory().CreateInInventory("HatchbackWheel");
934 GetInventory().CreateInInventory("HatchbackWheel");
935
936 GetInventory().CreateInInventory("HatchbackDoors_Driver");
937 GetInventory().CreateInInventory("HatchbackDoors_CoDriver");
938 GetInventory().CreateInInventory("HatchbackHood");
939 GetInventory().CreateInInventory("HatchbackTrunk");
940
941 //-----IN CAR CARGO
942 GetInventory().CreateInInventory("HatchbackWheel");
943 GetInventory().CreateInInventory("HatchbackWheel");
944 }
945}
946
948{
949 override void OnDebugSpawn()
950 {
954
955 GetInventory().CreateInInventory("HatchbackWheel");
956 GetInventory().CreateInInventory("HatchbackWheel");
957 GetInventory().CreateInInventory("HatchbackWheel");
958 GetInventory().CreateInInventory("HatchbackWheel");
959
960 GetInventory().CreateInInventory("HatchbackDoors_Driver_White");
961 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_White");
962 GetInventory().CreateInInventory("HatchbackHood_White");
963 GetInventory().CreateInInventory("HatchbackTrunk_White");
964
965 //-----IN CAR CARGO
966 GetInventory().CreateInInventory("HatchbackWheel");
967 GetInventory().CreateInInventory("HatchbackWheel");
968 }
969}
970
972{
973 override void OnDebugSpawn()
974 {
978
979 GetInventory().CreateInInventory("HatchbackWheel");
980 GetInventory().CreateInInventory("HatchbackWheel");
981 GetInventory().CreateInInventory("HatchbackWheel");
982 GetInventory().CreateInInventory("HatchbackWheel");
983
984 GetInventory().CreateInInventory("HatchbackDoors_Driver_Blue");
985 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_Blue");
986 GetInventory().CreateInInventory("HatchbackHood_Blue");
987 GetInventory().CreateInInventory("HatchbackTrunk_Blue");
988
989 //-----IN CAR CARGO
990 GetInventory().CreateInInventory("HatchbackWheel");
991 GetInventory().CreateInInventory("HatchbackWheel");
992 }
993}

◆ GetAnimSourceFromSelection()

override string OnDebugSpawn::GetAnimSourceFromSelection ( string selection)
protected

Definition at line 727 of file OffroadHatchback.c.

728{
732
733 void OffroadHatchback()
734 {
735 //m_dmgContactCoef = 0.075;
736
737 m_EngineStartOK = "offroad_engine_start_SoundSet";
738 m_EngineStartBattery = "offroad_engine_failed_start_battery_SoundSet";
739 m_EngineStartPlug = "offroad_engine_failed_start_sparkplugs_SoundSet";
740 m_EngineStartFuel = "offroad_engine_failed_start_fuel_SoundSet";
741 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
742
743 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
744 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
745 m_CarSeatShiftInSound = "Offroad_SeatShiftIn_SoundSet";
746 m_CarSeatShiftOutSound = "Offroad_SeatShiftOut_SoundSet";
747
748 m_CarHornShortSoundName = "Offroad_Horn_Short_SoundSet";
749 m_CarHornLongSoundName = "Offroad_Horn_SoundSet";
750
751 SetEnginePos("0 0.7 1.2");
752 }
753
754 override void EEInit()
755 {
756 super.EEInit();
757
758 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
759 {
761 m_UTSSettings.m_ManualUpdate = true;
762 m_UTSSettings.m_TemperatureMin = 0;
763 m_UTSSettings.m_TemperatureMax = 30;
764 m_UTSSettings.m_RangeFull = 0.5;
765 m_UTSSettings.m_RangeMax = 2;
766 m_UTSSettings.m_TemperatureCap = 25;
767
770 }
771 }
772
773 override void OnEngineStart()
774 {
775 super.OnEngineStart();
776
777 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
778 m_UTSource.SetDefferedActive(true, 20.0);
779 }
780
781 override void OnEngineStop()
782 {
783 super.OnEngineStop();
784
785 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
786 m_UTSource.SetDefferedActive(false, 10.0);
787 }
788
789 override void EOnPostSimulate(IEntity other, float timeSlice)
790 {
791 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
792 {
793 if (m_UTSource.IsActive())
795 }
796 }
797
798 override int GetAnimInstance()
799 {
800 return VehicleAnimInstances.HATCHBACK;
801 }
802
803 override float GetTransportCameraDistance()
804 {
805 return 3.5;
806 }
807
808 override int GetSeatAnimationType(int posIdx)
809 {
810 switch (posIdx)
811 {
812 case 0:
813 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
814 case 1:
815 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
816 case 2:
817 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
818 case 3:
819 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
820 }
821
822 return 0;
823
824 }
825
826
828 {
829 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackRearLight));
830 }
831
833 {
834 return CarLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackFrontLight));
835 }
836
838 {
839 if (!super.CanReleaseAttachment(attachment))
840 return false;
841
842 if (EngineIsOn() || GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
843 {
844 string attType = attachment.GetType();
845 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
846 return false;
847 }
848
849 return true;
850 }
851
852 override protected bool CanManipulateSpareWheel(string slotSelectionName)
853 {
854 return GetCarDoorsState("NivaHood") != CarDoorState.DOORS_CLOSED;
855 }
856
857 override bool CanDisplayAttachmentCategory(string category_name)
858 {
859 if (!super.CanDisplayAttachmentCategory(category_name))
860 return false;
861
862 category_name.ToLower();
863 if (category_name.Contains("engine"))
864 {
865 if (GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
866 return false;
867 }
868
869 return true;
870 }
871
872 override bool CanDisplayCargo()
873 {
874 if (!super.CanDisplayCargo())
875 return false;
876
877 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
878 return false;
879
880 return true;
881 }
882
883 override int GetCarDoorsState(string slotType)
884 {
886
887 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
888 if (!carDoor)
889 return CarDoorState.DOORS_MISSING;
890
891 switch (slotType)
892 {
893 case "NivaDriverDoors":
894 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
895
896 case "NivaCoDriverDoors":
897 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
898
899 case "NivaHood":
900 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
901
902 case "NivaTrunk":
903 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
904 }
905
906 return CarDoorState.DOORS_MISSING;
907 }
908
909 override bool CrewCanGetThrough(int posIdx)
910 {
912 switch (posIdx)
913 {
914 case 0:
915 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
916 return false;
917 else if (GetAnimationPhase("SeatDriver") > 0.5)
918 return false;
919
920 return true;
921
922 case 1:
923 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
924 return false;
925 else if (GetAnimationPhase("SeatCoDriver") > 0.5)
926 return false;
927
928 return true;
929
930 case 2:
931 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
932 return false;
933 else if (GetAnimationPhase("SeatDriver") <= 0.5)
934 return false;
935
936 return true;
937
938 case 3:
939 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
940 return false;
941 else if (GetAnimationPhase("SeatCoDriver") <= 0.5)
942 return false;
943
944 return true;
945 }
946
947 return false;
948 }
949
950 override string GetDoorSelectionNameFromSeatPos(int posIdx)
951 {
952 switch (posIdx)
953 {
954 case 0:
955 case 2:
956 return "doors_driver";
957 case 1:
958 case 3:
959 return "doors_codriver";
960 }
961
962 return super.GetDoorSelectionNameFromSeatPos(posIdx);
963 }
964
965 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
966 {
967 switch (posIdx)
968 {
969 case 0:
970 case 2:
971 return "NivaDriverDoors";
972 case 1:
973 case 3:
974 return "NivaCoDriverDoors";
975 }
976
977 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
978 }
979
980 // 0 full ambient and engine sound
981 // 1 zero ambient and engine sound
982 override float OnSound(CarSoundCtrl ctrl, float oldValue)
983 {
984 float tempCap = 0.0;
985
986 switch (ctrl)
987 {
988 case CarSoundCtrl.DOORS:
989 float newValue = 0;
990 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
991 newValue += 0.5;
992
993 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
994 newValue += 0.5;
995
996 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
997 newValue += 0.3;
998
999 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
1000 newValue -= 0.6;
1001
1002 if (GetHealthLevel("WindowLR") == GameConstants.STATE_RUINED)
1003 newValue -= 0.2;
1004
1005 if (GetHealthLevel("WindowRR") == GameConstants.STATE_RUINED)
1006 newValue -= 0.2;
1007
1008 return Math.Clamp(newValue, 0, 1);
1009 break;
1010 }
1011
1012 return super.OnSound(ctrl, oldValue);
1013 }
1014
1015 override string GetAnimSourceFromSelection(string selection)
1016 {
1017 switch (selection)
1018 {
1019 case "doors_driver":
1020 return "DoorsDriver";
1021 case "doors_codriver":
1022 return "DoorsCoDriver";
1023 case "doors_hood":
1024 return "DoorsHood";
1025 case "doors_trunk":
1026 return "DoorsTrunk";
1027 case "seatback_driver":
1028 return "SeatDriver";
1029 case "seatback_codriver":
1030 return "SeatCoDriver";
1031 }
1032
1033 return "";
1034 }
1035
1036 override string GetDoorConditionPointFromSelection(string selection)
1037 {
1038 switch (selection)
1039 {
1040 case "seat_driver":
1041 case "seatback_driver":
1042 case "seat_cargo1":
1043 return "seat_con_1_1";
1044 case "seat_codriver":
1045 case "seatback_codriver":
1046 case "seat_cargo2":
1047 return "seat_con_2_1";
1048 }
1049
1050 return "";
1051 }
1052
1053 override int GetCrewIndex(string selection)
1054 {
1055 switch (selection)
1056 {
1057 case "seatback_driver":
1058 return 0;
1059 case "seatback_codriver":
1060 return 1;
1061 }
1062
1063 return -1;
1064 }
1065
1066 override bool IsVitalTruckBattery()
1067 {
1068 return false;
1069 }
1070
1071 override bool IsVitalGlowPlug()
1072 {
1073 return false;
1074 }
1075
1076 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
1077 {
1078 if (nextSeat == 0 && GetAnimationPhase("SeatDriver") > 0.5)
1079 return false;
1080
1081 if (nextSeat == 1 && GetAnimationPhase("SeatCoDriver") > 0.5)
1082 return false;
1083
1084 switch (currentSeat)
1085 {
1086 case 0:
1087 return nextSeat == 1;
1088
1089 case 1:
1090 return nextSeat == 0;
1091
1092 case 2:
1093 return nextSeat == 3;
1094
1095 case 3:
1096 return nextSeat == 2;
1097 }
1098
1099 return false;
1100 }
1101
1102 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
1103 {
1104 switch (pCurrentSeat)
1105 {
1106 case 0:
1107 return pDoorsSelection == "DoorsDriver";
1108
1109 case 1:
1110 return pDoorsSelection == "DoorsCoDriver";
1111
1112 case 2:
1113 return pDoorsSelection == "DoorsDriver";
1114
1115 case 3:
1116 return pDoorsSelection == "DoorsCoDriver";
1117 }
1118
1119 return false;
1120 }
1121
1122 override int GetSeatIndexFromDoor(string pDoorSelection)
1123 {
1124 switch (pDoorSelection)
1125 {
1126 case "DoorsDriver":
1127 return 0;
1128 case "DoorsCoDriver":
1129 return 1;
1130 }
1131
1132 return -1;
1133 }
1134
1135 override void SetActions()
1136 {
1137 super.SetActions();
1138
1140 }
1141
1142 override void OnDebugSpawn()
1143 {
1147
1148 GetInventory().CreateInInventory("HatchbackWheel");
1149 GetInventory().CreateInInventory("HatchbackWheel");
1150 GetInventory().CreateInInventory("HatchbackWheel");
1151 GetInventory().CreateInInventory("HatchbackWheel");
1152
1153 GetInventory().CreateInInventory("HatchbackDoors_Driver");
1154 GetInventory().CreateInInventory("HatchbackDoors_CoDriver");
1155 GetInventory().CreateInInventory("HatchbackHood");
1156 GetInventory().CreateInInventory("HatchbackTrunk");
1157
1158 //-----IN CAR CARGO
1159 GetInventory().CreateInInventory("HatchbackWheel");
1160 GetInventory().CreateInInventory("HatchbackWheel");
1161 }
1162}
1163
1165{
1166 override void OnDebugSpawn()
1167 {
1171
1172 GetInventory().CreateInInventory("HatchbackWheel");
1173 GetInventory().CreateInInventory("HatchbackWheel");
1174 GetInventory().CreateInInventory("HatchbackWheel");
1175 GetInventory().CreateInInventory("HatchbackWheel");
1176
1177 GetInventory().CreateInInventory("HatchbackDoors_Driver_White");
1178 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_White");
1179 GetInventory().CreateInInventory("HatchbackHood_White");
1180 GetInventory().CreateInInventory("HatchbackTrunk_White");
1181
1182 //-----IN CAR CARGO
1183 GetInventory().CreateInInventory("HatchbackWheel");
1184 GetInventory().CreateInInventory("HatchbackWheel");
1185 }
1186}
1187
1189{
1190 override void OnDebugSpawn()
1191 {
1195
1196 GetInventory().CreateInInventory("HatchbackWheel");
1197 GetInventory().CreateInInventory("HatchbackWheel");
1198 GetInventory().CreateInInventory("HatchbackWheel");
1199 GetInventory().CreateInInventory("HatchbackWheel");
1200
1201 GetInventory().CreateInInventory("HatchbackDoors_Driver_Blue");
1202 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_Blue");
1203 GetInventory().CreateInInventory("HatchbackHood_Blue");
1204 GetInventory().CreateInInventory("HatchbackTrunk_Blue");
1205
1206 //-----IN CAR CARGO
1207 GetInventory().CreateInInventory("HatchbackWheel");
1208 GetInventory().CreateInInventory("HatchbackWheel");
1209 }
1210}

◆ GetCarDoorsState()

override int OnDebugSpawn::GetCarDoorsState ( string slotType)
protected

Definition at line 595 of file OffroadHatchback.c.

596{
600
601 void OffroadHatchback()
602 {
603 //m_dmgContactCoef = 0.075;
604
605 m_EngineStartOK = "offroad_engine_start_SoundSet";
606 m_EngineStartBattery = "offroad_engine_failed_start_battery_SoundSet";
607 m_EngineStartPlug = "offroad_engine_failed_start_sparkplugs_SoundSet";
608 m_EngineStartFuel = "offroad_engine_failed_start_fuel_SoundSet";
609 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
610
611 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
612 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
613 m_CarSeatShiftInSound = "Offroad_SeatShiftIn_SoundSet";
614 m_CarSeatShiftOutSound = "Offroad_SeatShiftOut_SoundSet";
615
616 m_CarHornShortSoundName = "Offroad_Horn_Short_SoundSet";
617 m_CarHornLongSoundName = "Offroad_Horn_SoundSet";
618
619 SetEnginePos("0 0.7 1.2");
620 }
621
622 override void EEInit()
623 {
624 super.EEInit();
625
626 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
627 {
629 m_UTSSettings.m_ManualUpdate = true;
630 m_UTSSettings.m_TemperatureMin = 0;
631 m_UTSSettings.m_TemperatureMax = 30;
632 m_UTSSettings.m_RangeFull = 0.5;
633 m_UTSSettings.m_RangeMax = 2;
634 m_UTSSettings.m_TemperatureCap = 25;
635
638 }
639 }
640
641 override void OnEngineStart()
642 {
643 super.OnEngineStart();
644
645 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
646 m_UTSource.SetDefferedActive(true, 20.0);
647 }
648
649 override void OnEngineStop()
650 {
651 super.OnEngineStop();
652
653 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
654 m_UTSource.SetDefferedActive(false, 10.0);
655 }
656
657 override void EOnPostSimulate(IEntity other, float timeSlice)
658 {
659 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
660 {
661 if (m_UTSource.IsActive())
663 }
664 }
665
666 override int GetAnimInstance()
667 {
668 return VehicleAnimInstances.HATCHBACK;
669 }
670
671 override float GetTransportCameraDistance()
672 {
673 return 3.5;
674 }
675
676 override int GetSeatAnimationType(int posIdx)
677 {
678 switch (posIdx)
679 {
680 case 0:
681 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
682 case 1:
683 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
684 case 2:
685 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
686 case 3:
687 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
688 }
689
690 return 0;
691
692 }
693
694
696 {
697 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackRearLight));
698 }
699
701 {
702 return CarLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackFrontLight));
703 }
704
706 {
707 if (!super.CanReleaseAttachment(attachment))
708 return false;
709
710 if (EngineIsOn() || GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
711 {
712 string attType = attachment.GetType();
713 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
714 return false;
715 }
716
717 return true;
718 }
719
720 override protected bool CanManipulateSpareWheel(string slotSelectionName)
721 {
722 return GetCarDoorsState("NivaHood") != CarDoorState.DOORS_CLOSED;
723 }
724
725 override bool CanDisplayAttachmentCategory(string category_name)
726 {
727 if (!super.CanDisplayAttachmentCategory(category_name))
728 return false;
729
730 category_name.ToLower();
731 if (category_name.Contains("engine"))
732 {
733 if (GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
734 return false;
735 }
736
737 return true;
738 }
739
740 override bool CanDisplayCargo()
741 {
742 if (!super.CanDisplayCargo())
743 return false;
744
745 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
746 return false;
747
748 return true;
749 }
750
751 override int GetCarDoorsState(string slotType)
752 {
754
755 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
756 if (!carDoor)
757 return CarDoorState.DOORS_MISSING;
758
759 switch (slotType)
760 {
761 case "NivaDriverDoors":
762 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
763
764 case "NivaCoDriverDoors":
765 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
766
767 case "NivaHood":
768 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
769
770 case "NivaTrunk":
771 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
772 }
773
774 return CarDoorState.DOORS_MISSING;
775 }
776
777 override bool CrewCanGetThrough(int posIdx)
778 {
780 switch (posIdx)
781 {
782 case 0:
783 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
784 return false;
785 else if (GetAnimationPhase("SeatDriver") > 0.5)
786 return false;
787
788 return true;
789
790 case 1:
791 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
792 return false;
793 else if (GetAnimationPhase("SeatCoDriver") > 0.5)
794 return false;
795
796 return true;
797
798 case 2:
799 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
800 return false;
801 else if (GetAnimationPhase("SeatDriver") <= 0.5)
802 return false;
803
804 return true;
805
806 case 3:
807 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
808 return false;
809 else if (GetAnimationPhase("SeatCoDriver") <= 0.5)
810 return false;
811
812 return true;
813 }
814
815 return false;
816 }
817
818 override string GetDoorSelectionNameFromSeatPos(int posIdx)
819 {
820 switch (posIdx)
821 {
822 case 0:
823 case 2:
824 return "doors_driver";
825 case 1:
826 case 3:
827 return "doors_codriver";
828 }
829
830 return super.GetDoorSelectionNameFromSeatPos(posIdx);
831 }
832
833 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
834 {
835 switch (posIdx)
836 {
837 case 0:
838 case 2:
839 return "NivaDriverDoors";
840 case 1:
841 case 3:
842 return "NivaCoDriverDoors";
843 }
844
845 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
846 }
847
848 // 0 full ambient and engine sound
849 // 1 zero ambient and engine sound
850 override float OnSound(CarSoundCtrl ctrl, float oldValue)
851 {
852 float tempCap = 0.0;
853
854 switch (ctrl)
855 {
856 case CarSoundCtrl.DOORS:
857 float newValue = 0;
858 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
859 newValue += 0.5;
860
861 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
862 newValue += 0.5;
863
864 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
865 newValue += 0.3;
866
867 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
868 newValue -= 0.6;
869
870 if (GetHealthLevel("WindowLR") == GameConstants.STATE_RUINED)
871 newValue -= 0.2;
872
873 if (GetHealthLevel("WindowRR") == GameConstants.STATE_RUINED)
874 newValue -= 0.2;
875
876 return Math.Clamp(newValue, 0, 1);
877 break;
878 }
879
880 return super.OnSound(ctrl, oldValue);
881 }
882
883 override string GetAnimSourceFromSelection(string selection)
884 {
885 switch (selection)
886 {
887 case "doors_driver":
888 return "DoorsDriver";
889 case "doors_codriver":
890 return "DoorsCoDriver";
891 case "doors_hood":
892 return "DoorsHood";
893 case "doors_trunk":
894 return "DoorsTrunk";
895 case "seatback_driver":
896 return "SeatDriver";
897 case "seatback_codriver":
898 return "SeatCoDriver";
899 }
900
901 return "";
902 }
903
904 override string GetDoorConditionPointFromSelection(string selection)
905 {
906 switch (selection)
907 {
908 case "seat_driver":
909 case "seatback_driver":
910 case "seat_cargo1":
911 return "seat_con_1_1";
912 case "seat_codriver":
913 case "seatback_codriver":
914 case "seat_cargo2":
915 return "seat_con_2_1";
916 }
917
918 return "";
919 }
920
921 override int GetCrewIndex(string selection)
922 {
923 switch (selection)
924 {
925 case "seatback_driver":
926 return 0;
927 case "seatback_codriver":
928 return 1;
929 }
930
931 return -1;
932 }
933
934 override bool IsVitalTruckBattery()
935 {
936 return false;
937 }
938
939 override bool IsVitalGlowPlug()
940 {
941 return false;
942 }
943
944 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
945 {
946 if (nextSeat == 0 && GetAnimationPhase("SeatDriver") > 0.5)
947 return false;
948
949 if (nextSeat == 1 && GetAnimationPhase("SeatCoDriver") > 0.5)
950 return false;
951
952 switch (currentSeat)
953 {
954 case 0:
955 return nextSeat == 1;
956
957 case 1:
958 return nextSeat == 0;
959
960 case 2:
961 return nextSeat == 3;
962
963 case 3:
964 return nextSeat == 2;
965 }
966
967 return false;
968 }
969
970 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
971 {
972 switch (pCurrentSeat)
973 {
974 case 0:
975 return pDoorsSelection == "DoorsDriver";
976
977 case 1:
978 return pDoorsSelection == "DoorsCoDriver";
979
980 case 2:
981 return pDoorsSelection == "DoorsDriver";
982
983 case 3:
984 return pDoorsSelection == "DoorsCoDriver";
985 }
986
987 return false;
988 }
989
990 override int GetSeatIndexFromDoor(string pDoorSelection)
991 {
992 switch (pDoorSelection)
993 {
994 case "DoorsDriver":
995 return 0;
996 case "DoorsCoDriver":
997 return 1;
998 }
999
1000 return -1;
1001 }
1002
1003 override void SetActions()
1004 {
1005 super.SetActions();
1006
1008 }
1009
1010 override void OnDebugSpawn()
1011 {
1015
1016 GetInventory().CreateInInventory("HatchbackWheel");
1017 GetInventory().CreateInInventory("HatchbackWheel");
1018 GetInventory().CreateInInventory("HatchbackWheel");
1019 GetInventory().CreateInInventory("HatchbackWheel");
1020
1021 GetInventory().CreateInInventory("HatchbackDoors_Driver");
1022 GetInventory().CreateInInventory("HatchbackDoors_CoDriver");
1023 GetInventory().CreateInInventory("HatchbackHood");
1024 GetInventory().CreateInInventory("HatchbackTrunk");
1025
1026 //-----IN CAR CARGO
1027 GetInventory().CreateInInventory("HatchbackWheel");
1028 GetInventory().CreateInInventory("HatchbackWheel");
1029 }
1030}
1031
1033{
1034 override void OnDebugSpawn()
1035 {
1039
1040 GetInventory().CreateInInventory("HatchbackWheel");
1041 GetInventory().CreateInInventory("HatchbackWheel");
1042 GetInventory().CreateInInventory("HatchbackWheel");
1043 GetInventory().CreateInInventory("HatchbackWheel");
1044
1045 GetInventory().CreateInInventory("HatchbackDoors_Driver_White");
1046 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_White");
1047 GetInventory().CreateInInventory("HatchbackHood_White");
1048 GetInventory().CreateInInventory("HatchbackTrunk_White");
1049
1050 //-----IN CAR CARGO
1051 GetInventory().CreateInInventory("HatchbackWheel");
1052 GetInventory().CreateInInventory("HatchbackWheel");
1053 }
1054}
1055
1057{
1058 override void OnDebugSpawn()
1059 {
1063
1064 GetInventory().CreateInInventory("HatchbackWheel");
1065 GetInventory().CreateInInventory("HatchbackWheel");
1066 GetInventory().CreateInInventory("HatchbackWheel");
1067 GetInventory().CreateInInventory("HatchbackWheel");
1068
1069 GetInventory().CreateInInventory("HatchbackDoors_Driver_Blue");
1070 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_Blue");
1071 GetInventory().CreateInInventory("HatchbackHood_Blue");
1072 GetInventory().CreateInInventory("HatchbackTrunk_Blue");
1073
1074 //-----IN CAR CARGO
1075 GetInventory().CreateInInventory("HatchbackWheel");
1076 GetInventory().CreateInInventory("HatchbackWheel");
1077 }
1078}

Referenced by CarScript::CanDisplayAttachmentCategory(), CarScript::CanDisplayCargo(), CarScript::CanManipulateSpareWheel(), CarScript::CanReleaseAttachment(), CarScript::CrewCanGetThrough(), and CarScript::OnSound().

◆ GetCrewIndex()

override int OnDebugSpawn::GetCrewIndex ( string selection)
protected

Definition at line 765 of file OffroadHatchback.c.

766{
770
771 void OffroadHatchback()
772 {
773 //m_dmgContactCoef = 0.075;
774
775 m_EngineStartOK = "offroad_engine_start_SoundSet";
776 m_EngineStartBattery = "offroad_engine_failed_start_battery_SoundSet";
777 m_EngineStartPlug = "offroad_engine_failed_start_sparkplugs_SoundSet";
778 m_EngineStartFuel = "offroad_engine_failed_start_fuel_SoundSet";
779 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
780
781 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
782 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
783 m_CarSeatShiftInSound = "Offroad_SeatShiftIn_SoundSet";
784 m_CarSeatShiftOutSound = "Offroad_SeatShiftOut_SoundSet";
785
786 m_CarHornShortSoundName = "Offroad_Horn_Short_SoundSet";
787 m_CarHornLongSoundName = "Offroad_Horn_SoundSet";
788
789 SetEnginePos("0 0.7 1.2");
790 }
791
792 override void EEInit()
793 {
794 super.EEInit();
795
796 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
797 {
799 m_UTSSettings.m_ManualUpdate = true;
800 m_UTSSettings.m_TemperatureMin = 0;
801 m_UTSSettings.m_TemperatureMax = 30;
802 m_UTSSettings.m_RangeFull = 0.5;
803 m_UTSSettings.m_RangeMax = 2;
804 m_UTSSettings.m_TemperatureCap = 25;
805
808 }
809 }
810
811 override void OnEngineStart()
812 {
813 super.OnEngineStart();
814
815 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
816 m_UTSource.SetDefferedActive(true, 20.0);
817 }
818
819 override void OnEngineStop()
820 {
821 super.OnEngineStop();
822
823 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
824 m_UTSource.SetDefferedActive(false, 10.0);
825 }
826
827 override void EOnPostSimulate(IEntity other, float timeSlice)
828 {
829 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
830 {
831 if (m_UTSource.IsActive())
833 }
834 }
835
836 override int GetAnimInstance()
837 {
838 return VehicleAnimInstances.HATCHBACK;
839 }
840
841 override float GetTransportCameraDistance()
842 {
843 return 3.5;
844 }
845
846 override int GetSeatAnimationType(int posIdx)
847 {
848 switch (posIdx)
849 {
850 case 0:
851 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
852 case 1:
853 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
854 case 2:
855 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
856 case 3:
857 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
858 }
859
860 return 0;
861
862 }
863
864
866 {
867 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackRearLight));
868 }
869
871 {
872 return CarLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackFrontLight));
873 }
874
876 {
877 if (!super.CanReleaseAttachment(attachment))
878 return false;
879
880 if (EngineIsOn() || GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
881 {
882 string attType = attachment.GetType();
883 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
884 return false;
885 }
886
887 return true;
888 }
889
890 override protected bool CanManipulateSpareWheel(string slotSelectionName)
891 {
892 return GetCarDoorsState("NivaHood") != CarDoorState.DOORS_CLOSED;
893 }
894
895 override bool CanDisplayAttachmentCategory(string category_name)
896 {
897 if (!super.CanDisplayAttachmentCategory(category_name))
898 return false;
899
900 category_name.ToLower();
901 if (category_name.Contains("engine"))
902 {
903 if (GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
904 return false;
905 }
906
907 return true;
908 }
909
910 override bool CanDisplayCargo()
911 {
912 if (!super.CanDisplayCargo())
913 return false;
914
915 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
916 return false;
917
918 return true;
919 }
920
921 override int GetCarDoorsState(string slotType)
922 {
924
925 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
926 if (!carDoor)
927 return CarDoorState.DOORS_MISSING;
928
929 switch (slotType)
930 {
931 case "NivaDriverDoors":
932 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
933
934 case "NivaCoDriverDoors":
935 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
936
937 case "NivaHood":
938 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
939
940 case "NivaTrunk":
941 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
942 }
943
944 return CarDoorState.DOORS_MISSING;
945 }
946
947 override bool CrewCanGetThrough(int posIdx)
948 {
950 switch (posIdx)
951 {
952 case 0:
953 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
954 return false;
955 else if (GetAnimationPhase("SeatDriver") > 0.5)
956 return false;
957
958 return true;
959
960 case 1:
961 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
962 return false;
963 else if (GetAnimationPhase("SeatCoDriver") > 0.5)
964 return false;
965
966 return true;
967
968 case 2:
969 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
970 return false;
971 else if (GetAnimationPhase("SeatDriver") <= 0.5)
972 return false;
973
974 return true;
975
976 case 3:
977 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
978 return false;
979 else if (GetAnimationPhase("SeatCoDriver") <= 0.5)
980 return false;
981
982 return true;
983 }
984
985 return false;
986 }
987
988 override string GetDoorSelectionNameFromSeatPos(int posIdx)
989 {
990 switch (posIdx)
991 {
992 case 0:
993 case 2:
994 return "doors_driver";
995 case 1:
996 case 3:
997 return "doors_codriver";
998 }
999
1000 return super.GetDoorSelectionNameFromSeatPos(posIdx);
1001 }
1002
1003 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
1004 {
1005 switch (posIdx)
1006 {
1007 case 0:
1008 case 2:
1009 return "NivaDriverDoors";
1010 case 1:
1011 case 3:
1012 return "NivaCoDriverDoors";
1013 }
1014
1015 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
1016 }
1017
1018 // 0 full ambient and engine sound
1019 // 1 zero ambient and engine sound
1020 override float OnSound(CarSoundCtrl ctrl, float oldValue)
1021 {
1022 float tempCap = 0.0;
1023
1024 switch (ctrl)
1025 {
1026 case CarSoundCtrl.DOORS:
1027 float newValue = 0;
1028 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
1029 newValue += 0.5;
1030
1031 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
1032 newValue += 0.5;
1033
1034 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
1035 newValue += 0.3;
1036
1037 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
1038 newValue -= 0.6;
1039
1040 if (GetHealthLevel("WindowLR") == GameConstants.STATE_RUINED)
1041 newValue -= 0.2;
1042
1043 if (GetHealthLevel("WindowRR") == GameConstants.STATE_RUINED)
1044 newValue -= 0.2;
1045
1046 return Math.Clamp(newValue, 0, 1);
1047 break;
1048 }
1049
1050 return super.OnSound(ctrl, oldValue);
1051 }
1052
1053 override string GetAnimSourceFromSelection(string selection)
1054 {
1055 switch (selection)
1056 {
1057 case "doors_driver":
1058 return "DoorsDriver";
1059 case "doors_codriver":
1060 return "DoorsCoDriver";
1061 case "doors_hood":
1062 return "DoorsHood";
1063 case "doors_trunk":
1064 return "DoorsTrunk";
1065 case "seatback_driver":
1066 return "SeatDriver";
1067 case "seatback_codriver":
1068 return "SeatCoDriver";
1069 }
1070
1071 return "";
1072 }
1073
1074 override string GetDoorConditionPointFromSelection(string selection)
1075 {
1076 switch (selection)
1077 {
1078 case "seat_driver":
1079 case "seatback_driver":
1080 case "seat_cargo1":
1081 return "seat_con_1_1";
1082 case "seat_codriver":
1083 case "seatback_codriver":
1084 case "seat_cargo2":
1085 return "seat_con_2_1";
1086 }
1087
1088 return "";
1089 }
1090
1091 override int GetCrewIndex(string selection)
1092 {
1093 switch (selection)
1094 {
1095 case "seatback_driver":
1096 return 0;
1097 case "seatback_codriver":
1098 return 1;
1099 }
1100
1101 return -1;
1102 }
1103
1104 override bool IsVitalTruckBattery()
1105 {
1106 return false;
1107 }
1108
1109 override bool IsVitalGlowPlug()
1110 {
1111 return false;
1112 }
1113
1114 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
1115 {
1116 if (nextSeat == 0 && GetAnimationPhase("SeatDriver") > 0.5)
1117 return false;
1118
1119 if (nextSeat == 1 && GetAnimationPhase("SeatCoDriver") > 0.5)
1120 return false;
1121
1122 switch (currentSeat)
1123 {
1124 case 0:
1125 return nextSeat == 1;
1126
1127 case 1:
1128 return nextSeat == 0;
1129
1130 case 2:
1131 return nextSeat == 3;
1132
1133 case 3:
1134 return nextSeat == 2;
1135 }
1136
1137 return false;
1138 }
1139
1140 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
1141 {
1142 switch (pCurrentSeat)
1143 {
1144 case 0:
1145 return pDoorsSelection == "DoorsDriver";
1146
1147 case 1:
1148 return pDoorsSelection == "DoorsCoDriver";
1149
1150 case 2:
1151 return pDoorsSelection == "DoorsDriver";
1152
1153 case 3:
1154 return pDoorsSelection == "DoorsCoDriver";
1155 }
1156
1157 return false;
1158 }
1159
1160 override int GetSeatIndexFromDoor(string pDoorSelection)
1161 {
1162 switch (pDoorSelection)
1163 {
1164 case "DoorsDriver":
1165 return 0;
1166 case "DoorsCoDriver":
1167 return 1;
1168 }
1169
1170 return -1;
1171 }
1172
1173 override void SetActions()
1174 {
1175 super.SetActions();
1176
1178 }
1179
1180 override void OnDebugSpawn()
1181 {
1185
1186 GetInventory().CreateInInventory("HatchbackWheel");
1187 GetInventory().CreateInInventory("HatchbackWheel");
1188 GetInventory().CreateInInventory("HatchbackWheel");
1189 GetInventory().CreateInInventory("HatchbackWheel");
1190
1191 GetInventory().CreateInInventory("HatchbackDoors_Driver");
1192 GetInventory().CreateInInventory("HatchbackDoors_CoDriver");
1193 GetInventory().CreateInInventory("HatchbackHood");
1194 GetInventory().CreateInInventory("HatchbackTrunk");
1195
1196 //-----IN CAR CARGO
1197 GetInventory().CreateInInventory("HatchbackWheel");
1198 GetInventory().CreateInInventory("HatchbackWheel");
1199 }
1200}
1201
1203{
1204 override void OnDebugSpawn()
1205 {
1209
1210 GetInventory().CreateInInventory("HatchbackWheel");
1211 GetInventory().CreateInInventory("HatchbackWheel");
1212 GetInventory().CreateInInventory("HatchbackWheel");
1213 GetInventory().CreateInInventory("HatchbackWheel");
1214
1215 GetInventory().CreateInInventory("HatchbackDoors_Driver_White");
1216 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_White");
1217 GetInventory().CreateInInventory("HatchbackHood_White");
1218 GetInventory().CreateInInventory("HatchbackTrunk_White");
1219
1220 //-----IN CAR CARGO
1221 GetInventory().CreateInInventory("HatchbackWheel");
1222 GetInventory().CreateInInventory("HatchbackWheel");
1223 }
1224}
1225
1227{
1228 override void OnDebugSpawn()
1229 {
1233
1234 GetInventory().CreateInInventory("HatchbackWheel");
1235 GetInventory().CreateInInventory("HatchbackWheel");
1236 GetInventory().CreateInInventory("HatchbackWheel");
1237 GetInventory().CreateInInventory("HatchbackWheel");
1238
1239 GetInventory().CreateInInventory("HatchbackDoors_Driver_Blue");
1240 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_Blue");
1241 GetInventory().CreateInInventory("HatchbackHood_Blue");
1242 GetInventory().CreateInInventory("HatchbackTrunk_Blue");
1243
1244 //-----IN CAR CARGO
1245 GetInventory().CreateInInventory("HatchbackWheel");
1246 GetInventory().CreateInInventory("HatchbackWheel");
1247 }
1248}

◆ GetDoorConditionPointFromSelection()

override string OnDebugSpawn::GetDoorConditionPointFromSelection ( string selection)
protected

Definition at line 748 of file OffroadHatchback.c.

749{
753
754 void OffroadHatchback()
755 {
756 //m_dmgContactCoef = 0.075;
757
758 m_EngineStartOK = "offroad_engine_start_SoundSet";
759 m_EngineStartBattery = "offroad_engine_failed_start_battery_SoundSet";
760 m_EngineStartPlug = "offroad_engine_failed_start_sparkplugs_SoundSet";
761 m_EngineStartFuel = "offroad_engine_failed_start_fuel_SoundSet";
762 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
763
764 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
765 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
766 m_CarSeatShiftInSound = "Offroad_SeatShiftIn_SoundSet";
767 m_CarSeatShiftOutSound = "Offroad_SeatShiftOut_SoundSet";
768
769 m_CarHornShortSoundName = "Offroad_Horn_Short_SoundSet";
770 m_CarHornLongSoundName = "Offroad_Horn_SoundSet";
771
772 SetEnginePos("0 0.7 1.2");
773 }
774
775 override void EEInit()
776 {
777 super.EEInit();
778
779 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
780 {
782 m_UTSSettings.m_ManualUpdate = true;
783 m_UTSSettings.m_TemperatureMin = 0;
784 m_UTSSettings.m_TemperatureMax = 30;
785 m_UTSSettings.m_RangeFull = 0.5;
786 m_UTSSettings.m_RangeMax = 2;
787 m_UTSSettings.m_TemperatureCap = 25;
788
791 }
792 }
793
794 override void OnEngineStart()
795 {
796 super.OnEngineStart();
797
798 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
799 m_UTSource.SetDefferedActive(true, 20.0);
800 }
801
802 override void OnEngineStop()
803 {
804 super.OnEngineStop();
805
806 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
807 m_UTSource.SetDefferedActive(false, 10.0);
808 }
809
810 override void EOnPostSimulate(IEntity other, float timeSlice)
811 {
812 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
813 {
814 if (m_UTSource.IsActive())
816 }
817 }
818
819 override int GetAnimInstance()
820 {
821 return VehicleAnimInstances.HATCHBACK;
822 }
823
824 override float GetTransportCameraDistance()
825 {
826 return 3.5;
827 }
828
829 override int GetSeatAnimationType(int posIdx)
830 {
831 switch (posIdx)
832 {
833 case 0:
834 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
835 case 1:
836 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
837 case 2:
838 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
839 case 3:
840 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
841 }
842
843 return 0;
844
845 }
846
847
849 {
850 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackRearLight));
851 }
852
854 {
855 return CarLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackFrontLight));
856 }
857
859 {
860 if (!super.CanReleaseAttachment(attachment))
861 return false;
862
863 if (EngineIsOn() || GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
864 {
865 string attType = attachment.GetType();
866 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
867 return false;
868 }
869
870 return true;
871 }
872
873 override protected bool CanManipulateSpareWheel(string slotSelectionName)
874 {
875 return GetCarDoorsState("NivaHood") != CarDoorState.DOORS_CLOSED;
876 }
877
878 override bool CanDisplayAttachmentCategory(string category_name)
879 {
880 if (!super.CanDisplayAttachmentCategory(category_name))
881 return false;
882
883 category_name.ToLower();
884 if (category_name.Contains("engine"))
885 {
886 if (GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
887 return false;
888 }
889
890 return true;
891 }
892
893 override bool CanDisplayCargo()
894 {
895 if (!super.CanDisplayCargo())
896 return false;
897
898 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
899 return false;
900
901 return true;
902 }
903
904 override int GetCarDoorsState(string slotType)
905 {
907
908 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
909 if (!carDoor)
910 return CarDoorState.DOORS_MISSING;
911
912 switch (slotType)
913 {
914 case "NivaDriverDoors":
915 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
916
917 case "NivaCoDriverDoors":
918 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
919
920 case "NivaHood":
921 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
922
923 case "NivaTrunk":
924 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
925 }
926
927 return CarDoorState.DOORS_MISSING;
928 }
929
930 override bool CrewCanGetThrough(int posIdx)
931 {
933 switch (posIdx)
934 {
935 case 0:
936 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
937 return false;
938 else if (GetAnimationPhase("SeatDriver") > 0.5)
939 return false;
940
941 return true;
942
943 case 1:
944 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
945 return false;
946 else if (GetAnimationPhase("SeatCoDriver") > 0.5)
947 return false;
948
949 return true;
950
951 case 2:
952 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
953 return false;
954 else if (GetAnimationPhase("SeatDriver") <= 0.5)
955 return false;
956
957 return true;
958
959 case 3:
960 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
961 return false;
962 else if (GetAnimationPhase("SeatCoDriver") <= 0.5)
963 return false;
964
965 return true;
966 }
967
968 return false;
969 }
970
971 override string GetDoorSelectionNameFromSeatPos(int posIdx)
972 {
973 switch (posIdx)
974 {
975 case 0:
976 case 2:
977 return "doors_driver";
978 case 1:
979 case 3:
980 return "doors_codriver";
981 }
982
983 return super.GetDoorSelectionNameFromSeatPos(posIdx);
984 }
985
986 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
987 {
988 switch (posIdx)
989 {
990 case 0:
991 case 2:
992 return "NivaDriverDoors";
993 case 1:
994 case 3:
995 return "NivaCoDriverDoors";
996 }
997
998 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
999 }
1000
1001 // 0 full ambient and engine sound
1002 // 1 zero ambient and engine sound
1003 override float OnSound(CarSoundCtrl ctrl, float oldValue)
1004 {
1005 float tempCap = 0.0;
1006
1007 switch (ctrl)
1008 {
1009 case CarSoundCtrl.DOORS:
1010 float newValue = 0;
1011 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
1012 newValue += 0.5;
1013
1014 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
1015 newValue += 0.5;
1016
1017 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
1018 newValue += 0.3;
1019
1020 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
1021 newValue -= 0.6;
1022
1023 if (GetHealthLevel("WindowLR") == GameConstants.STATE_RUINED)
1024 newValue -= 0.2;
1025
1026 if (GetHealthLevel("WindowRR") == GameConstants.STATE_RUINED)
1027 newValue -= 0.2;
1028
1029 return Math.Clamp(newValue, 0, 1);
1030 break;
1031 }
1032
1033 return super.OnSound(ctrl, oldValue);
1034 }
1035
1036 override string GetAnimSourceFromSelection(string selection)
1037 {
1038 switch (selection)
1039 {
1040 case "doors_driver":
1041 return "DoorsDriver";
1042 case "doors_codriver":
1043 return "DoorsCoDriver";
1044 case "doors_hood":
1045 return "DoorsHood";
1046 case "doors_trunk":
1047 return "DoorsTrunk";
1048 case "seatback_driver":
1049 return "SeatDriver";
1050 case "seatback_codriver":
1051 return "SeatCoDriver";
1052 }
1053
1054 return "";
1055 }
1056
1057 override string GetDoorConditionPointFromSelection(string selection)
1058 {
1059 switch (selection)
1060 {
1061 case "seat_driver":
1062 case "seatback_driver":
1063 case "seat_cargo1":
1064 return "seat_con_1_1";
1065 case "seat_codriver":
1066 case "seatback_codriver":
1067 case "seat_cargo2":
1068 return "seat_con_2_1";
1069 }
1070
1071 return "";
1072 }
1073
1074 override int GetCrewIndex(string selection)
1075 {
1076 switch (selection)
1077 {
1078 case "seatback_driver":
1079 return 0;
1080 case "seatback_codriver":
1081 return 1;
1082 }
1083
1084 return -1;
1085 }
1086
1087 override bool IsVitalTruckBattery()
1088 {
1089 return false;
1090 }
1091
1092 override bool IsVitalGlowPlug()
1093 {
1094 return false;
1095 }
1096
1097 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
1098 {
1099 if (nextSeat == 0 && GetAnimationPhase("SeatDriver") > 0.5)
1100 return false;
1101
1102 if (nextSeat == 1 && GetAnimationPhase("SeatCoDriver") > 0.5)
1103 return false;
1104
1105 switch (currentSeat)
1106 {
1107 case 0:
1108 return nextSeat == 1;
1109
1110 case 1:
1111 return nextSeat == 0;
1112
1113 case 2:
1114 return nextSeat == 3;
1115
1116 case 3:
1117 return nextSeat == 2;
1118 }
1119
1120 return false;
1121 }
1122
1123 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
1124 {
1125 switch (pCurrentSeat)
1126 {
1127 case 0:
1128 return pDoorsSelection == "DoorsDriver";
1129
1130 case 1:
1131 return pDoorsSelection == "DoorsCoDriver";
1132
1133 case 2:
1134 return pDoorsSelection == "DoorsDriver";
1135
1136 case 3:
1137 return pDoorsSelection == "DoorsCoDriver";
1138 }
1139
1140 return false;
1141 }
1142
1143 override int GetSeatIndexFromDoor(string pDoorSelection)
1144 {
1145 switch (pDoorSelection)
1146 {
1147 case "DoorsDriver":
1148 return 0;
1149 case "DoorsCoDriver":
1150 return 1;
1151 }
1152
1153 return -1;
1154 }
1155
1156 override void SetActions()
1157 {
1158 super.SetActions();
1159
1161 }
1162
1163 override void OnDebugSpawn()
1164 {
1168
1169 GetInventory().CreateInInventory("HatchbackWheel");
1170 GetInventory().CreateInInventory("HatchbackWheel");
1171 GetInventory().CreateInInventory("HatchbackWheel");
1172 GetInventory().CreateInInventory("HatchbackWheel");
1173
1174 GetInventory().CreateInInventory("HatchbackDoors_Driver");
1175 GetInventory().CreateInInventory("HatchbackDoors_CoDriver");
1176 GetInventory().CreateInInventory("HatchbackHood");
1177 GetInventory().CreateInInventory("HatchbackTrunk");
1178
1179 //-----IN CAR CARGO
1180 GetInventory().CreateInInventory("HatchbackWheel");
1181 GetInventory().CreateInInventory("HatchbackWheel");
1182 }
1183}
1184
1186{
1187 override void OnDebugSpawn()
1188 {
1192
1193 GetInventory().CreateInInventory("HatchbackWheel");
1194 GetInventory().CreateInInventory("HatchbackWheel");
1195 GetInventory().CreateInInventory("HatchbackWheel");
1196 GetInventory().CreateInInventory("HatchbackWheel");
1197
1198 GetInventory().CreateInInventory("HatchbackDoors_Driver_White");
1199 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_White");
1200 GetInventory().CreateInInventory("HatchbackHood_White");
1201 GetInventory().CreateInInventory("HatchbackTrunk_White");
1202
1203 //-----IN CAR CARGO
1204 GetInventory().CreateInInventory("HatchbackWheel");
1205 GetInventory().CreateInInventory("HatchbackWheel");
1206 }
1207}
1208
1210{
1211 override void OnDebugSpawn()
1212 {
1216
1217 GetInventory().CreateInInventory("HatchbackWheel");
1218 GetInventory().CreateInInventory("HatchbackWheel");
1219 GetInventory().CreateInInventory("HatchbackWheel");
1220 GetInventory().CreateInInventory("HatchbackWheel");
1221
1222 GetInventory().CreateInInventory("HatchbackDoors_Driver_Blue");
1223 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_Blue");
1224 GetInventory().CreateInInventory("HatchbackHood_Blue");
1225 GetInventory().CreateInInventory("HatchbackTrunk_Blue");
1226
1227 //-----IN CAR CARGO
1228 GetInventory().CreateInInventory("HatchbackWheel");
1229 GetInventory().CreateInInventory("HatchbackWheel");
1230 }
1231}

◆ GetDoorInvSlotNameFromSeatPos()

override string OnDebugSpawn::GetDoorInvSlotNameFromSeatPos ( int posIdx)
protected

Definition at line 677 of file OffroadHatchback.c.

678{
682
683 void OffroadHatchback()
684 {
685 //m_dmgContactCoef = 0.075;
686
687 m_EngineStartOK = "offroad_engine_start_SoundSet";
688 m_EngineStartBattery = "offroad_engine_failed_start_battery_SoundSet";
689 m_EngineStartPlug = "offroad_engine_failed_start_sparkplugs_SoundSet";
690 m_EngineStartFuel = "offroad_engine_failed_start_fuel_SoundSet";
691 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
692
693 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
694 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
695 m_CarSeatShiftInSound = "Offroad_SeatShiftIn_SoundSet";
696 m_CarSeatShiftOutSound = "Offroad_SeatShiftOut_SoundSet";
697
698 m_CarHornShortSoundName = "Offroad_Horn_Short_SoundSet";
699 m_CarHornLongSoundName = "Offroad_Horn_SoundSet";
700
701 SetEnginePos("0 0.7 1.2");
702 }
703
704 override void EEInit()
705 {
706 super.EEInit();
707
708 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
709 {
711 m_UTSSettings.m_ManualUpdate = true;
712 m_UTSSettings.m_TemperatureMin = 0;
713 m_UTSSettings.m_TemperatureMax = 30;
714 m_UTSSettings.m_RangeFull = 0.5;
715 m_UTSSettings.m_RangeMax = 2;
716 m_UTSSettings.m_TemperatureCap = 25;
717
720 }
721 }
722
723 override void OnEngineStart()
724 {
725 super.OnEngineStart();
726
727 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
728 m_UTSource.SetDefferedActive(true, 20.0);
729 }
730
731 override void OnEngineStop()
732 {
733 super.OnEngineStop();
734
735 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
736 m_UTSource.SetDefferedActive(false, 10.0);
737 }
738
739 override void EOnPostSimulate(IEntity other, float timeSlice)
740 {
741 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
742 {
743 if (m_UTSource.IsActive())
745 }
746 }
747
748 override int GetAnimInstance()
749 {
750 return VehicleAnimInstances.HATCHBACK;
751 }
752
753 override float GetTransportCameraDistance()
754 {
755 return 3.5;
756 }
757
758 override int GetSeatAnimationType(int posIdx)
759 {
760 switch (posIdx)
761 {
762 case 0:
763 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
764 case 1:
765 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
766 case 2:
767 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
768 case 3:
769 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
770 }
771
772 return 0;
773
774 }
775
776
778 {
779 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackRearLight));
780 }
781
783 {
784 return CarLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackFrontLight));
785 }
786
788 {
789 if (!super.CanReleaseAttachment(attachment))
790 return false;
791
792 if (EngineIsOn() || GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
793 {
794 string attType = attachment.GetType();
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("NivaHood") != CarDoorState.DOORS_CLOSED;
805 }
806
807 override bool CanDisplayAttachmentCategory(string category_name)
808 {
809 if (!super.CanDisplayAttachmentCategory(category_name))
810 return false;
811
812 category_name.ToLower();
813 if (category_name.Contains("engine"))
814 {
815 if (GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
816 return false;
817 }
818
819 return true;
820 }
821
822 override bool CanDisplayCargo()
823 {
824 if (!super.CanDisplayCargo())
825 return false;
826
827 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
828 return false;
829
830 return true;
831 }
832
833 override int GetCarDoorsState(string slotType)
834 {
836
837 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
838 if (!carDoor)
839 return CarDoorState.DOORS_MISSING;
840
841 switch (slotType)
842 {
843 case "NivaDriverDoors":
844 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
845
846 case "NivaCoDriverDoors":
847 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
848
849 case "NivaHood":
850 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
851
852 case "NivaTrunk":
853 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
854 }
855
856 return CarDoorState.DOORS_MISSING;
857 }
858
859 override bool CrewCanGetThrough(int posIdx)
860 {
862 switch (posIdx)
863 {
864 case 0:
865 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
866 return false;
867 else if (GetAnimationPhase("SeatDriver") > 0.5)
868 return false;
869
870 return true;
871
872 case 1:
873 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
874 return false;
875 else if (GetAnimationPhase("SeatCoDriver") > 0.5)
876 return false;
877
878 return true;
879
880 case 2:
881 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
882 return false;
883 else if (GetAnimationPhase("SeatDriver") <= 0.5)
884 return false;
885
886 return true;
887
888 case 3:
889 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
890 return false;
891 else if (GetAnimationPhase("SeatCoDriver") <= 0.5)
892 return false;
893
894 return true;
895 }
896
897 return false;
898 }
899
900 override string GetDoorSelectionNameFromSeatPos(int posIdx)
901 {
902 switch (posIdx)
903 {
904 case 0:
905 case 2:
906 return "doors_driver";
907 case 1:
908 case 3:
909 return "doors_codriver";
910 }
911
912 return super.GetDoorSelectionNameFromSeatPos(posIdx);
913 }
914
915 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
916 {
917 switch (posIdx)
918 {
919 case 0:
920 case 2:
921 return "NivaDriverDoors";
922 case 1:
923 case 3:
924 return "NivaCoDriverDoors";
925 }
926
927 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
928 }
929
930 // 0 full ambient and engine sound
931 // 1 zero ambient and engine sound
932 override float OnSound(CarSoundCtrl ctrl, float oldValue)
933 {
934 float tempCap = 0.0;
935
936 switch (ctrl)
937 {
938 case CarSoundCtrl.DOORS:
939 float newValue = 0;
940 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
941 newValue += 0.5;
942
943 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
944 newValue += 0.5;
945
946 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
947 newValue += 0.3;
948
949 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
950 newValue -= 0.6;
951
952 if (GetHealthLevel("WindowLR") == GameConstants.STATE_RUINED)
953 newValue -= 0.2;
954
955 if (GetHealthLevel("WindowRR") == GameConstants.STATE_RUINED)
956 newValue -= 0.2;
957
958 return Math.Clamp(newValue, 0, 1);
959 break;
960 }
961
962 return super.OnSound(ctrl, oldValue);
963 }
964
965 override string GetAnimSourceFromSelection(string selection)
966 {
967 switch (selection)
968 {
969 case "doors_driver":
970 return "DoorsDriver";
971 case "doors_codriver":
972 return "DoorsCoDriver";
973 case "doors_hood":
974 return "DoorsHood";
975 case "doors_trunk":
976 return "DoorsTrunk";
977 case "seatback_driver":
978 return "SeatDriver";
979 case "seatback_codriver":
980 return "SeatCoDriver";
981 }
982
983 return "";
984 }
985
986 override string GetDoorConditionPointFromSelection(string selection)
987 {
988 switch (selection)
989 {
990 case "seat_driver":
991 case "seatback_driver":
992 case "seat_cargo1":
993 return "seat_con_1_1";
994 case "seat_codriver":
995 case "seatback_codriver":
996 case "seat_cargo2":
997 return "seat_con_2_1";
998 }
999
1000 return "";
1001 }
1002
1003 override int GetCrewIndex(string selection)
1004 {
1005 switch (selection)
1006 {
1007 case "seatback_driver":
1008 return 0;
1009 case "seatback_codriver":
1010 return 1;
1011 }
1012
1013 return -1;
1014 }
1015
1016 override bool IsVitalTruckBattery()
1017 {
1018 return false;
1019 }
1020
1021 override bool IsVitalGlowPlug()
1022 {
1023 return false;
1024 }
1025
1026 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
1027 {
1028 if (nextSeat == 0 && GetAnimationPhase("SeatDriver") > 0.5)
1029 return false;
1030
1031 if (nextSeat == 1 && GetAnimationPhase("SeatCoDriver") > 0.5)
1032 return false;
1033
1034 switch (currentSeat)
1035 {
1036 case 0:
1037 return nextSeat == 1;
1038
1039 case 1:
1040 return nextSeat == 0;
1041
1042 case 2:
1043 return nextSeat == 3;
1044
1045 case 3:
1046 return nextSeat == 2;
1047 }
1048
1049 return false;
1050 }
1051
1052 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
1053 {
1054 switch (pCurrentSeat)
1055 {
1056 case 0:
1057 return pDoorsSelection == "DoorsDriver";
1058
1059 case 1:
1060 return pDoorsSelection == "DoorsCoDriver";
1061
1062 case 2:
1063 return pDoorsSelection == "DoorsDriver";
1064
1065 case 3:
1066 return pDoorsSelection == "DoorsCoDriver";
1067 }
1068
1069 return false;
1070 }
1071
1072 override int GetSeatIndexFromDoor(string pDoorSelection)
1073 {
1074 switch (pDoorSelection)
1075 {
1076 case "DoorsDriver":
1077 return 0;
1078 case "DoorsCoDriver":
1079 return 1;
1080 }
1081
1082 return -1;
1083 }
1084
1085 override void SetActions()
1086 {
1087 super.SetActions();
1088
1090 }
1091
1092 override void OnDebugSpawn()
1093 {
1097
1098 GetInventory().CreateInInventory("HatchbackWheel");
1099 GetInventory().CreateInInventory("HatchbackWheel");
1100 GetInventory().CreateInInventory("HatchbackWheel");
1101 GetInventory().CreateInInventory("HatchbackWheel");
1102
1103 GetInventory().CreateInInventory("HatchbackDoors_Driver");
1104 GetInventory().CreateInInventory("HatchbackDoors_CoDriver");
1105 GetInventory().CreateInInventory("HatchbackHood");
1106 GetInventory().CreateInInventory("HatchbackTrunk");
1107
1108 //-----IN CAR CARGO
1109 GetInventory().CreateInInventory("HatchbackWheel");
1110 GetInventory().CreateInInventory("HatchbackWheel");
1111 }
1112}
1113
1115{
1116 override void OnDebugSpawn()
1117 {
1121
1122 GetInventory().CreateInInventory("HatchbackWheel");
1123 GetInventory().CreateInInventory("HatchbackWheel");
1124 GetInventory().CreateInInventory("HatchbackWheel");
1125 GetInventory().CreateInInventory("HatchbackWheel");
1126
1127 GetInventory().CreateInInventory("HatchbackDoors_Driver_White");
1128 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_White");
1129 GetInventory().CreateInInventory("HatchbackHood_White");
1130 GetInventory().CreateInInventory("HatchbackTrunk_White");
1131
1132 //-----IN CAR CARGO
1133 GetInventory().CreateInInventory("HatchbackWheel");
1134 GetInventory().CreateInInventory("HatchbackWheel");
1135 }
1136}
1137
1139{
1140 override void OnDebugSpawn()
1141 {
1145
1146 GetInventory().CreateInInventory("HatchbackWheel");
1147 GetInventory().CreateInInventory("HatchbackWheel");
1148 GetInventory().CreateInInventory("HatchbackWheel");
1149 GetInventory().CreateInInventory("HatchbackWheel");
1150
1151 GetInventory().CreateInInventory("HatchbackDoors_Driver_Blue");
1152 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_Blue");
1153 GetInventory().CreateInInventory("HatchbackHood_Blue");
1154 GetInventory().CreateInInventory("HatchbackTrunk_Blue");
1155
1156 //-----IN CAR CARGO
1157 GetInventory().CreateInInventory("HatchbackWheel");
1158 GetInventory().CreateInInventory("HatchbackWheel");
1159 }
1160}

◆ GetDoorSelectionNameFromSeatPos()

override string OnDebugSpawn::GetDoorSelectionNameFromSeatPos ( int posIdx)
protected

Definition at line 662 of file OffroadHatchback.c.

663{
667
668 void OffroadHatchback()
669 {
670 //m_dmgContactCoef = 0.075;
671
672 m_EngineStartOK = "offroad_engine_start_SoundSet";
673 m_EngineStartBattery = "offroad_engine_failed_start_battery_SoundSet";
674 m_EngineStartPlug = "offroad_engine_failed_start_sparkplugs_SoundSet";
675 m_EngineStartFuel = "offroad_engine_failed_start_fuel_SoundSet";
676 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
677
678 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
679 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
680 m_CarSeatShiftInSound = "Offroad_SeatShiftIn_SoundSet";
681 m_CarSeatShiftOutSound = "Offroad_SeatShiftOut_SoundSet";
682
683 m_CarHornShortSoundName = "Offroad_Horn_Short_SoundSet";
684 m_CarHornLongSoundName = "Offroad_Horn_SoundSet";
685
686 SetEnginePos("0 0.7 1.2");
687 }
688
689 override void EEInit()
690 {
691 super.EEInit();
692
693 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
694 {
696 m_UTSSettings.m_ManualUpdate = true;
697 m_UTSSettings.m_TemperatureMin = 0;
698 m_UTSSettings.m_TemperatureMax = 30;
699 m_UTSSettings.m_RangeFull = 0.5;
700 m_UTSSettings.m_RangeMax = 2;
701 m_UTSSettings.m_TemperatureCap = 25;
702
705 }
706 }
707
708 override void OnEngineStart()
709 {
710 super.OnEngineStart();
711
712 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
713 m_UTSource.SetDefferedActive(true, 20.0);
714 }
715
716 override void OnEngineStop()
717 {
718 super.OnEngineStop();
719
720 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
721 m_UTSource.SetDefferedActive(false, 10.0);
722 }
723
724 override void EOnPostSimulate(IEntity other, float timeSlice)
725 {
726 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
727 {
728 if (m_UTSource.IsActive())
730 }
731 }
732
733 override int GetAnimInstance()
734 {
735 return VehicleAnimInstances.HATCHBACK;
736 }
737
738 override float GetTransportCameraDistance()
739 {
740 return 3.5;
741 }
742
743 override int GetSeatAnimationType(int posIdx)
744 {
745 switch (posIdx)
746 {
747 case 0:
748 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
749 case 1:
750 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
751 case 2:
752 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
753 case 3:
754 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
755 }
756
757 return 0;
758
759 }
760
761
763 {
764 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackRearLight));
765 }
766
768 {
769 return CarLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackFrontLight));
770 }
771
773 {
774 if (!super.CanReleaseAttachment(attachment))
775 return false;
776
777 if (EngineIsOn() || GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
778 {
779 string attType = attachment.GetType();
780 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
781 return false;
782 }
783
784 return true;
785 }
786
787 override protected bool CanManipulateSpareWheel(string slotSelectionName)
788 {
789 return GetCarDoorsState("NivaHood") != CarDoorState.DOORS_CLOSED;
790 }
791
792 override bool CanDisplayAttachmentCategory(string category_name)
793 {
794 if (!super.CanDisplayAttachmentCategory(category_name))
795 return false;
796
797 category_name.ToLower();
798 if (category_name.Contains("engine"))
799 {
800 if (GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
801 return false;
802 }
803
804 return true;
805 }
806
807 override bool CanDisplayCargo()
808 {
809 if (!super.CanDisplayCargo())
810 return false;
811
812 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
813 return false;
814
815 return true;
816 }
817
818 override int GetCarDoorsState(string slotType)
819 {
821
822 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
823 if (!carDoor)
824 return CarDoorState.DOORS_MISSING;
825
826 switch (slotType)
827 {
828 case "NivaDriverDoors":
829 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
830
831 case "NivaCoDriverDoors":
832 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
833
834 case "NivaHood":
835 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
836
837 case "NivaTrunk":
838 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
839 }
840
841 return CarDoorState.DOORS_MISSING;
842 }
843
844 override bool CrewCanGetThrough(int posIdx)
845 {
847 switch (posIdx)
848 {
849 case 0:
850 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
851 return false;
852 else if (GetAnimationPhase("SeatDriver") > 0.5)
853 return false;
854
855 return true;
856
857 case 1:
858 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
859 return false;
860 else if (GetAnimationPhase("SeatCoDriver") > 0.5)
861 return false;
862
863 return true;
864
865 case 2:
866 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
867 return false;
868 else if (GetAnimationPhase("SeatDriver") <= 0.5)
869 return false;
870
871 return true;
872
873 case 3:
874 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
875 return false;
876 else if (GetAnimationPhase("SeatCoDriver") <= 0.5)
877 return false;
878
879 return true;
880 }
881
882 return false;
883 }
884
885 override string GetDoorSelectionNameFromSeatPos(int posIdx)
886 {
887 switch (posIdx)
888 {
889 case 0:
890 case 2:
891 return "doors_driver";
892 case 1:
893 case 3:
894 return "doors_codriver";
895 }
896
897 return super.GetDoorSelectionNameFromSeatPos(posIdx);
898 }
899
900 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
901 {
902 switch (posIdx)
903 {
904 case 0:
905 case 2:
906 return "NivaDriverDoors";
907 case 1:
908 case 3:
909 return "NivaCoDriverDoors";
910 }
911
912 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
913 }
914
915 // 0 full ambient and engine sound
916 // 1 zero ambient and engine sound
917 override float OnSound(CarSoundCtrl ctrl, float oldValue)
918 {
919 float tempCap = 0.0;
920
921 switch (ctrl)
922 {
923 case CarSoundCtrl.DOORS:
924 float newValue = 0;
925 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
926 newValue += 0.5;
927
928 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
929 newValue += 0.5;
930
931 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
932 newValue += 0.3;
933
934 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
935 newValue -= 0.6;
936
937 if (GetHealthLevel("WindowLR") == GameConstants.STATE_RUINED)
938 newValue -= 0.2;
939
940 if (GetHealthLevel("WindowRR") == GameConstants.STATE_RUINED)
941 newValue -= 0.2;
942
943 return Math.Clamp(newValue, 0, 1);
944 break;
945 }
946
947 return super.OnSound(ctrl, oldValue);
948 }
949
950 override string GetAnimSourceFromSelection(string selection)
951 {
952 switch (selection)
953 {
954 case "doors_driver":
955 return "DoorsDriver";
956 case "doors_codriver":
957 return "DoorsCoDriver";
958 case "doors_hood":
959 return "DoorsHood";
960 case "doors_trunk":
961 return "DoorsTrunk";
962 case "seatback_driver":
963 return "SeatDriver";
964 case "seatback_codriver":
965 return "SeatCoDriver";
966 }
967
968 return "";
969 }
970
971 override string GetDoorConditionPointFromSelection(string selection)
972 {
973 switch (selection)
974 {
975 case "seat_driver":
976 case "seatback_driver":
977 case "seat_cargo1":
978 return "seat_con_1_1";
979 case "seat_codriver":
980 case "seatback_codriver":
981 case "seat_cargo2":
982 return "seat_con_2_1";
983 }
984
985 return "";
986 }
987
988 override int GetCrewIndex(string selection)
989 {
990 switch (selection)
991 {
992 case "seatback_driver":
993 return 0;
994 case "seatback_codriver":
995 return 1;
996 }
997
998 return -1;
999 }
1000
1001 override bool IsVitalTruckBattery()
1002 {
1003 return false;
1004 }
1005
1006 override bool IsVitalGlowPlug()
1007 {
1008 return false;
1009 }
1010
1011 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
1012 {
1013 if (nextSeat == 0 && GetAnimationPhase("SeatDriver") > 0.5)
1014 return false;
1015
1016 if (nextSeat == 1 && GetAnimationPhase("SeatCoDriver") > 0.5)
1017 return false;
1018
1019 switch (currentSeat)
1020 {
1021 case 0:
1022 return nextSeat == 1;
1023
1024 case 1:
1025 return nextSeat == 0;
1026
1027 case 2:
1028 return nextSeat == 3;
1029
1030 case 3:
1031 return nextSeat == 2;
1032 }
1033
1034 return false;
1035 }
1036
1037 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
1038 {
1039 switch (pCurrentSeat)
1040 {
1041 case 0:
1042 return pDoorsSelection == "DoorsDriver";
1043
1044 case 1:
1045 return pDoorsSelection == "DoorsCoDriver";
1046
1047 case 2:
1048 return pDoorsSelection == "DoorsDriver";
1049
1050 case 3:
1051 return pDoorsSelection == "DoorsCoDriver";
1052 }
1053
1054 return false;
1055 }
1056
1057 override int GetSeatIndexFromDoor(string pDoorSelection)
1058 {
1059 switch (pDoorSelection)
1060 {
1061 case "DoorsDriver":
1062 return 0;
1063 case "DoorsCoDriver":
1064 return 1;
1065 }
1066
1067 return -1;
1068 }
1069
1070 override void SetActions()
1071 {
1072 super.SetActions();
1073
1075 }
1076
1077 override void OnDebugSpawn()
1078 {
1082
1083 GetInventory().CreateInInventory("HatchbackWheel");
1084 GetInventory().CreateInInventory("HatchbackWheel");
1085 GetInventory().CreateInInventory("HatchbackWheel");
1086 GetInventory().CreateInInventory("HatchbackWheel");
1087
1088 GetInventory().CreateInInventory("HatchbackDoors_Driver");
1089 GetInventory().CreateInInventory("HatchbackDoors_CoDriver");
1090 GetInventory().CreateInInventory("HatchbackHood");
1091 GetInventory().CreateInInventory("HatchbackTrunk");
1092
1093 //-----IN CAR CARGO
1094 GetInventory().CreateInInventory("HatchbackWheel");
1095 GetInventory().CreateInInventory("HatchbackWheel");
1096 }
1097}
1098
1100{
1101 override void OnDebugSpawn()
1102 {
1106
1107 GetInventory().CreateInInventory("HatchbackWheel");
1108 GetInventory().CreateInInventory("HatchbackWheel");
1109 GetInventory().CreateInInventory("HatchbackWheel");
1110 GetInventory().CreateInInventory("HatchbackWheel");
1111
1112 GetInventory().CreateInInventory("HatchbackDoors_Driver_White");
1113 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_White");
1114 GetInventory().CreateInInventory("HatchbackHood_White");
1115 GetInventory().CreateInInventory("HatchbackTrunk_White");
1116
1117 //-----IN CAR CARGO
1118 GetInventory().CreateInInventory("HatchbackWheel");
1119 GetInventory().CreateInInventory("HatchbackWheel");
1120 }
1121}
1122
1124{
1125 override void OnDebugSpawn()
1126 {
1130
1131 GetInventory().CreateInInventory("HatchbackWheel");
1132 GetInventory().CreateInInventory("HatchbackWheel");
1133 GetInventory().CreateInInventory("HatchbackWheel");
1134 GetInventory().CreateInInventory("HatchbackWheel");
1135
1136 GetInventory().CreateInInventory("HatchbackDoors_Driver_Blue");
1137 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_Blue");
1138 GetInventory().CreateInInventory("HatchbackHood_Blue");
1139 GetInventory().CreateInInventory("HatchbackTrunk_Blue");
1140
1141 //-----IN CAR CARGO
1142 GetInventory().CreateInInventory("HatchbackWheel");
1143 GetInventory().CreateInInventory("HatchbackWheel");
1144 }
1145}

◆ GetSeatAnimationType()

override int OnDebugSpawn::GetSeatAnimationType ( int posIdx)
protected

Definition at line 520 of file OffroadHatchback.c.

521{
525
526 void OffroadHatchback()
527 {
528 //m_dmgContactCoef = 0.075;
529
530 m_EngineStartOK = "offroad_engine_start_SoundSet";
531 m_EngineStartBattery = "offroad_engine_failed_start_battery_SoundSet";
532 m_EngineStartPlug = "offroad_engine_failed_start_sparkplugs_SoundSet";
533 m_EngineStartFuel = "offroad_engine_failed_start_fuel_SoundSet";
534 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
535
536 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
537 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
538 m_CarSeatShiftInSound = "Offroad_SeatShiftIn_SoundSet";
539 m_CarSeatShiftOutSound = "Offroad_SeatShiftOut_SoundSet";
540
541 m_CarHornShortSoundName = "Offroad_Horn_Short_SoundSet";
542 m_CarHornLongSoundName = "Offroad_Horn_SoundSet";
543
544 SetEnginePos("0 0.7 1.2");
545 }
546
547 override void EEInit()
548 {
549 super.EEInit();
550
551 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
552 {
554 m_UTSSettings.m_ManualUpdate = true;
555 m_UTSSettings.m_TemperatureMin = 0;
556 m_UTSSettings.m_TemperatureMax = 30;
557 m_UTSSettings.m_RangeFull = 0.5;
558 m_UTSSettings.m_RangeMax = 2;
559 m_UTSSettings.m_TemperatureCap = 25;
560
563 }
564 }
565
566 override void OnEngineStart()
567 {
568 super.OnEngineStart();
569
570 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
571 m_UTSource.SetDefferedActive(true, 20.0);
572 }
573
574 override void OnEngineStop()
575 {
576 super.OnEngineStop();
577
578 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
579 m_UTSource.SetDefferedActive(false, 10.0);
580 }
581
582 override void EOnPostSimulate(IEntity other, float timeSlice)
583 {
584 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
585 {
586 if (m_UTSource.IsActive())
588 }
589 }
590
591 override int GetAnimInstance()
592 {
593 return VehicleAnimInstances.HATCHBACK;
594 }
595
596 override float GetTransportCameraDistance()
597 {
598 return 3.5;
599 }
600
601 override int GetSeatAnimationType(int posIdx)
602 {
603 switch (posIdx)
604 {
605 case 0:
606 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
607 case 1:
608 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
609 case 2:
610 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
611 case 3:
612 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
613 }
614
615 return 0;
616
617 }
618
619
621 {
622 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackRearLight));
623 }
624
626 {
627 return CarLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackFrontLight));
628 }
629
631 {
632 if (!super.CanReleaseAttachment(attachment))
633 return false;
634
635 if (EngineIsOn() || GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
636 {
637 string attType = attachment.GetType();
638 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
639 return false;
640 }
641
642 return true;
643 }
644
645 override protected bool CanManipulateSpareWheel(string slotSelectionName)
646 {
647 return GetCarDoorsState("NivaHood") != CarDoorState.DOORS_CLOSED;
648 }
649
650 override bool CanDisplayAttachmentCategory(string category_name)
651 {
652 if (!super.CanDisplayAttachmentCategory(category_name))
653 return false;
654
655 category_name.ToLower();
656 if (category_name.Contains("engine"))
657 {
658 if (GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
659 return false;
660 }
661
662 return true;
663 }
664
665 override bool CanDisplayCargo()
666 {
667 if (!super.CanDisplayCargo())
668 return false;
669
670 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
671 return false;
672
673 return true;
674 }
675
676 override int GetCarDoorsState(string slotType)
677 {
679
680 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
681 if (!carDoor)
682 return CarDoorState.DOORS_MISSING;
683
684 switch (slotType)
685 {
686 case "NivaDriverDoors":
687 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
688
689 case "NivaCoDriverDoors":
690 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
691
692 case "NivaHood":
693 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
694
695 case "NivaTrunk":
696 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
697 }
698
699 return CarDoorState.DOORS_MISSING;
700 }
701
702 override bool CrewCanGetThrough(int posIdx)
703 {
705 switch (posIdx)
706 {
707 case 0:
708 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
709 return false;
710 else if (GetAnimationPhase("SeatDriver") > 0.5)
711 return false;
712
713 return true;
714
715 case 1:
716 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
717 return false;
718 else if (GetAnimationPhase("SeatCoDriver") > 0.5)
719 return false;
720
721 return true;
722
723 case 2:
724 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
725 return false;
726 else if (GetAnimationPhase("SeatDriver") <= 0.5)
727 return false;
728
729 return true;
730
731 case 3:
732 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
733 return false;
734 else if (GetAnimationPhase("SeatCoDriver") <= 0.5)
735 return false;
736
737 return true;
738 }
739
740 return false;
741 }
742
743 override string GetDoorSelectionNameFromSeatPos(int posIdx)
744 {
745 switch (posIdx)
746 {
747 case 0:
748 case 2:
749 return "doors_driver";
750 case 1:
751 case 3:
752 return "doors_codriver";
753 }
754
755 return super.GetDoorSelectionNameFromSeatPos(posIdx);
756 }
757
758 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
759 {
760 switch (posIdx)
761 {
762 case 0:
763 case 2:
764 return "NivaDriverDoors";
765 case 1:
766 case 3:
767 return "NivaCoDriverDoors";
768 }
769
770 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
771 }
772
773 // 0 full ambient and engine sound
774 // 1 zero ambient and engine sound
775 override float OnSound(CarSoundCtrl ctrl, float oldValue)
776 {
777 float tempCap = 0.0;
778
779 switch (ctrl)
780 {
781 case CarSoundCtrl.DOORS:
782 float newValue = 0;
783 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
784 newValue += 0.5;
785
786 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
787 newValue += 0.5;
788
789 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
790 newValue += 0.3;
791
792 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
793 newValue -= 0.6;
794
795 if (GetHealthLevel("WindowLR") == GameConstants.STATE_RUINED)
796 newValue -= 0.2;
797
798 if (GetHealthLevel("WindowRR") == GameConstants.STATE_RUINED)
799 newValue -= 0.2;
800
801 return Math.Clamp(newValue, 0, 1);
802 break;
803 }
804
805 return super.OnSound(ctrl, oldValue);
806 }
807
808 override string GetAnimSourceFromSelection(string selection)
809 {
810 switch (selection)
811 {
812 case "doors_driver":
813 return "DoorsDriver";
814 case "doors_codriver":
815 return "DoorsCoDriver";
816 case "doors_hood":
817 return "DoorsHood";
818 case "doors_trunk":
819 return "DoorsTrunk";
820 case "seatback_driver":
821 return "SeatDriver";
822 case "seatback_codriver":
823 return "SeatCoDriver";
824 }
825
826 return "";
827 }
828
829 override string GetDoorConditionPointFromSelection(string selection)
830 {
831 switch (selection)
832 {
833 case "seat_driver":
834 case "seatback_driver":
835 case "seat_cargo1":
836 return "seat_con_1_1";
837 case "seat_codriver":
838 case "seatback_codriver":
839 case "seat_cargo2":
840 return "seat_con_2_1";
841 }
842
843 return "";
844 }
845
846 override int GetCrewIndex(string selection)
847 {
848 switch (selection)
849 {
850 case "seatback_driver":
851 return 0;
852 case "seatback_codriver":
853 return 1;
854 }
855
856 return -1;
857 }
858
859 override bool IsVitalTruckBattery()
860 {
861 return false;
862 }
863
864 override bool IsVitalGlowPlug()
865 {
866 return false;
867 }
868
869 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
870 {
871 if (nextSeat == 0 && GetAnimationPhase("SeatDriver") > 0.5)
872 return false;
873
874 if (nextSeat == 1 && GetAnimationPhase("SeatCoDriver") > 0.5)
875 return false;
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 == "DoorsDriver";
907
908 case 3:
909 return pDoorsSelection == "DoorsCoDriver";
910 }
911
912 return false;
913 }
914
915 override int GetSeatIndexFromDoor(string pDoorSelection)
916 {
917 switch (pDoorSelection)
918 {
919 case "DoorsDriver":
920 return 0;
921 case "DoorsCoDriver":
922 return 1;
923 }
924
925 return -1;
926 }
927
928 override void SetActions()
929 {
930 super.SetActions();
931
933 }
934
935 override void OnDebugSpawn()
936 {
940
941 GetInventory().CreateInInventory("HatchbackWheel");
942 GetInventory().CreateInInventory("HatchbackWheel");
943 GetInventory().CreateInInventory("HatchbackWheel");
944 GetInventory().CreateInInventory("HatchbackWheel");
945
946 GetInventory().CreateInInventory("HatchbackDoors_Driver");
947 GetInventory().CreateInInventory("HatchbackDoors_CoDriver");
948 GetInventory().CreateInInventory("HatchbackHood");
949 GetInventory().CreateInInventory("HatchbackTrunk");
950
951 //-----IN CAR CARGO
952 GetInventory().CreateInInventory("HatchbackWheel");
953 GetInventory().CreateInInventory("HatchbackWheel");
954 }
955}
956
958{
959 override void OnDebugSpawn()
960 {
964
965 GetInventory().CreateInInventory("HatchbackWheel");
966 GetInventory().CreateInInventory("HatchbackWheel");
967 GetInventory().CreateInInventory("HatchbackWheel");
968 GetInventory().CreateInInventory("HatchbackWheel");
969
970 GetInventory().CreateInInventory("HatchbackDoors_Driver_White");
971 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_White");
972 GetInventory().CreateInInventory("HatchbackHood_White");
973 GetInventory().CreateInInventory("HatchbackTrunk_White");
974
975 //-----IN CAR CARGO
976 GetInventory().CreateInInventory("HatchbackWheel");
977 GetInventory().CreateInInventory("HatchbackWheel");
978 }
979}
980
982{
983 override void OnDebugSpawn()
984 {
988
989 GetInventory().CreateInInventory("HatchbackWheel");
990 GetInventory().CreateInInventory("HatchbackWheel");
991 GetInventory().CreateInInventory("HatchbackWheel");
992 GetInventory().CreateInInventory("HatchbackWheel");
993
994 GetInventory().CreateInInventory("HatchbackDoors_Driver_Blue");
995 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_Blue");
996 GetInventory().CreateInInventory("HatchbackHood_Blue");
997 GetInventory().CreateInInventory("HatchbackTrunk_Blue");
998
999 //-----IN CAR CARGO
1000 GetInventory().CreateInInventory("HatchbackWheel");
1001 GetInventory().CreateInInventory("HatchbackWheel");
1002 }
1003}

◆ GetSeatIndexFromDoor()

override int OnDebugSpawn::GetSeatIndexFromDoor ( string pDoorSelection)
protected

Definition at line 834 of file OffroadHatchback.c.

835{
839
840 void OffroadHatchback()
841 {
842 //m_dmgContactCoef = 0.075;
843
844 m_EngineStartOK = "offroad_engine_start_SoundSet";
845 m_EngineStartBattery = "offroad_engine_failed_start_battery_SoundSet";
846 m_EngineStartPlug = "offroad_engine_failed_start_sparkplugs_SoundSet";
847 m_EngineStartFuel = "offroad_engine_failed_start_fuel_SoundSet";
848 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
849
850 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
851 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
852 m_CarSeatShiftInSound = "Offroad_SeatShiftIn_SoundSet";
853 m_CarSeatShiftOutSound = "Offroad_SeatShiftOut_SoundSet";
854
855 m_CarHornShortSoundName = "Offroad_Horn_Short_SoundSet";
856 m_CarHornLongSoundName = "Offroad_Horn_SoundSet";
857
858 SetEnginePos("0 0.7 1.2");
859 }
860
861 override void EEInit()
862 {
863 super.EEInit();
864
865 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
866 {
868 m_UTSSettings.m_ManualUpdate = true;
869 m_UTSSettings.m_TemperatureMin = 0;
870 m_UTSSettings.m_TemperatureMax = 30;
871 m_UTSSettings.m_RangeFull = 0.5;
872 m_UTSSettings.m_RangeMax = 2;
873 m_UTSSettings.m_TemperatureCap = 25;
874
877 }
878 }
879
880 override void OnEngineStart()
881 {
882 super.OnEngineStart();
883
884 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
885 m_UTSource.SetDefferedActive(true, 20.0);
886 }
887
888 override void OnEngineStop()
889 {
890 super.OnEngineStop();
891
892 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
893 m_UTSource.SetDefferedActive(false, 10.0);
894 }
895
896 override void EOnPostSimulate(IEntity other, float timeSlice)
897 {
898 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
899 {
900 if (m_UTSource.IsActive())
902 }
903 }
904
905 override int GetAnimInstance()
906 {
907 return VehicleAnimInstances.HATCHBACK;
908 }
909
910 override float GetTransportCameraDistance()
911 {
912 return 3.5;
913 }
914
915 override int GetSeatAnimationType(int posIdx)
916 {
917 switch (posIdx)
918 {
919 case 0:
920 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
921 case 1:
922 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
923 case 2:
924 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
925 case 3:
926 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
927 }
928
929 return 0;
930
931 }
932
933
935 {
936 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackRearLight));
937 }
938
940 {
941 return CarLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackFrontLight));
942 }
943
945 {
946 if (!super.CanReleaseAttachment(attachment))
947 return false;
948
949 if (EngineIsOn() || GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
950 {
951 string attType = attachment.GetType();
952 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
953 return false;
954 }
955
956 return true;
957 }
958
959 override protected bool CanManipulateSpareWheel(string slotSelectionName)
960 {
961 return GetCarDoorsState("NivaHood") != CarDoorState.DOORS_CLOSED;
962 }
963
964 override bool CanDisplayAttachmentCategory(string category_name)
965 {
966 if (!super.CanDisplayAttachmentCategory(category_name))
967 return false;
968
969 category_name.ToLower();
970 if (category_name.Contains("engine"))
971 {
972 if (GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
973 return false;
974 }
975
976 return true;
977 }
978
979 override bool CanDisplayCargo()
980 {
981 if (!super.CanDisplayCargo())
982 return false;
983
984 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
985 return false;
986
987 return true;
988 }
989
990 override int GetCarDoorsState(string slotType)
991 {
993
994 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
995 if (!carDoor)
996 return CarDoorState.DOORS_MISSING;
997
998 switch (slotType)
999 {
1000 case "NivaDriverDoors":
1001 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
1002
1003 case "NivaCoDriverDoors":
1004 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
1005
1006 case "NivaHood":
1007 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
1008
1009 case "NivaTrunk":
1010 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
1011 }
1012
1013 return CarDoorState.DOORS_MISSING;
1014 }
1015
1016 override bool CrewCanGetThrough(int posIdx)
1017 {
1019 switch (posIdx)
1020 {
1021 case 0:
1022 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
1023 return false;
1024 else if (GetAnimationPhase("SeatDriver") > 0.5)
1025 return false;
1026
1027 return true;
1028
1029 case 1:
1030 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
1031 return false;
1032 else if (GetAnimationPhase("SeatCoDriver") > 0.5)
1033 return false;
1034
1035 return true;
1036
1037 case 2:
1038 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
1039 return false;
1040 else if (GetAnimationPhase("SeatDriver") <= 0.5)
1041 return false;
1042
1043 return true;
1044
1045 case 3:
1046 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
1047 return false;
1048 else if (GetAnimationPhase("SeatCoDriver") <= 0.5)
1049 return false;
1050
1051 return true;
1052 }
1053
1054 return false;
1055 }
1056
1057 override string GetDoorSelectionNameFromSeatPos(int posIdx)
1058 {
1059 switch (posIdx)
1060 {
1061 case 0:
1062 case 2:
1063 return "doors_driver";
1064 case 1:
1065 case 3:
1066 return "doors_codriver";
1067 }
1068
1069 return super.GetDoorSelectionNameFromSeatPos(posIdx);
1070 }
1071
1072 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
1073 {
1074 switch (posIdx)
1075 {
1076 case 0:
1077 case 2:
1078 return "NivaDriverDoors";
1079 case 1:
1080 case 3:
1081 return "NivaCoDriverDoors";
1082 }
1083
1084 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
1085 }
1086
1087 // 0 full ambient and engine sound
1088 // 1 zero ambient and engine sound
1089 override float OnSound(CarSoundCtrl ctrl, float oldValue)
1090 {
1091 float tempCap = 0.0;
1092
1093 switch (ctrl)
1094 {
1095 case CarSoundCtrl.DOORS:
1096 float newValue = 0;
1097 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
1098 newValue += 0.5;
1099
1100 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
1101 newValue += 0.5;
1102
1103 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
1104 newValue += 0.3;
1105
1106 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
1107 newValue -= 0.6;
1108
1109 if (GetHealthLevel("WindowLR") == GameConstants.STATE_RUINED)
1110 newValue -= 0.2;
1111
1112 if (GetHealthLevel("WindowRR") == GameConstants.STATE_RUINED)
1113 newValue -= 0.2;
1114
1115 return Math.Clamp(newValue, 0, 1);
1116 break;
1117 }
1118
1119 return super.OnSound(ctrl, oldValue);
1120 }
1121
1122 override string GetAnimSourceFromSelection(string selection)
1123 {
1124 switch (selection)
1125 {
1126 case "doors_driver":
1127 return "DoorsDriver";
1128 case "doors_codriver":
1129 return "DoorsCoDriver";
1130 case "doors_hood":
1131 return "DoorsHood";
1132 case "doors_trunk":
1133 return "DoorsTrunk";
1134 case "seatback_driver":
1135 return "SeatDriver";
1136 case "seatback_codriver":
1137 return "SeatCoDriver";
1138 }
1139
1140 return "";
1141 }
1142
1143 override string GetDoorConditionPointFromSelection(string selection)
1144 {
1145 switch (selection)
1146 {
1147 case "seat_driver":
1148 case "seatback_driver":
1149 case "seat_cargo1":
1150 return "seat_con_1_1";
1151 case "seat_codriver":
1152 case "seatback_codriver":
1153 case "seat_cargo2":
1154 return "seat_con_2_1";
1155 }
1156
1157 return "";
1158 }
1159
1160 override int GetCrewIndex(string selection)
1161 {
1162 switch (selection)
1163 {
1164 case "seatback_driver":
1165 return 0;
1166 case "seatback_codriver":
1167 return 1;
1168 }
1169
1170 return -1;
1171 }
1172
1173 override bool IsVitalTruckBattery()
1174 {
1175 return false;
1176 }
1177
1178 override bool IsVitalGlowPlug()
1179 {
1180 return false;
1181 }
1182
1183 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
1184 {
1185 if (nextSeat == 0 && GetAnimationPhase("SeatDriver") > 0.5)
1186 return false;
1187
1188 if (nextSeat == 1 && GetAnimationPhase("SeatCoDriver") > 0.5)
1189 return false;
1190
1191 switch (currentSeat)
1192 {
1193 case 0:
1194 return nextSeat == 1;
1195
1196 case 1:
1197 return nextSeat == 0;
1198
1199 case 2:
1200 return nextSeat == 3;
1201
1202 case 3:
1203 return nextSeat == 2;
1204 }
1205
1206 return false;
1207 }
1208
1209 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
1210 {
1211 switch (pCurrentSeat)
1212 {
1213 case 0:
1214 return pDoorsSelection == "DoorsDriver";
1215
1216 case 1:
1217 return pDoorsSelection == "DoorsCoDriver";
1218
1219 case 2:
1220 return pDoorsSelection == "DoorsDriver";
1221
1222 case 3:
1223 return pDoorsSelection == "DoorsCoDriver";
1224 }
1225
1226 return false;
1227 }
1228
1229 override int GetSeatIndexFromDoor(string pDoorSelection)
1230 {
1231 switch (pDoorSelection)
1232 {
1233 case "DoorsDriver":
1234 return 0;
1235 case "DoorsCoDriver":
1236 return 1;
1237 }
1238
1239 return -1;
1240 }
1241
1242 override void SetActions()
1243 {
1244 super.SetActions();
1245
1247 }
1248
1249 override void OnDebugSpawn()
1250 {
1254
1255 GetInventory().CreateInInventory("HatchbackWheel");
1256 GetInventory().CreateInInventory("HatchbackWheel");
1257 GetInventory().CreateInInventory("HatchbackWheel");
1258 GetInventory().CreateInInventory("HatchbackWheel");
1259
1260 GetInventory().CreateInInventory("HatchbackDoors_Driver");
1261 GetInventory().CreateInInventory("HatchbackDoors_CoDriver");
1262 GetInventory().CreateInInventory("HatchbackHood");
1263 GetInventory().CreateInInventory("HatchbackTrunk");
1264
1265 //-----IN CAR CARGO
1266 GetInventory().CreateInInventory("HatchbackWheel");
1267 GetInventory().CreateInInventory("HatchbackWheel");
1268 }
1269}
1270
1272{
1273 override void OnDebugSpawn()
1274 {
1278
1279 GetInventory().CreateInInventory("HatchbackWheel");
1280 GetInventory().CreateInInventory("HatchbackWheel");
1281 GetInventory().CreateInInventory("HatchbackWheel");
1282 GetInventory().CreateInInventory("HatchbackWheel");
1283
1284 GetInventory().CreateInInventory("HatchbackDoors_Driver_White");
1285 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_White");
1286 GetInventory().CreateInInventory("HatchbackHood_White");
1287 GetInventory().CreateInInventory("HatchbackTrunk_White");
1288
1289 //-----IN CAR CARGO
1290 GetInventory().CreateInInventory("HatchbackWheel");
1291 GetInventory().CreateInInventory("HatchbackWheel");
1292 }
1293}
1294
1296{
1297 override void OnDebugSpawn()
1298 {
1302
1303 GetInventory().CreateInInventory("HatchbackWheel");
1304 GetInventory().CreateInInventory("HatchbackWheel");
1305 GetInventory().CreateInInventory("HatchbackWheel");
1306 GetInventory().CreateInInventory("HatchbackWheel");
1307
1308 GetInventory().CreateInInventory("HatchbackDoors_Driver_Blue");
1309 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_Blue");
1310 GetInventory().CreateInInventory("HatchbackHood_Blue");
1311 GetInventory().CreateInInventory("HatchbackTrunk_Blue");
1312
1313 //-----IN CAR CARGO
1314 GetInventory().CreateInInventory("HatchbackWheel");
1315 GetInventory().CreateInInventory("HatchbackWheel");
1316 }
1317}

◆ GetTransportCameraDistance()

override float OnDebugSpawn::GetTransportCameraDistance ( )
protected

Definition at line 515 of file OffroadHatchback.c.

516{
520
521 void OffroadHatchback()
522 {
523 //m_dmgContactCoef = 0.075;
524
525 m_EngineStartOK = "offroad_engine_start_SoundSet";
526 m_EngineStartBattery = "offroad_engine_failed_start_battery_SoundSet";
527 m_EngineStartPlug = "offroad_engine_failed_start_sparkplugs_SoundSet";
528 m_EngineStartFuel = "offroad_engine_failed_start_fuel_SoundSet";
529 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
530
531 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
532 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
533 m_CarSeatShiftInSound = "Offroad_SeatShiftIn_SoundSet";
534 m_CarSeatShiftOutSound = "Offroad_SeatShiftOut_SoundSet";
535
536 m_CarHornShortSoundName = "Offroad_Horn_Short_SoundSet";
537 m_CarHornLongSoundName = "Offroad_Horn_SoundSet";
538
539 SetEnginePos("0 0.7 1.2");
540 }
541
542 override void EEInit()
543 {
544 super.EEInit();
545
546 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
547 {
549 m_UTSSettings.m_ManualUpdate = true;
550 m_UTSSettings.m_TemperatureMin = 0;
551 m_UTSSettings.m_TemperatureMax = 30;
552 m_UTSSettings.m_RangeFull = 0.5;
553 m_UTSSettings.m_RangeMax = 2;
554 m_UTSSettings.m_TemperatureCap = 25;
555
558 }
559 }
560
561 override void OnEngineStart()
562 {
563 super.OnEngineStart();
564
565 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
566 m_UTSource.SetDefferedActive(true, 20.0);
567 }
568
569 override void OnEngineStop()
570 {
571 super.OnEngineStop();
572
573 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
574 m_UTSource.SetDefferedActive(false, 10.0);
575 }
576
577 override void EOnPostSimulate(IEntity other, float timeSlice)
578 {
579 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
580 {
581 if (m_UTSource.IsActive())
583 }
584 }
585
586 override int GetAnimInstance()
587 {
588 return VehicleAnimInstances.HATCHBACK;
589 }
590
591 override float GetTransportCameraDistance()
592 {
593 return 3.5;
594 }
595
596 override int GetSeatAnimationType(int posIdx)
597 {
598 switch (posIdx)
599 {
600 case 0:
601 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
602 case 1:
603 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
604 case 2:
605 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
606 case 3:
607 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
608 }
609
610 return 0;
611
612 }
613
614
616 {
617 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackRearLight));
618 }
619
621 {
622 return CarLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackFrontLight));
623 }
624
626 {
627 if (!super.CanReleaseAttachment(attachment))
628 return false;
629
630 if (EngineIsOn() || GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
631 {
632 string attType = attachment.GetType();
633 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
634 return false;
635 }
636
637 return true;
638 }
639
640 override protected bool CanManipulateSpareWheel(string slotSelectionName)
641 {
642 return GetCarDoorsState("NivaHood") != CarDoorState.DOORS_CLOSED;
643 }
644
645 override bool CanDisplayAttachmentCategory(string category_name)
646 {
647 if (!super.CanDisplayAttachmentCategory(category_name))
648 return false;
649
650 category_name.ToLower();
651 if (category_name.Contains("engine"))
652 {
653 if (GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
654 return false;
655 }
656
657 return true;
658 }
659
660 override bool CanDisplayCargo()
661 {
662 if (!super.CanDisplayCargo())
663 return false;
664
665 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
666 return false;
667
668 return true;
669 }
670
671 override int GetCarDoorsState(string slotType)
672 {
674
675 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
676 if (!carDoor)
677 return CarDoorState.DOORS_MISSING;
678
679 switch (slotType)
680 {
681 case "NivaDriverDoors":
682 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
683
684 case "NivaCoDriverDoors":
685 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
686
687 case "NivaHood":
688 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
689
690 case "NivaTrunk":
691 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
692 }
693
694 return CarDoorState.DOORS_MISSING;
695 }
696
697 override bool CrewCanGetThrough(int posIdx)
698 {
700 switch (posIdx)
701 {
702 case 0:
703 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
704 return false;
705 else if (GetAnimationPhase("SeatDriver") > 0.5)
706 return false;
707
708 return true;
709
710 case 1:
711 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
712 return false;
713 else if (GetAnimationPhase("SeatCoDriver") > 0.5)
714 return false;
715
716 return true;
717
718 case 2:
719 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
720 return false;
721 else if (GetAnimationPhase("SeatDriver") <= 0.5)
722 return false;
723
724 return true;
725
726 case 3:
727 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
728 return false;
729 else if (GetAnimationPhase("SeatCoDriver") <= 0.5)
730 return false;
731
732 return true;
733 }
734
735 return false;
736 }
737
738 override string GetDoorSelectionNameFromSeatPos(int posIdx)
739 {
740 switch (posIdx)
741 {
742 case 0:
743 case 2:
744 return "doors_driver";
745 case 1:
746 case 3:
747 return "doors_codriver";
748 }
749
750 return super.GetDoorSelectionNameFromSeatPos(posIdx);
751 }
752
753 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
754 {
755 switch (posIdx)
756 {
757 case 0:
758 case 2:
759 return "NivaDriverDoors";
760 case 1:
761 case 3:
762 return "NivaCoDriverDoors";
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 float tempCap = 0.0;
773
774 switch (ctrl)
775 {
776 case CarSoundCtrl.DOORS:
777 float newValue = 0;
778 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
779 newValue += 0.5;
780
781 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
782 newValue += 0.5;
783
784 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
785 newValue += 0.3;
786
787 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
788 newValue -= 0.6;
789
790 if (GetHealthLevel("WindowLR") == GameConstants.STATE_RUINED)
791 newValue -= 0.2;
792
793 if (GetHealthLevel("WindowRR") == GameConstants.STATE_RUINED)
794 newValue -= 0.2;
795
796 return Math.Clamp(newValue, 0, 1);
797 break;
798 }
799
800 return super.OnSound(ctrl, oldValue);
801 }
802
803 override string GetAnimSourceFromSelection(string selection)
804 {
805 switch (selection)
806 {
807 case "doors_driver":
808 return "DoorsDriver";
809 case "doors_codriver":
810 return "DoorsCoDriver";
811 case "doors_hood":
812 return "DoorsHood";
813 case "doors_trunk":
814 return "DoorsTrunk";
815 case "seatback_driver":
816 return "SeatDriver";
817 case "seatback_codriver":
818 return "SeatCoDriver";
819 }
820
821 return "";
822 }
823
824 override string GetDoorConditionPointFromSelection(string selection)
825 {
826 switch (selection)
827 {
828 case "seat_driver":
829 case "seatback_driver":
830 case "seat_cargo1":
831 return "seat_con_1_1";
832 case "seat_codriver":
833 case "seatback_codriver":
834 case "seat_cargo2":
835 return "seat_con_2_1";
836 }
837
838 return "";
839 }
840
841 override int GetCrewIndex(string selection)
842 {
843 switch (selection)
844 {
845 case "seatback_driver":
846 return 0;
847 case "seatback_codriver":
848 return 1;
849 }
850
851 return -1;
852 }
853
854 override bool IsVitalTruckBattery()
855 {
856 return false;
857 }
858
859 override bool IsVitalGlowPlug()
860 {
861 return false;
862 }
863
864 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
865 {
866 if (nextSeat == 0 && GetAnimationPhase("SeatDriver") > 0.5)
867 return false;
868
869 if (nextSeat == 1 && GetAnimationPhase("SeatCoDriver") > 0.5)
870 return false;
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 == "DoorsDriver";
902
903 case 3:
904 return pDoorsSelection == "DoorsCoDriver";
905 }
906
907 return false;
908 }
909
910 override int GetSeatIndexFromDoor(string pDoorSelection)
911 {
912 switch (pDoorSelection)
913 {
914 case "DoorsDriver":
915 return 0;
916 case "DoorsCoDriver":
917 return 1;
918 }
919
920 return -1;
921 }
922
923 override void SetActions()
924 {
925 super.SetActions();
926
928 }
929
930 override void OnDebugSpawn()
931 {
935
936 GetInventory().CreateInInventory("HatchbackWheel");
937 GetInventory().CreateInInventory("HatchbackWheel");
938 GetInventory().CreateInInventory("HatchbackWheel");
939 GetInventory().CreateInInventory("HatchbackWheel");
940
941 GetInventory().CreateInInventory("HatchbackDoors_Driver");
942 GetInventory().CreateInInventory("HatchbackDoors_CoDriver");
943 GetInventory().CreateInInventory("HatchbackHood");
944 GetInventory().CreateInInventory("HatchbackTrunk");
945
946 //-----IN CAR CARGO
947 GetInventory().CreateInInventory("HatchbackWheel");
948 GetInventory().CreateInInventory("HatchbackWheel");
949 }
950}
951
953{
954 override void OnDebugSpawn()
955 {
959
960 GetInventory().CreateInInventory("HatchbackWheel");
961 GetInventory().CreateInInventory("HatchbackWheel");
962 GetInventory().CreateInInventory("HatchbackWheel");
963 GetInventory().CreateInInventory("HatchbackWheel");
964
965 GetInventory().CreateInInventory("HatchbackDoors_Driver_White");
966 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_White");
967 GetInventory().CreateInInventory("HatchbackHood_White");
968 GetInventory().CreateInInventory("HatchbackTrunk_White");
969
970 //-----IN CAR CARGO
971 GetInventory().CreateInInventory("HatchbackWheel");
972 GetInventory().CreateInInventory("HatchbackWheel");
973 }
974}
975
977{
978 override void OnDebugSpawn()
979 {
983
984 GetInventory().CreateInInventory("HatchbackWheel");
985 GetInventory().CreateInInventory("HatchbackWheel");
986 GetInventory().CreateInInventory("HatchbackWheel");
987 GetInventory().CreateInInventory("HatchbackWheel");
988
989 GetInventory().CreateInInventory("HatchbackDoors_Driver_Blue");
990 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_Blue");
991 GetInventory().CreateInInventory("HatchbackHood_Blue");
992 GetInventory().CreateInInventory("HatchbackTrunk_Blue");
993
994 //-----IN CAR CARGO
995 GetInventory().CreateInInventory("HatchbackWheel");
996 GetInventory().CreateInInventory("HatchbackWheel");
997 }
998}

◆ IsVitalGlowPlug()

override bool OnDebugSpawn::IsVitalGlowPlug ( )
protected

Definition at line 783 of file OffroadHatchback.c.

784{
788
789 void OffroadHatchback()
790 {
791 //m_dmgContactCoef = 0.075;
792
793 m_EngineStartOK = "offroad_engine_start_SoundSet";
794 m_EngineStartBattery = "offroad_engine_failed_start_battery_SoundSet";
795 m_EngineStartPlug = "offroad_engine_failed_start_sparkplugs_SoundSet";
796 m_EngineStartFuel = "offroad_engine_failed_start_fuel_SoundSet";
797 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
798
799 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
800 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
801 m_CarSeatShiftInSound = "Offroad_SeatShiftIn_SoundSet";
802 m_CarSeatShiftOutSound = "Offroad_SeatShiftOut_SoundSet";
803
804 m_CarHornShortSoundName = "Offroad_Horn_Short_SoundSet";
805 m_CarHornLongSoundName = "Offroad_Horn_SoundSet";
806
807 SetEnginePos("0 0.7 1.2");
808 }
809
810 override void EEInit()
811 {
812 super.EEInit();
813
814 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
815 {
817 m_UTSSettings.m_ManualUpdate = true;
818 m_UTSSettings.m_TemperatureMin = 0;
819 m_UTSSettings.m_TemperatureMax = 30;
820 m_UTSSettings.m_RangeFull = 0.5;
821 m_UTSSettings.m_RangeMax = 2;
822 m_UTSSettings.m_TemperatureCap = 25;
823
826 }
827 }
828
829 override void OnEngineStart()
830 {
831 super.OnEngineStart();
832
833 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
834 m_UTSource.SetDefferedActive(true, 20.0);
835 }
836
837 override void OnEngineStop()
838 {
839 super.OnEngineStop();
840
841 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
842 m_UTSource.SetDefferedActive(false, 10.0);
843 }
844
845 override void EOnPostSimulate(IEntity other, float timeSlice)
846 {
847 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
848 {
849 if (m_UTSource.IsActive())
851 }
852 }
853
854 override int GetAnimInstance()
855 {
856 return VehicleAnimInstances.HATCHBACK;
857 }
858
859 override float GetTransportCameraDistance()
860 {
861 return 3.5;
862 }
863
864 override int GetSeatAnimationType(int posIdx)
865 {
866 switch (posIdx)
867 {
868 case 0:
869 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
870 case 1:
871 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
872 case 2:
873 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
874 case 3:
875 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
876 }
877
878 return 0;
879
880 }
881
882
884 {
885 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackRearLight));
886 }
887
889 {
890 return CarLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackFrontLight));
891 }
892
894 {
895 if (!super.CanReleaseAttachment(attachment))
896 return false;
897
898 if (EngineIsOn() || GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
899 {
900 string attType = attachment.GetType();
901 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
902 return false;
903 }
904
905 return true;
906 }
907
908 override protected bool CanManipulateSpareWheel(string slotSelectionName)
909 {
910 return GetCarDoorsState("NivaHood") != CarDoorState.DOORS_CLOSED;
911 }
912
913 override bool CanDisplayAttachmentCategory(string category_name)
914 {
915 if (!super.CanDisplayAttachmentCategory(category_name))
916 return false;
917
918 category_name.ToLower();
919 if (category_name.Contains("engine"))
920 {
921 if (GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
922 return false;
923 }
924
925 return true;
926 }
927
928 override bool CanDisplayCargo()
929 {
930 if (!super.CanDisplayCargo())
931 return false;
932
933 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
934 return false;
935
936 return true;
937 }
938
939 override int GetCarDoorsState(string slotType)
940 {
942
943 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
944 if (!carDoor)
945 return CarDoorState.DOORS_MISSING;
946
947 switch (slotType)
948 {
949 case "NivaDriverDoors":
950 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
951
952 case "NivaCoDriverDoors":
953 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
954
955 case "NivaHood":
956 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
957
958 case "NivaTrunk":
959 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
960 }
961
962 return CarDoorState.DOORS_MISSING;
963 }
964
965 override bool CrewCanGetThrough(int posIdx)
966 {
968 switch (posIdx)
969 {
970 case 0:
971 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
972 return false;
973 else if (GetAnimationPhase("SeatDriver") > 0.5)
974 return false;
975
976 return true;
977
978 case 1:
979 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
980 return false;
981 else if (GetAnimationPhase("SeatCoDriver") > 0.5)
982 return false;
983
984 return true;
985
986 case 2:
987 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
988 return false;
989 else if (GetAnimationPhase("SeatDriver") <= 0.5)
990 return false;
991
992 return true;
993
994 case 3:
995 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
996 return false;
997 else if (GetAnimationPhase("SeatCoDriver") <= 0.5)
998 return false;
999
1000 return true;
1001 }
1002
1003 return false;
1004 }
1005
1006 override string GetDoorSelectionNameFromSeatPos(int posIdx)
1007 {
1008 switch (posIdx)
1009 {
1010 case 0:
1011 case 2:
1012 return "doors_driver";
1013 case 1:
1014 case 3:
1015 return "doors_codriver";
1016 }
1017
1018 return super.GetDoorSelectionNameFromSeatPos(posIdx);
1019 }
1020
1021 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
1022 {
1023 switch (posIdx)
1024 {
1025 case 0:
1026 case 2:
1027 return "NivaDriverDoors";
1028 case 1:
1029 case 3:
1030 return "NivaCoDriverDoors";
1031 }
1032
1033 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
1034 }
1035
1036 // 0 full ambient and engine sound
1037 // 1 zero ambient and engine sound
1038 override float OnSound(CarSoundCtrl ctrl, float oldValue)
1039 {
1040 float tempCap = 0.0;
1041
1042 switch (ctrl)
1043 {
1044 case CarSoundCtrl.DOORS:
1045 float newValue = 0;
1046 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
1047 newValue += 0.5;
1048
1049 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
1050 newValue += 0.5;
1051
1052 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
1053 newValue += 0.3;
1054
1055 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
1056 newValue -= 0.6;
1057
1058 if (GetHealthLevel("WindowLR") == GameConstants.STATE_RUINED)
1059 newValue -= 0.2;
1060
1061 if (GetHealthLevel("WindowRR") == GameConstants.STATE_RUINED)
1062 newValue -= 0.2;
1063
1064 return Math.Clamp(newValue, 0, 1);
1065 break;
1066 }
1067
1068 return super.OnSound(ctrl, oldValue);
1069 }
1070
1071 override string GetAnimSourceFromSelection(string selection)
1072 {
1073 switch (selection)
1074 {
1075 case "doors_driver":
1076 return "DoorsDriver";
1077 case "doors_codriver":
1078 return "DoorsCoDriver";
1079 case "doors_hood":
1080 return "DoorsHood";
1081 case "doors_trunk":
1082 return "DoorsTrunk";
1083 case "seatback_driver":
1084 return "SeatDriver";
1085 case "seatback_codriver":
1086 return "SeatCoDriver";
1087 }
1088
1089 return "";
1090 }
1091
1092 override string GetDoorConditionPointFromSelection(string selection)
1093 {
1094 switch (selection)
1095 {
1096 case "seat_driver":
1097 case "seatback_driver":
1098 case "seat_cargo1":
1099 return "seat_con_1_1";
1100 case "seat_codriver":
1101 case "seatback_codriver":
1102 case "seat_cargo2":
1103 return "seat_con_2_1";
1104 }
1105
1106 return "";
1107 }
1108
1109 override int GetCrewIndex(string selection)
1110 {
1111 switch (selection)
1112 {
1113 case "seatback_driver":
1114 return 0;
1115 case "seatback_codriver":
1116 return 1;
1117 }
1118
1119 return -1;
1120 }
1121
1122 override bool IsVitalTruckBattery()
1123 {
1124 return false;
1125 }
1126
1127 override bool IsVitalGlowPlug()
1128 {
1129 return false;
1130 }
1131
1132 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
1133 {
1134 if (nextSeat == 0 && GetAnimationPhase("SeatDriver") > 0.5)
1135 return false;
1136
1137 if (nextSeat == 1 && GetAnimationPhase("SeatCoDriver") > 0.5)
1138 return false;
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 == "DoorsDriver";
1170
1171 case 3:
1172 return pDoorsSelection == "DoorsCoDriver";
1173 }
1174
1175 return false;
1176 }
1177
1178 override int GetSeatIndexFromDoor(string pDoorSelection)
1179 {
1180 switch (pDoorSelection)
1181 {
1182 case "DoorsDriver":
1183 return 0;
1184 case "DoorsCoDriver":
1185 return 1;
1186 }
1187
1188 return -1;
1189 }
1190
1191 override void SetActions()
1192 {
1193 super.SetActions();
1194
1196 }
1197
1198 override void OnDebugSpawn()
1199 {
1203
1204 GetInventory().CreateInInventory("HatchbackWheel");
1205 GetInventory().CreateInInventory("HatchbackWheel");
1206 GetInventory().CreateInInventory("HatchbackWheel");
1207 GetInventory().CreateInInventory("HatchbackWheel");
1208
1209 GetInventory().CreateInInventory("HatchbackDoors_Driver");
1210 GetInventory().CreateInInventory("HatchbackDoors_CoDriver");
1211 GetInventory().CreateInInventory("HatchbackHood");
1212 GetInventory().CreateInInventory("HatchbackTrunk");
1213
1214 //-----IN CAR CARGO
1215 GetInventory().CreateInInventory("HatchbackWheel");
1216 GetInventory().CreateInInventory("HatchbackWheel");
1217 }
1218}
1219
1221{
1222 override void OnDebugSpawn()
1223 {
1227
1228 GetInventory().CreateInInventory("HatchbackWheel");
1229 GetInventory().CreateInInventory("HatchbackWheel");
1230 GetInventory().CreateInInventory("HatchbackWheel");
1231 GetInventory().CreateInInventory("HatchbackWheel");
1232
1233 GetInventory().CreateInInventory("HatchbackDoors_Driver_White");
1234 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_White");
1235 GetInventory().CreateInInventory("HatchbackHood_White");
1236 GetInventory().CreateInInventory("HatchbackTrunk_White");
1237
1238 //-----IN CAR CARGO
1239 GetInventory().CreateInInventory("HatchbackWheel");
1240 GetInventory().CreateInInventory("HatchbackWheel");
1241 }
1242}
1243
1245{
1246 override void OnDebugSpawn()
1247 {
1251
1252 GetInventory().CreateInInventory("HatchbackWheel");
1253 GetInventory().CreateInInventory("HatchbackWheel");
1254 GetInventory().CreateInInventory("HatchbackWheel");
1255 GetInventory().CreateInInventory("HatchbackWheel");
1256
1257 GetInventory().CreateInInventory("HatchbackDoors_Driver_Blue");
1258 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_Blue");
1259 GetInventory().CreateInInventory("HatchbackHood_Blue");
1260 GetInventory().CreateInInventory("HatchbackTrunk_Blue");
1261
1262 //-----IN CAR CARGO
1263 GetInventory().CreateInInventory("HatchbackWheel");
1264 GetInventory().CreateInInventory("HatchbackWheel");
1265 }
1266}

◆ IsVitalTruckBattery()

override bool OnDebugSpawn::IsVitalTruckBattery ( )
protected

Definition at line 778 of file OffroadHatchback.c.

779{
783
784 void OffroadHatchback()
785 {
786 //m_dmgContactCoef = 0.075;
787
788 m_EngineStartOK = "offroad_engine_start_SoundSet";
789 m_EngineStartBattery = "offroad_engine_failed_start_battery_SoundSet";
790 m_EngineStartPlug = "offroad_engine_failed_start_sparkplugs_SoundSet";
791 m_EngineStartFuel = "offroad_engine_failed_start_fuel_SoundSet";
792 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
793
794 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
795 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
796 m_CarSeatShiftInSound = "Offroad_SeatShiftIn_SoundSet";
797 m_CarSeatShiftOutSound = "Offroad_SeatShiftOut_SoundSet";
798
799 m_CarHornShortSoundName = "Offroad_Horn_Short_SoundSet";
800 m_CarHornLongSoundName = "Offroad_Horn_SoundSet";
801
802 SetEnginePos("0 0.7 1.2");
803 }
804
805 override void EEInit()
806 {
807 super.EEInit();
808
809 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
810 {
812 m_UTSSettings.m_ManualUpdate = true;
813 m_UTSSettings.m_TemperatureMin = 0;
814 m_UTSSettings.m_TemperatureMax = 30;
815 m_UTSSettings.m_RangeFull = 0.5;
816 m_UTSSettings.m_RangeMax = 2;
817 m_UTSSettings.m_TemperatureCap = 25;
818
821 }
822 }
823
824 override void OnEngineStart()
825 {
826 super.OnEngineStart();
827
828 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
829 m_UTSource.SetDefferedActive(true, 20.0);
830 }
831
832 override void OnEngineStop()
833 {
834 super.OnEngineStop();
835
836 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
837 m_UTSource.SetDefferedActive(false, 10.0);
838 }
839
840 override void EOnPostSimulate(IEntity other, float timeSlice)
841 {
842 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
843 {
844 if (m_UTSource.IsActive())
846 }
847 }
848
849 override int GetAnimInstance()
850 {
851 return VehicleAnimInstances.HATCHBACK;
852 }
853
854 override float GetTransportCameraDistance()
855 {
856 return 3.5;
857 }
858
859 override int GetSeatAnimationType(int posIdx)
860 {
861 switch (posIdx)
862 {
863 case 0:
864 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
865 case 1:
866 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
867 case 2:
868 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
869 case 3:
870 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
871 }
872
873 return 0;
874
875 }
876
877
879 {
880 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackRearLight));
881 }
882
884 {
885 return CarLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackFrontLight));
886 }
887
889 {
890 if (!super.CanReleaseAttachment(attachment))
891 return false;
892
893 if (EngineIsOn() || GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
894 {
895 string attType = attachment.GetType();
896 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
897 return false;
898 }
899
900 return true;
901 }
902
903 override protected bool CanManipulateSpareWheel(string slotSelectionName)
904 {
905 return GetCarDoorsState("NivaHood") != CarDoorState.DOORS_CLOSED;
906 }
907
908 override bool CanDisplayAttachmentCategory(string category_name)
909 {
910 if (!super.CanDisplayAttachmentCategory(category_name))
911 return false;
912
913 category_name.ToLower();
914 if (category_name.Contains("engine"))
915 {
916 if (GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
917 return false;
918 }
919
920 return true;
921 }
922
923 override bool CanDisplayCargo()
924 {
925 if (!super.CanDisplayCargo())
926 return false;
927
928 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
929 return false;
930
931 return true;
932 }
933
934 override int GetCarDoorsState(string slotType)
935 {
937
938 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
939 if (!carDoor)
940 return CarDoorState.DOORS_MISSING;
941
942 switch (slotType)
943 {
944 case "NivaDriverDoors":
945 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
946
947 case "NivaCoDriverDoors":
948 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
949
950 case "NivaHood":
951 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
952
953 case "NivaTrunk":
954 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
955 }
956
957 return CarDoorState.DOORS_MISSING;
958 }
959
960 override bool CrewCanGetThrough(int posIdx)
961 {
963 switch (posIdx)
964 {
965 case 0:
966 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
967 return false;
968 else if (GetAnimationPhase("SeatDriver") > 0.5)
969 return false;
970
971 return true;
972
973 case 1:
974 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
975 return false;
976 else if (GetAnimationPhase("SeatCoDriver") > 0.5)
977 return false;
978
979 return true;
980
981 case 2:
982 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
983 return false;
984 else if (GetAnimationPhase("SeatDriver") <= 0.5)
985 return false;
986
987 return true;
988
989 case 3:
990 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
991 return false;
992 else if (GetAnimationPhase("SeatCoDriver") <= 0.5)
993 return false;
994
995 return true;
996 }
997
998 return false;
999 }
1000
1001 override string GetDoorSelectionNameFromSeatPos(int posIdx)
1002 {
1003 switch (posIdx)
1004 {
1005 case 0:
1006 case 2:
1007 return "doors_driver";
1008 case 1:
1009 case 3:
1010 return "doors_codriver";
1011 }
1012
1013 return super.GetDoorSelectionNameFromSeatPos(posIdx);
1014 }
1015
1016 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
1017 {
1018 switch (posIdx)
1019 {
1020 case 0:
1021 case 2:
1022 return "NivaDriverDoors";
1023 case 1:
1024 case 3:
1025 return "NivaCoDriverDoors";
1026 }
1027
1028 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
1029 }
1030
1031 // 0 full ambient and engine sound
1032 // 1 zero ambient and engine sound
1033 override float OnSound(CarSoundCtrl ctrl, float oldValue)
1034 {
1035 float tempCap = 0.0;
1036
1037 switch (ctrl)
1038 {
1039 case CarSoundCtrl.DOORS:
1040 float newValue = 0;
1041 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
1042 newValue += 0.5;
1043
1044 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
1045 newValue += 0.5;
1046
1047 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
1048 newValue += 0.3;
1049
1050 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
1051 newValue -= 0.6;
1052
1053 if (GetHealthLevel("WindowLR") == GameConstants.STATE_RUINED)
1054 newValue -= 0.2;
1055
1056 if (GetHealthLevel("WindowRR") == GameConstants.STATE_RUINED)
1057 newValue -= 0.2;
1058
1059 return Math.Clamp(newValue, 0, 1);
1060 break;
1061 }
1062
1063 return super.OnSound(ctrl, oldValue);
1064 }
1065
1066 override string GetAnimSourceFromSelection(string selection)
1067 {
1068 switch (selection)
1069 {
1070 case "doors_driver":
1071 return "DoorsDriver";
1072 case "doors_codriver":
1073 return "DoorsCoDriver";
1074 case "doors_hood":
1075 return "DoorsHood";
1076 case "doors_trunk":
1077 return "DoorsTrunk";
1078 case "seatback_driver":
1079 return "SeatDriver";
1080 case "seatback_codriver":
1081 return "SeatCoDriver";
1082 }
1083
1084 return "";
1085 }
1086
1087 override string GetDoorConditionPointFromSelection(string selection)
1088 {
1089 switch (selection)
1090 {
1091 case "seat_driver":
1092 case "seatback_driver":
1093 case "seat_cargo1":
1094 return "seat_con_1_1";
1095 case "seat_codriver":
1096 case "seatback_codriver":
1097 case "seat_cargo2":
1098 return "seat_con_2_1";
1099 }
1100
1101 return "";
1102 }
1103
1104 override int GetCrewIndex(string selection)
1105 {
1106 switch (selection)
1107 {
1108 case "seatback_driver":
1109 return 0;
1110 case "seatback_codriver":
1111 return 1;
1112 }
1113
1114 return -1;
1115 }
1116
1117 override bool IsVitalTruckBattery()
1118 {
1119 return false;
1120 }
1121
1122 override bool IsVitalGlowPlug()
1123 {
1124 return false;
1125 }
1126
1127 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
1128 {
1129 if (nextSeat == 0 && GetAnimationPhase("SeatDriver") > 0.5)
1130 return false;
1131
1132 if (nextSeat == 1 && GetAnimationPhase("SeatCoDriver") > 0.5)
1133 return false;
1134
1135 switch (currentSeat)
1136 {
1137 case 0:
1138 return nextSeat == 1;
1139
1140 case 1:
1141 return nextSeat == 0;
1142
1143 case 2:
1144 return nextSeat == 3;
1145
1146 case 3:
1147 return nextSeat == 2;
1148 }
1149
1150 return false;
1151 }
1152
1153 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
1154 {
1155 switch (pCurrentSeat)
1156 {
1157 case 0:
1158 return pDoorsSelection == "DoorsDriver";
1159
1160 case 1:
1161 return pDoorsSelection == "DoorsCoDriver";
1162
1163 case 2:
1164 return pDoorsSelection == "DoorsDriver";
1165
1166 case 3:
1167 return pDoorsSelection == "DoorsCoDriver";
1168 }
1169
1170 return false;
1171 }
1172
1173 override int GetSeatIndexFromDoor(string pDoorSelection)
1174 {
1175 switch (pDoorSelection)
1176 {
1177 case "DoorsDriver":
1178 return 0;
1179 case "DoorsCoDriver":
1180 return 1;
1181 }
1182
1183 return -1;
1184 }
1185
1186 override void SetActions()
1187 {
1188 super.SetActions();
1189
1191 }
1192
1193 override void OnDebugSpawn()
1194 {
1198
1199 GetInventory().CreateInInventory("HatchbackWheel");
1200 GetInventory().CreateInInventory("HatchbackWheel");
1201 GetInventory().CreateInInventory("HatchbackWheel");
1202 GetInventory().CreateInInventory("HatchbackWheel");
1203
1204 GetInventory().CreateInInventory("HatchbackDoors_Driver");
1205 GetInventory().CreateInInventory("HatchbackDoors_CoDriver");
1206 GetInventory().CreateInInventory("HatchbackHood");
1207 GetInventory().CreateInInventory("HatchbackTrunk");
1208
1209 //-----IN CAR CARGO
1210 GetInventory().CreateInInventory("HatchbackWheel");
1211 GetInventory().CreateInInventory("HatchbackWheel");
1212 }
1213}
1214
1216{
1217 override void OnDebugSpawn()
1218 {
1222
1223 GetInventory().CreateInInventory("HatchbackWheel");
1224 GetInventory().CreateInInventory("HatchbackWheel");
1225 GetInventory().CreateInInventory("HatchbackWheel");
1226 GetInventory().CreateInInventory("HatchbackWheel");
1227
1228 GetInventory().CreateInInventory("HatchbackDoors_Driver_White");
1229 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_White");
1230 GetInventory().CreateInInventory("HatchbackHood_White");
1231 GetInventory().CreateInInventory("HatchbackTrunk_White");
1232
1233 //-----IN CAR CARGO
1234 GetInventory().CreateInInventory("HatchbackWheel");
1235 GetInventory().CreateInInventory("HatchbackWheel");
1236 }
1237}
1238
1240{
1241 override void OnDebugSpawn()
1242 {
1246
1247 GetInventory().CreateInInventory("HatchbackWheel");
1248 GetInventory().CreateInInventory("HatchbackWheel");
1249 GetInventory().CreateInInventory("HatchbackWheel");
1250 GetInventory().CreateInInventory("HatchbackWheel");
1251
1252 GetInventory().CreateInInventory("HatchbackDoors_Driver_Blue");
1253 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_Blue");
1254 GetInventory().CreateInInventory("HatchbackHood_Blue");
1255 GetInventory().CreateInInventory("HatchbackTrunk_Blue");
1256
1257 //-----IN CAR CARGO
1258 GetInventory().CreateInInventory("HatchbackWheel");
1259 GetInventory().CreateInInventory("HatchbackWheel");
1260 }
1261}

◆ OffroadHatchback()

void OnDebugSpawn::OffroadHatchback ( )
protected

Definition at line 445 of file OffroadHatchback.c.

463{
464 override void OnDebugSpawn()

◆ OnDebugSpawn()

Definition at line 1 of file OffroadHatchback.c.

441 {
445
446 GetInventory().CreateInInventory("HatchbackWheel");
447 GetInventory().CreateInInventory("HatchbackWheel");
448 GetInventory().CreateInInventory("HatchbackWheel");
449 GetInventory().CreateInInventory("HatchbackWheel");
450
451 GetInventory().CreateInInventory("HatchbackDoors_Driver_White");
452 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_White");
453 GetInventory().CreateInInventory("HatchbackHood_White");
454 GetInventory().CreateInInventory("HatchbackTrunk_White");
455
456 //-----IN CAR CARGO
457 GetInventory().CreateInInventory("HatchbackWheel");
458 GetInventory().CreateInInventory("HatchbackWheel");
459 }

References m_UTSLEngine, m_UTSource, and m_UTSSettings.

◆ OnEngineStart()

override void OnDebugSpawn::OnEngineStart ( )
protected

Definition at line 485 of file OffroadHatchback.c.

486{
490
491 void OffroadHatchback()
492 {
493 //m_dmgContactCoef = 0.075;
494
495 m_EngineStartOK = "offroad_engine_start_SoundSet";
496 m_EngineStartBattery = "offroad_engine_failed_start_battery_SoundSet";
497 m_EngineStartPlug = "offroad_engine_failed_start_sparkplugs_SoundSet";
498 m_EngineStartFuel = "offroad_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 m_CarSeatShiftInSound = "Offroad_SeatShiftIn_SoundSet";
504 m_CarSeatShiftOutSound = "Offroad_SeatShiftOut_SoundSet";
505
506 m_CarHornShortSoundName = "Offroad_Horn_Short_SoundSet";
507 m_CarHornLongSoundName = "Offroad_Horn_SoundSet";
508
509 SetEnginePos("0 0.7 1.2");
510 }
511
512 override void EEInit()
513 {
514 super.EEInit();
515
516 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
517 {
519 m_UTSSettings.m_ManualUpdate = true;
520 m_UTSSettings.m_TemperatureMin = 0;
521 m_UTSSettings.m_TemperatureMax = 30;
522 m_UTSSettings.m_RangeFull = 0.5;
523 m_UTSSettings.m_RangeMax = 2;
524 m_UTSSettings.m_TemperatureCap = 25;
525
528 }
529 }
530
531 override void OnEngineStart()
532 {
533 super.OnEngineStart();
534
535 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
536 m_UTSource.SetDefferedActive(true, 20.0);
537 }
538
539 override void OnEngineStop()
540 {
541 super.OnEngineStop();
542
543 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
544 m_UTSource.SetDefferedActive(false, 10.0);
545 }
546
547 override void EOnPostSimulate(IEntity other, float timeSlice)
548 {
549 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
550 {
551 if (m_UTSource.IsActive())
553 }
554 }
555
556 override int GetAnimInstance()
557 {
558 return VehicleAnimInstances.HATCHBACK;
559 }
560
561 override float GetTransportCameraDistance()
562 {
563 return 3.5;
564 }
565
566 override int GetSeatAnimationType(int posIdx)
567 {
568 switch (posIdx)
569 {
570 case 0:
571 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
572 case 1:
573 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
574 case 2:
575 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
576 case 3:
577 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
578 }
579
580 return 0;
581
582 }
583
584
586 {
587 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackRearLight));
588 }
589
591 {
592 return CarLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackFrontLight));
593 }
594
596 {
597 if (!super.CanReleaseAttachment(attachment))
598 return false;
599
600 if (EngineIsOn() || GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
601 {
602 string attType = attachment.GetType();
603 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
604 return false;
605 }
606
607 return true;
608 }
609
610 override protected bool CanManipulateSpareWheel(string slotSelectionName)
611 {
612 return GetCarDoorsState("NivaHood") != CarDoorState.DOORS_CLOSED;
613 }
614
615 override bool CanDisplayAttachmentCategory(string category_name)
616 {
617 if (!super.CanDisplayAttachmentCategory(category_name))
618 return false;
619
620 category_name.ToLower();
621 if (category_name.Contains("engine"))
622 {
623 if (GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
624 return false;
625 }
626
627 return true;
628 }
629
630 override bool CanDisplayCargo()
631 {
632 if (!super.CanDisplayCargo())
633 return false;
634
635 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
636 return false;
637
638 return true;
639 }
640
641 override int GetCarDoorsState(string slotType)
642 {
644
645 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
646 if (!carDoor)
647 return CarDoorState.DOORS_MISSING;
648
649 switch (slotType)
650 {
651 case "NivaDriverDoors":
652 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
653
654 case "NivaCoDriverDoors":
655 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
656
657 case "NivaHood":
658 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
659
660 case "NivaTrunk":
661 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
662 }
663
664 return CarDoorState.DOORS_MISSING;
665 }
666
667 override bool CrewCanGetThrough(int posIdx)
668 {
670 switch (posIdx)
671 {
672 case 0:
673 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
674 return false;
675 else if (GetAnimationPhase("SeatDriver") > 0.5)
676 return false;
677
678 return true;
679
680 case 1:
681 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
682 return false;
683 else if (GetAnimationPhase("SeatCoDriver") > 0.5)
684 return false;
685
686 return true;
687
688 case 2:
689 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
690 return false;
691 else if (GetAnimationPhase("SeatDriver") <= 0.5)
692 return false;
693
694 return true;
695
696 case 3:
697 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
698 return false;
699 else if (GetAnimationPhase("SeatCoDriver") <= 0.5)
700 return false;
701
702 return true;
703 }
704
705 return false;
706 }
707
708 override string GetDoorSelectionNameFromSeatPos(int posIdx)
709 {
710 switch (posIdx)
711 {
712 case 0:
713 case 2:
714 return "doors_driver";
715 case 1:
716 case 3:
717 return "doors_codriver";
718 }
719
720 return super.GetDoorSelectionNameFromSeatPos(posIdx);
721 }
722
723 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
724 {
725 switch (posIdx)
726 {
727 case 0:
728 case 2:
729 return "NivaDriverDoors";
730 case 1:
731 case 3:
732 return "NivaCoDriverDoors";
733 }
734
735 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
736 }
737
738 // 0 full ambient and engine sound
739 // 1 zero ambient and engine sound
740 override float OnSound(CarSoundCtrl ctrl, float oldValue)
741 {
742 float tempCap = 0.0;
743
744 switch (ctrl)
745 {
746 case CarSoundCtrl.DOORS:
747 float newValue = 0;
748 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
749 newValue += 0.5;
750
751 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
752 newValue += 0.5;
753
754 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
755 newValue += 0.3;
756
757 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
758 newValue -= 0.6;
759
760 if (GetHealthLevel("WindowLR") == GameConstants.STATE_RUINED)
761 newValue -= 0.2;
762
763 if (GetHealthLevel("WindowRR") == GameConstants.STATE_RUINED)
764 newValue -= 0.2;
765
766 return Math.Clamp(newValue, 0, 1);
767 break;
768 }
769
770 return super.OnSound(ctrl, oldValue);
771 }
772
773 override string GetAnimSourceFromSelection(string selection)
774 {
775 switch (selection)
776 {
777 case "doors_driver":
778 return "DoorsDriver";
779 case "doors_codriver":
780 return "DoorsCoDriver";
781 case "doors_hood":
782 return "DoorsHood";
783 case "doors_trunk":
784 return "DoorsTrunk";
785 case "seatback_driver":
786 return "SeatDriver";
787 case "seatback_codriver":
788 return "SeatCoDriver";
789 }
790
791 return "";
792 }
793
794 override string GetDoorConditionPointFromSelection(string selection)
795 {
796 switch (selection)
797 {
798 case "seat_driver":
799 case "seatback_driver":
800 case "seat_cargo1":
801 return "seat_con_1_1";
802 case "seat_codriver":
803 case "seatback_codriver":
804 case "seat_cargo2":
805 return "seat_con_2_1";
806 }
807
808 return "";
809 }
810
811 override int GetCrewIndex(string selection)
812 {
813 switch (selection)
814 {
815 case "seatback_driver":
816 return 0;
817 case "seatback_codriver":
818 return 1;
819 }
820
821 return -1;
822 }
823
824 override bool IsVitalTruckBattery()
825 {
826 return false;
827 }
828
829 override bool IsVitalGlowPlug()
830 {
831 return false;
832 }
833
834 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
835 {
836 if (nextSeat == 0 && GetAnimationPhase("SeatDriver") > 0.5)
837 return false;
838
839 if (nextSeat == 1 && GetAnimationPhase("SeatCoDriver") > 0.5)
840 return false;
841
842 switch (currentSeat)
843 {
844 case 0:
845 return nextSeat == 1;
846
847 case 1:
848 return nextSeat == 0;
849
850 case 2:
851 return nextSeat == 3;
852
853 case 3:
854 return nextSeat == 2;
855 }
856
857 return false;
858 }
859
860 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
861 {
862 switch (pCurrentSeat)
863 {
864 case 0:
865 return pDoorsSelection == "DoorsDriver";
866
867 case 1:
868 return pDoorsSelection == "DoorsCoDriver";
869
870 case 2:
871 return pDoorsSelection == "DoorsDriver";
872
873 case 3:
874 return pDoorsSelection == "DoorsCoDriver";
875 }
876
877 return false;
878 }
879
880 override int GetSeatIndexFromDoor(string pDoorSelection)
881 {
882 switch (pDoorSelection)
883 {
884 case "DoorsDriver":
885 return 0;
886 case "DoorsCoDriver":
887 return 1;
888 }
889
890 return -1;
891 }
892
893 override void SetActions()
894 {
895 super.SetActions();
896
898 }
899
900 override void OnDebugSpawn()
901 {
905
906 GetInventory().CreateInInventory("HatchbackWheel");
907 GetInventory().CreateInInventory("HatchbackWheel");
908 GetInventory().CreateInInventory("HatchbackWheel");
909 GetInventory().CreateInInventory("HatchbackWheel");
910
911 GetInventory().CreateInInventory("HatchbackDoors_Driver");
912 GetInventory().CreateInInventory("HatchbackDoors_CoDriver");
913 GetInventory().CreateInInventory("HatchbackHood");
914 GetInventory().CreateInInventory("HatchbackTrunk");
915
916 //-----IN CAR CARGO
917 GetInventory().CreateInInventory("HatchbackWheel");
918 GetInventory().CreateInInventory("HatchbackWheel");
919 }
920}
921
923{
924 override void OnDebugSpawn()
925 {
929
930 GetInventory().CreateInInventory("HatchbackWheel");
931 GetInventory().CreateInInventory("HatchbackWheel");
932 GetInventory().CreateInInventory("HatchbackWheel");
933 GetInventory().CreateInInventory("HatchbackWheel");
934
935 GetInventory().CreateInInventory("HatchbackDoors_Driver_White");
936 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_White");
937 GetInventory().CreateInInventory("HatchbackHood_White");
938 GetInventory().CreateInInventory("HatchbackTrunk_White");
939
940 //-----IN CAR CARGO
941 GetInventory().CreateInInventory("HatchbackWheel");
942 GetInventory().CreateInInventory("HatchbackWheel");
943 }
944}
945
947{
948 override void OnDebugSpawn()
949 {
953
954 GetInventory().CreateInInventory("HatchbackWheel");
955 GetInventory().CreateInInventory("HatchbackWheel");
956 GetInventory().CreateInInventory("HatchbackWheel");
957 GetInventory().CreateInInventory("HatchbackWheel");
958
959 GetInventory().CreateInInventory("HatchbackDoors_Driver_Blue");
960 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_Blue");
961 GetInventory().CreateInInventory("HatchbackHood_Blue");
962 GetInventory().CreateInInventory("HatchbackTrunk_Blue");
963
964 //-----IN CAR CARGO
965 GetInventory().CreateInInventory("HatchbackWheel");
966 GetInventory().CreateInInventory("HatchbackWheel");
967 }
968}

◆ OnEngineStop()

override void OnDebugSpawn::OnEngineStop ( )
protected

Definition at line 493 of file OffroadHatchback.c.

494{
498
499 void OffroadHatchback()
500 {
501 //m_dmgContactCoef = 0.075;
502
503 m_EngineStartOK = "offroad_engine_start_SoundSet";
504 m_EngineStartBattery = "offroad_engine_failed_start_battery_SoundSet";
505 m_EngineStartPlug = "offroad_engine_failed_start_sparkplugs_SoundSet";
506 m_EngineStartFuel = "offroad_engine_failed_start_fuel_SoundSet";
507 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
508
509 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
510 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
511 m_CarSeatShiftInSound = "Offroad_SeatShiftIn_SoundSet";
512 m_CarSeatShiftOutSound = "Offroad_SeatShiftOut_SoundSet";
513
514 m_CarHornShortSoundName = "Offroad_Horn_Short_SoundSet";
515 m_CarHornLongSoundName = "Offroad_Horn_SoundSet";
516
517 SetEnginePos("0 0.7 1.2");
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;
530 m_UTSSettings.m_RangeFull = 0.5;
531 m_UTSSettings.m_RangeMax = 2;
532 m_UTSSettings.m_TemperatureCap = 25;
533
536 }
537 }
538
539 override void OnEngineStart()
540 {
541 super.OnEngineStart();
542
543 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
544 m_UTSource.SetDefferedActive(true, 20.0);
545 }
546
547 override void OnEngineStop()
548 {
549 super.OnEngineStop();
550
551 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
552 m_UTSource.SetDefferedActive(false, 10.0);
553 }
554
555 override void EOnPostSimulate(IEntity other, float timeSlice)
556 {
557 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
558 {
559 if (m_UTSource.IsActive())
561 }
562 }
563
564 override int GetAnimInstance()
565 {
566 return VehicleAnimInstances.HATCHBACK;
567 }
568
569 override float GetTransportCameraDistance()
570 {
571 return 3.5;
572 }
573
574 override int GetSeatAnimationType(int posIdx)
575 {
576 switch (posIdx)
577 {
578 case 0:
579 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
580 case 1:
581 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
582 case 2:
583 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
584 case 3:
585 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
586 }
587
588 return 0;
589
590 }
591
592
594 {
595 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackRearLight));
596 }
597
599 {
600 return CarLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackFrontLight));
601 }
602
604 {
605 if (!super.CanReleaseAttachment(attachment))
606 return false;
607
608 if (EngineIsOn() || GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
609 {
610 string attType = attachment.GetType();
611 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
612 return false;
613 }
614
615 return true;
616 }
617
618 override protected bool CanManipulateSpareWheel(string slotSelectionName)
619 {
620 return GetCarDoorsState("NivaHood") != CarDoorState.DOORS_CLOSED;
621 }
622
623 override bool CanDisplayAttachmentCategory(string category_name)
624 {
625 if (!super.CanDisplayAttachmentCategory(category_name))
626 return false;
627
628 category_name.ToLower();
629 if (category_name.Contains("engine"))
630 {
631 if (GetCarDoorsState("NivaHood") == 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("NivaTrunk") == 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 return CarDoorState.DOORS_MISSING;
656
657 switch (slotType)
658 {
659 case "NivaDriverDoors":
660 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
661
662 case "NivaCoDriverDoors":
663 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
664
665 case "NivaHood":
666 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
667
668 case "NivaTrunk":
669 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
670 }
671
672 return CarDoorState.DOORS_MISSING;
673 }
674
675 override bool CrewCanGetThrough(int posIdx)
676 {
678 switch (posIdx)
679 {
680 case 0:
681 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
682 return false;
683 else if (GetAnimationPhase("SeatDriver") > 0.5)
684 return false;
685
686 return true;
687
688 case 1:
689 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
690 return false;
691 else if (GetAnimationPhase("SeatCoDriver") > 0.5)
692 return false;
693
694 return true;
695
696 case 2:
697 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
698 return false;
699 else if (GetAnimationPhase("SeatDriver") <= 0.5)
700 return false;
701
702 return true;
703
704 case 3:
705 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
706 return false;
707 else if (GetAnimationPhase("SeatCoDriver") <= 0.5)
708 return false;
709
710 return true;
711 }
712
713 return false;
714 }
715
716 override string GetDoorSelectionNameFromSeatPos(int posIdx)
717 {
718 switch (posIdx)
719 {
720 case 0:
721 case 2:
722 return "doors_driver";
723 case 1:
724 case 3:
725 return "doors_codriver";
726 }
727
728 return super.GetDoorSelectionNameFromSeatPos(posIdx);
729 }
730
731 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
732 {
733 switch (posIdx)
734 {
735 case 0:
736 case 2:
737 return "NivaDriverDoors";
738 case 1:
739 case 3:
740 return "NivaCoDriverDoors";
741 }
742
743 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
744 }
745
746 // 0 full ambient and engine sound
747 // 1 zero ambient and engine sound
748 override float OnSound(CarSoundCtrl ctrl, float oldValue)
749 {
750 float tempCap = 0.0;
751
752 switch (ctrl)
753 {
754 case CarSoundCtrl.DOORS:
755 float newValue = 0;
756 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
757 newValue += 0.5;
758
759 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
760 newValue += 0.5;
761
762 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
763 newValue += 0.3;
764
765 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
766 newValue -= 0.6;
767
768 if (GetHealthLevel("WindowLR") == GameConstants.STATE_RUINED)
769 newValue -= 0.2;
770
771 if (GetHealthLevel("WindowRR") == GameConstants.STATE_RUINED)
772 newValue -= 0.2;
773
774 return Math.Clamp(newValue, 0, 1);
775 break;
776 }
777
778 return super.OnSound(ctrl, oldValue);
779 }
780
781 override string GetAnimSourceFromSelection(string selection)
782 {
783 switch (selection)
784 {
785 case "doors_driver":
786 return "DoorsDriver";
787 case "doors_codriver":
788 return "DoorsCoDriver";
789 case "doors_hood":
790 return "DoorsHood";
791 case "doors_trunk":
792 return "DoorsTrunk";
793 case "seatback_driver":
794 return "SeatDriver";
795 case "seatback_codriver":
796 return "SeatCoDriver";
797 }
798
799 return "";
800 }
801
802 override string GetDoorConditionPointFromSelection(string selection)
803 {
804 switch (selection)
805 {
806 case "seat_driver":
807 case "seatback_driver":
808 case "seat_cargo1":
809 return "seat_con_1_1";
810 case "seat_codriver":
811 case "seatback_codriver":
812 case "seat_cargo2":
813 return "seat_con_2_1";
814 }
815
816 return "";
817 }
818
819 override int GetCrewIndex(string selection)
820 {
821 switch (selection)
822 {
823 case "seatback_driver":
824 return 0;
825 case "seatback_codriver":
826 return 1;
827 }
828
829 return -1;
830 }
831
832 override bool IsVitalTruckBattery()
833 {
834 return false;
835 }
836
837 override bool IsVitalGlowPlug()
838 {
839 return false;
840 }
841
842 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
843 {
844 if (nextSeat == 0 && GetAnimationPhase("SeatDriver") > 0.5)
845 return false;
846
847 if (nextSeat == 1 && GetAnimationPhase("SeatCoDriver") > 0.5)
848 return false;
849
850 switch (currentSeat)
851 {
852 case 0:
853 return nextSeat == 1;
854
855 case 1:
856 return nextSeat == 0;
857
858 case 2:
859 return nextSeat == 3;
860
861 case 3:
862 return nextSeat == 2;
863 }
864
865 return false;
866 }
867
868 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
869 {
870 switch (pCurrentSeat)
871 {
872 case 0:
873 return pDoorsSelection == "DoorsDriver";
874
875 case 1:
876 return pDoorsSelection == "DoorsCoDriver";
877
878 case 2:
879 return pDoorsSelection == "DoorsDriver";
880
881 case 3:
882 return pDoorsSelection == "DoorsCoDriver";
883 }
884
885 return false;
886 }
887
888 override int GetSeatIndexFromDoor(string pDoorSelection)
889 {
890 switch (pDoorSelection)
891 {
892 case "DoorsDriver":
893 return 0;
894 case "DoorsCoDriver":
895 return 1;
896 }
897
898 return -1;
899 }
900
901 override void SetActions()
902 {
903 super.SetActions();
904
906 }
907
908 override void OnDebugSpawn()
909 {
913
914 GetInventory().CreateInInventory("HatchbackWheel");
915 GetInventory().CreateInInventory("HatchbackWheel");
916 GetInventory().CreateInInventory("HatchbackWheel");
917 GetInventory().CreateInInventory("HatchbackWheel");
918
919 GetInventory().CreateInInventory("HatchbackDoors_Driver");
920 GetInventory().CreateInInventory("HatchbackDoors_CoDriver");
921 GetInventory().CreateInInventory("HatchbackHood");
922 GetInventory().CreateInInventory("HatchbackTrunk");
923
924 //-----IN CAR CARGO
925 GetInventory().CreateInInventory("HatchbackWheel");
926 GetInventory().CreateInInventory("HatchbackWheel");
927 }
928}
929
931{
932 override void OnDebugSpawn()
933 {
937
938 GetInventory().CreateInInventory("HatchbackWheel");
939 GetInventory().CreateInInventory("HatchbackWheel");
940 GetInventory().CreateInInventory("HatchbackWheel");
941 GetInventory().CreateInInventory("HatchbackWheel");
942
943 GetInventory().CreateInInventory("HatchbackDoors_Driver_White");
944 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_White");
945 GetInventory().CreateInInventory("HatchbackHood_White");
946 GetInventory().CreateInInventory("HatchbackTrunk_White");
947
948 //-----IN CAR CARGO
949 GetInventory().CreateInInventory("HatchbackWheel");
950 GetInventory().CreateInInventory("HatchbackWheel");
951 }
952}
953
955{
956 override void OnDebugSpawn()
957 {
961
962 GetInventory().CreateInInventory("HatchbackWheel");
963 GetInventory().CreateInInventory("HatchbackWheel");
964 GetInventory().CreateInInventory("HatchbackWheel");
965 GetInventory().CreateInInventory("HatchbackWheel");
966
967 GetInventory().CreateInInventory("HatchbackDoors_Driver_Blue");
968 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_Blue");
969 GetInventory().CreateInInventory("HatchbackHood_Blue");
970 GetInventory().CreateInInventory("HatchbackTrunk_Blue");
971
972 //-----IN CAR CARGO
973 GetInventory().CreateInInventory("HatchbackWheel");
974 GetInventory().CreateInInventory("HatchbackWheel");
975 }
976}

◆ OnSound()

override float OnDebugSpawn::OnSound ( CarSoundCtrl ctrl,
float oldValue )
protected

Definition at line 694 of file OffroadHatchback.c.

695{
699
700 void OffroadHatchback()
701 {
702 //m_dmgContactCoef = 0.075;
703
704 m_EngineStartOK = "offroad_engine_start_SoundSet";
705 m_EngineStartBattery = "offroad_engine_failed_start_battery_SoundSet";
706 m_EngineStartPlug = "offroad_engine_failed_start_sparkplugs_SoundSet";
707 m_EngineStartFuel = "offroad_engine_failed_start_fuel_SoundSet";
708 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
709
710 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
711 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
712 m_CarSeatShiftInSound = "Offroad_SeatShiftIn_SoundSet";
713 m_CarSeatShiftOutSound = "Offroad_SeatShiftOut_SoundSet";
714
715 m_CarHornShortSoundName = "Offroad_Horn_Short_SoundSet";
716 m_CarHornLongSoundName = "Offroad_Horn_SoundSet";
717
718 SetEnginePos("0 0.7 1.2");
719 }
720
721 override void EEInit()
722 {
723 super.EEInit();
724
725 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
726 {
728 m_UTSSettings.m_ManualUpdate = true;
729 m_UTSSettings.m_TemperatureMin = 0;
730 m_UTSSettings.m_TemperatureMax = 30;
731 m_UTSSettings.m_RangeFull = 0.5;
732 m_UTSSettings.m_RangeMax = 2;
733 m_UTSSettings.m_TemperatureCap = 25;
734
737 }
738 }
739
740 override void OnEngineStart()
741 {
742 super.OnEngineStart();
743
744 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
745 m_UTSource.SetDefferedActive(true, 20.0);
746 }
747
748 override void OnEngineStop()
749 {
750 super.OnEngineStop();
751
752 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
753 m_UTSource.SetDefferedActive(false, 10.0);
754 }
755
756 override void EOnPostSimulate(IEntity other, float timeSlice)
757 {
758 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
759 {
760 if (m_UTSource.IsActive())
762 }
763 }
764
765 override int GetAnimInstance()
766 {
767 return VehicleAnimInstances.HATCHBACK;
768 }
769
770 override float GetTransportCameraDistance()
771 {
772 return 3.5;
773 }
774
775 override int GetSeatAnimationType(int posIdx)
776 {
777 switch (posIdx)
778 {
779 case 0:
780 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
781 case 1:
782 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
783 case 2:
784 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
785 case 3:
786 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
787 }
788
789 return 0;
790
791 }
792
793
795 {
796 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackRearLight));
797 }
798
800 {
801 return CarLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackFrontLight));
802 }
803
805 {
806 if (!super.CanReleaseAttachment(attachment))
807 return false;
808
809 if (EngineIsOn() || GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
810 {
811 string attType = attachment.GetType();
812 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
813 return false;
814 }
815
816 return true;
817 }
818
819 override protected bool CanManipulateSpareWheel(string slotSelectionName)
820 {
821 return GetCarDoorsState("NivaHood") != CarDoorState.DOORS_CLOSED;
822 }
823
824 override bool CanDisplayAttachmentCategory(string category_name)
825 {
826 if (!super.CanDisplayAttachmentCategory(category_name))
827 return false;
828
829 category_name.ToLower();
830 if (category_name.Contains("engine"))
831 {
832 if (GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
833 return false;
834 }
835
836 return true;
837 }
838
839 override bool CanDisplayCargo()
840 {
841 if (!super.CanDisplayCargo())
842 return false;
843
844 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
845 return false;
846
847 return true;
848 }
849
850 override int GetCarDoorsState(string slotType)
851 {
853
854 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
855 if (!carDoor)
856 return CarDoorState.DOORS_MISSING;
857
858 switch (slotType)
859 {
860 case "NivaDriverDoors":
861 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
862
863 case "NivaCoDriverDoors":
864 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
865
866 case "NivaHood":
867 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
868
869 case "NivaTrunk":
870 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
871 }
872
873 return CarDoorState.DOORS_MISSING;
874 }
875
876 override bool CrewCanGetThrough(int posIdx)
877 {
879 switch (posIdx)
880 {
881 case 0:
882 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
883 return false;
884 else if (GetAnimationPhase("SeatDriver") > 0.5)
885 return false;
886
887 return true;
888
889 case 1:
890 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
891 return false;
892 else if (GetAnimationPhase("SeatCoDriver") > 0.5)
893 return false;
894
895 return true;
896
897 case 2:
898 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
899 return false;
900 else if (GetAnimationPhase("SeatDriver") <= 0.5)
901 return false;
902
903 return true;
904
905 case 3:
906 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
907 return false;
908 else if (GetAnimationPhase("SeatCoDriver") <= 0.5)
909 return false;
910
911 return true;
912 }
913
914 return false;
915 }
916
917 override string GetDoorSelectionNameFromSeatPos(int posIdx)
918 {
919 switch (posIdx)
920 {
921 case 0:
922 case 2:
923 return "doors_driver";
924 case 1:
925 case 3:
926 return "doors_codriver";
927 }
928
929 return super.GetDoorSelectionNameFromSeatPos(posIdx);
930 }
931
932 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
933 {
934 switch (posIdx)
935 {
936 case 0:
937 case 2:
938 return "NivaDriverDoors";
939 case 1:
940 case 3:
941 return "NivaCoDriverDoors";
942 }
943
944 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
945 }
946
947 // 0 full ambient and engine sound
948 // 1 zero ambient and engine sound
949 override float OnSound(CarSoundCtrl ctrl, float oldValue)
950 {
951 float tempCap = 0.0;
952
953 switch (ctrl)
954 {
955 case CarSoundCtrl.DOORS:
956 float newValue = 0;
957 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
958 newValue += 0.5;
959
960 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
961 newValue += 0.5;
962
963 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
964 newValue += 0.3;
965
966 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
967 newValue -= 0.6;
968
969 if (GetHealthLevel("WindowLR") == GameConstants.STATE_RUINED)
970 newValue -= 0.2;
971
972 if (GetHealthLevel("WindowRR") == GameConstants.STATE_RUINED)
973 newValue -= 0.2;
974
975 return Math.Clamp(newValue, 0, 1);
976 break;
977 }
978
979 return super.OnSound(ctrl, oldValue);
980 }
981
982 override string GetAnimSourceFromSelection(string selection)
983 {
984 switch (selection)
985 {
986 case "doors_driver":
987 return "DoorsDriver";
988 case "doors_codriver":
989 return "DoorsCoDriver";
990 case "doors_hood":
991 return "DoorsHood";
992 case "doors_trunk":
993 return "DoorsTrunk";
994 case "seatback_driver":
995 return "SeatDriver";
996 case "seatback_codriver":
997 return "SeatCoDriver";
998 }
999
1000 return "";
1001 }
1002
1003 override string GetDoorConditionPointFromSelection(string selection)
1004 {
1005 switch (selection)
1006 {
1007 case "seat_driver":
1008 case "seatback_driver":
1009 case "seat_cargo1":
1010 return "seat_con_1_1";
1011 case "seat_codriver":
1012 case "seatback_codriver":
1013 case "seat_cargo2":
1014 return "seat_con_2_1";
1015 }
1016
1017 return "";
1018 }
1019
1020 override int GetCrewIndex(string selection)
1021 {
1022 switch (selection)
1023 {
1024 case "seatback_driver":
1025 return 0;
1026 case "seatback_codriver":
1027 return 1;
1028 }
1029
1030 return -1;
1031 }
1032
1033 override bool IsVitalTruckBattery()
1034 {
1035 return false;
1036 }
1037
1038 override bool IsVitalGlowPlug()
1039 {
1040 return false;
1041 }
1042
1043 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
1044 {
1045 if (nextSeat == 0 && GetAnimationPhase("SeatDriver") > 0.5)
1046 return false;
1047
1048 if (nextSeat == 1 && GetAnimationPhase("SeatCoDriver") > 0.5)
1049 return false;
1050
1051 switch (currentSeat)
1052 {
1053 case 0:
1054 return nextSeat == 1;
1055
1056 case 1:
1057 return nextSeat == 0;
1058
1059 case 2:
1060 return nextSeat == 3;
1061
1062 case 3:
1063 return nextSeat == 2;
1064 }
1065
1066 return false;
1067 }
1068
1069 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
1070 {
1071 switch (pCurrentSeat)
1072 {
1073 case 0:
1074 return pDoorsSelection == "DoorsDriver";
1075
1076 case 1:
1077 return pDoorsSelection == "DoorsCoDriver";
1078
1079 case 2:
1080 return pDoorsSelection == "DoorsDriver";
1081
1082 case 3:
1083 return pDoorsSelection == "DoorsCoDriver";
1084 }
1085
1086 return false;
1087 }
1088
1089 override int GetSeatIndexFromDoor(string pDoorSelection)
1090 {
1091 switch (pDoorSelection)
1092 {
1093 case "DoorsDriver":
1094 return 0;
1095 case "DoorsCoDriver":
1096 return 1;
1097 }
1098
1099 return -1;
1100 }
1101
1102 override void SetActions()
1103 {
1104 super.SetActions();
1105
1107 }
1108
1109 override void OnDebugSpawn()
1110 {
1114
1115 GetInventory().CreateInInventory("HatchbackWheel");
1116 GetInventory().CreateInInventory("HatchbackWheel");
1117 GetInventory().CreateInInventory("HatchbackWheel");
1118 GetInventory().CreateInInventory("HatchbackWheel");
1119
1120 GetInventory().CreateInInventory("HatchbackDoors_Driver");
1121 GetInventory().CreateInInventory("HatchbackDoors_CoDriver");
1122 GetInventory().CreateInInventory("HatchbackHood");
1123 GetInventory().CreateInInventory("HatchbackTrunk");
1124
1125 //-----IN CAR CARGO
1126 GetInventory().CreateInInventory("HatchbackWheel");
1127 GetInventory().CreateInInventory("HatchbackWheel");
1128 }
1129}
1130
1132{
1133 override void OnDebugSpawn()
1134 {
1138
1139 GetInventory().CreateInInventory("HatchbackWheel");
1140 GetInventory().CreateInInventory("HatchbackWheel");
1141 GetInventory().CreateInInventory("HatchbackWheel");
1142 GetInventory().CreateInInventory("HatchbackWheel");
1143
1144 GetInventory().CreateInInventory("HatchbackDoors_Driver_White");
1145 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_White");
1146 GetInventory().CreateInInventory("HatchbackHood_White");
1147 GetInventory().CreateInInventory("HatchbackTrunk_White");
1148
1149 //-----IN CAR CARGO
1150 GetInventory().CreateInInventory("HatchbackWheel");
1151 GetInventory().CreateInInventory("HatchbackWheel");
1152 }
1153}
1154
1156{
1157 override void OnDebugSpawn()
1158 {
1162
1163 GetInventory().CreateInInventory("HatchbackWheel");
1164 GetInventory().CreateInInventory("HatchbackWheel");
1165 GetInventory().CreateInInventory("HatchbackWheel");
1166 GetInventory().CreateInInventory("HatchbackWheel");
1167
1168 GetInventory().CreateInInventory("HatchbackDoors_Driver_Blue");
1169 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_Blue");
1170 GetInventory().CreateInInventory("HatchbackHood_Blue");
1171 GetInventory().CreateInInventory("HatchbackTrunk_Blue");
1172
1173 //-----IN CAR CARGO
1174 GetInventory().CreateInInventory("HatchbackWheel");
1175 GetInventory().CreateInInventory("HatchbackWheel");
1176 }
1177}

◆ SetActions()

override void OnDebugSpawn::SetActions ( )
protected

Definition at line 847 of file OffroadHatchback.c.

848{
852
853 void OffroadHatchback()
854 {
855 //m_dmgContactCoef = 0.075;
856
857 m_EngineStartOK = "offroad_engine_start_SoundSet";
858 m_EngineStartBattery = "offroad_engine_failed_start_battery_SoundSet";
859 m_EngineStartPlug = "offroad_engine_failed_start_sparkplugs_SoundSet";
860 m_EngineStartFuel = "offroad_engine_failed_start_fuel_SoundSet";
861 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
862
863 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
864 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
865 m_CarSeatShiftInSound = "Offroad_SeatShiftIn_SoundSet";
866 m_CarSeatShiftOutSound = "Offroad_SeatShiftOut_SoundSet";
867
868 m_CarHornShortSoundName = "Offroad_Horn_Short_SoundSet";
869 m_CarHornLongSoundName = "Offroad_Horn_SoundSet";
870
871 SetEnginePos("0 0.7 1.2");
872 }
873
874 override void EEInit()
875 {
876 super.EEInit();
877
878 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
879 {
881 m_UTSSettings.m_ManualUpdate = true;
882 m_UTSSettings.m_TemperatureMin = 0;
883 m_UTSSettings.m_TemperatureMax = 30;
884 m_UTSSettings.m_RangeFull = 0.5;
885 m_UTSSettings.m_RangeMax = 2;
886 m_UTSSettings.m_TemperatureCap = 25;
887
890 }
891 }
892
893 override void OnEngineStart()
894 {
895 super.OnEngineStart();
896
897 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
898 m_UTSource.SetDefferedActive(true, 20.0);
899 }
900
901 override void OnEngineStop()
902 {
903 super.OnEngineStop();
904
905 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
906 m_UTSource.SetDefferedActive(false, 10.0);
907 }
908
909 override void EOnPostSimulate(IEntity other, float timeSlice)
910 {
911 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
912 {
913 if (m_UTSource.IsActive())
915 }
916 }
917
918 override int GetAnimInstance()
919 {
920 return VehicleAnimInstances.HATCHBACK;
921 }
922
923 override float GetTransportCameraDistance()
924 {
925 return 3.5;
926 }
927
928 override int GetSeatAnimationType(int posIdx)
929 {
930 switch (posIdx)
931 {
932 case 0:
933 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
934 case 1:
935 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
936 case 2:
937 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
938 case 3:
939 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
940 }
941
942 return 0;
943
944 }
945
946
948 {
949 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackRearLight));
950 }
951
953 {
954 return CarLightBase.Cast(ScriptedLightBase.CreateLight(OffroadHatchbackFrontLight));
955 }
956
958 {
959 if (!super.CanReleaseAttachment(attachment))
960 return false;
961
962 if (EngineIsOn() || GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
963 {
964 string attType = attachment.GetType();
965 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
966 return false;
967 }
968
969 return true;
970 }
971
972 override protected bool CanManipulateSpareWheel(string slotSelectionName)
973 {
974 return GetCarDoorsState("NivaHood") != CarDoorState.DOORS_CLOSED;
975 }
976
977 override bool CanDisplayAttachmentCategory(string category_name)
978 {
979 if (!super.CanDisplayAttachmentCategory(category_name))
980 return false;
981
982 category_name.ToLower();
983 if (category_name.Contains("engine"))
984 {
985 if (GetCarDoorsState("NivaHood") == CarDoorState.DOORS_CLOSED)
986 return false;
987 }
988
989 return true;
990 }
991
992 override bool CanDisplayCargo()
993 {
994 if (!super.CanDisplayCargo())
995 return false;
996
997 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
998 return false;
999
1000 return true;
1001 }
1002
1003 override int GetCarDoorsState(string slotType)
1004 {
1006
1007 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
1008 if (!carDoor)
1009 return CarDoorState.DOORS_MISSING;
1010
1011 switch (slotType)
1012 {
1013 case "NivaDriverDoors":
1014 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
1015
1016 case "NivaCoDriverDoors":
1017 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
1018
1019 case "NivaHood":
1020 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
1021
1022 case "NivaTrunk":
1023 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
1024 }
1025
1026 return CarDoorState.DOORS_MISSING;
1027 }
1028
1029 override bool CrewCanGetThrough(int posIdx)
1030 {
1032 switch (posIdx)
1033 {
1034 case 0:
1035 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
1036 return false;
1037 else if (GetAnimationPhase("SeatDriver") > 0.5)
1038 return false;
1039
1040 return true;
1041
1042 case 1:
1043 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
1044 return false;
1045 else if (GetAnimationPhase("SeatCoDriver") > 0.5)
1046 return false;
1047
1048 return true;
1049
1050 case 2:
1051 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
1052 return false;
1053 else if (GetAnimationPhase("SeatDriver") <= 0.5)
1054 return false;
1055
1056 return true;
1057
1058 case 3:
1059 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
1060 return false;
1061 else if (GetAnimationPhase("SeatCoDriver") <= 0.5)
1062 return false;
1063
1064 return true;
1065 }
1066
1067 return false;
1068 }
1069
1070 override string GetDoorSelectionNameFromSeatPos(int posIdx)
1071 {
1072 switch (posIdx)
1073 {
1074 case 0:
1075 case 2:
1076 return "doors_driver";
1077 case 1:
1078 case 3:
1079 return "doors_codriver";
1080 }
1081
1082 return super.GetDoorSelectionNameFromSeatPos(posIdx);
1083 }
1084
1085 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
1086 {
1087 switch (posIdx)
1088 {
1089 case 0:
1090 case 2:
1091 return "NivaDriverDoors";
1092 case 1:
1093 case 3:
1094 return "NivaCoDriverDoors";
1095 }
1096
1097 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
1098 }
1099
1100 // 0 full ambient and engine sound
1101 // 1 zero ambient and engine sound
1102 override float OnSound(CarSoundCtrl ctrl, float oldValue)
1103 {
1104 float tempCap = 0.0;
1105
1106 switch (ctrl)
1107 {
1108 case CarSoundCtrl.DOORS:
1109 float newValue = 0;
1110 if (GetCarDoorsState("NivaDriverDoors") == CarDoorState.DOORS_CLOSED)
1111 newValue += 0.5;
1112
1113 if (GetCarDoorsState("NivaCoDriverDoors") == CarDoorState.DOORS_CLOSED)
1114 newValue += 0.5;
1115
1116 if (GetCarDoorsState("NivaTrunk") == CarDoorState.DOORS_CLOSED)
1117 newValue += 0.3;
1118
1119 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
1120 newValue -= 0.6;
1121
1122 if (GetHealthLevel("WindowLR") == GameConstants.STATE_RUINED)
1123 newValue -= 0.2;
1124
1125 if (GetHealthLevel("WindowRR") == GameConstants.STATE_RUINED)
1126 newValue -= 0.2;
1127
1128 return Math.Clamp(newValue, 0, 1);
1129 break;
1130 }
1131
1132 return super.OnSound(ctrl, oldValue);
1133 }
1134
1135 override string GetAnimSourceFromSelection(string selection)
1136 {
1137 switch (selection)
1138 {
1139 case "doors_driver":
1140 return "DoorsDriver";
1141 case "doors_codriver":
1142 return "DoorsCoDriver";
1143 case "doors_hood":
1144 return "DoorsHood";
1145 case "doors_trunk":
1146 return "DoorsTrunk";
1147 case "seatback_driver":
1148 return "SeatDriver";
1149 case "seatback_codriver":
1150 return "SeatCoDriver";
1151 }
1152
1153 return "";
1154 }
1155
1156 override string GetDoorConditionPointFromSelection(string selection)
1157 {
1158 switch (selection)
1159 {
1160 case "seat_driver":
1161 case "seatback_driver":
1162 case "seat_cargo1":
1163 return "seat_con_1_1";
1164 case "seat_codriver":
1165 case "seatback_codriver":
1166 case "seat_cargo2":
1167 return "seat_con_2_1";
1168 }
1169
1170 return "";
1171 }
1172
1173 override int GetCrewIndex(string selection)
1174 {
1175 switch (selection)
1176 {
1177 case "seatback_driver":
1178 return 0;
1179 case "seatback_codriver":
1180 return 1;
1181 }
1182
1183 return -1;
1184 }
1185
1186 override bool IsVitalTruckBattery()
1187 {
1188 return false;
1189 }
1190
1191 override bool IsVitalGlowPlug()
1192 {
1193 return false;
1194 }
1195
1196 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
1197 {
1198 if (nextSeat == 0 && GetAnimationPhase("SeatDriver") > 0.5)
1199 return false;
1200
1201 if (nextSeat == 1 && GetAnimationPhase("SeatCoDriver") > 0.5)
1202 return false;
1203
1204 switch (currentSeat)
1205 {
1206 case 0:
1207 return nextSeat == 1;
1208
1209 case 1:
1210 return nextSeat == 0;
1211
1212 case 2:
1213 return nextSeat == 3;
1214
1215 case 3:
1216 return nextSeat == 2;
1217 }
1218
1219 return false;
1220 }
1221
1222 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
1223 {
1224 switch (pCurrentSeat)
1225 {
1226 case 0:
1227 return pDoorsSelection == "DoorsDriver";
1228
1229 case 1:
1230 return pDoorsSelection == "DoorsCoDriver";
1231
1232 case 2:
1233 return pDoorsSelection == "DoorsDriver";
1234
1235 case 3:
1236 return pDoorsSelection == "DoorsCoDriver";
1237 }
1238
1239 return false;
1240 }
1241
1242 override int GetSeatIndexFromDoor(string pDoorSelection)
1243 {
1244 switch (pDoorSelection)
1245 {
1246 case "DoorsDriver":
1247 return 0;
1248 case "DoorsCoDriver":
1249 return 1;
1250 }
1251
1252 return -1;
1253 }
1254
1255 override void SetActions()
1256 {
1257 super.SetActions();
1258
1260 }
1261
1262 override void OnDebugSpawn()
1263 {
1267
1268 GetInventory().CreateInInventory("HatchbackWheel");
1269 GetInventory().CreateInInventory("HatchbackWheel");
1270 GetInventory().CreateInInventory("HatchbackWheel");
1271 GetInventory().CreateInInventory("HatchbackWheel");
1272
1273 GetInventory().CreateInInventory("HatchbackDoors_Driver");
1274 GetInventory().CreateInInventory("HatchbackDoors_CoDriver");
1275 GetInventory().CreateInInventory("HatchbackHood");
1276 GetInventory().CreateInInventory("HatchbackTrunk");
1277
1278 //-----IN CAR CARGO
1279 GetInventory().CreateInInventory("HatchbackWheel");
1280 GetInventory().CreateInInventory("HatchbackWheel");
1281 }
1282}
1283
1285{
1286 override void OnDebugSpawn()
1287 {
1291
1292 GetInventory().CreateInInventory("HatchbackWheel");
1293 GetInventory().CreateInInventory("HatchbackWheel");
1294 GetInventory().CreateInInventory("HatchbackWheel");
1295 GetInventory().CreateInInventory("HatchbackWheel");
1296
1297 GetInventory().CreateInInventory("HatchbackDoors_Driver_White");
1298 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_White");
1299 GetInventory().CreateInInventory("HatchbackHood_White");
1300 GetInventory().CreateInInventory("HatchbackTrunk_White");
1301
1302 //-----IN CAR CARGO
1303 GetInventory().CreateInInventory("HatchbackWheel");
1304 GetInventory().CreateInInventory("HatchbackWheel");
1305 }
1306}
1307
1309{
1310 override void OnDebugSpawn()
1311 {
1315
1316 GetInventory().CreateInInventory("HatchbackWheel");
1317 GetInventory().CreateInInventory("HatchbackWheel");
1318 GetInventory().CreateInInventory("HatchbackWheel");
1319 GetInventory().CreateInInventory("HatchbackWheel");
1320
1321 GetInventory().CreateInInventory("HatchbackDoors_Driver_Blue");
1322 GetInventory().CreateInInventory("HatchbackDoors_CoDriver_Blue");
1323 GetInventory().CreateInInventory("HatchbackHood_Blue");
1324 GetInventory().CreateInInventory("HatchbackTrunk_Blue");
1325
1326 //-----IN CAR CARGO
1327 GetInventory().CreateInInventory("HatchbackWheel");
1328 GetInventory().CreateInInventory("HatchbackWheel");
1329 }
1330}

Variable Documentation

◆ m_UTSLEngine

◆ m_UTSource

◆ m_UTSSettings

ref UniversalTemperatureSourceSettings m_UTSSettings
protected

Definition at line 442 of file OffroadHatchback.c.

Referenced by CarScript::EEInit(), CarScript::EOnPostSimulate(), and OnDebugSpawn().