mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Prevent switching to weapon while carrying fuel nozzle - fix #4601
This commit is contained in:
parent
e73d20f3c3
commit
c2e933355d
@ -14,6 +14,7 @@ PREP(dropNozzle);
|
||||
PREP(getFuel);
|
||||
PREP(handleDisconnect);
|
||||
PREP(handleKilled);
|
||||
PREP(handlePlayerWeaponChanged);
|
||||
PREP(handleUnconscious);
|
||||
PREP(makeJerryCan);
|
||||
PREP(maxDistanceDropNozzle);
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
["ace_unconscious", {_this call FUNC(handleUnconscious)}] call CBA_fnc_addEventHandler;
|
||||
["weapon", FUNC(handlePlayerWeaponChanged)] call CBA_fnc_addPlayerEventHandler;
|
||||
|
||||
if (isServer) then {
|
||||
addMissionEventHandler ["HandleDisconnect", {_this call FUNC(handleDisconnect)}];
|
||||
|
29
addons/refuel/functions/fnc_handlePlayerWeaponChanged.sqf
Normal file
29
addons/refuel/functions/fnc_handlePlayerWeaponChanged.sqf
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Author: Jonpas
|
||||
* Drops nozzle or jerry can when selecting a weapon.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Weapon <STRING> (unused)
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [_unit, "gun"] call ace_refuel_fnc_handlePlayerWeaponChanged;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit"];
|
||||
|
||||
// Drop nozzle/jerry can when selecting a non-primary weapon
|
||||
if (_unit getVariable [QGVAR(isRefueling), false]) then {
|
||||
private _nozzle = _unit getVariable [QGVAR(nozzle), objNull];
|
||||
if !(isNull _nozzle) then {
|
||||
[_unit, _nozzle] call FUNC(dropNozzle);
|
||||
_unit setVariable [QGVAR(selectedWeaponOnRefuel), nil];
|
||||
[_unit, "forceWalk", "ACE_refuel", false] call EFUNC(common,statusEffect_set);
|
||||
};
|
||||
};
|
@ -33,6 +33,10 @@ if (_nozzle getVariable [QGVAR(jerryCan), false]) exitWith {};
|
||||
["_nozzle", (_args select 0) getVariable [QGVAR(nozzle), objNull], [objNull]]
|
||||
];
|
||||
|
||||
if (_unit getVariable [QGVAR(isRefueling), false]) exitWith {
|
||||
[_pfID] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
if (isNull _source || {_unit distance (_source modelToWorld _endPosOffset) > (REFUEL_HOSE_LENGTH - 2)} || {!alive _source}) exitWith {
|
||||
if !(isNull _nozzle) then {
|
||||
[_unit, _nozzle] call FUNC(dropNozzle);
|
||||
|
Loading…
Reference in New Issue
Block a user