2015-02-14 06:39:01 +00:00
|
|
|
// by commy2
|
|
|
|
|
|
|
|
#include "script_component.hpp"
|
2024-06-18 08:05:01 +00:00
|
|
|
#include "\a3\ui_f\hpp\defineDIKCodes.inc"
|
2015-02-14 06:39:01 +00:00
|
|
|
|
2024-03-28 18:57:23 +00:00
|
|
|
["ace_flashbangExploded", LINKFUNC(flashbangExplosionEH)] call CBA_fnc_addEventHandler;
|
2024-06-11 14:59:36 +00:00
|
|
|
[QGVAR(damageEngineAndWheels), LINKFUNC(damageEngineAndWheels)] call CBA_fnc_addEventHandler;
|
2015-02-14 06:39:01 +00:00
|
|
|
|
2017-01-02 23:55:44 +00:00
|
|
|
// Register fired event handlers
|
2024-03-28 18:57:23 +00:00
|
|
|
["ace_firedPlayer", LINKFUNC(throwGrenade)] call CBA_fnc_addEventHandler;
|
|
|
|
["ace_firedPlayerNonLocal", LINKFUNC(throwGrenade)] call CBA_fnc_addEventHandler;
|
|
|
|
["ace_firedNonPlayer", LINKFUNC(throwGrenade)] call CBA_fnc_addEventHandler;
|
2017-01-02 23:55:44 +00:00
|
|
|
|
2015-09-11 14:58:26 +00:00
|
|
|
if (!hasInterface) exitWith {};
|
2015-02-14 06:39:01 +00:00
|
|
|
|
|
|
|
GVAR(flashbangPPEffectCC) = ppEffectCreate ["ColorCorrections", 4265];
|
|
|
|
GVAR(flashbangPPEffectCC) ppEffectForceInNVG true;
|
|
|
|
|
|
|
|
// Add keybinds
|
2024-06-18 08:05:01 +00:00
|
|
|
["ACE3 Weapons", QGVAR(switchGrenadeMode), LLSTRING(SwitchGrenadeMode), {
|
2015-03-05 07:32:26 +00:00
|
|
|
// Conditions: canInteract
|
2024-05-24 23:06:13 +00:00
|
|
|
if !([ACE_player, objNull, ["isNotEscorting", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
2015-03-05 07:32:26 +00:00
|
|
|
// Conditions: specific
|
2024-06-18 08:05:01 +00:00
|
|
|
if !(ACE_player call CBA_fnc_canUseWeapon) exitWith {false};
|
2016-09-06 19:54:42 +00:00
|
|
|
// Don't change mode or show hint if advanced throwing is active
|
|
|
|
if (ACE_player getVariable [QEGVAR(advanced_throwing,inHand), false]) exitWith {false};
|
2015-02-14 06:39:01 +00:00
|
|
|
|
2015-03-05 07:32:26 +00:00
|
|
|
// Statement
|
2024-06-18 08:05:01 +00:00
|
|
|
call FUNC(nextMode) // return
|
|
|
|
}, {}, [DIK_8, [false, false, false]], false] call CBA_fnc_addKeybind; // 8 Key
|
2020-08-24 17:45:56 +00:00
|
|
|
|
2021-10-11 20:48:30 +00:00
|
|
|
["CBA_settingsInitialized", {
|
2020-08-24 17:45:56 +00:00
|
|
|
if (GVAR(convertExplosives)) then {
|
2024-06-18 08:05:01 +00:00
|
|
|
call FUNC(addChangeFuseItemContextMenuOptions);
|
2020-08-24 17:45:56 +00:00
|
|
|
};
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
2024-05-27 09:19:52 +00:00
|
|
|
|
|
|
|
["vehicle", {
|
|
|
|
private _currentThrowable = currentThrowable ACE_player;
|
|
|
|
|
|
|
|
// Make sure grenade can be rolled if in roll mode (detonation time has to be >= 1 second and player isn't in a vehicle)
|
|
|
|
if !(
|
|
|
|
GVAR(currentThrowMode) == 3 &&
|
|
|
|
{_currentThrowable isNotEqualTo []} &&
|
|
|
|
{
|
|
|
|
!isNull objectParent ACE_player ||
|
|
|
|
{getNumber (configFile >> "CfgAmmo" >> getText (configFile >> "CfgMagazines" >> _currentThrowable select 0 >> "ammo") >> "explosionTime") < MIN_EXPLOSION_TIME_FOR_ROLL}
|
|
|
|
}
|
|
|
|
) exitWith {};
|
|
|
|
|
|
|
|
// If the player can't use throwables, don't change it
|
|
|
|
if !(ACE_player call CBA_fnc_canUseWeapon) exitWith {};
|
|
|
|
|
|
|
|
// Force the user into the normal throw mode
|
|
|
|
// Next throw mode after roll would be drop, which isn't ideal if the user tries to throw unknowingly...
|
|
|
|
[format [LLSTRING(RollGrenadeDisabled), LLSTRING(NormalThrow)], 2] call EFUNC(common,displayTextStructured);
|
|
|
|
|
|
|
|
GVAR(currentThrowMode) = 0;
|
|
|
|
GVAR(throwModePFEH) call CBA_fnc_removePerFrameHandler;
|
|
|
|
}, true] call CBA_fnc_addPlayerEventHandler;
|