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

Go to the source code of this file.

Classes

class  CarScript
 
class  Hatchback_02
 

Functions

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

Variables

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

Function Documentation

◆ CanDisplayAttachmentCategory()

override bool OnDebugSpawn::CanDisplayAttachmentCategory ( string category_name)
protected

Definition at line 498 of file Hatchback_02.c.

◆ CanDisplayCargo()

override bool OnDebugSpawn::CanDisplayCargo ( )
protected

Definition at line 515 of file Hatchback_02.c.

516{
520
521 void Hatchback_02()
522 {
523 //m_dmgContactCoef = 0.070;
524
525 m_EngineStartOK = "Hatchback_02_engine_start_SoundSet";
526 m_EngineStartBattery = "Hatchback_02_engine_failed_start_battery_SoundSet";
527 m_EngineStartPlug = "Hatchback_02_engine_failed_start_sparkplugs_SoundSet";
528 m_EngineStartFuel = "Hatchback_02_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
534 m_CarHornShortSoundName = "Hatchback_02_Horn_Short_SoundSet";
535 m_CarHornLongSoundName = "Hatchback_02_Horn_SoundSet";
536
537 SetEnginePos("0 0.7 1.4");
538 }
539
540 override void EEInit()
541 {
542 super.EEInit();
543
544 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
545 {
547 m_UTSSettings.m_ManualUpdate = true;
548 m_UTSSettings.m_TemperatureMin = 0;
549 m_UTSSettings.m_TemperatureMax = 30;
550 m_UTSSettings.m_RangeFull = 0.5;
551 m_UTSSettings.m_RangeMax = 2;
552 m_UTSSettings.m_TemperatureCap = 25;
553
556 }
557 }
558
559 override void OnEngineStart()
560 {
561 super.OnEngineStart();
562
563 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
564 m_UTSource.SetDefferedActive(true, 20.0);
565 }
566
567 override void OnEngineStop()
568 {
569 super.OnEngineStop();
570
571 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
572 m_UTSource.SetDefferedActive(false, 10.0);
573 }
574
575 override void EOnPostSimulate(IEntity other, float timeSlice)
576 {
577 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
578 {
579 if (m_UTSource.IsActive())
581 }
582 }
583
584 override int GetAnimInstance()
585 {
586 return VehicleAnimInstances.GOLF;
587 }
588
589 override int GetSeatAnimationType(int posIdx)
590 {
591 switch (posIdx)
592 {
593 case 0:
594 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
595 case 1:
596 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
597 case 2:
598 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
599 case 3:
600 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
601 }
602
603 return 0;
604 }
605
606 // Override for car-specific light type
608 {
609 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02RearLight));
610 }
611
612 // Override for car-specific light type
614 {
615 return CarLightBase.Cast(ScriptedLightBase.CreateLight(Hatchback_02FrontLight));
616 }
617
619 {
620 if (!super.CanReleaseAttachment(attachment))
621 return false;
622
623 if (EngineIsOn() || GetCarDoorsState("Hatchback_02_Hood") == CarDoorState.DOORS_CLOSED)
624 {
625 string attType = attachment.GetType();
626 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
627 return false;
628 }
629
630 return true;
631 }
632
633 override protected bool CanManipulateSpareWheel(string slotSelectionName)
634 {
635 return GetCarDoorsState("Hatchback_02_Trunk") != CarDoorState.DOORS_CLOSED;
636 }
637
638 override bool CanDisplayAttachmentCategory(string category_name)
639 {
640 //super
641 if (!super.CanDisplayAttachmentCategory(category_name))
642 return false;
643 //
644
645 category_name.ToLower();
646 if (category_name.Contains("engine"))
647 {
648 if (GetCarDoorsState("Hatchback_02_Hood") == 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("Hatchback_02_Trunk") == 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 "Hatchback_02_Door_1_1":
677 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
678
679 case "Hatchback_02_Door_2_1":
680 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
681
682 case "Hatchback_02_Door_1_2":
683 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
684
685 case "Hatchback_02_Door_2_2":
686 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
687
688 case "Hatchback_02_Hood":
689 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
690
691 case "Hatchback_02_Trunk":
692 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
693 }
694
695 return CarDoorState.DOORS_MISSING;
696 }
697
698
699 override bool CrewCanGetThrough(int posIdx)
700 {
701 switch (posIdx)
702 {
703 case 0:
704 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
705 return false;
706
707 return true;
708
709 case 1:
710 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
711 return false;
712
713 return true;
714
715 case 2:
716 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
717 return false;
718
719 return true;
720
721 case 3:
722 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
723 return false;
724
725 return true;
726 }
727
728 return false;
729 }
730
731 override string GetDoorSelectionNameFromSeatPos(int posIdx)
732 {
733 switch (posIdx)
734 {
735 case 0:
736 return "doors_driver";
737 break;
738 case 1:
739 return "doors_codriver";
740 break;
741 case 2:
742 return "doors_cargo1";
743 break;
744 case 3:
745 return "doors_cargo2";
746 break;
747 }
748
749 return super.GetDoorSelectionNameFromSeatPos(posIdx);
750 }
751
752 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
753 {
754 switch (posIdx)
755 {
756 case 0:
757 return "Hatchback_02_Door_1_1";
758 break;
759 case 1:
760 return "Hatchback_02_Door_2_1";
761 break;
762 case 2:
763 return "Hatchback_02_Door_1_2";
764 break;
765 case 3:
766 return "Hatchback_02_Door_2_2";
767 break;
768 }
769
770 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
771 }
772
773 override float OnSound(CarSoundCtrl ctrl, float oldValue)
774 {
775 switch (ctrl)
776 {
777 case CarSoundCtrl.DOORS:
778 float newValue = 0;
779 if (GetCarDoorsState("Hatchback_02_Door_1_1") == CarDoorState.DOORS_CLOSED)
780 newValue += 0.25;
781
782 if (GetCarDoorsState("Hatchback_02_Door_2_1") == CarDoorState.DOORS_CLOSED)
783 newValue += 0.25;
784
785 if (GetCarDoorsState("Hatchback_02_Door_1_2") == CarDoorState.DOORS_CLOSED)
786 newValue += 0.25;
787
788 if (GetCarDoorsState("Hatchback_02_Door_2_2") == CarDoorState.DOORS_CLOSED)
789 newValue += 0.25;
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_cargo1":
807 return "DoorsCargo1";
808 case "doors_cargo2":
809 return "DoorsCargo2";
810 case "doors_hood":
811 return "DoorsHood";
812 case "doors_trunk":
813 return "DoorsTrunk";
814 }
815
816 return "";
817 }
818
819
820 override bool IsVitalTruckBattery()
821 {
822 return false;
823 }
824
825 override bool IsVitalGlowPlug()
826 {
827 return false;
828 }
829
830 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
831 {
832 switch (currentSeat)
833 {
834 case 0:
835 return nextSeat == 1;
836 case 1:
837 return nextSeat == 0;
838 case 2:
839 return nextSeat == 3;
840 case 3:
841 return nextSeat == 2;
842 }
843
844 return false;
845 }
846
847 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
848 {
849 switch (pCurrentSeat)
850 {
851 case 0:
852 return pDoorsSelection == "DoorsDriver";
853 case 1:
854 return pDoorsSelection == "DoorsCoDriver";
855 case 2:
856 return pDoorsSelection == "DoorsCargo1";
857 case 3:
858 return pDoorsSelection == "DoorsCargo2";
859 }
860
861 return false;
862 }
863
864 override void OnDebugSpawn()
865 {
869
870 GetInventory().CreateInInventory("Hatchback_02_Wheel");
871 GetInventory().CreateInInventory("Hatchback_02_Wheel");
872 GetInventory().CreateInInventory("Hatchback_02_Wheel");
873 GetInventory().CreateInInventory("Hatchback_02_Wheel");
874
875 GetInventory().CreateInInventory("Hatchback_02_Door_1_1");
876 GetInventory().CreateInInventory("Hatchback_02_Door_1_2");
877 GetInventory().CreateInInventory("Hatchback_02_Door_2_1");
878 GetInventory().CreateInInventory("Hatchback_02_Door_2_2");
879 GetInventory().CreateInInventory("Hatchback_02_Hood");
880 GetInventory().CreateInInventory("Hatchback_02_Trunk");
881
882 //-----IN CAR CARGO
883 GetInventory().CreateInInventory("Hatchback_02_Wheel");
884 GetInventory().CreateInInventory("Hatchback_02_Wheel");
885 }
886}
887
889{
890 override void OnDebugSpawn()
891 {
895
896 GetInventory().CreateInInventory("Hatchback_02_Wheel");
897 GetInventory().CreateInInventory("Hatchback_02_Wheel");
898 GetInventory().CreateInInventory("Hatchback_02_Wheel");
899 GetInventory().CreateInInventory("Hatchback_02_Wheel");
900
901 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Black");
902 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Black");
903 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Black");
904 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Black");
905 GetInventory().CreateInInventory("Hatchback_02_Hood_Black");
906 GetInventory().CreateInInventory("Hatchback_02_Trunk_Black");
907
908 //-----IN CAR CARGO
909 GetInventory().CreateInInventory("Hatchback_02_Wheel");
910 GetInventory().CreateInInventory("Hatchback_02_Wheel");
911 }
912};
913
915{
916 override void OnDebugSpawn()
917 {
921
922 GetInventory().CreateInInventory("Hatchback_02_Wheel");
923 GetInventory().CreateInInventory("Hatchback_02_Wheel");
924 GetInventory().CreateInInventory("Hatchback_02_Wheel");
925 GetInventory().CreateInInventory("Hatchback_02_Wheel");
926
927 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Blue");
928 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Blue");
929 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Blue");
930 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Blue");
931 GetInventory().CreateInInventory("Hatchback_02_Hood_Blue");
932 GetInventory().CreateInInventory("Hatchback_02_Trunk_Blue");
933
934 //-----IN CAR CARGO
935 GetInventory().CreateInInventory("Hatchback_02_Wheel");
936 GetInventory().CreateInInventory("Hatchback_02_Wheel");
937 }
938}
CarSoundCtrl
Car's sound controller list. (native, do not change or extend)
Definition Car.c:4
void SpawnUniversalParts()
Definition CarScript.c:2516
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_CarDoorOpenSound
Definition CarScript.c:213
class Hatchback_02_Blue extends Hatchback_02 OnDebugSpawn
ref UniversalTemperatureSourceSettings m_UTSSettings
override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
override string GetAnimSourceFromSelection(string selection)
override int GetSeatAnimationType(int posIdx)
override float OnSound(CarSoundCtrl ctrl, float oldValue)
void Hatchback_02()
override string GetDoorInvSlotNameFromSeatPos(int posIdx)
override void EOnPostSimulate(IEntity other, float timeSlice)
override void OnEngineStop()
ref UniversalTemperatureSourceLambdaEngine m_UTSLEngine
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()
override bool IsVitalTruckBattery()
override string GetDoorSelectionNameFromSeatPos(int posIdx)
override int GetCarDoorsState(string slotType)
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.
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 493 of file Hatchback_02.c.

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

