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

◆ TryValidatePondHitPosition()

bool CCTLiquid::TryValidatePondHitPosition ( vector playerPos,
vector hitPosition,
out vector surfacePos,
out int liquidType,
out string surfaceType,
int expectedLiquidType = LIQUID_NONE )
inlineprotected

Use detected liquid as the source of truth.

If caller expected a specific liquid mask/type, require compatibility.

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

721 {
722 surfacePos = vector.Zero;
723 liquidType = LIQUID_NONE;
724 surfaceType = string.Empty;
725
726 if (IsNearlyZero(hitPosition))
727 return false;
728
729 if (vector.Distance(playerPos, hitPosition) > m_MaxActionDistance)
730 return false;
731
732 if (!g_Game.SurfaceIsPond(hitPosition[0], hitPosition[2]))
733 return false;
734
735 int detectedLiquidType;
736 if (!TryGetLiquidSurfaceAt(hitPosition, surfacePos, detectedLiquidType, surfaceType))
737 return false;
738
740 liquidType = detectedLiquidType;
741
743 if (expectedLiquidType != LIQUID_NONE && (liquidType & expectedLiquidType) == 0)
744 return false;
745
746 if (!IsAllowedPondLiquidSurface(playerPos, surfacePos, liquidType))
747 return false;
748
749 float hitToSurfaceHeight = Math.AbsFloat(hitPosition[1] - surfacePos[1]);
750 if (hitToSurfaceHeight > SYNTHETIC_POND_SURFACE_TOLERANCE)
751 return false;
752
753 return true;
754 }
DayZGame g_Game
Определения DayZGame.c:4074
bool IsNearlyZero(vector value)
Определения CCTLiquid.c:1024
bool TryGetLiquidSurfaceAt(vector probePosition, out vector surfacePosition, out int liquidType, out string surfaceType)
Определения CCTLiquid.c:293
bool IsAllowedPondLiquidSurface(vector playerPos, vector surfacePos, int liquidType)
Определения CCTLiquid.c:929
float m_MaxActionDistance
Определения CCTLiquid.c:23
static const float SYNTHETIC_POND_SURFACE_TOLERANCE
Определения CCTLiquid.c:7
const int LIQUID_NONE
Определения 3_Game/DayZ/constants.c:566

Перекрестные ссылки Math::AbsFloat(), vector::Distance(), g_Game, IsAllowedPondLiquidSurface(), IsNearlyZero(), LIQUID_NONE, m_MaxActionDistance, SYNTHETIC_POND_SURFACE_TOLERANCE, TryGetLiquidSurfaceAt() и vector::Zero.

Используется в IsValidPondHitPosition() и TryValidateHitCursor().