world.c 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. class World: Managed
  2. {
  3. //proto private void ~World();
  4. //proto private void World();
  5. proto void CheckSoundObstruction(EntityAI source, bool inSource, out float obstruction, out float occlusion);
  6. proto native void GetPlayerList(out array<Man> players);
  7. /**
  8. \brief Sets the world time acceleration, overriding config. Mostly used for debug purposes.
  9. \param timeMultiplier 0-64 acceleration value, -1 to reset back
  10. */
  11. proto native void SetTimeMultiplier(float timeMultiplier);
  12. /**
  13. \brief Get actual ingame world time
  14. \param year
  15. \param month in range <1, 12>
  16. \param day in range <1, 31>
  17. \param hour in range <0, 23>
  18. \param minute in range <0, 59>
  19. @code
  20. int year, month, day, hour, minute;
  21. GetGame().GetWorld().GetDate(year, month, day, hour, minute);
  22. @endcode
  23. */
  24. proto void GetDate(out int year, out int month, out int day, out int hour, out int minute);
  25. /**
  26. \brief Sets actual ingame world time
  27. \param year
  28. \param month in range <1, 12>
  29. \param day in range <1, 31>
  30. \param hour in range <0, 23>
  31. \param minute in range <0, 59>
  32. @code
  33. int year = 2016;
  34. int month = 5;
  35. int day = 4;
  36. int hour = 14;
  37. int minute = 57;
  38. GetGame().GetWorld().SetDate(year, month, day, hour, minute);
  39. @endcode
  40. */
  41. proto native void SetDate(int year, int month, int day, int hour, int minute);
  42. proto native float GetLatitude();
  43. proto native float GetLongitude();
  44. proto native float GetMoonIntensity();
  45. proto native float GetSunOrMoon();
  46. proto native bool IsNight();
  47. proto native float GetEyeAccom();
  48. proto native void SetEyeAccom(float eyeAccom);
  49. proto native void StartFpsBenchmark(int sectorsCount, float preloadDistance, float fpsLimitRed, float fpsLimitGreen, float fpsLimitBlue, float minX, float minY, float maxX, float maxY);
  50. proto native void StartFpsBenchmarkWithMask(float preloadDistance, float fpsLimitRed, float fpsLimitGreen, float fpsLimitBlue);
  51. proto native void StartFpsBenchmarkViews(string xmlFileName, float preloadDistance);
  52. proto native void SetBuldozerWaterEnabled(bool enable);
  53. /**
  54. \brief Sets preferred view distance, which persists between game sessions
  55. \param distance
  56. */
  57. proto native void SetPreferredViewDistance(float distance);
  58. proto native void SetViewDistance(float distance);
  59. proto native void SetObjectViewDistance(float distance);
  60. proto native void SetExplicitVolumeFactor_EnvSounds2D(float factor, float fadeTime);
  61. /**
  62. \brief Affects env sound controller value 'Shooting'
  63. \param sound position
  64. \param relative value (0..1) - how much should be value decreased
  65. */
  66. proto native void AddEnvShootingSource(vector position, float shootingValDecrease);
  67. proto int GetWorldSize();
  68. /**
  69. \brief Translates world coordinates to a grid coordinates(map grid)
  70. \param pos
  71. \param size of grid in meters
  72. \param x grid position result [out]
  73. \param z grid position result [out]
  74. @code
  75. int x,z;
  76. GetGame().GetWorld().GetGridCoords(GetGame().GetPlayer().GetPosition(), 100, x, z);
  77. @endcode
  78. */
  79. proto void GetGridCoords(vector pos, float gridSize, out int gridX, out int gridZ);
  80. /**
  81. load light config
  82. */
  83. proto native void LoadNewLightingCfg(string path);
  84. /**
  85. load user light config (just first item is used)
  86. */
  87. proto native void LoadUserLightingCfg(string path, string name);
  88. /**
  89. set lerp to user lighting cfg
  90. */
  91. proto native void SetUserLightingLerp(float val);
  92. /**
  93. returns reference to AIWorld
  94. */
  95. proto native AIWorld GetAIWorld();
  96. /**
  97. For entities that aren't a house, any animation source that contains "door" is treated as a door by the pathgraph.
  98. Using the phase value where 0=CLOSED, 1=OPENED, we can update the state of the door without regenerating the tile
  99. */
  100. proto native void UpdatePathgraphDoorByAnimationSourceName(notnull Object object, string animSourceName);
  101. proto native void MarkObjectForPathgraphUpdate(Object object);
  102. proto native void ProcessMarkedObjectsForPathgraphUpdate();
  103. /*!
  104. @code
  105. Material matColors = GetGame().GetWorld().GetMaterial("postprocess/glow");
  106. SetMaterialParam(matColors, "Saturation", 0.8);
  107. float color[4];
  108. color[0] = 0.5;
  109. color[1] = 0.8;
  110. color[2] = 0.7;
  111. color[3] = 0.6;
  112. SetMaterialParam(matColors, "OverlayColor", color);
  113. @endcode
  114. */
  115. proto native Material GetMaterial(string materialName);
  116. /*!
  117. set new PP effect and its material
  118. \param camera number of camera
  119. \param effectIndex index of effect
  120. \param effectName name of effect
  121. \param matName name of material
  122. */
  123. proto native void SetCameraPostProcessEffect(int cam, int ppEffect, string effectName, string materialName);
  124. void SetAperture(float invDiameter)
  125. {
  126. if (invDiameter <= 0)
  127. {
  128. SetEyeAccom(-1);
  129. }
  130. else
  131. {
  132. float apertureArea = 1.0 / invDiameter;
  133. SetEyeAccom(apertureArea * apertureArea);
  134. }
  135. }
  136. /*!
  137. checks if 3rd person camera is disabled from server
  138. */
  139. proto native bool Is3rdPersonDisabled();
  140. /*!
  141. checks if crosshair is disabled from server
  142. */
  143. proto native bool IsCrosshairDisabled();
  144. /*!
  145. checks if mouse and keyboard is enabled from server (only on console)
  146. */
  147. proto native bool IsMouseAndKeyboardEnabledOnServer();
  148. /*!
  149. Returns the value set in server config for notifying high ping
  150. */
  151. proto native int GetPingWarningThreshold();
  152. /*!
  153. Returns the value set in server config for notifying high ping
  154. */
  155. proto native int GetPingCriticalThreshold();
  156. /*!
  157. Returns the value set in server config for notifying low server fps
  158. */
  159. proto native float GetServerFpsWarningThreshold();
  160. /*!
  161. Returns the value set in server config for notifying low server fps
  162. */
  163. proto native float GetServerFpsCriticalThreshold();
  164. /*!
  165. enable/disable transmiting voice over network globally
  166. \param disable if true, then VoN is no more usable for transmiting voice
  167. */
  168. proto native void DisableTransmitVoN(bool disable);
  169. /*!
  170. enable/disable receiving all voice over network globally
  171. \param disable if true, then player is not able listen any voice from VoN
  172. \return true if mute request was sent successfully to server. If false, then was problem with sent request or missing player idendity.
  173. */
  174. proto native bool DisableReceiveVoN(bool disable);
  175. /*!
  176. \return true if transmiting voice over network is disabled, so player can not talking
  177. */
  178. proto native bool IsDisabledTransmitingVoN();
  179. /*!
  180. \return true, if receiving voice over network is disabled, so player can not listen anybody
  181. */
  182. proto native bool IsDisabledReceivingVoN();
  183. /*!
  184. enables/disables player's voice communication
  185. \param listening enable or disable microphone
  186. \param toggled enable or disable PTT/Voice activation
  187. */
  188. proto void SetVoiceOn(bool listening, bool toggled = false);
  189. /*!
  190. create sphere
  191. \param worldX world X of touch with ground
  192. \param worldZ world X of touch with ground
  193. \param radius radius
  194. \param centerLerp01 lerp of values inside rasterization
  195. \param timeDown01 relative speed of going down, 1 is usually 0.5secs
  196. \param maxHeight01 maximum relative height of flattening, 0 = no flatten
  197. */
  198. proto native void FlattenGrassSphere(float x, float z, float radius, float centerLerp01, float timeDown01, float maxHeight01);
  199. /*!
  200. create ellipse
  201. \param worldX world X of touch with ground
  202. \param worldZ world X of touch with ground
  203. \param radiusX radius in X coord before rotate
  204. \param radiusZ radius in Z coord before rotate
  205. \param offset offset, 0 = default center, <-1, 1>
  206. \param angleRAD rotation
  207. \param centerLerp01 lerp of values inside rasterization
  208. \param timeDown01 relative speed of going down, 1 is usually 0.5secs
  209. \param maxHeight01 maximum relative height of flattening, 0 = no flatten
  210. */
  211. proto native void FlattenGrassEllipse(float x, float z, float sideX, float sideZ, float offset, float angleRAD, float centerLerp01, float timeDown01, float maxHeight01);
  212. /*!
  213. create box
  214. \param worldX world X of touch with ground
  215. \param worldZ world X of touch with ground
  216. \param sideSize size of side
  217. \param angleRAD rotation
  218. \param centerLerp01 lerp of values inside rasterization
  219. \param timeDown01 relative speed of going down, 1 is usually 0.5secs
  220. \param maxHeight01 maximum relative height of flattening, 0 = no flatten
  221. */
  222. proto native void FlattenGrassBox(float x, float z, float side, float angleRAD, float centerLerp01, float timeDown01, float maxHeight01);
  223. /*!
  224. create rectangle
  225. \param worldX world X of touch with ground
  226. \param worldZ world X of touch with ground
  227. \param sideXSize size of side in X
  228. \param sideZSize size of side in Z
  229. \param offset offset, 0 = default center, <-1, 1>
  230. \param angleRAD rotation
  231. \param centerLerp01 lerp of values inside rasterization
  232. \param timeDown01 relative speed of going down, 1 is usually 0.5secs
  233. \param maxHeight01 maximum relative height of flattening, 0 = no flatten
  234. */
  235. proto native void FlattenGrassRect(float x, float z, float sideX, float sideZ, float offset, float angleRAD, float centerLerp01, float timeDown01, float maxHeight01);
  236. };