More FFV animation stuff

This commit is contained in:
PabstMirror 2015-08-23 12:32:46 -05:00
parent b5fb0daa9b
commit 8ca06a9a76
6 changed files with 70 additions and 36 deletions

View File

@ -1,6 +1,22 @@
/*
* Author: PabstMirror
* Finds a free cargo seat, searching non FFV first
*
* Arguments:
* 0: The Vehicle <OBJECT>
*
* Return Value:
* ARRAY [seat index <NUMBER>, is FFV <BOOL>]
*
* Example:
* [car1] call ACE_captives_fnc_findEmptyNonFFVCargoSeat
*
* Public: No
*/
#include "script_component.hpp" #include "script_component.hpp"
params ["_vehicle"]; params ["_vehicle"];
TRACE_1("params", _vehicle);
_vehicleConfig = configFile >> "CfgVehicles" >> (typeOf _vehicle); _vehicleConfig = configFile >> "CfgVehicles" >> (typeOf _vehicle);
@ -30,10 +46,21 @@ _occupiedSeats = [];
TRACE_3("Searching for empty seat",_realCargoCount,_ffvCargoIndexes,_occupiedSeats); TRACE_3("Searching for empty seat",_realCargoCount,_ffvCargoIndexes,_occupiedSeats);
_emptyCargoSeatReturn = -1; _emptyCargoSeatReturn = [-1, false];
//First seach for non-ffv seats:
for "_index" from 0 to (_realCargoCount - 1) do { for "_index" from 0 to (_realCargoCount - 1) do {
if ((!(_index in _ffvCargoIndexes)) && {!(_index in _occupiedSeats)}) exitWith { if ((!(_index in _ffvCargoIndexes)) && {!(_index in _occupiedSeats)}) exitWith {
_emptyCargoSeatReturn = _index; _emptyCargoSeatReturn = [_index, false];
};
};
//Only use FFV if none found:
if (_emptyCargoSeatReturn isEqualTo [-1, false]) then {
for "_index" from 0 to (_realCargoCount - 1) do {
if (!(_index in _occupiedSeats)) exitWith {
_emptyCargoSeatReturn = [_index, true];
};
}; };
}; };

View File

@ -4,8 +4,8 @@
* *
* Arguments: * Arguments:
* 0: _vehicle <OBJECT> * 0: _vehicle <OBJECT>
* 2: dunno <OBJECT> * 1: dunno <OBJECT>
* 1: _unit <OBJECT> * 2: _unit <OBJECT>
* *
* Return Value: * Return Value:
* The return value <BOOL> * The return value <BOOL>
@ -17,7 +17,8 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
params ["_vehicle", "_dontcare","_unit"]; params ["_vehicle", "","_unit"];
TRACE_2("params",_vehicle,_unit);
if (local _unit) then { if (local _unit) then {
if (_unit getVariable [QGVAR(isEscorting), false]) then { if (_unit getVariable [QGVAR(isEscorting), false]) then {
@ -27,4 +28,18 @@ if (local _unit) then {
if (_unit getVariable [QGVAR(isSurrendering), false]) then { if (_unit getVariable [QGVAR(isSurrendering), false]) then {
[_unit, false] call FUNC(setSurrender); [_unit, false] call FUNC(setSurrender);
}; };
if (_unit getVariable [QGVAR(isHandcuffed), false]) then {
//Need to force animation for FFV turrets
_turretPath = [];
{
_x params ["_xUnit", "", "", "_xTurretPath"];
if (_unit == _xUnit) exitWith {_turretPath = _xTurretPath};
} forEach (fullCrew (vehicle _unit));
if (!(_turretPath isEqualTo [])) then {
TRACE_1("Setting FFV Handcuffed Animation",_turretPath);
[_unit, "ACE_HandcuffedFFV", 2] call EFUNC(common,doAnimation);
[_unit, "ACE_HandcuffedFFV", 1] call EFUNC(common,doAnimation);
};
};
}; };

View File

@ -4,8 +4,8 @@
* *
* Arguments: * Arguments:
* 0: _vehicle <OBJECT> * 0: _vehicle <OBJECT>
* 2: dunno <OBJECT> * 1: dunno <OBJECT>
* 1: _unit <OBJECT> * 2: _unit <OBJECT>
* *
* Return Value: * Return Value:
* The return value <BOOL> * The return value <BOOL>
@ -17,18 +17,21 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
params ["_vehicle", "_dontcare","_unit"]; params ["_vehicle", "", "_unit"];
TRACE_2("params",_vehicle,_unit);
if ((local _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]}) then { if ((local _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]}) then {
private ["_cargoIndex"]; private ["_cargoIndex"];
_cargoIndex = _unit getVariable [QGVAR(CargoIndex), -1]; _cargoIndex = _unit getVariable [QGVAR(CargoIndex), -1];
//If captive was not "unloaded", then move them back into the vehicle. if (_cargoIndex != -1) then {
if (_cargoIndex != -1) exitWith { //If captive was not "unloaded", then move them back into the vehicle.
TRACE_1("forcing back into vehicle",_cargoIndex);
_unit moveInCargo [_vehicle, _cargoIndex]; _unit moveInCargo [_vehicle, _cargoIndex];
} else {
//Getting out of vehicle:
[_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation);
[_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation);
}; };
[_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation);
[_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation);
}; };

