simplify resupply actions addition
This commit is contained in:
@@ -1,14 +1,14 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
params ["_type"]; // string of the object's classname
|
params [
|
||||||
if (!(_type isKindOf "CAManBase")) exitWith {};
|
["_types", [], [[]]], // classnames to assign these action to
|
||||||
|
["_useInheritance", false, [false]]
|
||||||
|
];
|
||||||
|
|
||||||
if (
|
{ // forEach _types
|
||||||
(localNamespace getVariable [QGVAR(fileForReinsertClassesAdded), []])
|
private _classToAddActionsTo = _x;
|
||||||
find _type != -1
|
|
||||||
) exitWith {};
|
|
||||||
|
|
||||||
private _fileForReinsertAction = [
|
private _fileForReinsertAction = [
|
||||||
QGVAR(fileReinsertRequestAction),
|
QGVAR(fileReinsertRequestAction),
|
||||||
"File Re-insert Request",
|
"File Re-insert Request",
|
||||||
"\A3\ui_f\data\igui\cfg\simpleTasks\types\takeoff_ca.paa",
|
"\A3\ui_f\data\igui\cfg\simpleTasks\types\takeoff_ca.paa",
|
||||||
@@ -28,19 +28,19 @@ private _fileForReinsertAction = [
|
|||||||
private _base = [_player] call EFUNC(common,getNearestBase);
|
private _base = [_player] call EFUNC(common,getNearestBase);
|
||||||
private _baseDistance = _player distance _base;
|
private _baseDistance = _player distance _base;
|
||||||
|
|
||||||
private _maxRangeToReady = missionNamespace getVariable [QGVAR(setting_maxRangeToReady), 400];
|
private _maxRangeToReady = [QGVAR(setting_maxRangeToReady)] call CBA_settings_fnc_get;
|
||||||
private _existingQueue = missionNamespace getVariable [QGVAR(reinsertionQueue), []];
|
private _existingQueue = missionNamespace getVariable [QGVAR(reinsertionQueue), []];
|
||||||
|
|
||||||
// check if module is enabled, player is near a base, and player is not already in the queue
|
// check if module is enabled, player is near a base, and player is not already in the queue
|
||||||
// (serverTime - GVAR(missionStartServerTime)) > 60*5 && // only allow after 15 minutes
|
// (serverTime - GVAR(missionStartServerTime)) > 60*5 && // only allow after 15 minutes
|
||||||
missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_enabled", true] &&
|
[QGVAR(setting_enabled)] call CBA_settings_fnc_get &&
|
||||||
(_baseDistance < _maxRangeToReady) &&
|
(_baseDistance < _maxRangeToReady) &&
|
||||||
not (_player in (_existingQueue apply {_x#0}))
|
not (_player in (_existingQueue apply {_x#0}))
|
||||||
}
|
}
|
||||||
] call ace_interact_menu_fnc_createAction;
|
] call ace_interact_menu_fnc_createAction;
|
||||||
[_type, 1, ["ACE_SelfActions"], _fileForReinsertAction, true] call ace_interact_menu_fnc_addActionToClass;
|
[_classToAddActionsTo, 1, ["ACE_SelfActions"], _fileForReinsertAction, _useInheritance] call ace_interact_menu_fnc_addActionToClass;
|
||||||
|
|
||||||
private _removeFileForReinsertAction = [
|
private _removeFileForReinsertAction = [
|
||||||
QGVAR(removeReinsertRequestAction),
|
QGVAR(removeReinsertRequestAction),
|
||||||
"Remove Re-insert Request",
|
"Remove Re-insert Request",
|
||||||
"\A3\ui_f\data\igui\cfg\simpleTasks\types\land_ca.paa",
|
"\A3\ui_f\data\igui\cfg\simpleTasks\types\land_ca.paa",
|
||||||
@@ -57,13 +57,9 @@ private _removeFileForReinsertAction = [
|
|||||||
|
|
||||||
// check if module is enabled, player is in the queue
|
// check if module is enabled, player is in the queue
|
||||||
// (serverTime - GVAR(missionStartServerTime)) > 60*5 && // only allow after 15 minutes
|
// (serverTime - GVAR(missionStartServerTime)) > 60*5 && // only allow after 15 minutes
|
||||||
missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_enabled", true] &&
|
[QGVAR(setting_enabled)] call CBA_settings_fnc_get &&
|
||||||
(_player in (_existingQueue apply {_x#0}))
|
(_player in (_existingQueue apply {_x#0}))
|
||||||
}
|
}
|
||||||
] call ace_interact_menu_fnc_createAction;
|
] call ace_interact_menu_fnc_createAction;
|
||||||
[_type, 1, ["ACE_SelfActions"], _removeFileForReinsertAction, true] call ace_interact_menu_fnc_addActionToClass;
|
[_classToAddActionsTo, 1, ["ACE_SelfActions"], _removeFileForReinsertAction, _useInheritance] call ace_interact_menu_fnc_addActionToClass;
|
||||||
|
} forEach _types;
|
||||||
private _classesActionsAddedTo = (localNamespace getVariable [QGVAR(fileForReinsertClassesAdded), []]);
|
|
||||||
_classesActionsAddedTo pushBackUnique _type;
|
|
||||||
localNamespace setVariable [QGVAR(fileForReinsertClassesAdded), _classesActionsAddedTo];
|
|
||||||
|
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
params ["_type"]; // string of the object's classname
|
params [
|
||||||
if (!(_type isKindOf "CAManBase")) exitWith {};
|
["_types", [], [[]]], // classnames to assign these action to
|
||||||
|
["_useInheritance", false, [false]]
|
||||||
|
];
|
||||||
|
|
||||||
if (
|
{ // forEach _types
|
||||||
(localNamespace getVariable [QGVAR(checkReinsertQueueClassesAdded), []])
|
private _classToAddActionsTo = _x;
|
||||||
find _type != -1
|
|
||||||
) exitWith {};
|
|
||||||
|
|
||||||
private _checkReinsertQueueAction = [
|
private _checkReinsertQueueAction = [
|
||||||
QGVAR(checkReinsertQueue),
|
QGVAR(checkReinsertQueue),
|
||||||
"[PILOT] Check Re-insert Queue",
|
"[PILOT] Check Re-insert Queue",
|
||||||
"\A3\ui_f\data\igui\cfg\simpleTasks\types\land_ca.paa",
|
"\A3\ui_f\data\igui\cfg\simpleTasks\types\land_ca.paa",
|
||||||
@@ -20,11 +20,9 @@ private _checkReinsertQueueAction = [
|
|||||||
localNamespace setVariable [QGVAR(lastReinsertQueueCheck), diag_tickTime];
|
localNamespace setVariable [QGVAR(lastReinsertQueueCheck), diag_tickTime];
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
missionNamespace getVariable [QGVAR(setting_enabled), true]
|
GVAR(setting_enabled);
|
||||||
} // always allow
|
} // condition
|
||||||
] call ace_interact_menu_fnc_createAction;
|
] call ace_interact_menu_fnc_createAction;
|
||||||
[_type, 1, ["ACE_SelfActions"], _checkReinsertQueueAction, true] call ace_interact_menu_fnc_addActionToClass;
|
[_classToAddActionsTo, 1, ["ACE_SelfActions"], _checkReinsertQueueAction, _useInheritance] call ace_interact_menu_fnc_addActionToClass;
|
||||||
|
|
||||||
private _classesActionsAddedTo = (localNamespace getVariable [QGVAR(checkReinsertQueueClassesAdded), []]);
|
} forEach _types;
|
||||||
_classesActionsAddedTo pushBackUnique _type;
|
|
||||||
localNamespace setVariable [QGVAR(checkReinsertQueueClassesAdded), _classesActionsAddedTo];
|
|
||||||
@@ -5,26 +5,16 @@ if (!hasInterface) exitWith {};
|
|||||||
// ACE SELF-INTERACTIONS FOR FILING AND RESCINDING REINSERT REQUESTS NEAR BASE - ALL PLAYERS
|
// ACE SELF-INTERACTIONS FOR FILING AND RESCINDING REINSERT REQUESTS NEAR BASE - ALL PLAYERS
|
||||||
localNamespace setVariable [QGVAR(fileForReinsertClassesAdded), []];
|
localNamespace setVariable [QGVAR(fileForReinsertClassesAdded), []];
|
||||||
// add actions to current class
|
// add actions to current class
|
||||||
[typeOf player] call FUNC(addAceSelfActions);
|
[["CAManBase"], true] call FUNC(addAceSelfActions);
|
||||||
// add actions to future classes
|
|
||||||
["ace_interact_menu_newControllableObject", {
|
|
||||||
_this call FUNC(addAceSelfActions);
|
|
||||||
}] call CBA_fnc_addEventHandler;
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
// PILOTS ONLY
|
// PILOTS ONLY
|
||||||
// ACE SELF-INTERACTIONS FOR CHECKING REINSERT QUEUE - ONLY FOR PILOTS
|
// ACE SELF-INTERACTIONS FOR CHECKING REINSERT QUEUE - ONLY FOR PILOTS
|
||||||
if ((typeOf player) in ["B_Helipilot_F", "B_helicrew_F"]) then {
|
localNamespace setVariable [QGVAR(checkReinsertQueueClassesAdded), []];
|
||||||
localNamespace setVariable [QGVAR(checkReinsertQueueClassesAdded), []];
|
localNamespace setVariable [QGVAR(lastReinsertQueueCheck), diag_tickTime];
|
||||||
localNamespace setVariable [QGVAR(lastReinsertQueueCheck), diag_tickTime];
|
|
||||||
|
|
||||||
// add actions to current class
|
// add actions to pilot classes, and don't apply to child classes
|
||||||
[typeOf player] call FUNC(addCheckQueueSelfAction);
|
[["B_Helipilot_F", "B_helicrew_F"], false] call FUNC(addCheckQueueSelfAction);
|
||||||
// add actions to future classes
|
|
||||||
["ace_interact_menu_newControllableObject", {
|
|
||||||
_this call FUNC(addCheckQueueSelfAction);
|
|
||||||
}] call CBA_fnc_addEventHandler;
|
|
||||||
};
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
@@ -33,13 +23,13 @@ if ((typeOf player) in ["B_Helipilot_F", "B_helicrew_F"]) then {
|
|||||||
[{
|
[{
|
||||||
// if module not enabled and pilot forced check not enabled, exit
|
// if module not enabled and pilot forced check not enabled, exit
|
||||||
if (not (
|
if (not (
|
||||||
missionNamespace getVariable [QGVAR(setting_enabled), true] &&
|
[QGVAR(setting_enabled)] call CBA_settings_fnc_get and
|
||||||
missionNamespace getVariable [QGVAR(setting_pilotForcedCheckEnabled), true]
|
[QGVAR(setting_pilotForcedCheckEnabled)] call CBA_settings_fnc_get
|
||||||
)) exitWith {};
|
)) exitWith {};
|
||||||
|
|
||||||
// if last check was less than X minutes ago, skip
|
// if last check was less than X minutes ago, skip
|
||||||
private _lastCheck = localNamespace getVariable [QGVAR(lastReinsertQueueCheck), diag_tickTime];
|
private _lastCheck = localNamespace getVariable [QGVAR(lastReinsertQueueCheck), diag_tickTime];
|
||||||
private _requiredCheckInterval = missionNamespace getVariable [QGVAR(setting_pilotForcedCheckInterval), 60*20];
|
private _requiredCheckInterval = [QGVAR(setting_pilotForcedCheckInterval)] call CBA_settings_fnc_get;
|
||||||
if (
|
if (
|
||||||
diag_tickTime - _lastCheck <
|
diag_tickTime - _lastCheck <
|
||||||
_requiredCheckInterval
|
_requiredCheckInterval
|
||||||
|
|||||||
@@ -35,9 +35,7 @@ private _supplyCrateTypesCfgs = _supplyCratesCfg call BIS_fnc_returnChildren;
|
|||||||
private _cfg = _x;
|
private _cfg = _x;
|
||||||
private _supplyCrateDisplayName = (_cfg >> "displayName") call BIS_fnc_getCfgData;
|
private _supplyCrateDisplayName = (_cfg >> "displayName") call BIS_fnc_getCfgData;
|
||||||
|
|
||||||
|
// add action to spawn supply crate
|
||||||
|
|
||||||
|
|
||||||
private _actionID = _arsenalBox addAction [format ["<t color='#ffffff'>Spawn %1</t>", _supplyCrateDisplayName], {
|
private _actionID = _arsenalBox addAction [format ["<t color='#ffffff'>Spawn %1</t>", _supplyCrateDisplayName], {
|
||||||
params ["_target", "_caller", "_actionId", "_arguments"];
|
params ["_target", "_caller", "_actionId", "_arguments"];
|
||||||
_arguments params ["_supplyCrateCfg"];
|
_arguments params ["_supplyCrateCfg"];
|
||||||
|
|||||||
Reference in New Issue
Block a user