cfggameplaydatajson.c 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. //!contents of this class will be transfered to client upon connecting, with the variables in either initial state as set through the 'InitServer..()' call, or replaced with contents of the json configuration file if such file is both present and reading is enabled in server.cfg
  2. class CfgGameplayJson
  3. {
  4. int version = -1;
  5. //! Obsolete, 'InitServer' on individual json items is now called centrally
  6. void InitServer()
  7. {
  8. }
  9. //-------------------------------------------------------------------------------------------------
  10. //!!! all member variables must correspond with the cfggameplay.json file contents !!!!
  11. ref ITEM_GeneralData GeneralData = new ITEM_GeneralData;
  12. ref ITEM_PlayerData PlayerData = new ITEM_PlayerData;
  13. ref ITEM_WorldData WorldsData = new ITEM_WorldData;
  14. ref ITEM_BaseBuildingData BaseBuildingData = new ITEM_BaseBuildingData;
  15. ref ITEM_UIData UIData = new ITEM_UIData;
  16. ref ITEM_MapData MapData = new ITEM_MapData;
  17. ref ITEM_VehicleData VehicleData = new ITEM_VehicleData;
  18. };
  19. class ITEM_DataBase
  20. {
  21. void ITEM_DataBase()
  22. {
  23. #ifdef SERVER
  24. CfgGameplayHandler.RegisterItem(this);
  25. #endif
  26. }
  27. bool ValidateServer()
  28. {
  29. return true;
  30. }
  31. void InitServer();
  32. }
  33. class ITEM_GeneralData : ITEM_DataBase
  34. {
  35. override void InitServer()
  36. {
  37. disableBaseDamage = GetGame().ServerConfigGetInt( "disableBaseDamage" );
  38. disableContainerDamage = GetGame().ServerConfigGetInt( "disableContainerDamage" );
  39. disableRespawnDialog = GetGame().ServerConfigGetInt("disableRespawnDialog");
  40. }
  41. override bool ValidateServer()
  42. {
  43. return true;
  44. }
  45. //-------------------------------------------------------------------------------------------------
  46. //!!! all member variables must correspond with the cfggameplay.json file contents !!!!
  47. bool disableBaseDamage;
  48. bool disableContainerDamage;
  49. bool disableRespawnDialog;
  50. bool disableRespawnInUnconsciousness;
  51. };
  52. //--------------------------------------------------------------------------------------------------------------------------------------------------
  53. class ITEM_PlayerData : ITEM_DataBase
  54. {
  55. ref ITEM_StaminaData StaminaData = new ITEM_StaminaData;
  56. ref ITEM_ShockHandlingData ShockHandlingData = new ITEM_ShockHandlingData;
  57. ref ITEM_MovementData MovementData = new ITEM_MovementData;
  58. ref ITEM_DrowningData DrowningData = new ITEM_DrowningData;
  59. override void InitServer()
  60. {
  61. disablePersonalLight = GetGame().ServerConfigGetInt( "disablePersonalLight" );
  62. }
  63. override bool ValidateServer()
  64. {
  65. return true;
  66. }
  67. //-------------------------------------------------------------------------------------------------
  68. //!!! all member variables must correspond with the cfggameplay.json file contents !!!!
  69. bool disablePersonalLight;
  70. bool disable2dMap;
  71. ref TStringArray spawnGearPresetFiles;
  72. };
  73. //--------------------------------------------------------------------------------------------------------------------------------------------------
  74. class ITEM_ShockHandlingData : ITEM_DataBase
  75. {
  76. override void InitServer()
  77. {
  78. }
  79. override bool ValidateServer()
  80. {
  81. return true;
  82. }
  83. //-------------------------------------------------------------------------------------------------
  84. //!!! all member variables must correspond with the cfggameplay.json file contents !!!!
  85. float shockRefillSpeedConscious = PlayerConstants.SHOCK_REFILL_CONSCIOUS_SPEED;
  86. float shockRefillSpeedUnconscious = PlayerConstants.SHOCK_REFILl_UNCONSCIOUS_SPEED;
  87. bool allowRefillSpeedModifier = true;
  88. };
  89. //--------------------------------------------------------------------------------------------------------------------------------------------------
  90. class ITEM_StaminaData : ITEM_DataBase
  91. {
  92. override void InitServer()
  93. {
  94. staminaMax = GameConstants.STAMINA_MAX;
  95. }
  96. override bool ValidateServer()
  97. {
  98. if (staminaMax == 0.0)
  99. return false;
  100. return true;
  101. }
  102. //-------------------------------------------------------------------------------------------------
  103. //!!! all member variables must correspond with the cfggameplay.json file contents !!!!
  104. float staminaWeightLimitThreshold = GameConstants.STAMINA_WEIGHT_LIMIT_THRESHOLD;
  105. float staminaMax = GameConstants.STAMINA_MAX;
  106. float staminaKgToStaminaPercentPenalty = GameConstants.STAMINA_KG_TO_STAMINAPERCENT_PENALTY;
  107. float staminaMinCap = GameConstants.STAMINA_MIN_CAP;
  108. float sprintStaminaModifierErc = 1;//consumption of stamina during standing sprint modification
  109. float sprintStaminaModifierCro = 1;//consumption of stamina during crouched sprint modification
  110. float sprintSwimmingStaminaModifier = 1;//consumption of stamina during swimming sprint modification
  111. float sprintLadderStaminaModifier = 1;//consumption of stamina during climbing sprint modification
  112. float meleeStaminaModifier = 1;//consumption of stamina during melee attacks and evasion modification
  113. float obstacleTraversalStaminaModifier = 1;// vaulting and climbing stamina consumption modification
  114. float holdBreathStaminaModifier = 1;// hold breath stamina consumption modification
  115. };
  116. //--------------------------------------------------------------------------------------------------------------------------------------------------
  117. class ITEM_MovementData : ITEM_DataBase
  118. {
  119. override void InitServer()
  120. {
  121. }
  122. override bool ValidateServer()
  123. {
  124. return true;
  125. }
  126. //-------------------------------------------------------------------------------------------------
  127. //!!! all member variables must correspond with the cfggameplay.json file contents !!!!
  128. float timeToStrafeJog = 0.1;
  129. float rotationSpeedJog = 0.15;
  130. float timeToSprint = 0.45;
  131. float timeToStrafeSprint = 0.3;
  132. float rotationSpeedSprint = 0.15;
  133. bool allowStaminaAffectInertia = 1;
  134. }
  135. //--------------------------------------------------------------------------------------------------------------------------------------------------
  136. class ITEM_WorldData : ITEM_DataBase
  137. {
  138. override void InitServer()
  139. {
  140. lightingConfig = GetGame().ServerConfigGetInt( "lightingConfig" );
  141. wetnessWeightModifiers = {GameConstants.WEIGHT_DRY,GameConstants.WEIGHT_DAMP,GameConstants.WEIGHT_WET,GameConstants.WEIGHT_SOAKING_WET,GameConstants.WEIGHT_DRENCHED};
  142. }
  143. override bool ValidateServer()
  144. {
  145. if (!wetnessWeightModifiers || wetnessWeightModifiers.Count() != 5)
  146. {
  147. return false;
  148. }
  149. return true;
  150. }
  151. //-------------------------------------------------------------------------------------------------
  152. //!!! all member variables must correspond with the cfggameplay.json file contents !!!!
  153. int lightingConfig;
  154. ref array<string> objectSpawnersArr;
  155. ref array<float> environmentMinTemps;
  156. ref array<float> environmentMaxTemps;
  157. ref array<float> wetnessWeightModifiers = {GameConstants.WEIGHT_DRY,GameConstants.WEIGHT_DAMP,GameConstants.WEIGHT_WET,GameConstants.WEIGHT_SOAKING_WET,GameConstants.WEIGHT_DRENCHED};
  158. ref TStringArray playerRestrictedAreaFiles;
  159. };
  160. //--------------------------------------------------------------------------------------------------------------------------------------------------
  161. class ITEM_BaseBuildingData : ITEM_DataBase
  162. {
  163. override void InitServer()
  164. {
  165. }
  166. override bool ValidateServer()
  167. {
  168. return true;
  169. }
  170. //-------------------------------------------------------------------------------------------------
  171. //!!! all member variables must correspond with the cfggameplay.json file contents !!!!
  172. ref ITEM_HologramData HologramData = new ITEM_HologramData;
  173. ref ITEM_ConstructionData ConstructionData = new ITEM_ConstructionData;
  174. };
  175. //--------------------------------------------------------------------------------------------------------------------------------------------------
  176. class ITEM_HologramData : ITEM_DataBase
  177. {
  178. override void InitServer()
  179. {
  180. disallowedTypesInUnderground = new TStringSet();
  181. disallowedTypesInUnderground.Insert("FenceKit");
  182. disallowedTypesInUnderground.Insert("TerritoryFlagKit");
  183. disallowedTypesInUnderground.Insert("WatchtowerKit");
  184. }
  185. override bool ValidateServer()
  186. {
  187. return true;
  188. }
  189. //-------------------------------------------------------------------------------------------------
  190. //!!! all member variables must correspond with the cfggameplay.json file contents !!!!
  191. bool disableIsCollidingBBoxCheck;
  192. bool disableIsCollidingPlayerCheck;
  193. bool disableIsClippingRoofCheck;
  194. bool disableIsBaseViableCheck;
  195. bool disableIsCollidingGPlotCheck;
  196. bool disableIsCollidingAngleCheck;
  197. bool disableIsPlacementPermittedCheck;
  198. bool disableHeightPlacementCheck;
  199. bool disableIsUnderwaterCheck;
  200. bool disableIsInTerrainCheck;
  201. bool disableColdAreaPlacementCheck;
  202. ref TStringSet disallowedTypesInUnderground;
  203. };
  204. //--------------------------------------------------------------------------------------------------------------------------------------------------
  205. class ITEM_ConstructionData : ITEM_DataBase
  206. {
  207. override void InitServer()
  208. {
  209. }
  210. override bool ValidateServer()
  211. {
  212. return true;
  213. }
  214. //-------------------------------------------------------------------------------------------------
  215. //!!! all member variables must correspond with the cfggameplay.json file contents !!!!
  216. bool disablePerformRoofCheck;
  217. bool disableIsCollidingCheck;
  218. bool disableDistanceCheck;
  219. };
  220. //--------------------------------------------------------------------------------------------------------------------------------------------------
  221. //! data for UI, in-game HUD, and similar
  222. class ITEM_UIData : ITEM_DataBase
  223. {
  224. override void InitServer()
  225. {
  226. HitIndicationData.InitServer();
  227. }
  228. override bool ValidateServer()
  229. {
  230. return true;
  231. }
  232. //-------------------------------------------------------------------------------------------------
  233. //!!! all member variables must correspond with the cfggameplay.json file contents !!!!
  234. ref ITEM_HitIndicationData HitIndicationData = new ITEM_HitIndicationData;
  235. bool use3DMap = false;
  236. };
  237. //--------------------------------------------------------------------------------------------------------------------------------------------------
  238. class ITEM_HitIndicationData : ITEM_DataBase
  239. {
  240. override void InitServer()
  241. {
  242. hitDirectionOverrideEnabled = false;
  243. hitIndicationPostProcessEnabled = false;
  244. }
  245. override bool ValidateServer()
  246. {
  247. return true;
  248. }
  249. //-------------------------------------------------------------------------------------------------
  250. //!!! all member variables must correspond with the cfggameplay.json file contents !!!!
  251. //!!! all member variables must be defined in the .json file, otherwise they are treated as '0' value (unless that's what you want..)
  252. bool hitDirectionOverrideEnabled = false;
  253. int hitDirectionBehaviour = HitDirectionModes.STATIC;
  254. int hitDirectionStyle = HitIndicatorType.SPLASH;
  255. string hitDirectionIndicatorColorStr;
  256. float hitDirectionMaxDuration = HitDirectionConstants.DURATION_BASE;
  257. float hitDirectionBreakPointRelative = HitDirectionConstants.BREAKPOINT_BASE;
  258. float hitDirectionScatter = HitDirectionConstants.SCATTER;
  259. bool hitIndicationPostProcessEnabled = false;
  260. };
  261. //--------------------------------------------------------------------------------------------------------------------------------------------------
  262. class ITEM_MapData : ITEM_DataBase
  263. {
  264. override void InitServer()
  265. {
  266. }
  267. override bool ValidateServer()
  268. {
  269. return true;
  270. }
  271. //-------------------------------------------------------------------------------------------------
  272. //!!! all member variables must correspond with the cfggameplay.json file contents !!!!
  273. bool ignoreMapOwnership = false;
  274. bool ignoreNavItemsOwnership = false;
  275. bool displayPlayerPosition = false;
  276. bool displayNavInfo = true;
  277. }
  278. //--------------------------------------------------------------------------------------------------------------------------------------------------
  279. class ITEM_DrowningData : ITEM_DataBase
  280. {
  281. override void InitServer()
  282. {
  283. }
  284. override bool ValidateServer()
  285. {
  286. return true;
  287. }
  288. //-------------------------------------------------------------------------------------------------
  289. //!!! all member variables must correspond with the cfggameplay.json file contents !!!!
  290. float staminaDepletionSpeed = 10;
  291. float healthDepletionSpeed = 10;
  292. float shockDepletionSpeed = 10;
  293. }
  294. //--------------------------------------------------------------------------------------------------------------------------------------------------
  295. class ITEM_VehicleData : ITEM_DataBase
  296. {
  297. override void InitServer()
  298. {
  299. }
  300. override bool ValidateServer()
  301. {
  302. return true;
  303. }
  304. //-------------------------------------------------------------------------------------------------
  305. //!!! all member variables must correspond with the cfggameplay.json file contents !!!!
  306. float boatDecayMultiplier = 1;
  307. };