mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge branch 'master' into explosiveInteraction
This commit is contained in:
commit
fcb7e8b1bd
@ -9,7 +9,6 @@ class Extended_PostInit_EventHandlers {
|
|||||||
init = QUOTE(call COMPILE_FILE(XEH_postInit));
|
init = QUOTE(call COMPILE_FILE(XEH_postInit));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
//release escorted captive when entering a vehicle
|
//release escorted captive when entering a vehicle
|
||||||
class Extended_GetIn_EventHandlers {
|
class Extended_GetIn_EventHandlers {
|
||||||
class All {
|
class All {
|
||||||
@ -18,7 +17,6 @@ class Extended_GetIn_EventHandlers {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
//reset captive animation after leaving vehicle
|
//reset captive animation after leaving vehicle
|
||||||
class Extended_GetOut_EventHandlers {
|
class Extended_GetOut_EventHandlers {
|
||||||
class All {
|
class All {
|
||||||
@ -27,7 +25,6 @@ class Extended_GetOut_EventHandlers {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
//reset captivity and escorting status when getting killed
|
//reset captivity and escorting status when getting killed
|
||||||
class Extended_Killed_EventHandlers {
|
class Extended_Killed_EventHandlers {
|
||||||
class CAManBase {
|
class CAManBase {
|
||||||
@ -36,7 +33,6 @@ class Extended_Killed_EventHandlers {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
//mission start
|
//mission start
|
||||||
class Extended_InitPost_EventHandlers {
|
class Extended_InitPost_EventHandlers {
|
||||||
class CAManBase {
|
class CAManBase {
|
||||||
@ -45,4 +41,3 @@ class Extended_InitPost_EventHandlers {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ class CfgMovesMaleSdr: CfgMovesBasic {
|
|||||||
InterpolateTo[] = {"Unconscious",0.01};
|
InterpolateTo[] = {"Unconscious",0.01};
|
||||||
};
|
};
|
||||||
class ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon {
|
class ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon {
|
||||||
speed = 0.333; //for gameplay reasons, slow this down
|
speed = 0.5; //for gameplay reasons, slow this down
|
||||||
actions = "CivilStandActions";
|
actions = "CivilStandActions";
|
||||||
file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\sur\non\AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon";
|
file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\sur\non\AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon";
|
||||||
ConnectTo[] = {"AmovPercMstpSnonWnonDnon",0.1};
|
ConnectTo[] = {"AmovPercMstpSnonWnonDnon",0.1};
|
||||||
|
@ -90,7 +90,7 @@ class CfgVehicles {
|
|||||||
class ACE_StartSurrenderingSelf {
|
class ACE_StartSurrenderingSelf {
|
||||||
displayName = "$STR_ACE_Captives_StartSurrendering";
|
displayName = "$STR_ACE_Captives_StartSurrendering";
|
||||||
condition = QUOTE([ARR_2(_player, true)] call FUNC(canSurrender));
|
condition = QUOTE([ARR_2(_player, true)] call FUNC(canSurrender));
|
||||||
statement = QUOTE([ARR_2(_player, true)] call FUNC(surrender));
|
statement = QUOTE([ARR_2(_player, true)] call FUNC(setSurrendered));
|
||||||
exceptions[] = {};
|
exceptions[] = {};
|
||||||
showDisabled = 0;
|
showDisabled = 0;
|
||||||
priority = 0;
|
priority = 0;
|
||||||
@ -98,7 +98,7 @@ class CfgVehicles {
|
|||||||
class ACE_StopSurrenderingSelf {
|
class ACE_StopSurrenderingSelf {
|
||||||
displayName = "$STR_ACE_Captives_StopSurrendering";
|
displayName = "$STR_ACE_Captives_StopSurrendering";
|
||||||
condition = QUOTE([ARR_2(_player, false)] call FUNC(canSurrender));
|
condition = QUOTE([ARR_2(_player, false)] call FUNC(canSurrender));
|
||||||
statement = QUOTE([ARR_2(_player, false)] call FUNC(surrender));
|
statement = QUOTE([ARR_2(_player, false)] call FUNC(setSurrendered));
|
||||||
exceptions[] = {QGVAR(isNotSurrendering)};
|
exceptions[] = {QGVAR(isNotSurrendering)};
|
||||||
showDisabled = 0;
|
showDisabled = 0;
|
||||||
priority = 0;
|
priority = 0;
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler);
|
|
||||||
["MoveInCaptive", {_this call FUNC(vehicleCaptiveMoveIn)}] call EFUNC(common,addEventHandler);
|
|
||||||
["MoveOutCaptive", {_this call FUNC(vehicleCaptiveMoveOut)}] call EFUNC(common,addEventHandler);
|
|
||||||
["SetHandcuffed", {_this call FUNC(setHandcuffed)}] call EFUNC(common,addEventHandler);
|
|
||||||
|
|
||||||
//Handles when someone starts escorting and then disconnects, leaving the captive attached
|
//Handles when someone starts escorting and then disconnects, leaving the captive attached
|
||||||
//This is normaly handled by the PFEH in doEscortCaptive, but that won't be running if they DC
|
//This is normaly handled by the PFEH in doEscortCaptive, but that won't be running if they DC
|
||||||
|
|
||||||
if (isServer) then {
|
if (isServer) then {
|
||||||
addMissionEventHandler ["HandleDisconnect", {
|
addMissionEventHandler ["HandleDisconnect", {
|
||||||
PARAMS_1(_disconnectedPlayer);
|
PARAMS_1(_disconnectedPlayer);
|
||||||
@ -21,6 +18,15 @@ if (isServer) then {
|
|||||||
}];
|
}];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
["playerVehicleChanged", {_this call FUNC(handleVehicleChanged)}] call EFUNC(common,addEventHandler);
|
||||||
|
["zeusDisplayChanged", {_this call FUNC(handleZeusDisplayChanged)}] call EFUNC(common,addEventHandler);
|
||||||
|
["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler);
|
||||||
|
["MoveInCaptive", {_this call FUNC(vehicleCaptiveMoveIn)}] call EFUNC(common,addEventHandler);
|
||||||
|
["MoveOutCaptive", {_this call FUNC(vehicleCaptiveMoveOut)}] call EFUNC(common,addEventHandler);
|
||||||
|
|
||||||
|
["SetHandcuffed", {_this call FUNC(setHandcuffed)}] call EFUNC(common,addEventHandler);
|
||||||
|
["SetSurrendered", {_this call FUNC(setSurrendered)}] call EFUNC(common,addEventHandler);
|
||||||
|
|
||||||
//TODO: Medical Integration Events???
|
//TODO: Medical Integration Events???
|
||||||
|
|
||||||
// [_unit, "knockedOut", {
|
// [_unit, "knockedOut", {
|
||||||
|
@ -23,9 +23,10 @@ PREP(handleKnockedOut);
|
|||||||
PREP(handlePlayerChanged);
|
PREP(handlePlayerChanged);
|
||||||
PREP(handleUnitInitPost);
|
PREP(handleUnitInitPost);
|
||||||
PREP(handleWokeUp);
|
PREP(handleWokeUp);
|
||||||
|
PREP(handleZeusDisplayChanged);
|
||||||
PREP(moduleSurrender);
|
PREP(moduleSurrender);
|
||||||
PREP(setHandcuffed);
|
PREP(setHandcuffed);
|
||||||
PREP(surrender);
|
PREP(setSurrendered);
|
||||||
PREP(vehicleCaptiveMoveIn);
|
PREP(vehicleCaptiveMoveIn);
|
||||||
PREP(vehicleCaptiveMoveOut);
|
PREP(vehicleCaptiveMoveOut);
|
||||||
|
|
||||||
|
@ -18,5 +18,12 @@
|
|||||||
|
|
||||||
PARAMS_2(_unit,_newSurrenderState);
|
PARAMS_2(_unit,_newSurrenderState);
|
||||||
|
|
||||||
//TODO: any other conditions??
|
private "_returnValue";
|
||||||
(!((_unit getVariable [QGVAR(isSurrendering), false]) isEqualTo _newSurrenderState))
|
|
||||||
|
_returnValue = if (_newSurrenderState) then {
|
||||||
|
!(_unit getVariable [QGVAR(isSurrendering), false]); //Not currently surrendering
|
||||||
|
} else {
|
||||||
|
(_unit getVariable [QGVAR(isSurrendering), false]); //is Surrendering
|
||||||
|
};
|
||||||
|
|
||||||
|
_returnValue
|
||||||
|
@ -19,6 +19,12 @@
|
|||||||
|
|
||||||
PARAMS_3(_vehicle,_dontcare,_unit);
|
PARAMS_3(_vehicle,_dontcare,_unit);
|
||||||
|
|
||||||
if ((local _unit) && (_unit getVariable [QGVAR(isEscorting), false])) then {
|
if (local _unit) then {
|
||||||
_unit setVariable [QGVAR(isEscorting), false, true];
|
if (_unit getVariable [QGVAR(isEscorting), false]) then {
|
||||||
|
_unit setVariable [QGVAR(isEscorting), false, true];
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_unit getVariable [QGVAR(isSurrendering), false]) then {
|
||||||
|
[_unit, false] call FUNC(setSurrender);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,2 +1,25 @@
|
|||||||
// by commy2
|
/*
|
||||||
|
* Author: commy2, PabstMirror
|
||||||
|
* Handles when a unit gets knocked out. Ends surrendering.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Unit <OBJECT>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Nothing
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [bob, true] call ACE_captives_fnc_handleKnockedOut
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
//ToDo: Waiting on medical integration
|
||||||
|
|
||||||
|
PARAMS_1(_unit);
|
||||||
|
|
||||||
|
if (_unit getVariable [QGVAR(isSurrendering), false]) then { //If surrendering, stop
|
||||||
|
[_unit, false] call FUNC(setSurrendered);
|
||||||
|
};
|
||||||
|
@ -18,10 +18,16 @@
|
|||||||
|
|
||||||
PARAMS_2(_newUnit,_oldUnit);
|
PARAMS_2(_newUnit,_oldUnit);
|
||||||
|
|
||||||
|
//set showHUD based on new unit status:
|
||||||
if ((_newUnit getVariable [QGVAR(isHandcuffed), false]) || {_newUnit getVariable [QGVAR(isSurrendering), false]}) then {
|
if ((_newUnit getVariable [QGVAR(isHandcuffed), false]) || {_newUnit getVariable [QGVAR(isSurrendering), false]}) then {
|
||||||
TRACE_1("Player Change (showHUD false)",_newUnit);
|
TRACE_1("Player Change (showHUD false)",_newUnit);
|
||||||
showHUD false;
|
showHUD false;
|
||||||
} else {
|
} else {
|
||||||
TRACE_1("Player Change (showHUD true)",_newUnit);
|
TRACE_1("Player Change (showHUD true)",_newUnit);
|
||||||
showHUD true;
|
showHUD true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//If old player was escorting, stop
|
||||||
|
if (_oldUnit getVariable [QGVAR(isEscorting), false]) then {
|
||||||
|
_oldUnit setVariable [QGVAR(isEscorting), false, true];
|
||||||
|
};
|
||||||
|
@ -29,6 +29,6 @@ if (local _unit) then {
|
|||||||
|
|
||||||
if (_unit getVariable [QGVAR(isSurrendering), false]) then {
|
if (_unit getVariable [QGVAR(isSurrendering), false]) then {
|
||||||
_unit setVariable [QGVAR(isSurrendering), false];
|
_unit setVariable [QGVAR(isSurrendering), false];
|
||||||
[_unit, true] call FUNC(surrender);
|
[_unit, true] call FUNC(setSurrendered);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
31
addons/captives/functions/fnc_handleZeusDisplayChanged.sqf
Normal file
31
addons/captives/functions/fnc_handleZeusDisplayChanged.sqf
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Author: PabstMirror
|
||||||
|
* Handles ZeusDisplayChanged event
|
||||||
|
* Need to reset showHUD after closing zeus
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Unit <OBJECT>
|
||||||
|
* 1: Display is now open <BOOL>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Nothing
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [bob1, false] call ACE_captives_fnc_handleZeusDisplayChanged
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
PARAMS_2(_unit,_zeusIsOpen);
|
||||||
|
|
||||||
|
//set showHUD based on unit status:
|
||||||
|
if (!_zeusIsOpen) then {
|
||||||
|
if ((_unit getVariable [QGVAR(isHandcuffed), false]) || {_unit getVariable [QGVAR(isSurrendering), false]}) then {
|
||||||
|
TRACE_1("Player Change (showHUD false)",_unit);
|
||||||
|
showHUD false;
|
||||||
|
} else {
|
||||||
|
TRACE_1("Player Change (showHUD true)",_unit);
|
||||||
|
showHUD true;
|
||||||
|
};
|
||||||
|
};
|
@ -27,19 +27,31 @@ if (local _logic) then {
|
|||||||
if ((count _bisMouseOver) == 2) then {//check what mouse was over before the module was placed
|
if ((count _bisMouseOver) == 2) then {//check what mouse was over before the module was placed
|
||||||
_mouseOverObject = _bisMouseOver select 1;
|
_mouseOverObject = _bisMouseOver select 1;
|
||||||
if ((_mouseOverObject isKindOf "CAManBase") && {(vehicle _mouseOverObject) == _mouseOverObject}) then {
|
if ((_mouseOverObject isKindOf "CAManBase") && {(vehicle _mouseOverObject) == _mouseOverObject}) then {
|
||||||
systemChat format ["Debug - module surrendering %1", (name _mouseOverObject)];
|
TRACE_2("Debug - module surrendering %1",_mouseOverObject,(name _mouseOverObject));
|
||||||
[_mouseOverObject, true] call FUNC(surrender);
|
if (alive _mouseOverObject) then {
|
||||||
|
if (!(_mouseOverObject getVariable [QGVAR(isSurrendering), false])) then {
|
||||||
|
["SetSurrendered", [_mouseOverObject], [_mouseOverObject, true]] call EFUNC(common,targetEvent);
|
||||||
|
} else {
|
||||||
|
["SetSurrendered", [_mouseOverObject], [_mouseOverObject, false]] call EFUNC(common,targetEvent);
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
["STR_ACE_Captives_Zeus_OnlyAlive"] call EFUNC(common,displayTextStructured);
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
systemChat format ["Only use on dismounted inf"];
|
["STR_ACE_Captives_Zeus_OnlyInfentry"] call EFUNC(common,displayTextStructured);
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
systemChat format ["Nothing under mouse"];
|
["STR_ACE_Captives_Zeus_NothingSelected"] call EFUNC(common,displayTextStructured);
|
||||||
};
|
};
|
||||||
} else {//an editor module
|
} else {
|
||||||
{
|
//an editor module
|
||||||
systemChat format ["Debug - module surrendering %1", (name _x)];
|
//Modules run before postInit can instal the event handler, so we need to wait a little bit
|
||||||
[_x, true] call FUNC(surrender);
|
[{
|
||||||
} forEach _units;
|
PARAMS_1(_units);
|
||||||
|
{
|
||||||
|
["SetSurrendered", [_x], [_x, true]] call EFUNC(common,targetEvent);
|
||||||
|
} forEach _units;
|
||||||
|
}, [_units], 0.05, 0.05]call EFUNC(common,waitAndExecute);
|
||||||
};
|
};
|
||||||
|
|
||||||
deleteVehicle _logic;
|
deleteVehicle _logic;
|
||||||
|
@ -18,19 +18,23 @@
|
|||||||
|
|
||||||
PARAMS_2(_unit,_state);
|
PARAMS_2(_unit,_state);
|
||||||
|
|
||||||
// We only want this function to work on local machines
|
|
||||||
if (!local _unit) exitwith {
|
|
||||||
[_this, QUOTE(FUNC(setHandcuffed)), _unit] call EFUNC(common,execRemoteFnc);
|
|
||||||
TRACE_2("running setHandcuffed on remote unit",_unit,_state);
|
|
||||||
};
|
|
||||||
|
|
||||||
if (_state isEqualTo (_unit getVariable [QGVAR(isHandcuffed), false])) then {
|
if (!local _unit) exitwith {
|
||||||
LOG("setHandcuffed: current state same as new");
|
ERROR("running setHandcuffed on remote unit");
|
||||||
|
};
|
||||||
|
if ((_unit getVariable [QGVAR(isHandcuffed), false]) isEqualTo _state) exitWith {
|
||||||
|
ERROR("setHandcuffed: current state same as new");
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_state) then {
|
if (_state) then {
|
||||||
_unit setVariable [QGVAR(isHandcuffed), true, true];
|
_unit setVariable [QGVAR(isHandcuffed), true, true];
|
||||||
[_unit, QGVAR(Handcuffed), true] call EFUNC(common,setCaptivityStatus);
|
[_unit, QGVAR(Handcuffed), true] call EFUNC(common,setCaptivityStatus);
|
||||||
|
|
||||||
|
if (_unit getVariable [QGVAR(isSurrendering), false]) then { //If surrendering, stop
|
||||||
|
[_unit, false] call FUNC(setSurrendered);
|
||||||
|
};
|
||||||
|
|
||||||
|
//Set unit cargoIndex (will be -1 if dismounted)
|
||||||
_unit setVariable [QGVAR(CargoIndex), ((vehicle _unit) getCargoIndex _unit), true];
|
_unit setVariable [QGVAR(CargoIndex), ((vehicle _unit) getCargoIndex _unit), true];
|
||||||
|
|
||||||
if (_unit == ACE_player) then {
|
if (_unit == ACE_player) then {
|
||||||
@ -43,11 +47,30 @@ if (_state) then {
|
|||||||
if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then {
|
if (_unit getVariable [QGVAR(isHandcuffed), false] && {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
|
||||||
|
//If we get a change in animation then redo the animation (handles people vaulting to break the animation chain)
|
||||||
|
_animChangedEHID = _unit addEventHandler ["AnimChanged", {
|
||||||
|
PARAMS_2(_unit,_newAnimation);
|
||||||
|
if ((_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") && (_newAnimation != "Unconscious")) then {
|
||||||
|
ERROR("Handcuff animation interrupted");
|
||||||
|
systemChat format ["debug %2: new %1", _newAnimation, time];
|
||||||
|
[_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation);
|
||||||
|
};
|
||||||
|
}];
|
||||||
|
_unit setVariable [QGVAR(handcuffAnimEHID), _animChangedEHID];
|
||||||
|
|
||||||
};
|
};
|
||||||
}, [_unit], 0.01, 0] 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);
|
||||||
|
|
||||||
|
//remove AnimChanged EH
|
||||||
|
_animChangedEHID = _unit getVariable [QGVAR(handcuffAnimEHID), -1];
|
||||||
|
_unit removeEventHandler ["AnimChanged", _animChangedEHID];
|
||||||
|
_unit setVariable [QGVAR(handcuffAnimEHID), -1];
|
||||||
|
|
||||||
if ((vehicle _unit) == _unit) then {
|
if ((vehicle _unit) == _unit) then {
|
||||||
//Break out of hands up animation loop (doAnimation handles Unconscious prioity)
|
//Break out of hands up animation loop (doAnimation handles Unconscious prioity)
|
||||||
[_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);
|
[_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);
|
||||||
|
101
addons/captives/functions/fnc_setSurrendered.sqf
Normal file
101
addons/captives/functions/fnc_setSurrendered.sqf
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
/*
|
||||||
|
* Author: commy2 PabstMirror
|
||||||
|
* Lets a unit surrender
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Unit <OBJECT>
|
||||||
|
* 1: True to surrender, false to un-surrender <BOOL>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Nothing
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [Pierre, true] call ACE_captives_fnc_setSurrendered;
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
PARAMS_2(_unit,_state);
|
||||||
|
|
||||||
|
|
||||||
|
if (!local _unit) exitwith {
|
||||||
|
ERROR("running surrender on remote unit");
|
||||||
|
};
|
||||||
|
|
||||||
|
if ((_unit getVariable [QGVAR(isSurrendering), false]) isEqualTo _state) exitWith {
|
||||||
|
ERROR("Surrender: current state same as new");
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_state) then {
|
||||||
|
if ((vehicle _unit) != _unit) exitWith {ERROR("Cannot surrender while mounted");};
|
||||||
|
if (_unit getVariable [QGVAR(isHandcuffed), false]) exitWith {ERROR("Cannot surrender while handcuffed");};
|
||||||
|
|
||||||
|
_unit setVariable [QGVAR(isSurrendering), true, true];
|
||||||
|
|
||||||
|
[_unit, QGVAR(Surrendered), true] call EFUNC(common,setCaptivityStatus);
|
||||||
|
|
||||||
|
if (_unit == ACE_player) then {
|
||||||
|
showHUD false;
|
||||||
|
};
|
||||||
|
|
||||||
|
[_unit] call EFUNC(common,fixLoweredRifleAnimation);
|
||||||
|
[_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation);
|
||||||
|
|
||||||
|
// fix anim on mission start (should work on dedicated servers)
|
||||||
|
[{
|
||||||
|
PARAMS_1(_unit);
|
||||||
|
if (_unit getVariable [QGVAR(isSurrendering), false] && {(vehicle _unit) == _unit}) then {
|
||||||
|
//Adds an animation changed eh
|
||||||
|
//If we get a change in animation then redo the animation (handles people vaulting to break the animation chain)
|
||||||
|
_animChangedEHID = _unit addEventHandler ["AnimChanged", {
|
||||||
|
PARAMS_2(_unit,_newAnimation);
|
||||||
|
if ((_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") && (_newAnimation != "Unconscious")) then {
|
||||||
|
ERROR("Surrender animation interrupted");
|
||||||
|
systemChat format ["debug %2: new %1", _newAnimation, time];
|
||||||
|
[_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation);
|
||||||
|
};
|
||||||
|
}];
|
||||||
|
_unit setVariable [QGVAR(surrenderAnimEHID), _animChangedEHID];
|
||||||
|
};
|
||||||
|
}, [_unit], 0.01, 0] call EFUNC(common,waitAndExecute);
|
||||||
|
} else {
|
||||||
|
_unit setVariable [QGVAR(isSurrendering), false, true];
|
||||||
|
[_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus);
|
||||||
|
|
||||||
|
//remove AnimChanged EH
|
||||||
|
_animChangedEHID = _unit getVariable [QGVAR(surrenderAnimEHID), -1];
|
||||||
|
_unit removeEventHandler ["AnimChanged", _animChangedEHID];
|
||||||
|
_unit setVariable [QGVAR(surrenderAnimEHID), -1];
|
||||||
|
|
||||||
|
if (_unit == ACE_player) then {
|
||||||
|
//only re-enable HUD if not handcuffed
|
||||||
|
if (!(_unit getVariable [QGVAR(isHandcuffed), false])) then {
|
||||||
|
showHUD true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_unit getVariable ["ACE_isUnconscious", false]) exitWith {}; //don't touch animations if unconscious
|
||||||
|
|
||||||
|
//if we are in "hands up" animationState, crack it now
|
||||||
|
if (((vehicle _unit) == _unit) && {(animationState _unit) == "ACE_AmovPercMstpSsurWnonDnon"}) then {
|
||||||
|
[_unit, "ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);
|
||||||
|
} else {
|
||||||
|
//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
|
||||||
|
[{
|
||||||
|
PARAMS_2(_args,_pfID);
|
||||||
|
EXPLODE_2_PVT(_args,_unit,_maxTime);
|
||||||
|
//If waited long enough or they re-surrendered or they are unconscious, exit loop
|
||||||
|
if ((time > _maxTime) || {_unit getVariable [QGVAR(isSurrendering), false]} || {_unit getVariable ["ACE_isUnconscious", false]}) exitWith {
|
||||||
|
[_pfID] call CBA_fnc_removePerFrameHandler;
|
||||||
|
};
|
||||||
|
//Only break animation if they are actualy the "hands up" animation (because we are using switchmove there won't be an transition)
|
||||||
|
if (((vehicle _unit) == _unit) && {(animationState _unit) == "ACE_AmovPercMstpSsurWnonDnon"}) exitWith {
|
||||||
|
[_pfID] call CBA_fnc_removePerFrameHandler;
|
||||||
|
//Break out of hands up animation loop
|
||||||
|
[_unit, "ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);
|
||||||
|
};
|
||||||
|
}, 0, [_unit, (time + 20)]] call CBA_fnc_addPerFrameHandler;
|
||||||
|
};
|
||||||
|
};
|
@ -1,76 +0,0 @@
|
|||||||
/*
|
|
||||||
* Author: commy2 PabstMirror
|
|
||||||
* Lets a unit surrender
|
|
||||||
*
|
|
||||||
* Arguments:
|
|
||||||
* 0: Unit <OBJECT>
|
|
||||||
* 1: State <BOOL>
|
|
||||||
*
|
|
||||||
* Return Value:
|
|
||||||
* Nothing
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* [Pierre, true] call ACE_captives_fnc_surrender;
|
|
||||||
*
|
|
||||||
* Public: No
|
|
||||||
*/
|
|
||||||
#include "script_component.hpp"
|
|
||||||
|
|
||||||
PARAMS_2(_unit,_state);
|
|
||||||
|
|
||||||
// We only want this function to work on local machines
|
|
||||||
if (!local _unit) exitwith {
|
|
||||||
[_this, QUOTE(FUNC(surrender)), _unit] call EFUNC(common,execRemoteFnc);
|
|
||||||
TRACE_2("running surrender on remote unit",_unit,_state);
|
|
||||||
};
|
|
||||||
|
|
||||||
if ((_unit getVariable [QGVAR(isSurrendering), false]) isEqualTo _state) then {
|
|
||||||
LOG("Surrender: current state same as new");
|
|
||||||
};
|
|
||||||
|
|
||||||
if (_state) then {
|
|
||||||
_unit setVariable [QGVAR(isSurrendering), true, true];
|
|
||||||
[_unit, QGVAR(Surrendered), true] call EFUNC(common,setCaptivityStatus);
|
|
||||||
|
|
||||||
if (_unit == ACE_player) then {
|
|
||||||
showHUD false;
|
|
||||||
};
|
|
||||||
|
|
||||||
// fix anim on mission start (should work on dedicated servers)
|
|
||||||
[{
|
|
||||||
PARAMS_1(_unit);
|
|
||||||
if (_unit getVariable [QGVAR(isSurrendering), false] && {vehicle _unit == _unit}) then {
|
|
||||||
[_unit] call EFUNC(common,fixLoweredRifleAnimation);
|
|
||||||
[_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation);
|
|
||||||
};
|
|
||||||
}, [_unit], 0.01, 0] call EFUNC(common,waitAndExecute);
|
|
||||||
|
|
||||||
//PFEH - (TODO: move to event system?)
|
|
||||||
[{
|
|
||||||
EXPLODE_1_PVT((_this select 0),_unit);
|
|
||||||
if (_unit getVariable [QGVAR(isSurrendering), false]) then {
|
|
||||||
//If unit dies, gets knocked out, or is handcuffed then end surrender
|
|
||||||
if ((!alive _unit) || {_unit getVariable ["ACE_isUnconscious", false]} || {_unit getVariable [QGVAR(isHandcuffed), false]}) then {
|
|
||||||
[_unit, false] call FUNC(surrender);
|
|
||||||
[(_this select 1)] call CBA_fnc_removePerFrameHandler;
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
|
||||||
};
|
|
||||||
}, 0.0, [_unit]] call CBA_fnc_addPerFrameHandler;
|
|
||||||
} else {
|
|
||||||
_unit setVariable [QGVAR(isSurrendering), false, true];
|
|
||||||
[_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus);
|
|
||||||
|
|
||||||
if ((vehicle _unit) == _unit) then {
|
|
||||||
//Break out of hands up animation loop (doAnimation handles Unconscious prioity)
|
|
||||||
[_unit, "ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);
|
|
||||||
};
|
|
||||||
|
|
||||||
if (_unit == ACE_player) then {
|
|
||||||
//only re-enable HUD if not handcuffed
|
|
||||||
if (!(_unit getVariable [QGVAR(isHandcuffed), false])) then {
|
|
||||||
showHUD true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- Edited with tabler - 2015-02-06 -->
|
<!-- Edited with tabler - 2015-02-24 -->
|
||||||
<Project name="ACE">
|
<Project name="ACE">
|
||||||
<Package name="Captives">
|
<Package name="Captives">
|
||||||
<Key ID="STR_ACE_Captives_SetCaptive">
|
<Key ID="STR_ACE_Captives_SetCaptive">
|
||||||
@ -136,5 +136,14 @@
|
|||||||
<Key ID="STR_ACE_Captives_StopSurrendering">
|
<Key ID="STR_ACE_Captives_StopSurrendering">
|
||||||
<English>Stop Surrendering</English>
|
<English>Stop Surrendering</English>
|
||||||
</Key>
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Captives_Zeus_OnlyAlive">
|
||||||
|
<English>Only use on alive units</English>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Captives_Zeus_OnlyInfentry">
|
||||||
|
<English>Only use on dismounted inf</English>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Captives_Zeus_NothingSelected">
|
||||||
|
<English>Nothing under mouse</English>
|
||||||
|
</Key>
|
||||||
</Package>
|
</Package>
|
||||||
</Project>
|
</Project>
|
@ -158,3 +158,6 @@ GVAR(OldPlayerTurret) = [ACE_player] call FUNC(getTurretIndex);
|
|||||||
PARAMS_2(_vehicle,_fuelLevel);
|
PARAMS_2(_vehicle,_fuelLevel);
|
||||||
_vehicle setFuel _fuelLevel;
|
_vehicle setFuel _fuelLevel;
|
||||||
}] call FUNC(addEventhandler);
|
}] call FUNC(addEventhandler);
|
||||||
|
|
||||||
|
["displayTextStructured", FUNC(displayTextStructured)] call FUNC(addEventhandler);
|
||||||
|
["displayTextPicture", FUNC(displayTextPicture)] call FUNC(addEventhandler);
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
* 0: Text <ANY>
|
* 0: Text <ANY>
|
||||||
* 1: Image <STRING>
|
* 1: Image <STRING>
|
||||||
* 2: Image color <ARRAY> <OPTIONAL>
|
* 2: Image color <ARRAY> <OPTIONAL>
|
||||||
|
* 3: Target Unit. Will only display if target is the player controlled object <OBJECT> <OPTIONAL>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* Nothing
|
* Nothing
|
||||||
@ -14,17 +15,30 @@
|
|||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_text", "_image", "_imageColor"];
|
private ["_text", "_image", "_imageColor", "_target"];
|
||||||
_text = _this select 0;
|
_text = _this select 0;
|
||||||
_image = _this select 1;
|
_image = _this select 1;
|
||||||
_imageColor = if (count _this > 2) then {_this select 2} else {[1,1,1]};
|
_imageColor = if (count _this > 2) then {_this select 2} else {[1,1,1]};
|
||||||
_imageColor resize 3;
|
_imageColor resize 3;
|
||||||
|
_target = if (count _this > 3) then {_this select 3} else {ACE_player};
|
||||||
|
|
||||||
|
if (_target != ACE_player) exitWith {};
|
||||||
|
|
||||||
if (typeName _text != "TEXT") then {
|
if (typeName _text != "TEXT") then {
|
||||||
if (typeName _text == "STRING" && {isLocalized _text}) then {
|
if (typeName _text == "ARRAY") then {
|
||||||
|
if (count _text > 0) then {
|
||||||
|
{
|
||||||
|
if (typeName _x == "STRING" && {isLocalized _x}) then {
|
||||||
|
_text set [_foreachIndex, localize _x];
|
||||||
|
};
|
||||||
|
}foreach _text;
|
||||||
|
_text = format _text;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if (typeName _text == "STRING" && {isLocalized _text}) then {
|
||||||
_text = localize _text;
|
_text = localize _text;
|
||||||
};
|
};
|
||||||
_text = parseText format ["<t align='center'>%1</t>", _text];
|
_text = parseText format ["<t align='center'>%1</t>", _text];
|
||||||
};
|
};
|
||||||
_text = composeText [parseText format ["<img size='2' align='center' color='%2' image='%1'/>", _image, _imageColor call BIS_fnc_colorRGBtoHTML], lineBreak, _text];
|
_text = composeText [parseText format ["<img size='2' align='center' color='%2' image='%1'/>", _image, _imageColor call BIS_fnc_colorRGBtoHTML], lineBreak, _text];
|
||||||
[_text, 2] call FUNC(displayTextStructured);
|
[_text, 2] call FUNC(displayTextStructured);
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
* Argument:
|
* Argument:
|
||||||
* 0: Text <ANY>
|
* 0: Text <ANY>
|
||||||
* 1: Size of the textbox <NUMBER> <OPTIONAL>
|
* 1: Size of the textbox <NUMBER> <OPTIONAL>
|
||||||
|
* 2: Target Unit. Will only display if target is the player controlled object <OBJECT> <OPTIONAL>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* Nothing
|
* Nothing
|
||||||
@ -13,14 +14,24 @@
|
|||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_text", "_size", "_isShown", "_ctrlHint", "_yPos", "_xPos", "_wPos", "_hPos", "_position"];
|
private ["_text", "_size", "_isShown", "_ctrlHint", "_yPos", "_xPos", "_wPos", "_hPos", "_position", "_target"];
|
||||||
|
|
||||||
_text = _this select 0;
|
_text = _this select 0;
|
||||||
_size = _this select 1;
|
_size = if (count _this > 1) then {_this select 1} else {1.5;};
|
||||||
|
_target = if (count _this > 2) then {_this select 2} else {ACE_player};
|
||||||
|
|
||||||
if (isNil "_size") then {_size = 1.5};
|
if (_target != ACE_player) exitWith {};
|
||||||
|
|
||||||
if (typeName _text != "TEXT") then {
|
if (typeName _text != "TEXT") then {
|
||||||
|
if (typeName _text == "ARRAY") then {
|
||||||
|
if (count _text > 0) then {
|
||||||
|
{
|
||||||
|
if (typeName _x == "STRING" && {isLocalized _x}) then {
|
||||||
|
_text set [_foreachIndex, localize _x];
|
||||||
|
};
|
||||||
|
}foreach _text;
|
||||||
|
_text = format _text;
|
||||||
|
};
|
||||||
|
};
|
||||||
if (typeName _text == "STRING" && {isLocalized _text}) then {
|
if (typeName _text == "STRING" && {isLocalized _text}) then {
|
||||||
_text = localize _text;
|
_text = localize _text;
|
||||||
};
|
};
|
||||||
@ -48,6 +59,12 @@ _xPos = ((safezoneX + safezoneW) - (10 *(((safezoneW / safezoneH) min 1.2) / 40)
|
|||||||
_yPos = safeZoneY + 0.175 * safezoneH;
|
_yPos = safeZoneY + 0.175 * safezoneH;
|
||||||
_wPos = (10 *(((safezoneW / safezoneH) min 1.2) / 40));
|
_wPos = (10 *(((safezoneW / safezoneH) min 1.2) / 40));
|
||||||
_hPos = (2 *((((safezoneW / safezoneH) min 1.2) / 1.2) / 25));
|
_hPos = (2 *((((safezoneW / safezoneH) min 1.2) / 1.2) / 25));
|
||||||
|
|
||||||
|
//Zeus Interface Open and Display would be under the "CREATE" list
|
||||||
|
if (!isnull curatorCamera) then {
|
||||||
|
_xPos = _xPos min ((safezoneX + safezoneW - 12.5 * (((safezoneW / safezoneH) min 1.2) / 40)) - _wPos);
|
||||||
|
};
|
||||||
|
|
||||||
_position = [_xPos, _yPos, _wPos, _size * _hPos];
|
_position = [_xPos, _yPos, _wPos, _size * _hPos];
|
||||||
|
|
||||||
_ctrlHint ctrlSetPosition _position;
|
_ctrlHint ctrlSetPosition _position;
|
||||||
|
Loading…
Reference in New Issue
Block a user