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

Go to the source code of this file.

Classes

class  CarScript
 
class  CivilianSedan
 

Functions

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

Variables

ref UniversalTemperatureSource m_UTSource
 
ref UniversalTemperatureSourceSettings m_UTSSettings
 
ref UniversalTemperatureSourceLambdaEngine m_UTSLEngine
 

Function Documentation

◆ CanDisplayAttachmentCategory()

override bool OnDebugSpawn::CanDisplayAttachmentCategory ( string category_name)
protected

Definition at line 538 of file CivilianSedan.c.

◆ CanDisplayCargo()

override bool OnDebugSpawn::CanDisplayCargo ( )
protected

Definition at line 555 of file CivilianSedan.c.

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

◆ CanManipulateSpareWheel()

bool OnDebugSpawn::CanManipulateSpareWheel ( string slotSelectionName)
protected

Definition at line 533 of file CivilianSedan.c.

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

◆ CanReachDoorsFromSeat()

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

Definition at line 767 of file CivilianSedan.c.

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

◆ CanReachSeatFromSeat()

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

Definition at line 747 of file CivilianSedan.c.

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

◆ CanReleaseAttachment()

override bool OnDebugSpawn::CanReleaseAttachment ( EntityAI attachment)
protected

Definition at line 517 of file CivilianSedan.c.

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

◆ CivilianSedan()

void OnDebugSpawn::CivilianSedan ( )
protected

Definition at line 415 of file CivilianSedan.c.

◆ CreateFrontLight()

override CarLightBase OnDebugSpawn::CreateFrontLight ( )
protected

Definition at line 506 of file CivilianSedan.c.

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

◆ CreateRearLight()

override CarRearLightBase OnDebugSpawn::CreateRearLight ( )
protected

Definition at line 512 of file CivilianSedan.c.

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

◆ CrewCanGetThrough()

override bool OnDebugSpawn::CrewCanGetThrough ( int posIdx)
protected

Definition at line 605 of file CivilianSedan.c.

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

◆ EEInit()

override void OnDebugSpawn::EEInit ( )
protected

Definition at line 434 of file CivilianSedan.c.

