cfggameplaydatajson.c 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  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. ref ITEM_WeaponObstructionData WeaponObstructionData = new ITEM_WeaponObstructionData;
  60. override void InitServer()
  61. {
  62. disablePersonalLight = GetGame().ServerConfigGetInt( "disablePersonalLight" );
  63. }
  64. override bool ValidateServer()
  65. {
  66. return true;
  67. }
  68. //-------------------------------------------------------------------------------------------------
  69. //!!! all member variables must correspond with the cfggameplay.json file contents !!!!
  70. bool disablePersonalLight;
  71. bool disable2dMap;
  72. ref TStringArray spawnGearPresetFiles;
  73. };
  74. //--------------------------------------------------------------------------------------------------------------------------------------------------
  75. class ITEM_ShockHandlingData : ITEM_DataBase
  76. {
  77. override void InitServer()
  78. {
  79. }
  80. override bool ValidateServer()
  81. {
  82. return true;
  83. }
  84. //-------------------------------------------------------------------------------------------------
  85. //!!! all member variables must correspond with the cfggameplay.json file contents !!!!
  86. float shockRefillSpeedConscious = PlayerConstants.SHOCK_REFILL_CONSCIOUS_SPEED;
  87. float shockRefillSpeedUnconscious = PlayerConstants.SHOCK_REFILl_UNCONSCIOUS_SPEED;
  88. bool allowRefillSpeedModifier = true;
  89. };
  90. //--------------------------------------------------------------------------------------------------------------------------------------------------
  91. class ITEM_StaminaData : ITEM_DataBase
  92. {
  93. override void InitServer()
  94. {
  95. staminaMax = GameConstants.STAMINA_MAX;
  96. }
  97. override bool ValidateServer()
  98. {
  99. if (staminaMax == 0.0)
  100. return false;
  101. return true;
  102. }
  103. //-------------------------------------------------------------------------------------------------
  104. //!!! all member variables must correspond with the cfggameplay.json file contents !!!!
  105. float staminaWeightLimitThreshold = GameConstants.STAMINA_WEIGHT_LIMIT_THRESHOLD;
  106. float staminaMax = GameConstants.STAMINA_MAX;
  107. float staminaKgToStaminaPercentPenalty = GameConstants.STAMINA_KG_TO_STAMINAPERCENT_PENALTY;
  108. float staminaMinCap = GameConstants.STAMINA_MIN_CAP;
  109. float sprintStaminaModifierErc = 1;//consumption of stamina during standing sprint modification
  110. float sprintStaminaModifierCro = 1;//consumption of stamina during crouched sprint modification
  111. float sprintSwimmingStaminaModifier = 1;//consumption of stamina during swimming sprint modification
  112. float sprintLadderStaminaModifier = 1;//consumption of stamina during climbing sprint modification
  113. float meleeStaminaModifier = 1;//consumption of stamina during melee attacks and evasion modification
  114. float obstacleTraversalStaminaModifier = 1;// vaulting and climbing stamina consumption modification
  115. float holdBreathStaminaModifier = 1;// hold breath stamina consumption modification
  116. };
  117. //--------------------------------------------------------------------------------------------------------------------------------------------------
  118. class ITEM_MovementData : ITEM_DataBase
  119. {
  120. override void InitServer()
  121. {
  122. }
  123. override bool ValidateServer()
  124. {
  125. return true;
  126. }
  127. //-------------------------------------------------------------------------------------------------
  128. //!!! all member variables must correspond with the cfggameplay.json file contents !!!!
  129. float timeToStrafeJog = 0.1;
  130. float rotationSpeedJog = 0.15;
  131. float timeToSprint = 0.45;
  132. float timeToStrafeSprint = 0.3;
  133. float rotationSpeedSprint = 0.15;
  134. bool allowStaminaAffectInertia = 1;
  135. }
  136. //--------------------------------------------------------------------------------------------------------------------------------------------------
  137. class ITEM_WorldData : ITEM_DataBase
  138. {
  139. override void InitServer()
  140. {
  141. lightingConfig = GetGame().ServerConfigGetInt( "lightingConfig" );
  142. wetnessWeightModifiers = {GameConstants.WEIGHT_DRY,GameConstants.WEIGHT_DAMP,GameConstants.WEIGHT_WET,GameConstants.WEIGHT_SOAKING_WET,GameConstants.WEIGHT_DRENCHED};
  143. }
  144. override bool ValidateServer()
  145. {
  146. if (!wetnessWeightModifiers || wetnessWeightModifiers.Count() != 5)
  147. {
  148. return false;
  149. }
  150. return true;
  151. }
  152. //-------------------------------------------------------------------------------------------------
  153. //!!! all member variables must correspond with the cfggameplay.json file contents !!!!
  154. int lightingConfig;
  155. ref array<string> objectSpawnersArr;
  156. ref array<float> environmentMinTemps;
  157. ref array<float> environmentMaxTemps;
  158. ref array<float> wetnessWeightModifiers = {GameConstants.WEIGHT_DRY,GameConstants.WEIGHT_DAMP,GameConstants.WEIGHT_WET,GameConstants.WEIGHT_SOAKING_WET,GameConstants.WEIGHT_DRENCHED};
  159. ref TStringArray playerRestrictedAreaFiles;
  160. };
  161. //--------------------------------------------------------------------------------------------------------------------------------------------------
  162. class ITEM_BaseBuildingData : ITEM_DataBase
  163. {
  164. override void InitServer()
  165. {
  166. }
  167. override bool ValidateServer()
  168. {
  169. return true;
  170. }
  171. //-------------------------------------------------------------------------------------------------
  172. //!!! all member variables must correspond with the cfggameplay.json file contents !!!!
  173. ref ITEM_HologramData HologramData = new ITEM_HologramData;
  174. ref ITEM_ConstructionData ConstructionData = new ITEM_ConstructionData;
  175. };
  176. //--------------------------------------------------------------------------------------------------------------------------------------------------
  177. class ITEM_HologramData : ITEM_DataBase
  178. {
  179. override void InitServer()
  180. {
  181. disallowedTypesInUnderground = new TStringSet();
  182. disallowedTypesInUnderground.Insert("FenceKit");
  183. disallowedTypesInUnderground.Insert("TerritoryFlagKit");
  184. disallowedTypesInUnderground.Insert("WatchtowerKit");
  185. }
  186. override bool ValidateServer()
  187. {
  188. return true;
  189. }
  190. //-------------------------------------------------------------------------------------------------
  191. //!!! all member variables must correspond with the cfggameplay.json file contents !!!!
  192. bool disableIsCollidingBBoxCheck;
  193. bool disableIsCollidingPlayerCheck;
  194. bool disableIsClippingRoofCheck;
  195. bool disableIsBaseViableCheck;
  196. bool disableIsCollidingGPlotCheck;
  197. bool disableIsCollidingAngleCheck;
  198. bool disableIsPlacementPermittedCheck;
  199. bool disableHeightPlacementCheck;
  200. bool disableIsUnderwaterCheck;
  201. bool disableIsInTerrainCheck;
  202. bool disableColdAreaPlacementCheck;
  203. ref TStringSet disallowedTypesInUnderground;
  204. };
  205. //--------------------------------------------------------------------------------------------------------------------------------------------------
  206. class ITEM_ConstructionData : ITEM_DataBase
  207. {
  208. override void InitServer()
  209. {
  210. }
  211. override bool ValidateServer()
  212. {
  213. return true;
  214. }
  215. //-------------------------------------------------------------------------------------------------
  216. //!!! all member variables must correspond with the cfggameplay.json file contents !!!!
  217. bool disablePerformRoofCheck;
  218. bool disableIsCollidingCheck;
  219. bool disableDistanceCheck;
  220. };
  221. //--------------------------------------------------------------------------------------------------------------------------------------------------
  222. //! data for UI, in-game HUD, and similar
  223. class ITEM_UIData : ITEM_DataBase
  224. {
  225. override void InitServer()
  226. {
  227. HitIndicationData.InitServer();
  228. }
  229. override bool ValidateServer()
  230. {
  231. return true;
  232. }
  233. //-------------------------------------------------------------------------------------------------
  234. //!!! all member variables must correspond with the cfggameplay.json file contents !!!!
  235. ref ITEM_HitIndicationData HitIndicationData = new ITEM_HitIndicationData;
  236. bool use3DMap = false;
  237. };
  238. //--------------------------------------------------------------------------------------------------------------------------------------------------
  239. class ITEM_HitIndicationData : ITEM_DataBase
  240. {
  241. override void InitServer()
  242. {
  243. hitDirectionOverrideEnabled = false;
  244. hitIndicationPostProcessEnabled = false;
  245. }
  246. override bool ValidateServer()
  247. {
  248. return true;
  249. }
  250. //-------------------------------------------------------------------------------------------------
  251. //!!! all member variables must correspond with the cfggameplay.json file contents !!!!
  252. //!!! all member variables must be defined in the .json file, otherwise they are treated as '0' value (unless that's what you want..)
  253. bool hitDirectionOverrideEnabled = false;
  254. int hitDirectionBehaviour = HitDirectionModes.STATIC;
  255. int hitDirectionStyle = HitIndicatorType.SPLASH;
  256. string hitDirectionIndicatorColorStr;
  257. float hitDirectionMaxDuration = HitDirectionConstants.DURATION_BASE;
  258. float hitDirectionBreakPointRelative = HitDirectionConstants.BREAKPOINT_BASE;
  259. float hitDirectionScatter = HitDirectionConstants.SCATTER;
  260. bool hitIndicationPostProcessEnabled = false;
  261. };
  262. //--------------------------------------------------------------------------------------------------------------------------------------------------
  263. class ITEM_MapData : ITEM_DataBase
  264. {
  265. override void InitServer()
  266. {
  267. }
  268. override bool ValidateServer()
  269. {
  270. return true;
  271. }
  272. //-------------------------------------------------------------------------------------------------
  273. //!!! all member variables must correspond with the cfggameplay.json file contents !!!!
  274. bool ignoreMapOwnership = false;
  275. bool ignoreNavItemsOwnership = false;
  276. bool displayPlayerPosition = false;
  277. bool displayNavInfo = true;
  278. }
  279. //--------------------------------------------------------------------------------------------------------------------------------------------------
  280. class ITEM_DrowningData : ITEM_DataBase
  281. {
  282. override void InitServer()
  283. {
  284. }
  285. override bool ValidateServer()
  286. {
  287. return true;
  288. }
  289. //-------------------------------------------------------------------------------------------------
  290. //!!! all member variables must correspond with the cfggameplay.json file contents !!!!
  291. float staminaDepletionSpeed = 10;
  292. float healthDepletionSpeed = 10;
  293. float shockDepletionSpeed = 10;
  294. }
  295. //--------------------------------------------------------------------------------------------------------------------------------------------------
  296. enum EWeaponObstructionMode
  297. {
  298. DISABLED = 0, // Obstruction disallowed. Weapon doesn't obstruct, but still lifts.
  299. ENABLED = 1, // Obstruction allowed. Weapon first obstructs and then lifts.
  300. ALWAYS = 2, // Obstruction always. Weapon obstructs and never lifts.
  301. }
  302. class ITEM_WeaponObstructionData : ITEM_DataBase
  303. {
  304. override void InitServer()
  305. {
  306. }
  307. override bool ValidateServer()
  308. {
  309. return true;
  310. }
  311. //-------------------------------------------------------------------------------------------------
  312. //!!! all member variables must correspond with the cfggameplay.json file contents !!!!
  313. EWeaponObstructionMode staticMode = EWeaponObstructionMode.ENABLED;
  314. EWeaponObstructionMode dynamicMode = EWeaponObstructionMode.ENABLED;
  315. }
  316. //--------------------------------------------------------------------------------------------------------------------------------------------------
  317. class ITEM_VehicleData : ITEM_DataBase
  318. {
  319. override void InitServer()
  320. {
  321. }
  322. override bool ValidateServer()
  323. {
  324. return true;
  325. }
  326. //-------------------------------------------------------------------------------------------------
  327. //!!! all member variables must correspond with the cfggameplay.json file contents !!!!
  328. float boatDecayMultiplier = 1;
  329. };