diff --git a/addons/overthrow_main/CfgFunctions.hpp b/addons/overthrow_main/CfgFunctions.hpp index 6fe1d2ec..c5587ad6 100644 --- a/addons/overthrow_main/CfgFunctions.hpp +++ b/addons/overthrow_main/CfgFunctions.hpp @@ -663,6 +663,9 @@ class CfgFunctions file = "\overthrow_main\functions\integration"; //class advancedTowingInit {}; class detectItems {}; + class zenSetMoney {}; + class zenSetStability {}; + class zenChangeSupport {}; }; }; }; diff --git a/addons/overthrow_main/functions/integration/fn_zenChangeSupport.sqf b/addons/overthrow_main/functions/integration/fn_zenChangeSupport.sqf new file mode 100644 index 00000000..cc1609c0 --- /dev/null +++ b/addons/overthrow_main/functions/integration/fn_zenChangeSupport.sqf @@ -0,0 +1,32 @@ +/* + Description: + Creates the dialog to change the support of the nearest town. + Parameters: + _position: ARRAY - The position the module was placed + _logic: OBJECT - The module object + Usage: + [_hoveredEntity] call OT_zenChangeSupport; + Returns: BOOL - Dialog created +*/ + +params ["_position", "_logic"]; +deleteVehicle _logic; + +private _nearestTown = _position call OT_fnc_nearestTown; +private _support = [_nearestTown] call OT_fnc_support; + +[ + format ["Change Town Support: %1", _nearestTown], + [[ + "EDIT", + "Change this towns support by", + "0" + ]], + { + params ["_result", "_args"]; + _args params ["_town"]; + [_town, parseNumber (_result # 0)] call OT_fnc_support; + }, + {}, + [_nearestTown, _support] +] call zen_dialog_fnc_create; diff --git a/addons/overthrow_main/functions/integration/fn_zenSetMoney.sqf b/addons/overthrow_main/functions/integration/fn_zenSetMoney.sqf new file mode 100644 index 00000000..903b1711 --- /dev/null +++ b/addons/overthrow_main/functions/integration/fn_zenSetMoney.sqf @@ -0,0 +1,25 @@ +/* + Description: + Creates the dialog to change money, and sets the money. + Parameters: + _unit: OBJECT - Unit to change the money of + Usage: + [_hoveredEntity] call OT_zenSetMoney; + Returns: BOOL - Dialog created +*/ + +params ["_unit"]; + +if !(isPlayer _unit) exitWith {false}; + +[ + "Set Unit Money", + [[ + "EDIT", + "Set this units money to", + "0" + ]], + {params ["_result", "_unit"]; _unit setVariable ["money", parseNumber (_result # 0), true]}, + {}, + _unit +] call zen_dialog_fnc_create; diff --git a/addons/overthrow_main/functions/integration/fn_zenSetStability.sqf b/addons/overthrow_main/functions/integration/fn_zenSetStability.sqf new file mode 100644 index 00000000..c007f8ae --- /dev/null +++ b/addons/overthrow_main/functions/integration/fn_zenSetStability.sqf @@ -0,0 +1,34 @@ +/* + Description: + Creates the dialog to change the stability of the nearest town. + Parameters: + _position: ARRAY - The position the module was placed + _logic: OBJECT - The module object + Usage: + [_hoveredEntity] call OT_zenSetStability; + Returns: BOOL - Dialog created +*/ + +params ["_position", "_logic"]; +deleteVehicle _logic; + +private _nearestTown = _position call OT_fnc_nearestTown; +private _stability = server getVariable [format ["stability%1", _nearestTown], 100]; + +[ + format ["Set Town Stability: %1", _nearestTown], + [[ + "SLIDER:PERCENT", + "Set this towns stability to:", + 0, + 1, + (_stability / 100) + ]], + { + params ["_result", "_args"]; + _args params ["_town"]; + server setVariable [format ["stability%1", _town], round ((_result # 0) * 100)] + }, + {}, + [_nearestTown, _stability] +] call zen_dialog_fnc_create; diff --git a/addons/overthrow_main/functions/player/fn_initPlayerLocal.sqf b/addons/overthrow_main/functions/player/fn_initPlayerLocal.sqf index a090f889..14b91fe6 100644 --- a/addons/overthrow_main/functions/player/fn_initPlayerLocal.sqf +++ b/addons/overthrow_main/functions/player/fn_initPlayerLocal.sqf @@ -447,6 +447,15 @@ player call OT_fnc_mapSystem; }; }foreach(server getVariable ["bases",[]]); +// ZEN integration +if (isClass (configFile >> "CfgPatches" >> "zen_common")) then { + systemChat "Zeus Enhanced has been detected, Overthrow specific functionality has been added to Zeus"; + ["Overthrow", "Change Town Stability", {_this call OT_fnc_zenSetStability}] call zen_custom_modules_fnc_register; + ["Overthrow", "Change Town Support", {_this call OT_fnc_zenChangeSupport}] call zen_custom_modules_fnc_register; +} else { + systemChat "Zeus Enhanced not detected, consider adding it to your modlist for Overthrow specific functionality"; +}; + [] call OT_fnc_setupPlayer; _introcam cameraEffect ["Terminate", "BACK" ]; camDestroy _introcam; diff --git a/addons/overthrow_main/mission_component.hpp b/addons/overthrow_main/mission_component.hpp index fa665605..7287774c 100644 --- a/addons/overthrow_main/mission_component.hpp +++ b/addons/overthrow_main/mission_component.hpp @@ -154,3 +154,15 @@ class Params { default = 1; }; }; + +// ZEN integration +// This will do nothing if ZEN is loaded +class zen_context_menu_actions { + class ot_setmoney { + displayName = "Overthrow: Set Money"; + icon = "\overthrow_main\ui\markers\shop-General.paa"; + statement = "[_hoveredEntity] call OT_fnc_zenSetMoney"; + condition = "_hoveredEntity isKindOf 'CAManBase' && {isPlayer _hoveredEntity}"; + priority = 50; + }; +};