mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Captive FFV stuff
This commit is contained in:
parent
7c276d9d25
commit
c35fc35eb3
@ -6,12 +6,11 @@
|
|||||||
|
|
||||||
if (isServer) then {
|
if (isServer) then {
|
||||||
addMissionEventHandler ["HandleDisconnect", {
|
addMissionEventHandler ["HandleDisconnect", {
|
||||||
PARAMS_1(_disconnectedPlayer);
|
params ["_disconnectedPlayer"];
|
||||||
private "_escortedUnit";
|
private "_escortedUnit";
|
||||||
_escortedUnit = _disconnectedPlayer getVariable [QGVAR(escortedUnit), objNull];
|
_escortedUnit = _disconnectedPlayer getVariable [QGVAR(escortedUnit), objNull];
|
||||||
if ((!isNull _escortedUnit) && {(attachedTo _escortedUnit) == _disconnectedPlayer}) then {
|
if ((!isNull _escortedUnit) && {(attachedTo _escortedUnit) == _disconnectedPlayer}) then {
|
||||||
detach _escortedUnit;
|
detach _escortedUnit;
|
||||||
//systemChat "debug: DC detach";
|
|
||||||
};
|
};
|
||||||
if (_disconnectedPlayer getVariable [QGVAR(isEscorting), false]) then {
|
if (_disconnectedPlayer getVariable [QGVAR(isEscorting), false]) then {
|
||||||
_disconnectedPlayer setVariable [QGVAR(isEscorting), false, true];
|
_disconnectedPlayer setVariable [QGVAR(isEscorting), false, true];
|
||||||
|
@ -16,6 +16,7 @@ PREP(doFriskPerson);
|
|||||||
PREP(doLoadCaptive);
|
PREP(doLoadCaptive);
|
||||||
PREP(doRemoveHandcuffs);
|
PREP(doRemoveHandcuffs);
|
||||||
PREP(doUnloadCaptive);
|
PREP(doUnloadCaptive);
|
||||||
|
PREP(findEmptyNonFFVCargoSeat);
|
||||||
PREP(handleGetIn);
|
PREP(handleGetIn);
|
||||||
PREP(handleGetOut);
|
PREP(handleGetOut);
|
||||||
PREP(handleKilled);
|
PREP(handleKilled);
|
||||||
|
@ -35,4 +35,4 @@ if (isNull _vehicle) then {
|
|||||||
&& {!isNull _vehicle}
|
&& {!isNull _vehicle}
|
||||||
&& {_unit getVariable [QGVAR(isEscorting), false]}
|
&& {_unit getVariable [QGVAR(isEscorting), false]}
|
||||||
&& {_target getVariable [QGVAR(isHandcuffed), false]}
|
&& {_target getVariable [QGVAR(isHandcuffed), false]}
|
||||||
&& {_vehicle emptyPositions "cargo" > 0}
|
&& {([_vehicle] call FUNC(findEmptyNonFFVCargoSeat)) != -1}
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
private ["_weapon", "_listedItemClasses", "_actions", "_allGear"];
|
private ["_weapon", "_listedItemClasses", "_actions", "_allGear"];
|
||||||
|
|
||||||
PARAMS_2(_player,_unit);
|
|
||||||
params ["_player", "_unit"];
|
params ["_player", "_unit"];
|
||||||
|
|
||||||
_weapon = currentWeapon _player;
|
_weapon = currentWeapon _player;
|
||||||
|
40
addons/captives/functions/fnc_findEmptyNonFFVCargoSeat.sqf
Normal file
40
addons/captives/functions/fnc_findEmptyNonFFVCargoSeat.sqf
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
params ["_vehicle"];
|
||||||
|
|
||||||
|
_vehicleConfig = configFile >> "CfgVehicles" >> (typeOf _vehicle);
|
||||||
|
|
||||||
|
_proxyOrder = getArray (_vehicleConfig >> "getInProxyOrder");
|
||||||
|
_transportSoldier = getNumber (_vehicleConfig >> "transportSoldier");
|
||||||
|
_realCargoCount = if (isArray (_vehicleConfig >> "getInProxyOrder")) then {count _proxyOrder} else {_transportSoldier};
|
||||||
|
|
||||||
|
//Find FFV turrets:
|
||||||
|
_ffvCargoIndexes = [];
|
||||||
|
{
|
||||||
|
_turretConfig = [_vehicleConfig, _x] call EFUNC(common,getTurretConfigPath);
|
||||||
|
_isCargoProxy = ((getText (_turretConfig >> "proxyType")) == "CPCargo") && {isNumber (_turretConfig >> "proxyIndex")};
|
||||||
|
|
||||||
|
if (_isCargoProxy) then {
|
||||||
|
_proxyCargoIndex = getNumber (_turretConfig >> "proxyIndex");
|
||||||
|
_cargoIndex = _proxyOrder find _proxyCargoIndex;
|
||||||
|
_ffvCargoIndexes pushBack _cargoIndex;
|
||||||
|
};
|
||||||
|
} forEach (allTurrets [_vehicle, true]);
|
||||||
|
|
||||||
|
//Find Empty Seats:
|
||||||
|
_occupiedSeats = [];
|
||||||
|
{
|
||||||
|
_x params ["", "", "_xIndex"];
|
||||||
|
if (_xIndex > -1) then {_occupiedSeats pushBack _xIndex;};
|
||||||
|
} forEach (fullCrew _vehicle);
|
||||||
|
|
||||||
|
TRACE_3("Searching for empty seat",_realCargoCount,_ffvCargoIndexes,_occupiedSeats);
|
||||||
|
|
||||||
|
_emptyCargoSeatReturn = -1;
|
||||||
|
for "_index" from 0 to (_realCargoCount - 1) do {
|
||||||
|
if ((!(_index in _ffvCargoIndexes)) && {!(_index in _occupiedSeats)}) exitWith {
|
||||||
|
_emptyCargoSeatReturn = _index;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_emptyCargoSeatReturn
|
@ -30,4 +30,5 @@ if ((local _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]}) then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
[_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation);
|
[_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation);
|
||||||
|
[_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation);
|
||||||
};
|
};
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
params ["_unit"];
|
params ["_unit"];
|
||||||
|
|
||||||
// prevent players from throwing grenades (added to all units)
|
// prevent players from throwing grenades (added to all units)
|
||||||
[_unit, "Throw", {((_this select 1) getVariable [QGVAR(isHandcuffed), false]) || {(_this select 1) getVariable [QGVAR(isSurrendering), false]}}, {}] call EFUNC(common,addActionEventhandler);
|
// [_unit, "Throw", {systemChat "a"; ((_this select 1) getVariable [QGVAR(isHandcuffed), false]) || {(_this select 1) getVariable [QGVAR(isSurrendering), false]}; true}, {systemChat "b";}] call EFUNC(common,addActionEventhandler);
|
||||||
|
|
||||||
if (local _unit) then {
|
if (local _unit) then {
|
||||||
// reset status on mission start
|
// reset status on mission start
|
||||||
|
@ -26,11 +26,11 @@ if (!_activated) exitWith {};
|
|||||||
if (local _logic) then {
|
if (local _logic) then {
|
||||||
//Modules run before postInit can instal the event handler, so we need to wait a little bit
|
//Modules run before postInit can instal the event handler, so we need to wait a little bit
|
||||||
[{
|
[{
|
||||||
PARAMS_1(_units);
|
params ["_units"];
|
||||||
{
|
{
|
||||||
["SetSurrendered", [_x], [_x, true]] call EFUNC(common,targetEvent);
|
["SetSurrendered", [_x], [_x, true]] call EFUNC(common,targetEvent);
|
||||||
} forEach _units;
|
} forEach _units;
|
||||||
}, [_units], 0.05, 0.05]call EFUNC(common,waitAndExecute);
|
}, [_units], 0.05]call EFUNC(common,waitAndExecute);
|
||||||
|
|
||||||
deleteVehicle _logic;
|
deleteVehicle _logic;
|
||||||
};
|
};
|
||||||
|
@ -43,24 +43,43 @@ if (_state) then {
|
|||||||
// fix anim on mission start (should work on dedicated servers)
|
// fix anim on mission start (should work on dedicated servers)
|
||||||
[{
|
[{
|
||||||
params ["_unit"];
|
params ["_unit"];
|
||||||
if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then {
|
if (!(_unit getVariable [QGVAR(isHandcuffed), false])) exitWith {};
|
||||||
|
|
||||||
|
if ((vehicle _unit) == _unit) then {
|
||||||
[_unit] call EFUNC(common,fixLoweredRifleAnimation);
|
[_unit] call EFUNC(common,fixLoweredRifleAnimation);
|
||||||
[_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation);
|
[_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation);
|
||||||
|
};
|
||||||
|
|
||||||
//Adds an animation changed eh
|
//Adds an animation changed eh
|
||||||
//If we get a change in animation then redo the animation (handles people vaulting to break the animation chain)
|
//If we get a change in animation then redo the animation (handles people vaulting to break the animation chain)
|
||||||
private "_animChangedEHID";
|
private "_animChangedEHID";
|
||||||
|
TRACE_1("Adding animChangedEH",_unit);
|
||||||
_animChangedEHID = _unit addEventHandler ["AnimChanged", {
|
_animChangedEHID = _unit addEventHandler ["AnimChanged", {
|
||||||
PARAMS_2(_unit,_newAnimation);
|
params ["_unit", "_newAnimation"];
|
||||||
|
TRACE_2("AnimChanged",_unit,_newAnimation);
|
||||||
|
if (_unit == (vehicle _unit)) then {
|
||||||
if ((_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") && {!(_unit getVariable ["ACE_isUnconscious", false])}) then {
|
if ((_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") && {!(_unit getVariable ["ACE_isUnconscious", false])}) then {
|
||||||
TRACE_1("Handcuff animation interrupted",_newAnimation);
|
TRACE_1("Handcuff animation interrupted",_newAnimation);
|
||||||
[_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation);
|
[_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation);
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
|
// _turretPath = [];
|
||||||
|
// {
|
||||||
|
// _x params ["_xUnit", "", "", "_xTurretPath"];
|
||||||
|
// if (_unit == _xUnit) exitWith {_turretPath = _xTurretPath};
|
||||||
|
// } forEach (fullCrew (vehicle _unit));
|
||||||
|
// TRACE_1("turret Path",_turretPath);
|
||||||
|
// if (_turretPath isEqualTo []) exitWith {};
|
||||||
|
// _turretConfig = [(configFile >> "CfgVehicles" >> (typeOf (vehicle _unit))), _turretPath] call EFUNC(common,getTurretConfigPath);
|
||||||
|
// _gunnerAction = getText (_turretConfig >> "gunnerAction");
|
||||||
|
// TRACE_1("reseting to",_gunnerAction);
|
||||||
|
// [_unit, "ACE_HandcuffedFFV", 2] call EFUNC(common,doAnimation);
|
||||||
|
// [_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation);
|
||||||
|
};
|
||||||
}];
|
}];
|
||||||
_unit setVariable [QGVAR(handcuffAnimEHID), _animChangedEHID];
|
_unit setVariable [QGVAR(handcuffAnimEHID), _animChangedEHID];
|
||||||
|
|
||||||
};
|
}, [_unit], 0.01] call EFUNC(common,waitAndExecute);
|
||||||
}, [_unit], 0.01, 0] call EFUNC(common,waitAndExecute);
|
|
||||||
} else {
|
} else {
|
||||||
_unit setVariable [QGVAR(isHandcuffed), false, true];
|
_unit setVariable [QGVAR(isHandcuffed), false, true];
|
||||||
[_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus);
|
[_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus);
|
||||||
|
@ -43,13 +43,13 @@ if (_state) then {
|
|||||||
|
|
||||||
// fix anim on mission start (should work on dedicated servers)
|
// fix anim on mission start (should work on dedicated servers)
|
||||||
[{
|
[{
|
||||||
PARAMS_1(_unit);
|
params ["_unit"];
|
||||||
if (_unit getVariable [QGVAR(isSurrendering), false] && {(vehicle _unit) == _unit}) then {
|
if (_unit getVariable [QGVAR(isSurrendering), false] && {(vehicle _unit) == _unit}) then {
|
||||||
//Adds an animation changed eh
|
//Adds an animation changed eh
|
||||||
//If we get a change in animation then redo the animation (handles people vaulting to break the animation chain)
|
//If we get a change in animation then redo the animation (handles people vaulting to break the animation chain)
|
||||||
private "_animChangedEHID";
|
private "_animChangedEHID";
|
||||||
_animChangedEHID = _unit addEventHandler ["AnimChanged", {
|
_animChangedEHID = _unit addEventHandler ["AnimChanged", {
|
||||||
PARAMS_2(_unit,_newAnimation);
|
params ["_unit", "_newAnimation"];
|
||||||
if ((_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") && {!(_unit getVariable ["ACE_isUnconscious", false])}) then {
|
if ((_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") && {!(_unit getVariable ["ACE_isUnconscious", false])}) then {
|
||||||
TRACE_1("Surrender animation interrupted",_newAnimation);
|
TRACE_1("Surrender animation interrupted",_newAnimation);
|
||||||
[_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation);
|
[_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation);
|
||||||
@ -57,7 +57,7 @@ if (_state) then {
|
|||||||
}];
|
}];
|
||||||
_unit setVariable [QGVAR(surrenderAnimEHID), _animChangedEHID];
|
_unit setVariable [QGVAR(surrenderAnimEHID), _animChangedEHID];
|
||||||
};
|
};
|
||||||
}, [_unit], 0.01, 0] call EFUNC(common,waitAndExecute);
|
}, [_unit], 0.01] call EFUNC(common,waitAndExecute);
|
||||||
} else {
|
} else {
|
||||||
_unit setVariable [QGVAR(isSurrendering), false, true];
|
_unit setVariable [QGVAR(isSurrendering), false, true];
|
||||||
[_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus);
|
[_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus);
|
||||||
@ -85,8 +85,8 @@ if (_state) then {
|
|||||||
//spin up a PFEH, to watching animationState for the next 20 seconds to make sure we don't enter "hands up"
|
//spin up a PFEH, to watching animationState for the next 20 seconds to make sure we don't enter "hands up"
|
||||||
//Handles long animation chains
|
//Handles long animation chains
|
||||||
[{
|
[{
|
||||||
PARAMS_2(_args,_pfID);
|
params ["_args", "_pfID"];
|
||||||
EXPLODE_2_PVT(_args,_unit,_maxTime);
|
_args params ["_unit", "_maxTime"];
|
||||||
//If waited long enough or they re-surrendered or they are unconscious, exit loop
|
//If waited long enough or they re-surrendered or they are unconscious, exit loop
|
||||||
if ((ACE_time > _maxTime) || {_unit getVariable [QGVAR(isSurrendering), false]} || {_unit getVariable ["ACE_isUnconscious", false]}) exitWith {
|
if ((ACE_time > _maxTime) || {_unit getVariable [QGVAR(isSurrendering), false]} || {_unit getVariable ["ACE_isUnconscious", false]}) exitWith {
|
||||||
[_pfID] call CBA_fnc_removePerFrameHandler;
|
[_pfID] call CBA_fnc_removePerFrameHandler;
|
||||||
|
@ -20,7 +20,9 @@ private ["_cargoIndex"];
|
|||||||
|
|
||||||
params ["_target","_vehicle"];
|
params ["_target","_vehicle"];
|
||||||
|
|
||||||
_target moveInCargo _vehicle;
|
_cargoIndex = [_vehicle] call FUNC(findEmptyNonFFVCargoSeat);
|
||||||
|
if (_cargoIndex < 0) exitWith {ERROR("No Seat Avail");};
|
||||||
|
|
||||||
|
_target moveInCargo [_vehicle, _cargoIndex];
|
||||||
_target assignAsCargo _vehicle;
|
_target assignAsCargo _vehicle;
|
||||||
_cargoIndex = _vehicle getCargoIndex _target;
|
|
||||||
_target setVariable [QGVAR(CargoIndex), _cargoIndex, true];
|
_target setVariable [QGVAR(CargoIndex), _cargoIndex, true];
|
||||||
|
@ -20,4 +20,5 @@ _unit setVariable [QGVAR(CargoIndex), -1, true];
|
|||||||
|
|
||||||
moveOut _unit;
|
moveOut _unit;
|
||||||
[_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation);
|
[_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation);
|
||||||
|
[_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation);
|
||||||
unassignVehicle _unit;
|
unassignVehicle _unit;
|
||||||
|
Loading…
Reference in New Issue
Block a user