Merge remote-tracking branch 'refs/remotes/acemod/master'

This commit is contained in:
nomisum
2016-04-02 15:39:44 +02:00
203 changed files with 1564 additions and 656 deletions

View File

@ -0,0 +1,29 @@
/*
* Author: BaerMitUmlaut
* Checks if the player can close the ramp of the given helo.
*
* Arguments:
* 0: The helicopter <OBJECT>
* 1: The ramp animation name <STRING>
* 2: Turret paths that can close the ramp <ARRAY>
*
* Return Value:
* Able to close ramp <BOOL>
*
* Example:
* [_player, _vehicle] call ace_fastroping_fnc_canCloseRamp
*
* Public: No
*/
#include "script_component.hpp"
params ["_vehicle", "_door", "_turretPaths"];
(_vehicle doorPhase _door > 0.5) &&
{alive _vehicle} &&
{(_vehicle getVariable ["bis_disabled_Ramp", 0]) != 1} &&
{!(_vehicle getVariable [QGVAR(doorsLocked), false])} &&
{
(ACE_player == driver _vehicle) ||
{((assignedVehicleRole ACE_player) param [1, []]) in _turretPaths}
}

View File

@ -19,7 +19,6 @@ params ["_vehicle"];
private _config = configFile >> "CfgVehicles" >> typeOf _vehicle;
(isNumber (_config >> QGVAR(enabled)) &&
{(getNumber (_config >> QGVAR(enabled)) == 1) || {!(isNull (_vehicle getVariable [QGVAR(FRIES), objNull]))}} &&
((getNumber (_config >> QGVAR(enabled)) == 1) || {!(isNull (_vehicle getVariable [QGVAR(FRIES), objNull]))}) &&
{(_vehicle getVariable [QGVAR(deploymentStage), 0]) == 0} &&
{isText (_config >> QGVAR(onPrepare))})
{getText (_config >> QGVAR(onPrepare)) != ""}

View File

@ -32,8 +32,11 @@ _deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []];
};
};
[QGVAR(ropeDetach), [_hook, _ropeTop]] call EFUNC(common,serverEvent);
[{{deleteVehicle _x} count _this}, [_ropeTop, _ropeBottom, _dummy, _hook], 60] call EFUNC(common,waitAndExecute);
//Destroy rope
//Only delete the hook first so the rope falls down.
//Note: ropeDetach was used here before, but the command seems a bit broken.
deleteVehicle _hook;
[{{deleteVehicle _x} count _this}, [_ropeTop, _ropeBottom, _dummy], 60] call EFUNC(common,waitAndExecute);
} count _deployedRopes;
_vehicle setVariable [QGVAR(deployedRopes), [], true];

View File

