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

◆ GetCarDoorsState()

override int OnDebugSpawn::GetCarDoorsState ( string slotType)
protected

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

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