mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Explosives - Fix cellphone ringing if RF blocking present (#8991)
This commit is contained in:
parent
accba4dd34
commit
b9ce02acf9
@ -39,3 +39,4 @@ PREP(startTimer);
|
|||||||
PREP(triggerType);
|
PREP(triggerType);
|
||||||
PREP(allowDefuse);
|
PREP(allowDefuse);
|
||||||
PREP(isAllowedDefuse);
|
PREP(isAllowedDefuse);
|
||||||
|
PREP(checkDetonateHandlers);
|
||||||
|
38
addons/explosives/functions/fnc_checkDetonateHandlers.sqf
Normal file
38
addons/explosives/functions/fnc_checkDetonateHandlers.sqf
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
/*
|
||||||
|
* Author: PabstMirror, Whigital
|
||||||
|
* Check if there is a handler blocking detonation
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Unit <OBJECT>
|
||||||
|
* 1: Max range (-1 to ignore) <NUMBER>
|
||||||
|
* 2: Explosive <OBJECT>
|
||||||
|
* 3: Fuse time <NUMBER>
|
||||||
|
* 4: Trigger Item Classname <STRING>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Detonation Allowed <BOOL>
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [player, -1, Explosive, 1, "ACE_Cellphone"] call ACE_Explosives_fnc_checkDetonateHandlers;
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
params ["_unit", "_range", "_explosive", "_fuseTime", ["_triggerClassname", "#unknown", [""]]];
|
||||||
|
TRACE_5("checkDetonateHandlers",_unit,_range,_explosive,_fuseTime,_triggerClassname);
|
||||||
|
|
||||||
|
private _detonationAllowed = true;
|
||||||
|
|
||||||
|
{
|
||||||
|
// Pass [Unit<OBJECT>, MaxRange <NUMBER>, Explosive <OBJECT>, FuzeTime <NUMBER>, TriggerItem <STRING>]
|
||||||
|
private _handlerResult = [_unit, _range, _explosive, _fuseTime, _triggerClassname] call _x;
|
||||||
|
|
||||||
|
if (_handlerResult isEqualTo false) then {
|
||||||
|
TRACE_1("Handler Blocking",_forEachIndex);
|
||||||
|
_detonationAllowed = false;
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
} forEach GVAR(detonationHandlers);
|
||||||
|
|
||||||
|
_detonationAllowed
|
@ -28,12 +28,8 @@ private _ignoreRange = (_range == -1);
|
|||||||
if (!_ignoreRange && {(_unit distance (_item select 0)) > _range}) exitWith {TRACE_1("out of range",_range); false};
|
if (!_ignoreRange && {(_unit distance (_item select 0)) > _range}) exitWith {TRACE_1("out of range",_range); false};
|
||||||
|
|
||||||
private _result = true;
|
private _result = true;
|
||||||
{
|
|
||||||
// Pass [Unit<OBJECT>, MaxRange <NUMBER>, Explosive <OBJECT>, FuzeTime <NUMBER>, TriggerItem <STRING>]
|
if !([_unit, _range, _item select 0, _item select 1, _triggerClassname] call FUNC(checkDetonateHandlers)) exitWith {false};
|
||||||
private _handlerResult = [_unit, _range, _item select 0, _item select 1, _triggerClassname] call _x;
|
|
||||||
if (_handlerResult isEqualTo false) then {TRACE_1("Handler Failed",_forEachIndex); _result = false};
|
|
||||||
} forEach GVAR(detonationHandlers);
|
|
||||||
if (!_result) exitWith {false};
|
|
||||||
|
|
||||||
if (getNumber (ConfigFile >> "CfgAmmo" >> typeOf (_item select 0) >> "TriggerWhenDestroyed") == 0) then {
|
if (getNumber (ConfigFile >> "CfgAmmo" >> typeOf (_item select 0) >> "TriggerWhenDestroyed") == 0) then {
|
||||||
private _previousExp = _item select 0;
|
private _previousExp = _item select 0;
|
||||||
|
@ -35,9 +35,15 @@ if (_unit == ace_player) then {
|
|||||||
private _explosive = [_code] call FUNC(getSpeedDialExplosive);
|
private _explosive = [_code] call FUNC(getSpeedDialExplosive);
|
||||||
if ((count _explosive) > 0) then {
|
if ((count _explosive) > 0) then {
|
||||||
[{
|
[{
|
||||||
playSound3D [QUOTE(PATHTO_R(Data\Audio\Cellphone_Ring.wss)),objNull, false, getPosASL (_this select 1),3.16228,1,75];
|
params ["_unit", "_item"];
|
||||||
(_this select 0) setVariable [QGVAR(Dialing), false, true];
|
|
||||||
}, [_unit,_explosive select 0], 0.25 * (count _arr - 4)] call CBA_fnc_waitAndExecute;
|
if ([_unit, -1, (_item # 0), (_item # 2), "ACE_Cellphone"] call FUNC(checkDetonateHandlers)) then {
|
||||||
|
playSound3D [QUOTE(PATHTO_R(Data\Audio\Cellphone_Ring.wss)), objNull, false, (getPosASL (_item # 0)), 3.16228, 1, 75];
|
||||||
|
};
|
||||||
|
|
||||||
|
_unit setVariable [QGVAR(Dialing), false, true];
|
||||||
|
}, [_unit, _explosive], 0.25 * (count _arr - 4)] call CBA_fnc_waitAndExecute;
|
||||||
|
|
||||||
[_explosive select 0,(0.25 * (count _arr - 1)) + (_explosive select 2), "ACE_Cellphone", _unit] call FUNC(startTimer);
|
[_explosive select 0,(0.25 * (count _arr - 1)) + (_explosive select 2), "ACE_Cellphone", _unit] call FUNC(startTimer);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -39,9 +39,14 @@ if (_i >= (count _arr + 2)) then {
|
|||||||
ctrlSetText [1400,"Call Ended!"];
|
ctrlSetText [1400,"Call Ended!"];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_i == (count _arr)) then {
|
if (_i == (count _arr)) then {
|
||||||
if ((count _explosive) > 0) then {
|
if (
|
||||||
playSound3D [QUOTE(PATHTO_R(Data\Audio\Cellphone_Ring.wss)),objNull, false, getPosASL (_explosive select 0),3.16228,1,75];
|
((count _explosive) > 0) &&
|
||||||
|
{[_unit, -1, (_explosive # 0), (_explosive # 2), "ACE_Cellphone"] call FUNC(checkDetonateHandlers)}
|
||||||
|
) then {
|
||||||
|
playSound3D [QUOTE(PATHTO_R(Data\Audio\Cellphone_Ring.wss)), objNull, false, (getPosASL (_explosive # 0)), 3.16228, 1, 75];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
_args set [1, _i + 1];
|
_args set [1, _i + 1];
|
||||||
|
Loading…
Reference in New Issue
Block a user