@ -0,0 +1,96 @@
/*
* Author: BaerMitUmlaut
* Auomatically deploy a helicopter filled with AI units.
*
* Arguments:
* 0: The helicopter <OBJECT>
* 1: Deploy special roles (gunners, copilot) (default: false) <BOOL>
* 2: Create deployment group (default: true) <BOOL>
*
* Return Value:
* None
*
* Example:
* [_vehicle] call ace_fastroping_fnc_deployAI
*
* Public: Yes
*/
#include "script_component.hpp"
params [["_vehicle", objNull, [objNull]], ["_deploySpecial", false, [true]], ["_createDeploymentGroup", true, [true]]];
private ["_config", "_configEnabled", "_deployTime", "_unitsToDeploy", "_deployGroup"];
if (isNull _vehicle || {!(_vehicle isKindOf "Helicopter")}) exitWith {
if (hasInterface) then {
// Note: BIS_fnc_guiMessage causes a CTD with call, so spawn is used instead.
["deployAI was called with an invalid or non-existant vehicle.", QFUNC(deployAI)] spawn BIS_fnc_guiMessage;
};
ACE_LOGERROR('FUNC(deployAI): deployAI was called with an invalid or non-existant vehicle.');
};
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
_configEnabled = getNumber (_config >> QGVAR(enabled));
if (_configEnabled == 0) exitWith {
if (hasInterface) then {
[format ["You cannot fast rope from a ""%1"" helicopter.", getText (_config >> "DisplayName")], QFUNC(deployAI)] spawn BIS_fnc_guiMessage;
};
ACE_LOGERROR_1('FUNC(deployAI): You cannot fast rope from a "%1" helicopter.',getText (_config >> "DisplayName"));
};
if (_configEnabled == 2 && {isNull (_vehicle getVariable [QGVAR(FRIES), objNull])}) exitWith {
if (hasInterface) then {
[format ["""%1"" requires a FRIES for fastroping, but has not been equipped with one.", getText (_config >> "DisplayName")], QFUNC(deployAI)] spawn BIS_fnc_guiMessage;
};
ACE_LOGERROR_1('FUNC(deployAI): "%1" requires a FRIES for fastroping but has not been equipped with one.',getText (_config >> "DisplayName"));
};
_unitsToDeploy = crew _vehicle;
if (_deploySpecial) then {
_unitsToDeploy deleteAt (_unitsToDeploy find driver _vehicle);
} else {
_unitsToDeploy = _unitsToDeploy select {(assignedVehicleRole _x) select 0 == "cargo"};
};
if (_unitsToDeploy isEqualTo []) exitWith {
ACE_LOGWARNING_1('FUNC(deployAI): Found no units to deploy in "%1".',getText (_config >> "DisplayName"));
};
if (_createDeploymentGroup) then {
_deployGroup = createGroup side (_unitsToDeploy select 0);
_unitsToDeploy joinSilent _deployGroup;
};
_deployTime = 0;
if (getText (_config >> QGVAR(onPrepare)) != "") then {
_deployTime = [_vehicle] call (missionNamespace getVariable (getText (_config >> QGVAR(onPrepare))));
};
[{[_this] call FUNC(deployRopes)}, _vehicle, _deployTime] call EFUNC(common,waitAndExecute);
driver _vehicle disableAI "MOVE";
DFUNC(deployAIRecursive) = {
params ["_vehicle", "_unitsToDeploy"];
private _unit = _unitsToDeploy deleteAt 0;
unassignVehicle _unit;
[_unit, _vehicle] call FUNC(fastRope);
if !(_unitsToDeploy isEqualTo []) then {
[{
[{
params ["_vehicle"];
private _deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []];
({!(_x select 5)} count (_deployedRopes)) > 0
}, FUNC(deployAIRecursive), _this] call EFUNC(common,waitUntilAndExecute);
}, [_vehicle, _unitsToDeploy], 1] call EFUNC(common,waitAndExecute);
} else {
[{
private _deployedRopes = _this getVariable [QGVAR(deployedRopes), []];
({_x select 5} count (_deployedRopes)) == 0
}, {
[_this] call FUNC(cutRopes);
driver _this enableAI "MOVE";
}, _vehicle] call EFUNC(common,waitUntilAndExecute);
};
};
[FUNC(deployAIRecursive), [_vehicle, _unitsToDeploy], _deployTime + 4] call EFUNC(common,waitAndExecute);

View File

@ -0,0 +1,42 @@
/*
* Author: BaerMitUmlaut
* Waypoint function for the fast rope waypoint.
*
* Arguments:
* 0: Group <GROUP>
* 1: Waypoint position <ARRAY>
*
* Return Value:
* true
*
* Example:
* [_group, [6560, 12390, 0]] call ace_fastroping_fnc_deployAIWayoint
*
* Public: No
*/
#include "script_component.hpp"
params [["_group", grpNull, [grpNull]], ["_position", [0, 0, 0], [[]], 3]];
private ["_vehicle", "_commander", "_speedMode"];
_vehicle = vehicle leader _group;
_commander = effectiveCommander _vehicle;
_speedMode = speedMode _group;
// - Approach -----------------------------------------------------------------
if (_vehicle distance2D _position > 50) then {
_group setSpeedMode "LIMITED";
_vehicle flyInHeight 20;
_commander doMove _position;
waitUntil {_vehicle distance2D _position < 50};
waitUntil {vectorMagnitude (velocity _vehicle) < 3};
//doStop _commander;
};
// - Deployment ---------------------------------------------------------------
[_vehicle] call FUNC(deployAI);
waitUntil {!((_vehicle getVariable [QGVAR(deployedRopes), []]) isEqualTo [])};
waitUntil {(_vehicle getVariable [QGVAR(deployedRopes), []]) isEqualTo []};
_group setSpeedMode _speedMode;
true

View File

@ -24,7 +24,7 @@ _deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []];
_usableRope = _deployedRopes select 0;
_usableRopeIndex = 0;
{
if !(_x select 6) exitWith {
if !(_x select 5) exitWith {
_usableRope = _x;
_usableRopeIndex = _forEachIndex;
};

View File

@ -25,7 +25,7 @@ private ["_vectorUp", "_vectorDir", "_origin"];
if (vehicle _unit != _unit) exitWith {};
//Start fast roping
if (animationState _unit != "ACE_FastRoping") exitWith {
if (getMass _dummy != 80) exitWith {
//Fix for twitchyness
_dummy setMass 80;
_dummy setCenterOfMass [0, 0, -2];
@ -38,7 +38,9 @@ if (animationState _unit != "ACE_FastRoping") exitWith {
};
//Check if rope broke and unit is falling
if (isNull attachedTo _unit) exitWith {
//Make sure this isn't executed before the unit is actually fastroping
//Note: Stretching ropes does not change ropeLength
if ((isNull attachedTo _unit) && {ropeLength _ropeTop > 0.5}) exitWith {
[_pfhHandle] call CBA_fnc_removePerFrameHandler;
};

View File

@ -24,16 +24,24 @@ if !(isNull _fries) then {
[{
_this animateDoor ["door_R", 0];
_this animateDoor ["door_L", 0];
_vehicle animate ["dvere1_posunZ", 0];
_vehicle animate ["dvere2_posunZ", 0];
_this animateDoor ["CargoRamp_Open", 0];
_this animateDoor ["Door_rear_source", 0];
_this animateDoor ["Door_6_source", 0];
_this animate ["dvere1_posunZ", 0];
_this animate ["dvere2_posunZ", 0];
_this setVariable [QGVAR(doorsLocked), false, true];
}, _vehicle, 2] call EFUNC(common,waitAndExecute);
4
} else {
_vehicle animateDoor ["door_R", 0];
_vehicle animateDoor ["door_L", 0];
_vehicle animateDoor ["CargoRamp_Open", 0];
_vehicle animateDoor ["Door_rear_source", 0];
_vehicle animateDoor ["Door_6_source", 0];
_vehicle animate ["dvere1_posunZ", 0];
_vehicle animate ["dvere2_posunZ", 0];
_vehicle setVariable [QGVAR(doorsLocked), false, true];
2
};

View File

@ -22,9 +22,14 @@ _waitTime = 2;
_vehicle animateDoor ["door_R", 1];
_vehicle animateDoor ["door_L", 1];
_vehicle animateDoor ["CargoRamp_Open", 1];
_vehicle animateDoor ["Door_rear_source", 1];
_vehicle animateDoor ["Door_6_source", 1];
_vehicle animate ["dvere1_posunZ", 1];
_vehicle animate ["dvere2_posunZ", 1];
_vehicle setVariable [QGVAR(doorsLocked), true, true];
_fries = _vehicle getVariable [QGVAR(FRIES), objNull];
if !(isNull _fries) then {
[{