cfggameplaydatajson.c 12 KB

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