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
54 lines
1.7 KiB
Plaintext
54 lines
1.7 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: Dslyecxi, Jonpas
|
|
* Prepares throwable or selects the next.
|
|
*
|
|
* Arguments:
|
|
* 0: Unit <OBJECT>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [unit] call ace_advanced_throwing_fnc_prepare
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params ["_unit"];
|
|
TRACE_1("params",_unit);
|
|
|
|
// Select next throwable if one already in hand
|
|
if (_unit getVariable [QGVAR(inHand), false]) exitWith {
|
|
TRACE_1("inHand",_unit);
|
|
if (!(_unit getVariable [QGVAR(primed), false])) then {
|
|
TRACE_1("not primed",_unit);
|
|
// Restore muzzle ammo (setAmmo 1 has no impact if no appliccable throwable in inventory)
|
|
// selectNextGrenade relies on muzzles array (setAmmo 0 removes the muzzle from the array and current can't be found, cycles between 0 and 1 muzzles)
|
|
ACE_player setAmmo [ACE_player getVariable [QGVAR(activeMuzzle), ""], 1];
|
|
[_unit] call EFUNC(weaponselect,selectNextGrenade);
|
|
};
|
|
};
|
|
|
|
// Try selecting next throwable if none currently selected
|
|
if (isNull (_unit getVariable [QGVAR(activeThrowable), objNull]) && {(currentThrowable _unit) isEqualTo []} && {!([_unit] call EFUNC(weaponselect,selectNextGrenade))}) exitWith {
|
|
TRACE_1("no throwables",_unit);
|
|
};
|
|
|
|
|
|
_unit setVariable [QGVAR(inHand), true];
|
|
|
|
// Add controls hint
|
|
call FUNC(updateControlsHint);
|
|
|
|
// Add throw action to suppress weapon firing (not possible to suppress mouseButtonDown event)
|
|
_unit setVariable [QGVAR(throwAction), [_unit, "DefaultAction", {true}, {true}] call EFUNC(common,addActionEventHandler)];
|
|
|
|
// Draw throwable and throw arc if enabled
|
|
GVAR(draw3DHandle) = addMissionEventHandler ["Draw3D", {
|
|
call FUNC(drawThrowable);
|
|
if (GVAR(showThrowArc)) then {
|
|
call FUNC(drawArc);
|
|
};
|
|
}];
|