View File

@ -17,6 +17,7 @@
#include "script_component.hpp" #include "script_component.hpp"
params ["_unit","_state"]; params ["_unit","_state"];
TRACE_2("params",_unit,_state);
if (!local _unit) exitwith { if (!local _unit) exitwith {
ERROR("running surrender on remote unit"); ERROR("running surrender on remote unit");

View File

@ -16,31 +16,17 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
params ["_target","_vehicle"];
TRACE_2("params",_target,_vehicle);
private ["_cargoIndex"]; private ["_cargoIndex"];
params ["_target","_vehicle"]; _getSeat = [_vehicle] call FUNC(findEmptyNonFFVCargoSeat);
TRACE_1("free cargo seat",_getSeat);
_cargoIndex = _getSeat select 0;
if (_cargoIndex == -1) exitWith {ERROR("cargo index -1");};
// _cargoIndex = [_vehicle] call FUNC(findEmptyNonFFVCargoSeat); _target moveInCargo [_vehicle, _cargoIndex];
// if (_cargoIndex < 0) exitWith {ERROR("No Seat Avail");}; _target assignAsCargoIndex [_vehicle, _cargoIndex];
// _target moveInCargo [_vehicle, _cargoIndex];
_target moveInCargo _vehicle;
_target assignAsCargo _vehicle;
_cargoIndex = _vehicle getCargoIndex _target;
_target setVariable [QGVAR(CargoIndex), _cargoIndex, true]; _target setVariable [QGVAR(CargoIndex), _cargoIndex, true];
//Check if is a FFV turret:
_turretPath = [];
{
_x params ["_xUnit", "", "", "_xTurretPath"];
if (_target == _xUnit) exitWith {_turretPath = _xTurretPath};
} forEach (fullCrew (vehicle _target));
TRACE_1("turret Path",_turretPath);
if (_turretPath isEqualTo []) exitWith {};
TRACE_1("Setting FFV Animation",_newAnimation);
[_target, "ACE_HandcuffedFFV", 2] call EFUNC(common,doAnimation);
[_target, "ACE_HandcuffedFFV", 1] call EFUNC(common,doAnimation);

View File

@ -16,6 +16,8 @@
#include "script_component.hpp" #include "script_component.hpp"
params ["_unit"]; params ["_unit"];
TRACE_1("params",_unit);
_unit setVariable [QGVAR(CargoIndex), -1, true]; _unit setVariable [QGVAR(CargoIndex), -1, true];
moveOut _unit; moveOut _unit;