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
59 lines
1.6 KiB
Plaintext
59 lines
1.6 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: esteldunedain
|
|
* Start linking the belt
|
|
*
|
|
* Arguments:
|
|
* 0: Player <OBJECT>
|
|
* 1: Target <OBJECT>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [bob, kevin] call ace_reload_fnc_startLinkingBelt
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params ["_player", "_target"];
|
|
|
|
if (vehicle _target != _target) exitWith {false};
|
|
|
|
private _magazineType = currentMagazine _target;
|
|
|
|
|
|
private _maxAmmo = [_player, _target] call FUNC(getAmmoToLinkBelt);
|
|
|
|
//if _maxAmmo is below 0 we quit
|
|
if (_maxAmmo <= 0) exitWith {};
|
|
|
|
// Condition to call each frame
|
|
private _condition = {
|
|
(_this select 0) params ["_player", "_target"];
|
|
([_player, _target, []] call EFUNC(common,canInteractWith)) && ((_player distance _target) < 3) && ((speed _target) < 1)
|
|
};
|
|
|
|
private _onFinish = {
|
|
(_this select 0) params ["_player", "_target", "_magazine"];
|
|
|
|
// Raise event on remote unit
|
|
[QGVAR(ammoLinked), [_target, _player, _magazine], [_target]] call CBA_fnc_targetEvent;
|
|
};
|
|
|
|
private _onFailure = {
|
|
(_this select 0) params ["_player", "_target", "_magazine"];
|
|
[_player, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation);
|
|
|
|
// Add back the magazine with the former ammo count
|
|
_player addMagazine _magazine;
|
|
};
|
|
|
|
[_player, "PutDown"] call EFUNC(common,doGesture);
|
|
|
|
// Remove the magazine with maximum remaining ammo
|
|
[_player, _magazineType, _maxAmmo] call EFUNC(common,removeSpecificMagazine);
|
|
|
|
// Call progress bar
|
|
[4, [_player, _target, [_magazineType, _maxAmmo]], _onFinish, _onFailure, (localize LSTRING(LinkingBelt)), _condition, ["isNotInside"]] call EFUNC(common,progressBar);
|