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

◆ OnVehicleJumpOutServer()

void OnVehicleJumpOutServer ( GetOutTransportActionData gotActionData)
protected

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

1117 {
1118 PlayerBase player = gotActionData.m_Player;
1119
1120 array<ClothingBase> equippedClothes = new array<ClothingBase>;
1121 equippedClothes.Insert(ClothingBase.Cast(player.GetItemOnSlot("LEGS")));
1122 equippedClothes.Insert(ClothingBase.Cast(player.GetItemOnSlot("BACK")));
1123 equippedClothes.Insert(ClothingBase.Cast(player.GetItemOnSlot("VEST")));
1124 equippedClothes.Insert(ClothingBase.Cast(player.GetItemOnSlot("HeadGear")));
1125 equippedClothes.Insert(ClothingBase.Cast(player.GetItemOnSlot("Mask")));
1126 equippedClothes.Insert(ClothingBase.Cast(player.GetItemOnSlot("BODY")));
1127 equippedClothes.Insert(ClothingBase.Cast(player.GetItemOnSlot("FEET")));
1128 equippedClothes.Insert(ClothingBase.Cast(player.GetItemOnSlot("GLOVES")));
1129
1130 // -----------------------------------------------
1131 float shockTaken = (gotActionData.m_Speed * gotActionData.m_Speed) / ActionGetOutTransport.DMG_FACTOR;
1132
1133 //Lower shock taken if player uses a helmet
1134 ItemBase headGear = ClothingBase.Cast(player.GetItemOnHead());
1135 HelmetBase helmet;
1136 if (Class.CastTo(helmet, headGear))
1137 shockTaken *= 0.5;
1138
1139 // -----------------------------------------------
1140
1141 int randNum; //value used for probability evaluation
1142 randNum = Math.RandomInt(0, 100);
1143 if (gotActionData.m_Speed < ActionGetOutTransport.LOW_SPEED_VALUE)
1144 {
1145 if (randNum < 20)
1146 player.GiveShock(-shockTaken); //To inflict shock, a negative value must be passed
1147
1148 randNum = Math.RandomIntInclusive(0, PlayerBase.m_BleedingSourcesLow.Count() - 1);
1149
1150 player.m_BleedingManagerServer.AttemptAddBleedingSourceBySelection(PlayerBase.m_BleedingSourcesLow[randNum]);
1151 }
1153 {
1154 if (randNum < 50)
1155 player.GiveShock(-shockTaken);
1156
1157 randNum = Math.RandomInt(0, PlayerBase.m_BleedingSourcesUp.Count() - 1);
1158
1159 player.m_BleedingManagerServer.AttemptAddBleedingSourceBySelection(PlayerBase.m_BleedingSourcesUp[randNum]);
1160 }
1161 else if (gotActionData.m_Speed >= ActionGetOutTransport.HIGH_SPEED_VALUE)
1162 {
1163 if (!headGear)
1164 player.m_BleedingManagerServer.AttemptAddBleedingSourceBySelection("Head");
1165
1166 if (randNum < 75)
1167 player.GiveShock(-shockTaken);
1168 }
1169
1170 float dmgTaken = (gotActionData.m_Speed * gotActionData.m_Speed) / ActionGetOutTransport.SHOCK_FACTOR;
1171
1172 //Damage all currently equipped clothes
1173 foreach (ClothingBase cloth : equippedClothes)
1174 {
1175 //If no item is equipped on slot, slot is ignored
1176 if (cloth == null)
1177 continue;
1178
1179 cloth.DecreaseHealth(dmgTaken, false);
1180 }
1181
1182 vector posMS = gotActionData.m_Player.WorldToModel(gotActionData.m_Player.GetPosition());
1183 gotActionData.m_Player.DamageAllLegs(dmgTaken); //Additionnal leg specific damage dealing
1184
1186 healthCoef = Math.Clamp(healthCoef, 0.0, 1.0);
1187 gotActionData.m_Player.ProcessDirectDamage(DamageType.CUSTOM, gotActionData.m_Player, "", "FallDamageHealth", posMS, healthCoef);
1188 }
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
const int SHOCK_FACTOR
Определения ActionGetOutTransport.c:27
const int LOW_SPEED_VALUE
Определения ActionGetOutTransport.c:30
const int HEALTH_HIGH_SPEED_VALUE
Определения ActionGetOutTransport.c:37
const int HIGH_SPEED_VALUE
Определения ActionGetOutTransport.c:31
const int HEALTH_LOW_SPEED_VALUE
Определения ActionGetOutTransport.c:36
const int DMG_FACTOR
Определения ActionGetOutTransport.c:26
Super root of all classes in Enforce script.
Определения EnScript.c:11
Определения DallasMask.c:2
Определения GreatHelm.c:2
Определения InventoryItem.c:731
Определения EnMath.c:7
Определения PlayerBaseClient.c:2
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Определения EnConvert.c:106
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
Определения EnMath.c:54

Перекрестные ссылки Class::CastTo(), Math::Clamp(), ActionGetOutTransport::DMG_FACTOR, ActionGetOutTransport::HEALTH_HIGH_SPEED_VALUE, ActionGetOutTransport::HEALTH_LOW_SPEED_VALUE, ActionGetOutTransport::HIGH_SPEED_VALUE, Math::InverseLerp(), ActionGetOutTransport::LOW_SPEED_VALUE, GetOutTransportActionData::m_Speed, Math::RandomInt(), Math::RandomIntInclusive() и ActionGetOutTransport::SHOCK_FACTOR.