ACE3/addons/headless/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

38 lines
1.8 KiB
Plaintext

#include "script_component.hpp"
["ace_settingsInitialized", {
// Register and remove HCs if not client that is not server and distribution or end mission enabled
if ((!hasInterface || isServer) && {XGVAR(enabled) || XGVAR(endMission) != 0}) then {
if (isServer) then {
// Request rebalance on any unit spawn (only if distribution enabled)
if (XGVAR(enabled)) then {
["AllVehicles", "init", FUNC(handleSpawn), nil, nil, true] call CBA_fnc_addClassEventHandler;
};
// Add disconnect EH
addMissionEventHandler ["HandleDisconnect", {call FUNC(handleDisconnect)}];
} else {
// Register HC (this part happens on HC only)
[QXGVAR(headlessClientJoined), [player]] call CBA_fnc_globalEvent; // Global event for API purposes
};
// Transfer loadouts (naked unit work-around)
if (XGVAR(transferLoadout) > 0) then {
["CAManBase", "Local", {
params ["_unit", "_local"];
// Check if naked unit bug happened
if (_local && {uniform _unit == ""}) then {
INFO_1("Unit [%1] became local with broken loadout - attempting to fix",_unit);
if (XGVAR(transferLoadout) == 1) then {
// Transferred loadout, if unavailable reset to config default (still better than naked)
_unit setUnitLoadout (_unit getVariable [QGVAR(loadout), typeOf _unit]);
} else {
// Config default loadout
_unit setUnitLoadout (typeOf _unit);
};
};
}] call CBA_fnc_addClassEventHandler;
};
};
}] call CBA_fnc_addEventHandler;