DayZ 1.28
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ GetCarDoorsState()

override int OnDebugSpawn::GetCarDoorsState ( string slotType)
protected

См. определение в файле CivilianSedan.c строка 592

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

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