mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Moved FRIES equipping into seperate function
This commit is contained in:
parent
ea92424d15
commit
af834838ef
@ -8,6 +8,7 @@ PREP(canFastRope);
|
||||
PREP(canPrepareFRIES);
|
||||
PREP(cutRopes);
|
||||
PREP(deployRopes);
|
||||
PREP(equipFRIES);
|
||||
PREP(fastRope);
|
||||
PREP(fastRopeLocalPFH);
|
||||
PREP(fastRopeServerPFH);
|
||||
|
39
addons/fastroping/functions/fnc_equipFRIES.sqf
Normal file
39
addons/fastroping/functions/fnc_equipFRIES.sqf
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Author: BaerMitUmlaut
|
||||
* Equips the given helicopter with a FRIES.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The helicopter <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [_vehicle] call ace_fastroping_fnc_equipFRIES
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
params ["_vehicle"];
|
||||
private ["_config", "_fries"];
|
||||
|
||||
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
|
||||
if !(isNumber (_config >> QGVAR(enabled))) then {
|
||||
["%1 has not been configured for ACE_Fastroping.", getText (_config >> "DisplayName")] call BIS_fnc_error;
|
||||
} else {
|
||||
if (getNumber (_config >> QGVAR(enabled)) == 2) then {
|
||||
_fries = (getText (_config >> QGVAR(friesType))) createVehicle [0, 0, 0];
|
||||
_fries attachTo [_vehicle, (getArray (_config >> QGVAR(friesAttachmentPoint)))];
|
||||
_vehicle setVariable [QGVAR(FRIES), _fries, true];
|
||||
_vehicle addEventHandler ["Killed", {
|
||||
params ["_vehicle"];
|
||||
deleteVehicle (_vehicle getVariable [QGVAR(FRIES), objNull]);
|
||||
_vehicle setVariable [QGVAR(FRIES), nil, true];
|
||||
|
||||
if !((_vehicle getVariable [QGVAR(deployedRopes), []] isEqualTo [])) then {
|
||||
[_vehicle] call FUNC(cutRopes);
|
||||
};
|
||||
}];
|
||||
};
|
||||
};
|
@ -16,31 +16,12 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
params ["_module"];
|
||||
private ["_synchedUnits", "_config", "_fries"];
|
||||
|
||||
_synchedUnits = synchronizedObjects _module;
|
||||
private _synchedUnits = synchronizedObjects _module;
|
||||
{
|
||||
if (_x isKindOf "CAManBase") then {
|
||||
_x = vehicle _x;
|
||||
};
|
||||
_config = configFile >> "CfgVehicles" >> typeOf _x;
|
||||
if !(isNumber (_config >> QGVAR(enabled))) then {
|
||||
["%1 has not been configured for ACE_Fastroping.", getText (_config >> "DisplayName")] call BIS_fnc_error;
|
||||
} else {
|
||||
if (getNumber (_config >> QGVAR(enabled)) == 2) then {
|
||||
_fries = (getText (_config >> QGVAR(friesType))) createVehicle [0, 0, 0];
|
||||
_fries attachTo [_x, (getArray (_config >> QGVAR(friesAttachmentPoint)))];
|
||||
_x setVariable [QGVAR(FRIES), _fries, true];
|
||||
_x addEventHandler ["Killed", {
|
||||
params ["_vehicle"];
|
||||
deleteVehicle (_vehicle getVariable [QGVAR(FRIES), objNull]);
|
||||
_vehicle setVariable [QGVAR(FRIES), nil, true];
|
||||
|
||||
if !((_vehicle getVariable [QGVAR(deployedRopes), []] isEqualTo [])) then {
|
||||
[_vehicle] call FUNC(cutRopes);
|
||||
};
|
||||
}];
|
||||
};
|
||||
};
|
||||
[_x] call FUNC(equipFRIES);
|
||||
false
|
||||
} count _synchedUnits;
|
||||
|
Loading…
Reference in New Issue
Block a user