Surface.c
class Surface
{
static int GetStepsParticleID(string surface_name)
{
return SurfaceInfo.GetByName(surface_name).GetStepParticleId();
}
static int GetWheelParticleID(string surface_name)
{
return SurfaceInfo.GetByName(surface_name).GetWheelParticleId();
}
static int GetParamInt(string surface_name, string param_name)
{
return g_Game.ConfigGetInt("CfgSurfaces " + surface_name + " " + param_name);
}
static float GetParamFloat(string surface_name, string param_name)
{
return g_Game.ConfigGetFloat("CfgSurfaces " + surface_name + " " + param_name);
}
static string GetParamText(string surfaceName, string paramName)
{
string output = "";
g_Game.ConfigGetText("CfgSurfaces " + surfaceName + " " + paramName, output);
return output;
}
static bool AllowedWaterSurface(float pHeight, string pSurface, array<string> pAllowedSurfaceList)
{
if (pSurface)
{
pSurface.Replace("_ext", "");
pSurface.Replace("_int", "");
pSurface.Replace("sakhal_", "");
}
bool isSeaCheck = false;
foreach (string allowedSurface : pAllowedSurfaceList)
{
if (pSurface == "" && allowedSurface == UAWaterType.SEA)
isSeaCheck = pHeight <= (g_Game.SurfaceGetSeaLevel() + 0.25); //MaxWave_default
if (isSeaCheck || allowedSurface == pSurface)
return true;
}
return false;
}
static bool CheckLiquidSource(float pHeight, string pSurface, int allowedWaterSourceMask)
{
bool success = false;
if (pSurface == "")
{
if ( allowedWaterSourceMask & LIQUID_SALTWATER )
{
success = true;
}
}
else
{
int liquidType = SurfaceInfo.GetByName(pSurface).GetLiquidType();
success = allowedWaterSourceMask & liquidType;
}
return success;
}
}