Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
surface.c
Go to the documentation of this file.
1class Surface
2{
3 static int GetStepsParticleID(string surface_name)
4 {
5 return SurfaceInfo.GetByName(surface_name).GetStepParticleId();
6 }
7
8 static int GetWheelParticleID(string surface_name)
9 {
10 return SurfaceInfo.GetByName(surface_name).GetWheelParticleId();
11 }
12
13 static int GetParamInt(string surface_name, string param_name)
14 {
15 return g_Game.ConfigGetInt("CfgSurfaces " + surface_name + " " + param_name);
16 }
17
18 static float GetParamFloat(string surface_name, string param_name)
19 {
20 return g_Game.ConfigGetFloat("CfgSurfaces " + surface_name + " " + param_name);
21 }
22
23 static string GetParamText(string surfaceName, string paramName)
24 {
25 string output = "";
26 g_Game.ConfigGetText("CfgSurfaces " + surfaceName + " " + paramName, output);
27 return output;
28
29 }
30
31 static bool AllowedWaterSurface(float pHeight, string pSurface, array<string> pAllowedSurfaceList)
32 {
33 if (pSurface)
34 {
35 pSurface.Replace("_ext", "");
36 pSurface.Replace("_int", "");
37 pSurface.Replace("sakhal_", "");
38 }
39
40 bool isSeaCheck = false;
41
42 foreach (string allowedSurface : pAllowedSurfaceList)
43 {
44 if (pSurface == "" && allowedSurface == UAWaterType.SEA)
45 isSeaCheck = pHeight <= (g_Game.SurfaceGetSeaLevel() + 0.25); //MaxWave_default
46
47 if (isSeaCheck || allowedSurface == pSurface)
48 return true;
49 }
50
51 return false;
52 }
53
54 static bool CheckLiquidSource(float pHeight, string pSurface, int allowedWaterSourceMask)
55 {
56 bool success = false;
57 if (pSurface == "")
58 {
59 if ( allowedWaterSourceMask & LIQUID_SALTWATER )
60 {
61 success = true;
62 }
63 }
64 else
65 {
66 int liquidType = SurfaceInfo.GetByName(pSurface).GetLiquidType();
67
68 success = allowedWaterSourceMask & liquidType;
69 }
70
71 return success;
72 }
73}
static float GetParamFloat(string surface_name, string param_name)
Definition surface.c:18
static int GetWheelParticleID(string surface_name)
Definition surface.c:8
static int GetParamInt(string surface_name, string param_name)
Definition surface.c:13
static int GetStepsParticleID(string surface_name)
Definition surface.c:3
static string GetParamText(string surfaceName, string paramName)
Definition surface.c:23
static bool AllowedWaterSurface(float pHeight, string pSurface, array< string > pAllowedSurfaceList)
Definition surface.c:31
static bool CheckLiquidSource(float pHeight, string pSurface, int allowedWaterSourceMask)
Definition surface.c:54
Unmanaged surface info handle.
Definition surfaceinfo.c:9
proto int GetWheelParticleId()
static proto SurfaceInfo GetByName(string name)
Warning: O(n) time complexity where n is the total number of loaded surfaces Note: Will load the surf...
proto int GetStepParticleId()
See 'ParticleList', if config entry not set, value is 'ParticleList.NONE', if config entry is set but...
proto int GetLiquidType()
See 'LiquidTypes' in 'constants.c'.
const string SEA
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
DayZGame g_Game
Definition dayzgame.c:3942
const int LIQUID_SALTWATER
Definition constants.c:553
proto int Replace(string sample, string replace)
Replace all occurrances of 'sample' in 'str' by 'replace'.