mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
e2ac18a05d
* advanced_ballistics * advanced_fatigue * advanced_throwing * ai * aircraft * arsenal * atragmx * attach * backpacks * ballistics * captives * cargo * chemlights * common * concertina_wire * cookoff * dagr * disarming * disposable * dogtags * dragging * explosives * fastroping * fcs * finger * frag * gestures * gforces * goggles * grenades * gunbag * hearing * hitreactions * huntir * interact_menu * interaction * inventory * kestrel4500 * laser * laserpointer * logistics_uavbattery * logistics_wirecutter * magazinerepack * map * map_gestures * maptools * markers * medical * medical_ai * medical_blood * medical_menu * microdagr * minedetector * missileguidance * missionmodules * mk6mortar * modules * movement * nametags * nightvision * nlaw * optics * optionsmenu * overheating * overpressure * parachute * pylons * quickmount * rangecard * rearm * recoil * refuel * reload * reloadlaunchers * repair * respawn * safemode * sandbag * scopes * slideshow * spectator * spottingscope * switchunits * tacticalladder * tagging * trenches * tripod * ui * vector * vehiclelock * vehicles * viewdistance * weaponselect * weather * winddeflection * yardage450 * zeus * arsenal defines.hpp * optionals * DEBUG_MODE_FULL 1 * DEBUG_MODE_FULL 2 * Manual fixes * Add SQF Validator check for #include after block comment * explosives fnc_openTimerUI * fix uniqueItems
86 lines
2.7 KiB
Plaintext
86 lines
2.7 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: GitHawk
|
|
* Show the resupplyable ammunition of all surrounding vehicles.
|
|
*
|
|
* Arguments:
|
|
* 0: Ammo Truck <OBJECT>
|
|
*
|
|
* Return Value:
|
|
* ChildActions <ARRAY>
|
|
*
|
|
* Example:
|
|
* [tank] call ace_rearm_fnc_addRearmActions
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params ["_truck"];
|
|
|
|
private _vehicles = nearestObjects [_truck, ["AllVehicles"], 20];
|
|
_vehicles = _vehicles select {(_x != _truck) && {!(_x isKindOf "CAManBase")} && {!(_x getVariable [QGVAR(disabled), false])}};
|
|
|
|
private _vehicleActions = [];
|
|
{
|
|
private _vehicle = _x;
|
|
|
|
// Array of magazines that can be rearmed in the vehicle
|
|
private _needRearmMags = ([_vehicle] call FUNC(getNeedRearmMagazines)) apply {_x select 0};
|
|
|
|
// _needRearmMags without duplicates
|
|
private _magazineHelper = _needRearmMags arrayIntersect _needRearmMags;
|
|
|
|
_magazineHelper = _magazineHelper select {[_truck, _x] call FUNC(hasEnoughSupply)};
|
|
TRACE_2("can add",_x,_magazineHelper);
|
|
|
|
if (!(_magazineHelper isEqualTo [])) then {
|
|
private _icon = getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "Icon");
|
|
if !((_icon select [0, 1]) == "\") then {
|
|
_icon = "";
|
|
};
|
|
if (GVAR(level) == 0) then {
|
|
// [Level 0] adds a single action to rearm the entire vic
|
|
private _action = [
|
|
_vehicle,
|
|
getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName"),
|
|
_icon,
|
|
{_this call FUNC(rearmEntireVehicle)},
|
|
{true},
|
|
{},
|
|
_vehicle
|
|
] call EFUNC(interact_menu,createAction);
|
|
_vehicleActions pushBack [_action, [], _truck];
|
|
} else {
|
|
// [Level 1,2] - Add actions for each magazine
|
|
private _actions = [];
|
|
{
|
|
private _action = [
|
|
_x,
|
|
getText(configFile >> "CfgMagazines" >> _x >> "displayName"),
|
|
getText(configFile >> "CfgMagazines" >> _x >> "picture"),
|
|
{_this call FUNC(takeAmmo)},
|
|
{true},
|
|
{},
|
|
[_x, _vehicle]
|
|
] call EFUNC(interact_menu,createAction);
|
|
|
|
_actions pushBack [_action, [], _truck];
|
|
} forEach _magazineHelper;
|
|
|
|
private _action = [
|
|
_vehicle,
|
|
getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName"),
|
|
_icon,
|
|
{},
|
|
{true},
|
|
{},
|
|
[]
|
|
] call EFUNC(interact_menu,createAction);
|
|
|
|
_vehicleActions pushBack [_action, _actions, _truck];
|
|
};
|
|
};
|
|
} forEach _vehicles;
|
|
|
|
_vehicleActions
|