surface.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. class Surface
  2. {
  3. static int GetStepsParticleID(string surface_name)
  4. {
  5. return SurfaceInfo.GetByName(surface_name).GetStepParticleId();
  6. }
  7. static int GetWheelParticleID(string surface_name)
  8. {
  9. return SurfaceInfo.GetByName(surface_name).GetWheelParticleId();
  10. }
  11. static int GetParamInt(string surface_name, string param_name)
  12. {
  13. return GetGame().ConfigGetInt("CfgSurfaces " + surface_name + " " + param_name);
  14. }
  15. static float GetParamFloat(string surface_name, string param_name)
  16. {
  17. return GetGame().ConfigGetFloat("CfgSurfaces " + surface_name + " " + param_name);
  18. }
  19. static string GetParamText(string surfaceName, string paramName)
  20. {
  21. string output = "";
  22. GetGame().ConfigGetText("CfgSurfaces " + surfaceName + " " + paramName, output);
  23. return output;
  24. }
  25. static bool AllowedWaterSurface(float pHeight, string pSurface, array<string> pAllowedSurfaceList)
  26. {
  27. if (pSurface)
  28. {
  29. pSurface.Replace("_ext", "");
  30. pSurface.Replace("_int", "");
  31. pSurface.Replace("sakhal_", "");
  32. }
  33. bool isSeaCheck = false;
  34. foreach (string allowedSurface : pAllowedSurfaceList)
  35. {
  36. if (pSurface == "" && allowedSurface == UAWaterType.SEA)
  37. isSeaCheck = pHeight <= (g_Game.SurfaceGetSeaLevel() + 0.25); //MaxWave_default
  38. if (isSeaCheck || allowedSurface == pSurface)
  39. return true;
  40. }
  41. return false;
  42. }
  43. static bool CheckLiquidSource(float pHeight, string pSurface, int allowedWaterSourceMask)
  44. {
  45. bool success = false;
  46. if (pSurface == "")
  47. {
  48. if ( allowedWaterSourceMask & LIQUID_SALTWATER )
  49. {
  50. success = pHeight <= (g_Game.SurfaceGetSeaLevel() + 0.25); //MaxWave_default
  51. }
  52. }
  53. else
  54. {
  55. int liquidType = SurfaceInfo.GetByName(pSurface).GetLiquidType();
  56. success = allowedWaterSourceMask & liquidType;
  57. }
  58. return success;
  59. }
  60. }