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

◆ OnVehicleJumpOutServer()

void Car::OnVehicleJumpOutServer ( GetOutTransportActionData gotActionData)
inlineprotected

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

952 {
953 PlayerBase player = gotActionData.m_Player;
954
955 array<ClothingBase> equippedClothes = new array<ClothingBase>;
956 equippedClothes.Insert(ClothingBase.Cast(player.GetItemOnSlot("LEGS")));
957 equippedClothes.Insert(ClothingBase.Cast(player.GetItemOnSlot("BACK")));
958 equippedClothes.Insert(ClothingBase.Cast(player.GetItemOnSlot("VEST")));
959 equippedClothes.Insert(ClothingBase.Cast(player.GetItemOnSlot("HeadGear")));
960 equippedClothes.Insert(ClothingBase.Cast(player.GetItemOnSlot("Mask")));
961 equippedClothes.Insert(ClothingBase.Cast(player.GetItemOnSlot("BODY")));
962 equippedClothes.Insert(ClothingBase.Cast(player.GetItemOnSlot("FEET")));
963 equippedClothes.Insert(ClothingBase.Cast(player.GetItemOnSlot("GLOVES")));
964
965 // -----------------------------------------------
966 float shockTaken = (gotActionData.m_Speed * gotActionData.m_Speed) / ActionGetOutTransport.DMG_FACTOR;
967
968 //Lower shock taken if player uses a helmet
969 ItemBase headGear = ClothingBase.Cast(player.GetItemOnHead());
970 HelmetBase helmet;
971 if (Class.CastTo(helmet, headGear))
972 shockTaken *= 0.5;
973
974 // -----------------------------------------------
975
976 int randNum; //value used for probability evaluation
977 randNum = Math.RandomInt(0, 100);
978 if (gotActionData.m_Speed < ActionGetOutTransport.LOW_SPEED_VALUE)
979 {
980 if (randNum < 20)
981 player.GiveShock(-shockTaken); //To inflict shock, a negative value must be passed
982
983 randNum = Math.RandomIntInclusive(0, PlayerBase.m_BleedingSourcesLow.Count() - 1);
984
985 if (player.m_BleedingManagerServer)
986 player.m_BleedingManagerServer.AttemptAddBleedingSourceBySelection(PlayerBase.m_BleedingSourcesLow[randNum]);
987 }
988 else if (gotActionData.m_Speed >= ActionGetOutTransport.LOW_SPEED_VALUE && gotActionData.m_Speed < ActionGetOutTransport.HIGH_SPEED_VALUE)
989 {
990 if (randNum < 50)
991 player.GiveShock(-shockTaken);
992
993 randNum = Math.RandomInt(0, PlayerBase.m_BleedingSourcesUp.Count() - 1);
994
995 if (player.m_BleedingManagerServer)
996 player.m_BleedingManagerServer.AttemptAddBleedingSourceBySelection(PlayerBase.m_BleedingSourcesUp[randNum]);
997 }
998 else if (gotActionData.m_Speed >= ActionGetOutTransport.HIGH_SPEED_VALUE)
999 {
1000 if (!headGear && player.m_BleedingManagerServer)
1001 player.m_BleedingManagerServer.AttemptAddBleedingSourceBySelection("Head");
1002
1003 if (randNum < 75)
1004 player.GiveShock(-shockTaken);
1005 }
1006
1007 float dmgTaken = (gotActionData.m_Speed * gotActionData.m_Speed) / ActionGetOutTransport.SHOCK_FACTOR;
1008
1009 //Damage all currently equipped clothes
1010 foreach (ClothingBase cloth : equippedClothes)
1011 {
1012 //If no item is equipped on slot, slot is ignored
1013 if (cloth == null)
1014 continue;
1015
1016 cloth.DecreaseHealth(dmgTaken, false);
1017 }
1018
1019 vector posMS = gotActionData.m_Player.WorldToModel(gotActionData.m_Player.GetPosition());
1020 gotActionData.m_Player.DamageAllLegs(dmgTaken); //Additionnal leg specific damage dealing
1021
1022 float healthCoef = Math.InverseLerp(ActionGetOutTransport.HEALTH_LOW_SPEED_VALUE, ActionGetOutTransport.HEALTH_HIGH_SPEED_VALUE, gotActionData.m_Speed);
1023 healthCoef = Math.Clamp(healthCoef, 0.0, 1.0);
1024 gotActionData.m_Player.ProcessDirectDamage(DamageType.CUSTOM, gotActionData.m_Player, "", "FallDamageHealth", posMS, healthCoef);
1025 }
Clothing ClothingBase
Определения Clothing_Base.c:206
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
class GP5GasMask extends MaskBase ItemBase
PlayerBase m_Player
Определения ActionBase.c:40

Перекрестные ссылки 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, ActionData::m_Player, GetOutTransportActionData::m_Speed, Math::RandomInt(), Math::RandomIntInclusive() и ActionGetOutTransport::SHOCK_FACTOR.