2016-02-26 06:57:18 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2018-11-10 20:33:20 +00:00
|
|
|
#define IDD_DISPLAY3DEN 313
|
|
|
|
|
2016-05-16 13:55:19 +00:00
|
|
|
// Global skill module PVs values for persistence, just listen for the PV
|
|
|
|
QGVAR(GlobalSkillAI) addPublicVariableEventHandler FUNC(moduleGlobalSetSkill);
|
2016-05-18 20:19:52 +00:00
|
|
|
|
2017-05-26 15:07:33 +00:00
|
|
|
[QGVAR(moveToRespawnPosition), BIS_fnc_moveToRespawnPosition] call CBA_fnc_addEventHandler;
|
2016-06-11 20:02:16 +00:00
|
|
|
[QGVAR(moduleDefendArea), CBA_fnc_taskDefend] call CBA_fnc_addEventHandler;
|
|
|
|
[QGVAR(modulePatrolArea), CBA_fnc_taskPatrol] call CBA_fnc_addEventHandler;
|
|
|
|
[QGVAR(moduleSearchNearby), CBA_fnc_searchNearby] call CBA_fnc_addEventHandler;
|
|
|
|
[QGVAR(moduleSearchArea), CBA_fnc_taskSearchArea] call CBA_fnc_addEventHandler;
|
2017-05-10 16:29:04 +00:00
|
|
|
[QGVAR(suppressiveFire), LINKFUNC(moduleSuppressiveFireLocal)] call CBA_fnc_addEventHandler;
|
2016-11-15 12:07:48 +00:00
|
|
|
|
|
|
|
// Editable object commands must be ran on server, this events are used in the respective module
|
|
|
|
if (isServer) then {
|
2016-12-15 05:55:06 +00:00
|
|
|
[QGVAR(equipFries), EFUNC(fastroping,equipFRIES)] call CBA_fnc_addEventHandler;
|
2018-04-24 17:46:59 +00:00
|
|
|
|
2016-11-15 12:07:48 +00:00
|
|
|
[QGVAR(addObjects), {
|
2016-12-15 05:55:06 +00:00
|
|
|
params ["_objects", ["_curator", objNull]];
|
2016-11-15 12:07:48 +00:00
|
|
|
|
2023-11-11 00:13:53 +00:00
|
|
|
// If valid object
|
|
|
|
if (_curator isEqualType objNull && {!isNull _curator}) exitWith {_curator addCuratorEditableObjects [_objects, true]};
|
|
|
|
|
|
|
|
// If invalid object (= objNull) or other
|
|
|
|
if !(_curator isEqualType []) then {
|
|
|
|
_curator = allCurators;
|
|
|
|
};
|
2016-11-15 12:07:48 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
_x addCuratorEditableObjects [_objects, true];
|
2023-11-11 00:13:53 +00:00
|
|
|
} forEach _curator;
|
2016-11-15 12:07:48 +00:00
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
[QGVAR(removeObjects), {
|
2016-12-15 05:55:06 +00:00
|
|
|
params ["_objects", ["_curator", objNull]];
|
2016-11-15 12:07:48 +00:00
|
|
|
|
2023-11-11 00:13:53 +00:00
|
|
|
// If valid object
|
|
|
|
if (_curator isEqualType objNull && {!isNull _curator}) exitWith {_curator removeCuratorEditableObjects [_objects, true]};
|
|
|
|
|
|
|
|
// If invalid object (= objNull) or other
|
|
|
|
if !(_curator isEqualType []) then {
|
|
|
|
_curator = allCurators;
|
|
|
|
};
|
2016-11-15 12:07:48 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
_x removeCuratorEditableObjects [_objects, true];
|
2023-11-11 00:13:53 +00:00
|
|
|
} forEach _curator;
|
2016-11-15 12:07:48 +00:00
|
|
|
}] call CBA_fnc_addEventHandler;
|
2018-11-10 20:33:20 +00:00
|
|
|
|
|
|
|
[QGVAR(createZeus), {
|
|
|
|
params ["_ownerPlayer"];
|
|
|
|
private _owner = ["#adminLogged", getPlayerUID _ownerPlayer] select isMultiplayer;
|
|
|
|
private _group = createGroup sideLogic;
|
|
|
|
private _zeus = _group createUnit ["ModuleCurator_F", [0,0,0], [], 0, "NONE"];
|
|
|
|
missionNamespace setVariable [format [QGVAR(zeus_%1), _owner], _zeus];
|
|
|
|
_zeus setVariable ["owner", _owner, true];
|
|
|
|
_zeus setVariable ["Addons", 3, true];
|
2018-12-15 21:28:32 +00:00
|
|
|
_zeus setVariable ["BIS_fnc_initModules_disableAutoActivation", false];
|
2018-11-10 20:33:20 +00:00
|
|
|
_zeus setCuratorCoef ["Place", 0];
|
|
|
|
_zeus setCuratorCoef ["Delete", 0];
|
|
|
|
_group deleteGroupWhenEmpty true;
|
|
|
|
if (!isMultiplayer && {!isNull findDisplay IDD_DISPLAY3DEN}) then {
|
|
|
|
// if loaded from editor (but not after restart), addons are not activated so we do it manually
|
|
|
|
private _addons = ('true' configClasses (configFile >> "CfgPatches")) apply {configName _x};
|
|
|
|
activateAddons _addons;
|
|
|
|
removeAllCuratorAddons _zeus;
|
|
|
|
_zeus addCuratorAddons _addons;
|
|
|
|
};
|
|
|
|
[QGVAR(zeusCreated), _zeus, _ownerPlayer] call CBA_fnc_targetEvent;
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
|
|
|
|
addMissionEventHandler ["HandleDisconnect", {
|
|
|
|
private _owner = _this select 2;
|
|
|
|
private _zeusVarName = format [QGVAR(zeus_%1), _owner];
|
|
|
|
private _zeus = missionNamespace getVariable _zeusVarName;
|
|
|
|
if (!isNil "_zeus") then {
|
|
|
|
if (!isNull _zeus) then {deleteVehicle _zeus};
|
|
|
|
missionNamespace setVariable [_zeusVarName, nil];
|
|
|
|
};
|
|
|
|
}];
|
|
|
|
};
|
|
|
|
|
|
|
|
if (hasInterface) then {
|
|
|
|
[QGVAR(zeusCreated), {
|
|
|
|
params ["_zeus"];
|
|
|
|
GVAR(zeus) = _zeus;
|
|
|
|
[localize "str_a3_cfgvehicles_moduletasksetstate_f_arguments_state_values_created_0"] call EFUNC(common,displayTextStructured);
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
2016-11-15 12:07:48 +00:00
|
|
|
};
|