fnc_buildZenDialog.sqf 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. #include "function_macros.hpp"
  2. params["_functionToExecute","_functionParams"];
  3. if(isNil "zen_dialog_fnc_create") exitWith {
  4. LOG_ERROR("zen_dialog_fnc_create is Nil, invoking module directly.");
  5. _functionParams call _functionToExecute;
  6. };
  7. LOG("Found zen_dialog_fnc_create, building dialog");
  8. private _content = [
  9. [ "CHECKBOX", ["Ignore Custom Selection", "Spawns the default list of units if checked, meaning anything you check here will be ignored."], [ false ], false ],
  10. [ "CHECKBOX", ["B1", "Will allow B1s to be spawned by new factories."], [ true ], false ],
  11. [ "CHECKBOX", ["B1 Heavy", "Will allow Heavy B1s to be spawned by new factories."], [ false ], false ],
  12. [ "CHECKBOX", ["B1 Shotgun", "Will allow Shotgun B1s to be spawned by new factories."], [ false ], false ],
  13. [ "CHECKBOX", ["B1 Grenadier", "Will allow Grenadier B1s to be spawned by new factories."], [ true ], false ],
  14. [ "CHECKBOX", ["B1 Marksman", "Will allow BX Commandos to be spawned by new factories."], [ true ], false ],
  15. [ "CHECKBOX", ["B1 Light AT", "Will allow Light AT B1s to be spawned by new factories."], [ true ], false ],
  16. [ "CHECKBOX", ["B1 Heavy AT", "Will allow Heavy AT B1s to be spawned by new factories."], [ true ], false ],
  17. [ "CHECKBOX", ["B2", "Will allow B2s to be spawned by new factories."], [ true ], false ],
  18. [ "CHECKBOX", ["Super B2", "Will allow Super B2s to be spawned by new factories."], [ false ], false ],
  19. [ "CHECKBOX", ["B1 Jammer", "Will allow Jammer B1s to be spawned by new factories."], [ false ], false ],
  20. [ "CHECKBOX", ["BX Commando", "Will allow BX Commandos to be spawned by new factories."], [ false ], false ],
  21. [ "CHECKBOX", ["B1 Spec Ops", "Will allow Spec Ops B1s to be spawned by new factories."], [ false ], false ],
  22. [ "CHECKBOX", ["B1 Anti Air", "Will allow Anti Air B1s to be spawned by new factories."], [ false ], false ],
  23. [ "CHECKBOX", ["B1 Security", "Will allow Security B1s to be spawned by new factories."], [ false ], false ],
  24. [ "CHECKBOX", ["B1 Marine", "Will allow Marine B1s to be spawned by new factories."], [ false ], false ],
  25. [ "SLIDER", ["Maximum Droids to Deploy", "Maximum number of droids any one dispenser will keep up at any time. This is not the total droids spawned, but how many will be spawned before it decides to stop."], [ 0, 40, 20, 0 ], false ],
  26. [ "SLIDER", ["Rate of Deployment", "How many seconds between each droid spawn."], [ 4, 60, 8, 0 ], false ]
  27. ];
  28. private _fnc_onConfirm = {
  29. // On Confirm
  30. params["_dialogValues", "_args"];
  31. LOGF_2("On Confirm for %1 -|- %2", _dialogValues,_args);
  32. _dialogValues params [
  33. "_ignoreList",
  34. "_b1",
  35. "_b1_heavy",
  36. "_b1_shotgun",
  37. "_b1_grenadier",
  38. "_b1_marksman",
  39. "_b1_light_at",
  40. "_b1_heavy_at",
  41. "_b2",
  42. "_b2_super",
  43. "_b1_jammer",
  44. "_bx",
  45. "_b1_spec_ops",
  46. "_b1_aa",
  47. "_b1_security",
  48. "_b1_marine",
  49. "_numDroids",
  50. "_deployDelay"
  51. ];
  52. private _selectedTypes = [];
  53. if!(_ignoreList) then {
  54. if(_b1) then {
  55. _selectedTypes pushBack "RD501_opfor_unit_B1";
  56. };
  57. if(_b1_heavy) then {
  58. _selectedTypes pushBack "RD501_opfor_unit_B1_heavy";
  59. };
  60. if(_b1_shotgun) then {
  61. _selectedTypes pushBack "RD501_opfor_unit_B1_shotgun";
  62. };
  63. if(_b1_grenadier) then {
  64. _selectedTypes pushBack "RD501_opfor_unit_B1_grenadier";
  65. };
  66. if(_b1_marksman) then {
  67. _selectedTypes pushBack "RD501_opfor_unit_B1_marksman";
  68. };
  69. if(_b1_light_at) then {
  70. _selectedTypes pushBack "RD501_opfor_unit_B1_AT_light";
  71. };
  72. if(_b1_heavy_at) then {
  73. _selectedTypes pushBack "RD501_opfor_unit_B1_AT_heavy";
  74. };
  75. if(_b2) then {
  76. _selectedTypes pushBack "RD501_opfor_unit_B2_droid_Standard";
  77. };
  78. if(_b2_super) then {
  79. _selectedTypes pushBack "RD501_opfor_unit_B2_droid_Super";
  80. };
  81. if(_b1_jammer) then {
  82. _selectedTypes pushBack "RD501_opfor_unit_B1_jammer";
  83. };
  84. if(_b1_spec_ops) then {
  85. _selectedTypes pushBack "RD501_opfor_unit_B1_prototype";
  86. };
  87. if(_bx) then {
  88. _selectedTypes pushBack "RD501_opfor_unit_bx";
  89. };
  90. if(_b1_aa) then {
  91. _selectedTypes pushBack "RD501_opfor_unit_B1_aa";
  92. };
  93. if(_b1_security) then {
  94. _selectedTypes pushBack "RD501_opfor_unit_B1_security";
  95. };
  96. }
  97. else
  98. {
  99. _selectedTypes = [
  100. "RD501_opfor_unit_B2_droid_Standard",
  101. "RD501_opfor_unit_b1_grenadier",
  102. "RD501_opfor_unit_B1_AT_heavy",
  103. "RD501_opfor_unit_B1",
  104. "RD501_opfor_unit_B1_marksman",
  105. "RD501_opfor_unit_B1_AT_light"
  106. ];
  107. };
  108. [QUOTE(GVAR(droidDispenserUpdateGlobals)), [_selectedTypes, _numDroids, _deployDelay]] call CBA_fnc_serverEvent;
  109. _args params["_functionToExecute","_functionParams"];
  110. _functionParams call _functionToExecute;
  111. };
  112. private _fnc_onCancel = {
  113. // On Cancel
  114. params["_dialogValues", "_args"];
  115. _args params ["_logic"];
  116. deleteVehicle _logic;
  117. };
  118. private _args = [_functionToExecute, _functionParams];
  119. private _saveName = "";
  120. _created = [
  121. "Configure Droid Factory",
  122. _content,
  123. _fnc_onConfirm,
  124. _fnc_onCancel,
  125. _args,
  126. _saveName
  127. ] call zen_dialog_fnc_create;
  128. _created;