◆ CanReachDoorsFromSeat()

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

Definition at line 707 of file Hatchback_02.c.

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

◆ CanReachSeatFromSeat()

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

Definition at line 690 of file Hatchback_02.c.

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

◆ CanReleaseAttachment()

override bool OnDebugSpawn::CanReleaseAttachment ( EntityAI attachment)
protected

Definition at line 478 of file Hatchback_02.c.

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

◆ CreateFrontLight()

override CarLightBase OnDebugSpawn::CreateFrontLight ( )
protected

Definition at line 473 of file Hatchback_02.c.

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

◆ CreateRearLight()

override CarRearLightBase OnDebugSpawn::CreateRearLight ( )
protected

Definition at line 467 of file Hatchback_02.c.

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

◆ CrewCanGetThrough()

override bool OnDebugSpawn::CrewCanGetThrough ( int posIdx)
protected

Definition at line 559 of file Hatchback_02.c.

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

◆ EEInit()

override void OnDebugSpawn::EEInit ( )
protected

Definition at line 400 of file Hatchback_02.c.

401{
402 override void OnDebugSpawn()
403 {
407
408 GetInventory().CreateInInventory("Hatchback_02_Wheel");
409 GetInventory().CreateInInventory("Hatchback_02_Wheel");
410 GetInventory().CreateInInventory("Hatchback_02_Wheel");
411 GetInventory().CreateInInventory("Hatchback_02_Wheel");
412
413 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Blue");
414 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Blue");
415 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Blue");
416 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Blue");
417 GetInventory().CreateInInventory("Hatchback_02_Hood_Blue");

◆ EOnPostSimulate()

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

Definition at line 435 of file Hatchback_02.c.

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

◆ GetAnimInstance()

override int OnDebugSpawn::GetAnimInstance ( )
protected

Definition at line 444 of file Hatchback_02.c.

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

◆ GetAnimSourceFromSelection()

override string OnDebugSpawn::GetAnimSourceFromSelection ( string selection)
protected

Definition at line 658 of file Hatchback_02.c.

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

◆ GetCarDoorsState()

override int OnDebugSpawn::GetCarDoorsState ( string slotType)
protected

Definition at line 526 of file Hatchback_02.c.

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

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

◆ GetDoorInvSlotNameFromSeatPos()

override string OnDebugSpawn::GetDoorInvSlotNameFromSeatPos ( int posIdx)
protected

Definition at line 612 of file Hatchback_02.c.

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

◆ GetDoorSelectionNameFromSeatPos()

override string OnDebugSpawn::GetDoorSelectionNameFromSeatPos ( int posIdx)
protected

Definition at line 591 of file Hatchback_02.c.

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

◆ GetSeatAnimationType()

override int OnDebugSpawn::GetSeatAnimationType ( int posIdx)
protected

Definition at line 449 of file Hatchback_02.c.

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

◆ Hatchback_02()

void OnDebugSpawn::Hatchback_02 ( )
protected

Definition at line 381 of file Hatchback_02.c.

◆ IsVitalGlowPlug()

override bool OnDebugSpawn::IsVitalGlowPlug ( )
protected

Definition at line 685 of file Hatchback_02.c.

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

◆ IsVitalTruckBattery()

override bool OnDebugSpawn::IsVitalTruckBattery ( )
protected

Definition at line 680 of file Hatchback_02.c.

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

◆ OnEngineStart()

override void OnDebugSpawn::OnEngineStart ( )
protected

Definition at line 419 of file Hatchback_02.c.

◆ OnEngineStop()

override void OnDebugSpawn::OnEngineStop ( )
protected

Definition at line 427 of file Hatchback_02.c.

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

◆ OnSound()

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

Definition at line 633 of file Hatchback_02.c.

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

Variable Documentation

◆ m_UTSLEngine

Definition at line 379 of file Hatchback_02.c.

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

◆ m_UTSource

◆ m_UTSSettings

ref UniversalTemperatureSourceSettings m_UTSSettings
protected

Definition at line 378 of file Hatchback_02.c.

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

◆ OnDebugSpawn

override void OnDebugSpawn

Definition at line 1 of file Hatchback_02.c.

377 {
381
382 GetInventory().CreateInInventory("Hatchback_02_Wheel");
383 GetInventory().CreateInInventory("Hatchback_02_Wheel");
384 GetInventory().CreateInInventory("Hatchback_02_Wheel");
385 GetInventory().CreateInInventory("Hatchback_02_Wheel");
386
387 GetInventory().CreateInInventory("Hatchback_02_Door_1_1_Black");
388 GetInventory().CreateInInventory("Hatchback_02_Door_1_2_Black");
389 GetInventory().CreateInInventory("Hatchback_02_Door_2_1_Black");
390 GetInventory().CreateInInventory("Hatchback_02_Door_2_2_Black");
391 GetInventory().CreateInInventory("Hatchback_02_Hood_Black");
392 GetInventory().CreateInInventory("Hatchback_02_Trunk_Black");
393
394 //-----IN CAR CARGO
395 GetInventory().CreateInInventory("Hatchback_02_Wheel");
396 GetInventory().CreateInInventory("Hatchback_02_Wheel");
397 }

Referenced by Entity::OnDebugSpawnEx().