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

◆ OnSound()

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

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

733{
737
738 void CivilianSedan()
739 {
740 //m_dmgContactCoef = 0.065;
741
742 m_EngineStartOK = "CivilianSedan_engine_start_SoundSet";
743 m_EngineStartBattery = "CivilianSedan_engine_failed_start_battery_SoundSet";
744 m_EngineStartPlug = "CivilianSedan_engine_failed_start_sparkplugs_SoundSet";
745 m_EngineStartFuel = "CivilianSedan_engine_failed_start_fuel_SoundSet";
746 m_EngineStop = "CivilianSedan_engine_stop_SoundSet";
747 m_EngineStopFuel = "CivilianSedan_engine_stop_fuel_SoundSet";
748
749 m_CarDoorOpenSound = "offroad_door_open_SoundSet";
750 m_CarDoorCloseSound = "offroad_door_close_SoundSet";
751
752 m_CarHornShortSoundName = "CivilianSedan_Horn_Short_SoundSet";
753 m_CarHornLongSoundName = "CivilianSedan_Horn_SoundSet";
754
755 SetEnginePos("0 0.7 1.6");
756 }
757
758 void ~CivilianSedan()
759 {
760 m_UTSource = null;
761 m_UTSSettings = null;
762 m_UTSLEngine = null;
763 }
764
765 override void EEInit()
766 {
767 super.EEInit();
768
769 if (g_Game.IsServer() || !g_Game.IsMultiplayer())
770 {
772 m_UTSSettings.m_ManualUpdate = true;
774 m_UTSSettings.m_TemperatureCap = 0;
775 m_UTSSettings.m_RangeFull = 0.5;
776 m_UTSSettings.m_RangeMax = 2;
777
780 }
781 }
782
783 override void OnEngineStart()
784 {
785 super.OnEngineStart();
786
787 if (g_Game.IsServer() || !g_Game.IsMultiplayer())
788 {
789 if (m_UTSource)
790 m_UTSource.SetDefferedActive(true, 20.0);
791 }
792 }
793
794 override void OnEngineStop()
795 {
796 super.OnEngineStop();
797
798 if (g_Game.IsServer() || !g_Game.IsMultiplayer())
799 {
800 if (m_UTSource)
801 m_UTSource.SetDefferedActive(false, 10.0);
802 }
803 }
804
805 override void EOnPostSimulate(IEntity other, float timeSlice)
806 {
807 if (g_Game.IsServer() || !g_Game.IsMultiplayer())
808 {
809 if (m_UTSource && m_UTSource.IsActive())
810 {
812 }
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
855 override bool CanReleaseAttachment( EntityAI attachment )
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 {
906 CarDoor carDoor;
907
908 Class.CastTo( carDoor, FindAttachmentBySlotName( slotType ) );
909 if (!carDoor)
910 {
911 return CarDoorState.DOORS_MISSING;
912 }
913
914 switch (slotType)
915 {
916 case "CivSedanDriverDoors":
917 return TranslateAnimationPhaseToCarDoorState("DoorsDriver");
918 break;
919
920 case "CivSedanCoDriverDoors":
921 return TranslateAnimationPhaseToCarDoorState("DoorsCoDriver");
922 break;
923
924 case "CivSedanCargo1Doors":
925 return TranslateAnimationPhaseToCarDoorState("DoorsCargo1");
926 break;
927
928 case "CivSedanCargo2Doors":
929 return TranslateAnimationPhaseToCarDoorState("DoorsCargo2");
930 break;
931
932 case "CivSedanTrunk":
933 return TranslateAnimationPhaseToCarDoorState("DoorsTrunk");
934 break;
935
936 case "CivSedanHood":
937 return TranslateAnimationPhaseToCarDoorState("DoorsHood");
938 break;
939 }
940
941 return CarDoorState.DOORS_MISSING;
942 }
943
944
945 override bool CrewCanGetThrough( int posIdx )
946 {
947 switch( posIdx )
948 {
949 case 0:
950 if ( GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED )
951 return false;
952
953 return true;
954 break;
955
956 case 1:
957 if ( GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED )
958 return false;
959
960 return true;
961 break;
962
963 case 2:
964 if ( GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED )
965 return false;
966
967 return true;
968 break;
969
970 case 3:
971 if ( GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED )
972 return false;
973
974 return true;
975 break;
976 }
977
978 return false;
979 }
980
981 override string GetDoorSelectionNameFromSeatPos(int posIdx)
982 {
983 switch( posIdx )
984 {
985 case 0:
986 return "doors_driver";
987 break;
988 case 1:
989 return "doors_codriver";
990 break;
991 case 2:
992 return "doors_cargo1";
993 break;
994 case 3:
995 return "doors_cargo2";
996 break;
997 }
998
999 return super.GetDoorSelectionNameFromSeatPos(posIdx);
1000 }
1001
1002 override string GetDoorInvSlotNameFromSeatPos(int posIdx)
1003 {
1004 switch( posIdx )
1005 {
1006 case 0:
1007 return "CivSedanDriverDoors";
1008 break;
1009 case 1:
1010 return "CivSedanCoDriverDoors";
1011 break;
1012 case 2:
1013 return "CivSedanCargo1Doors";
1014 break;
1015 case 3:
1016 return "CivSedanCargo2Doors";
1017 break;
1018 }
1019
1020 return super.GetDoorInvSlotNameFromSeatPos(posIdx);
1021 }
1022
1023 // 0 full ambient and engine sound
1024 // 1 zero ambient and engine sound
1025 override float OnSound(CarSoundCtrl ctrl, float oldValue)
1026 {
1027 switch (ctrl)
1028 {
1029 case CarSoundCtrl.DOORS:
1030 float newValue = 0;
1031 if (GetCarDoorsState("CivSedanDriverDoors") == CarDoorState.DOORS_CLOSED)
1032 {
1033 newValue += 0.25;
1034 }
1035
1036 if (GetCarDoorsState("CivSedanCoDriverDoors") == CarDoorState.DOORS_CLOSED)
1037 {
1038 newValue += 0.25;
1039 }
1040
1041 if (GetCarDoorsState("CivSedanCargo1Doors") == CarDoorState.DOORS_CLOSED)
1042 {
1043 newValue += 0.25;
1044 }
1045
1046 if (GetCarDoorsState("CivSedanCargo2Doors") == CarDoorState.DOORS_CLOSED)
1047 {
1048 newValue += 0.25;
1049 }
1050
1051 if (GetHealthLevel("WindowFront") == GameConstants.STATE_RUINED)
1052 {
1053 newValue -= 0.6;
1054 }
1055
1056 if (GetHealthLevel("WindowBack") == GameConstants.STATE_RUINED)
1057 {
1058 newValue -= 0.6;
1059 }
1060
1061 return Math.Clamp(newValue, 0, 1);
1062 break;
1063 }
1064
1065 return super.OnSound(ctrl, oldValue);
1066 }
1067
1068 override string GetAnimSourceFromSelection(string selection)
1069 {
1070 switch (selection)
1071 {
1072 case "doors_driver":
1073 return "DoorsDriver";
1074 case "doors_codriver":
1075 return "DoorsCoDriver";
1076 case "doors_cargo1":
1077 return "DoorsCargo1";
1078 case "doors_cargo2":
1079 return "DoorsCargo2";
1080 case "doors_hood":
1081 return "DoorsHood";
1082 case "doors_trunk":
1083 return "DoorsTrunk";
1084 }
1085
1086 return "";
1087 }
1088
1089 override bool IsVitalTruckBattery()
1090 {
1091 return false;
1092 }
1093
1094 override bool IsVitalGlowPlug()
1095 {
1096 return false;
1097 }
1098
1099 override bool CanReachSeatFromSeat(int currentSeat, int nextSeat)
1100 {
1101 switch (currentSeat)
1102 {
1103 case 0:
1104 return nextSeat == 1;
1105
1106 case 1:
1107 return nextSeat == 0;
1108
1109 case 2:
1110 return nextSeat == 3;
1111
1112 case 3:
1113 return nextSeat == 2;
1114 }
1115
1116 return false;
1117 }
1118
1119 override bool CanReachDoorsFromSeat( string pDoorsSelection, int pCurrentSeat )
1120 {
1121 switch (pCurrentSeat)
1122 {
1123 case 0:
1124 return pDoorsSelection == "DoorsDriver";
1125
1126 case 1:
1127 return pDoorsSelection == "DoorsCoDriver";
1128
1129 case 2:
1130 return pDoorsSelection == "DoorsCargo1";
1131
1132 case 3:
1133 return pDoorsSelection == "DoorsCargo2";
1134 }
1135
1136 return false;
1137 }
1138
1139 override void OnDebugSpawn()
1140 {
1141 SpawnUniversalParts();
1142 SpawnAdditionalItems();
1143 FillUpCarFluids();
1144
1145 GameInventory inventory = GetInventory();
1146 inventory.CreateInInventory("CivSedanWheel");
1147 inventory.CreateInInventory("CivSedanWheel");
1148 inventory.CreateInInventory("CivSedanWheel");
1149 inventory.CreateInInventory("CivSedanWheel");
1150
1151 inventory.CreateInInventory("CivSedanDoors_Driver");
1152 inventory.CreateInInventory("CivSedanDoors_CoDriver");
1153 inventory.CreateInInventory("CivSedanDoors_BackLeft");
1154 inventory.CreateInInventory("CivSedanDoors_BackRight");
1155 inventory.CreateInInventory("CivSedanHood");
1156 inventory.CreateInInventory("CivSedanTrunk");
1157
1158 //-----IN CAR CARGO
1159 inventory.CreateInInventory("CivSedanWheel");
1160 inventory.CreateInInventory("CivSedanWheel");
1161 }
1162
1163 override float GetPushForceCoefficientMultiplier()
1164 {
1165 return 1.5;
1166 }
1167}
1168
1169class CivilianSedan_Wine extends CivilianSedan
1170{
1171 override void OnDebugSpawn()
1172 {
1173 SpawnUniversalParts();
1174 SpawnAdditionalItems();
1175 FillUpCarFluids();
1176
1177 GameInventory inventory = GetInventory();
1178 inventory.CreateInInventory("CivSedanWheel");
1179 inventory.CreateInInventory("CivSedanWheel");
1180 inventory.CreateInInventory("CivSedanWheel");
1181 inventory.CreateInInventory("CivSedanWheel");
1182
1183 inventory.CreateInInventory("CivSedanDoors_Driver_Wine");
1184 inventory.CreateInInventory("CivSedanDoors_CoDriver_Wine");
1185 inventory.CreateInInventory("CivSedanDoors_BackLeft_Wine");
1186 inventory.CreateInInventory("CivSedanDoors_BackRight_Wine");
1187 inventory.CreateInInventory("CivSedanHood_Wine");
1188 inventory.CreateInInventory("CivSedanTrunk_Wine");
1189
1190 //-----IN CAR CARGO
1191 inventory.CreateInInventory("CivSedanWheel");
1192 inventory.CreateInInventory("CivSedanWheel");
1193 }
1194}
1195
1196class CivilianSedan_Black extends CivilianSedan
1197{
1198 override void OnDebugSpawn()
1199 {
1200 SpawnUniversalParts();
1201 SpawnAdditionalItems();
1202 FillUpCarFluids();
1203
1204 GameInventory inventory = GetInventory();
1205 inventory.CreateInInventory("CivSedanWheel");
1206 inventory.CreateInInventory("CivSedanWheel");
1207 inventory.CreateInInventory("CivSedanWheel");
1208 inventory.CreateInInventory("CivSedanWheel");
1209
1210 inventory.CreateInInventory("CivSedanDoors_Driver_Black");
1211 inventory.CreateInInventory("CivSedanDoors_CoDriver_Black");
1212 inventory.CreateInInventory("CivSedanDoors_BackLeft_Black");
1213 inventory.CreateInInventory("CivSedanDoors_BackRight_Black");
1214 inventory.CreateInInventory("CivSedanHood_Black");
1215 inventory.CreateInInventory("CivSedanTrunk_Black");
1216
1217 //-----IN CAR CARGO
1218 inventory.CreateInInventory("CivSedanWheel");
1219 inventory.CreateInInventory("CivSedanWheel");
1220 }
1221}
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.