ACE3/addons/fortify/XEH_postInit.sqf
jonpas 6ca9d59443
Merge ACEX (#8415)
* Merge ACEX - first attempt
Backwards compatibility with XGVAR set of macros used on all settings and config entries
Public API functions not taken into account yet, many other things probably still missed

* Resolve issues

* Switch to addSetting, backward compatible CfgPatches, missed XGVAR.

* Remove unnecessary backwards compat

* Convert ACEX Categorised settings to initSettings / Fix Intel items magazine

* Apply suggestions from code review

Co-authored-by: PabstMirror <pabstmirror@gmail.com>

* Remove maintainers from merged ACEX components

* Cleanup unused module and faction classes

* Sitting - Add more object configs by @Dystopian
https://github.com/acemod/ACEX/pull/255

* Translations - Add Japanese by @classicarma
https://github.com/acemod/ACEX/pull/259

* Kill Tracker - Add killtracker.inc public include file by @Freddo3000"
https://github.com/acemod/ACEX/pull/251

* Add ACEX authors and sort authors file

* acex - final tweaks (#8513)

* acex - handle old funcs

* replace thirst/hunger setvars to acex naming

fix macro

Revert "fix macro"

This reverts commit d807e5e804c43916eaa42d34a89af94c6d9a48ad.

Revert "replace thirst/hunger setvars to acex naming"

This reverts commit bafc607884932d6e339daedc7c22e25dddbdd868.

x

Co-authored-by: TyroneMF <TyroneMF@hotmail.com>
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
2021-10-14 10:46:43 -05:00

66 lines
2.7 KiB
Plaintext

#include "script_component.hpp"
if (isServer) then {
[QGVAR(registerObjects), LINKFUNC(registerObjects)] call CBA_fnc_addEventHandler;
[QGVAR(objectPlaced), {
params ["_unit", "_side", "_object"];
TRACE_3("objectPlaced",_unit,_side,_object);
private _jipID = [QGVAR(addActionToObject), [_side, _object]] call CBA_fnc_globalEventJIP;
[_jipID, _object] call CBA_fnc_removeGlobalEventJIP; // idealy this function should be called on the server
}] call CBA_fnc_addEventHandler;
};
if (!hasInterface) exitWith {};
GVAR(isPlacing) = PLACE_CANCEL;
["ace_interactMenuOpened", {GVAR(isPlacing) = PLACE_CANCEL}] call CBA_fnc_addEventHandler;
GVAR(objectRotationX) = 0;
GVAR(objectRotationY) = 0;
GVAR(objectRotationZ) = 0;
// Register CBA Chat command for admins (Example: #ace-fortify west small 200)
["ace-fortify", LINKFUNC(handleChatCommand), "admin"] call CBA_fnc_registerChatCommand;
[QGVAR(sideBudgetHint), {
params ["_side"];
if (_side isEqualTo side group ACE_player && {XGVAR(settingHint) isEqualTo 2 || {XGVAR(settingHint) isEqualTo 1 && {"ACE_Fortify" in (ACE_player call EFUNC(common,uniqueItems))}}}) then {
private _budget = [_side] call FUNC(getBudget);
TRACE_2("sideBudgetHint",_side,_budget);
[format ["%1 $%2", LLSTRING(Budget), _budget]] call EFUNC(common,displayTextStructured);
};
}] call CBA_fnc_addEventHandler;
[QGVAR(addActionToObject), {
params ["_side", "_object"];
TRACE_2("addActionToObject EH",_side,_object);
if (isNull _object) exitWith {};
if (_side isEqualTo side group ace_player) then {
private _budget = [_side] call FUNC(getBudget);
private _cost = [_side, typeOf _object] call FUNC(getCost);
private _text = [format ["Remove Object +$%1", _cost], "Remove Object"] select (_budget == -1);
// Remove object action
private _removeAction = [
QGVAR(removeObject),
_text,
"",
{
params ["_target", "_player", "_params"];
_params params ["_side"];
TRACE_2("deleting placed object",_target,_params);
[QGVAR(objectDeleted), [_player, _side, _target]] call CBA_fnc_globalEvent;
deleteVehicle _target;
_params call FUNC(updateBudget);
},
{(missionNamespace getVariable [QGVAR(fortifyAllowed), true]) && {"ACE_Fortify" in (_player call EFUNC(common,uniqueItems))}},
{},
[_side, _cost],
{[0, 0, 0]},
5
] call EFUNC(interact_menu,createAction);
[_object, 0, ["ACE_MainActions"], _removeAction] call EFUNC(interact_menu,addActionToObject);
};
}] call CBA_fnc_addEventHandler;