435{
436 override void OnDebugSpawn()
437 {
441
442 GetInventory().CreateInInventory("CivSedanWheel");
443 GetInventory().CreateInInventory("CivSedanWheel");
444 GetInventory().CreateInInventory("CivSedanWheel");
445 GetInventory().CreateInInventory("CivSedanWheel");
446
447 GetInventory().CreateInInventory("CivSedanDoors_Driver_Black");
448 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Black");
449 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Black");
450 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Black");
451 GetInventory().CreateInInventory("CivSedanHood_Black");

◆ EOnPostSimulate()

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

Definition at line 469 of file CivilianSedan.c.

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

◆ GetAnimInstance()

override int OnDebugSpawn::GetAnimInstance ( )
protected

Definition at line 478 of file CivilianSedan.c.

479{
483
484 void CivilianSedan()
485 {
486 //m_dmgContactCoef = 0.065;
487
488 m_EngineStartOK = "CivilianSedan_engine_start_SoundSet";
489 m_EngineStartBattery = "CivilianSedan_engine_failed_start_battery_SoundSet";
490 m_EngineStartPlug = "CivilianSedan_engine_failed_start_sparkplugs_SoundSet";
491 m_EngineStartFuel = "CivilianSedan_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 = "CivilianSedan_Horn_Short_SoundSet";
498 m_CarHornLongSoundName = "CivilianSedan_Horn_SoundSet";
499
500 SetEnginePos("0 0.7 1.6");
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.SEDAN;
550 }
551
552 override float GetTransportCameraDistance()
553 {
554 return 4.5;
555 }
556
557 override int GetSeatAnimationType(int posIdx)
558 {
559 switch (posIdx)
560 {
561 case 0:
562 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
563 case 1:
564 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
565 case 2:
566 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
567 case 3:
568 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
569 }
570
571 return 0;
572 }
573
574 // Override for car-specific light type
576 {
577 return CarLightBase.Cast(ScriptedLightBase.CreateLight(CivilianSedanFrontLight));
578 }
579
580 // Override for car-specific light type
582 {
583 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(CivilianSedanRearLight));
584 }
585
587 {
588 if (!super.CanReleaseAttachment(attachment))
589 return false;
590
591 string attType = attachment.GetType();
592
593 if (EngineIsOn() || GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED)
594 {
595 if (attType == "CarRadiator" || attType == "CarBattery" || attType == "SparkPlug")
596 return false;
597 }
598
599 return true;
600 }
601
602 override protected bool CanManipulateSpareWheel(string slotSelectionName)
603 {
604 return GetCarDoorsState("CivSedanTrunk") != CarDoorState.DOORS_CLOSED;
605 }
606
607 override bool CanDisplayAttachmentCategory(string category_name)
608 {
609 //super
610 if (!super.CanDisplayAttachmentCategory(category_name))
611 return false;
612 //
613
614 category_name.ToLower();
615 if (category_name.Contains("engine"))
616 {
617 if (GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED)
618 return false;
619 }
620
621 return true;
622 }
623
624 override bool CanDisplayCargo()
625 {
626 if (!super.CanDisplayCargo())
627 return false;
628
629 if (GetCarDoorsState("CivSedanTrunk") == CarDoorState.DOORS_CLOSED)
630 return false;
631
632 return true;
633 }
634
635 override int GetCarDoorsState(string slotType)
636 {
638
639 Class.CastTo(carDoor, FindAttachmentBySlotName(slotType));
640 if (!carDoor)
641 return CarDoorState.DOORS_MISSING;
642
643 switch (slotType)
644 {
645 case "CivSedanDriverDoors":
646 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
647 break;
648
649 case "CivSedanCoDriverDoors":
650 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
651 break;
652
653 case "CivSedanCargo1Doors":
654 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
655 break;
656
657 case "CivSedanCargo2Doors":
658 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
659 break;
660
661 case "CivSedanTrunk":
662 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
663 break;
664
665 case "CivSedanHood":
666 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
667 break;
668 }
669
670 return CarDoorState.DOORS_MISSING;
671 }
672
673
674 override bool CrewCanGetThrough(int posIdx)
675 {
676 switch (posIdx)
677 {
678 case 0:
679 if (GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED)
680 return false;
681
682 return true;
683 break;
684
685 case 1:
686 if (GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED)
687 return false;
688
689 return true;
690 break;
691
692 case 2:
693 if (GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED)
694 return false;
695
696 return true;
697 break;
698
699 case 3:
700 if (GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED)
701 return false;
702
703 return true;
704 break;
705 }
706
707 return false;
708 }
709
710 override string GetDoorSelectionNameFromSeatPos(int posIdx)
711 {
712 switch (posIdx)
713 {
714 case 0:
715 return "doors_driver";
716 break;
717 case 1:
718 return "doors_codriver";
719 break;
720 case 2:
721 return "doors_cargo1";
722 break;
723 case 3:
724 return "doors_cargo2";
725 break;
726 }
727
728 return super.GetDoorSelectionNameFromSeatPos(posIdx);
729 }
730
731 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
732 {
733 switch (posIdx)
734 {
735 case 0:
736 return "CivSedanDriverDoors";
737 break;
738 case 1:
739 return "CivSedanCoDriverDoors";
740 break;
741 case 2:
742 return "CivSedanCargo1Doors";
743 break;
744 case 3:
745 return "CivSedanCargo2Doors";
746 break;
747 }
748
749 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
750 }
751
752 // 0 full ambient and engine sound
753 // 1 zero ambient and engine sound
754 override float OnSound(CarSoundCtrl ctrl, float oldValue)
755 {
756 switch (ctrl)
757 {
758 case CarSoundCtrl.DOORS:
759 float newValue = 0;
760 if (GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED)
761 newValue += 0.25;
762
763 if (GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED)
764 newValue += 0.25;
765
766 if (GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED)
767 newValue += 0.25;
768
769 if (GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED)
770 newValue += 0.25;
771
772 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
773 newValue -= 0.6;
774
775 if (GetHealthLevel("WindowBack") == GameConstants.STATE_RUINED)
776 newValue -= 0.6;
777
778 return Math.Clamp(newValue, 0, 1);
779 break;
780 }
781
782 return super.OnSound(ctrl, oldValue);
783 }
784
785 override string GetAnimSourceFromSelection(string selection)
786 {
787 switch (selection)
788 {
789 case "doors_driver":
790 return "DoorsDriver";
791 case "doors_codriver":
792 return "DoorsCoDriver";
793 case "doors_cargo1":
794 return "DoorsCargo1";
795 case "doors_cargo2":
796 return "DoorsCargo2";
797 case "doors_hood":
798 return "DoorsHood";
799 case "doors_trunk":
800 return "DoorsTrunk";
801 }
802
803 return "";
804 }
805
806 override bool IsVitalTruckBattery()
807 {
808 return false;
809 }
810
811 override bool IsVitalGlowPlug()
812 {
813 return false;
814 }
815
816 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
817 {
818 switch (currentSeat)
819 {
820 case 0:
821 return nextSeat == 1;
822
823 case 1:
824 return nextSeat == 0;
825
826 case 2:
827 return nextSeat == 3;
828
829 case 3:
830 return nextSeat == 2;
831 }
832
833 return false;
834 }
835
836 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
837 {
838 switch (pCurrentSeat)
839 {
840 case 0:
841 return pDoorsSelection == "DoorsDriver";
842
843 case 1:
844 return pDoorsSelection == "DoorsCoDriver";
845
846 case 2:
847 return pDoorsSelection == "DoorsCargo1";
848
849 case 3:
850 return pDoorsSelection == "DoorsCargo2";
851 }
852
853 return false;
854 }
855
856 override void OnDebugSpawn()
857 {
861
862 GetInventory().CreateInInventory("CivSedanWheel");
863 GetInventory().CreateInInventory("CivSedanWheel");
864 GetInventory().CreateInInventory("CivSedanWheel");
865 GetInventory().CreateInInventory("CivSedanWheel");
866
867 GetInventory().CreateInInventory("CivSedanDoors_Driver");
868 GetInventory().CreateInInventory("CivSedanDoors_CoDriver");
869 GetInventory().CreateInInventory("CivSedanDoors_BackLeft");
870 GetInventory().CreateInInventory("CivSedanDoors_BackRight");
871 GetInventory().CreateInInventory("CivSedanHood");
872 GetInventory().CreateInInventory("CivSedanTrunk");
873
874 //-----IN CAR CARGO
875 GetInventory().CreateInInventory("CivSedanWheel");
876 GetInventory().CreateInInventory("CivSedanWheel");
877 }
878
879 override float GetPushForceCoefficientMultiplier()
880 {
881 return 1.5;
882 }
883}
884
886{
887 override void OnDebugSpawn()
888 {
892
893 GetInventory().CreateInInventory("CivSedanWheel");
894 GetInventory().CreateInInventory("CivSedanWheel");
895 GetInventory().CreateInInventory("CivSedanWheel");
896 GetInventory().CreateInInventory("CivSedanWheel");
897
898 GetInventory().CreateInInventory("CivSedanDoors_Driver_Wine");
899 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Wine");
900 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Wine");
901 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Wine");
902 GetInventory().CreateInInventory("CivSedanHood_Wine");
903 GetInventory().CreateInInventory("CivSedanTrunk_Wine");
904
905 //-----IN CAR CARGO
906 GetInventory().CreateInInventory("CivSedanWheel");
907 GetInventory().CreateInInventory("CivSedanWheel");
908 }
909}
910
912{
913 override void OnDebugSpawn()
914 {
918
919 GetInventory().CreateInInventory("CivSedanWheel");
920 GetInventory().CreateInInventory("CivSedanWheel");
921 GetInventory().CreateInInventory("CivSedanWheel");
922 GetInventory().CreateInInventory("CivSedanWheel");
923
924 GetInventory().CreateInInventory("CivSedanDoors_Driver_Black");
925 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Black");
926 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Black");
927 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Black");
928 GetInventory().CreateInInventory("CivSedanHood_Black");
929 GetInventory().CreateInInventory("CivSedanTrunk_Black");
930
931 //-----IN CAR CARGO
932 GetInventory().CreateInInventory("CivSedanWheel");
933 GetInventory().CreateInInventory("CivSedanWheel");
934 }
935}

◆ GetAnimSourceFromSelection()

override string OnDebugSpawn::GetAnimSourceFromSelection ( string selection)
protected

Definition at line 716 of file CivilianSedan.c.

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

◆ GetCarDoorsState()

override int OnDebugSpawn::GetCarDoorsState ( string slotType)
protected

Definition at line 566 of file CivilianSedan.c.

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

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 662 of file CivilianSedan.c.

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

◆ GetDoorSelectionNameFromSeatPos()

override string OnDebugSpawn::GetDoorSelectionNameFromSeatPos ( int posIdx)
protected

Definition at line 641 of file CivilianSedan.c.

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

◆ GetPushForceCoefficientMultiplier()

override float OnDebugSpawn::GetPushForceCoefficientMultiplier ( )
protected

Definition at line 810 of file CivilianSedan.c.

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

◆ GetSeatAnimationType()

override int OnDebugSpawn::GetSeatAnimationType ( int posIdx)
protected

Definition at line 488 of file CivilianSedan.c.

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

◆ GetTransportCameraDistance()

override float OnDebugSpawn::GetTransportCameraDistance ( )
protected

Definition at line 483 of file CivilianSedan.c.

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

◆ IsVitalGlowPlug()

override bool OnDebugSpawn::IsVitalGlowPlug ( )
protected

Definition at line 742 of file CivilianSedan.c.

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

◆ IsVitalTruckBattery()

override bool OnDebugSpawn::IsVitalTruckBattery ( )
protected

Definition at line 737 of file CivilianSedan.c.

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

◆ OnDebugSpawn()

Definition at line 1 of file CivilianSedan.c.

411 {
415
416 GetInventory().CreateInInventory("CivSedanWheel");
417 GetInventory().CreateInInventory("CivSedanWheel");
418 GetInventory().CreateInInventory("CivSedanWheel");
419 GetInventory().CreateInInventory("CivSedanWheel");
420
421 GetInventory().CreateInInventory("CivSedanDoors_Driver_Wine");
422 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Wine");
423 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Wine");
424 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Wine");
425 GetInventory().CreateInInventory("CivSedanHood_Wine");
426 GetInventory().CreateInInventory("CivSedanTrunk_Wine");
427
428 //-----IN CAR CARGO
429 GetInventory().CreateInInventory("CivSedanWheel");
430 GetInventory().CreateInInventory("CivSedanWheel");
431 }

◆ OnEngineStart()

override void OnDebugSpawn::OnEngineStart ( )
protected

Definition at line 453 of file CivilianSedan.c.

◆ OnEngineStop()

override void OnDebugSpawn::OnEngineStop ( )
protected

Definition at line 461 of file CivilianSedan.c.

462{
466
467 void CivilianSedan()
468 {
469 //m_dmgContactCoef = 0.065;
470
471 m_EngineStartOK = "CivilianSedan_engine_start_SoundSet";
472 m_EngineStartBattery = "CivilianSedan_engine_failed_start_battery_SoundSet";
473 m_EngineStartPlug = "CivilianSedan_engine_failed_start_sparkplugs_SoundSet";
474 m_EngineStartFuel = "CivilianSedan_engine_failed_start_fuel_SoundSet";
475 m_EngineStopFuel = "offroad_engine_stop_fuel_SoundSet";
476
477 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
478 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
479
480 m_CarHornShortSoundName = "CivilianSedan_Horn_Short_SoundSet";
481 m_CarHornLongSoundName = "CivilianSedan_Horn_SoundSet";
482
483 SetEnginePos("0 0.7 1.6");
484 }
485
486 override void EEInit()
487 {
488 super.EEInit();
489
490 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
491 {
493 m_UTSSettings.m_ManualUpdate = true;
494 m_UTSSettings.m_TemperatureMin = 0;
495 m_UTSSettings.m_TemperatureMax = 30;
496 m_UTSSettings.m_RangeFull = 0.5;
497 m_UTSSettings.m_RangeMax = 2;
498 m_UTSSettings.m_TemperatureCap = 25;
499
502 }
503 }
504
505 override void OnEngineStart()
506 {
507 super.OnEngineStart();
508
509 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
510 m_UTSource.SetDefferedActive(true, 20.0);
511 }
512
513 override void OnEngineStop()
514 {
515 super.OnEngineStop();
516
517 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
518 m_UTSource.SetDefferedActive(false, 10.0);
519 }
520
521 override void EOnPostSimulate(IEntity other, float timeSlice)
522 {
523 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
524 {
525 if (m_UTSource.IsActive())
527 }
528 }
529
530 override int GetAnimInstance()
531 {
532 return VehicleAnimInstances.SEDAN;
533 }
534
535 override float GetTransportCameraDistance()
536 {
537 return 4.5;
538 }
539
540 override int GetSeatAnimationType(int posIdx)
541 {
542 switch (posIdx)
543 {
544 case 0:
545 return DayZPlayerConstants.VEHICLESEAT_DRIVER;
546 case 1:
547 return DayZPlayerConstants.VEHICLESEAT_CODRIVER;
548 case 2:
549 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_L;
550 case 3:
551 return DayZPlayerConstants.VEHICLESEAT_PASSENGER_R;
552 }
553
554 return 0;
555 }
556
557 // Override for car-specific light type
559 {
560 return CarLightBase.Cast(ScriptedLightBase.CreateLight(CivilianSedanFrontLight));
561 }
562
563 // Override for car-specific light type
565 {
566 return CarRearLightBase.Cast(ScriptedLightBase.CreateLight(CivilianSedanRearLight));
567 }
568
570 {
571 if (!super.CanReleaseAttachment(attachment))
572 return false;
573
574 string attType = attachment.GetType();
575
576 if (EngineIsOn() || GetCarDoorsState("CivSedanHood") == CarDoorState.DOORS_CLOSED)
577 {
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("CivSedanTrunk") != 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("CivSedanHood") == 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("CivSedanTrunk") == 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 "CivSedanDriverDoors":
629 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
630 break;
631
632 case "CivSedanCoDriverDoors":
633 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
634 break;
635
636 case "CivSedanCargo1Doors":
637 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
638 break;
639
640 case "CivSedanCargo2Doors":
641 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
642 break;
643
644 case "CivSedanTrunk":
645 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
646 break;
647
648 case "CivSedanHood":
649 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
650 break;
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("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED)
663 return false;
664
665 return true;
666 break;
667
668 case 1:
669 if (GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED)
670 return false;
671
672 return true;
673 break;
674
675 case 2:
676 if (GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED)
677 return false;
678
679 return true;
680 break;
681
682 case 3:
683 if (GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED)
684 return false;
685
686 return true;
687 break;
688 }
689
690 return false;
691 }
692
693 override string GetDoorSelectionNameFromSeatPos(int posIdx)
694 {
695 switch (posIdx)
696 {
697 case 0:
698 return "doors_driver";
699 break;
700 case 1:
701 return "doors_codriver";
702 break;
703 case 2:
704 return "doors_cargo1";
705 break;
706 case 3:
707 return "doors_cargo2";
708 break;
709 }
710
711 return super.GetDoorSelectionNameFromSeatPos(posIdx);
712 }
713
714 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
715 {
716 switch (posIdx)
717 {
718 case 0:
719 return "CivSedanDriverDoors";
720 break;
721 case 1:
722 return "CivSedanCoDriverDoors";
723 break;
724 case 2:
725 return "CivSedanCargo1Doors";
726 break;
727 case 3:
728 return "CivSedanCargo2Doors";
729 break;
730 }
731
732 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
733 }
734
735 // 0 full ambient and engine sound
736 // 1 zero ambient and engine sound
737 override float OnSound(CarSoundCtrl ctrl, float oldValue)
738 {
739 switch (ctrl)
740 {
741 case CarSoundCtrl.DOORS:
742 float newValue = 0;
743 if (GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED)
744 newValue += 0.25;
745
746 if (GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED)
747 newValue += 0.25;
748
749 if (GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED)
750 newValue += 0.25;
751
752 if (GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED)
753 newValue += 0.25;
754
755 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
756 newValue -= 0.6;
757
758 if (GetHealthLevel("WindowBack") == GameConstants.STATE_RUINED)
759 newValue -= 0.6;
760
761 return Math.Clamp(newValue, 0, 1);
762 break;
763 }
764
765 return super.OnSound(ctrl, oldValue);
766 }
767
768 override string GetAnimSourceFromSelection(string selection)
769 {
770 switch (selection)
771 {
772 case "doors_driver":
773 return "DoorsDriver";
774 case "doors_codriver":
775 return "DoorsCoDriver";
776 case "doors_cargo1":
777 return "DoorsCargo1";
778 case "doors_cargo2":
779 return "DoorsCargo2";
780 case "doors_hood":
781 return "DoorsHood";
782 case "doors_trunk":
783 return "DoorsTrunk";
784 }
785
786 return "";
787 }
788
789 override bool IsVitalTruckBattery()
790 {
791 return false;
792 }
793
794 override bool IsVitalGlowPlug()
795 {
796 return false;
797 }
798
799 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
800 {
801 switch (currentSeat)
802 {
803 case 0:
804 return nextSeat == 1;
805
806 case 1:
807 return nextSeat == 0;
808
809 case 2:
810 return nextSeat == 3;
811
812 case 3:
813 return nextSeat == 2;
814 }
815
816 return false;
817 }
818
819 override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
820 {
821 switch (pCurrentSeat)
822 {
823 case 0:
824 return pDoorsSelection == "DoorsDriver";
825
826 case 1:
827 return pDoorsSelection == "DoorsCoDriver";
828
829 case 2:
830 return pDoorsSelection == "DoorsCargo1";
831
832 case 3:
833 return pDoorsSelection == "DoorsCargo2";
834 }
835
836 return false;
837 }
838
839 override void OnDebugSpawn()
840 {
844
845 GetInventory().CreateInInventory("CivSedanWheel");
846 GetInventory().CreateInInventory("CivSedanWheel");
847 GetInventory().CreateInInventory("CivSedanWheel");
848 GetInventory().CreateInInventory("CivSedanWheel");
849
850 GetInventory().CreateInInventory("CivSedanDoors_Driver");
851 GetInventory().CreateInInventory("CivSedanDoors_CoDriver");
852 GetInventory().CreateInInventory("CivSedanDoors_BackLeft");
853 GetInventory().CreateInInventory("CivSedanDoors_BackRight");
854 GetInventory().CreateInInventory("CivSedanHood");
855 GetInventory().CreateInInventory("CivSedanTrunk");
856
857 //-----IN CAR CARGO
858 GetInventory().CreateInInventory("CivSedanWheel");
859 GetInventory().CreateInInventory("CivSedanWheel");
860 }
861
862 override float GetPushForceCoefficientMultiplier()
863 {
864 return 1.5;
865 }
866}
867
869{
870 override void OnDebugSpawn()
871 {
875
876 GetInventory().CreateInInventory("CivSedanWheel");
877 GetInventory().CreateInInventory("CivSedanWheel");
878 GetInventory().CreateInInventory("CivSedanWheel");
879 GetInventory().CreateInInventory("CivSedanWheel");
880
881 GetInventory().CreateInInventory("CivSedanDoors_Driver_Wine");
882 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Wine");
883 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Wine");
884 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Wine");
885 GetInventory().CreateInInventory("CivSedanHood_Wine");
886 GetInventory().CreateInInventory("CivSedanTrunk_Wine");
887
888 //-----IN CAR CARGO
889 GetInventory().CreateInInventory("CivSedanWheel");
890 GetInventory().CreateInInventory("CivSedanWheel");
891 }
892}
893
895{
896 override void OnDebugSpawn()
897 {
901
902 GetInventory().CreateInInventory("CivSedanWheel");
903 GetInventory().CreateInInventory("CivSedanWheel");
904 GetInventory().CreateInInventory("CivSedanWheel");
905 GetInventory().CreateInInventory("CivSedanWheel");
906
907 GetInventory().CreateInInventory("CivSedanDoors_Driver_Black");
908 GetInventory().CreateInInventory("CivSedanDoors_CoDriver_Black");
909 GetInventory().CreateInInventory("CivSedanDoors_BackLeft_Black");
910 GetInventory().CreateInInventory("CivSedanDoors_BackRight_Black");
911 GetInventory().CreateInInventory("CivSedanHood_Black");
912 GetInventory().CreateInInventory("CivSedanTrunk_Black");
913
914 //-----IN CAR CARGO
915 GetInventory().CreateInInventory("CivSedanWheel");
916 GetInventory().CreateInInventory("CivSedanWheel");
917 }
918}

◆ OnSound()

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

Definition at line 685 of file CivilianSedan.c.

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

Variable Documentation

◆ m_UTSLEngine

◆ m_UTSource

◆ m_UTSSettings

ref UniversalTemperatureSourceSettings m_UTSSettings
protected

Definition at line 412 of file CivilianSedan.c.

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