Surrendering

This commit is contained in:
PabstMirror 2015-02-06 15:54:26 -06:00
parent 7a3029b9fd
commit 98564fae68
10 changed files with 121 additions and 83 deletions

View File

@ -1,7 +1,7 @@
class CfgMovesBasic { class CfgMovesBasic {
class Actions { class Actions {
class CivilStandActions; class CivilStandActions;
class ACE_CivilStandCaptiveActions: CivilStandActions { class ACE_CivilStandHandcuffedActions: CivilStandActions {
turnL = ""; turnL = "";
turnR = ""; turnR = "";
stop = "ACE_AmovPercMstpScapWnonDnon"; stop = "ACE_AmovPercMstpScapWnonDnon";
@ -11,6 +11,11 @@ class CfgMovesBasic {
throwPrepare = ""; throwPrepare = "";
throwGrenade[] = {"","Gesture"}; throwGrenade[] = {"","Gesture"};
}; };
class ACE_CivilStandSurrenderActions: ACE_CivilStandHandcuffedActions {
stop = "ACE_AmovPercMstpScapWnonDnon";
StopRelaxed = "ACE_AmovPercMstpScapWnonDnon";
default = "ACE_AmovPercMstpScapWnonDnon";
};
}; };
}; };
@ -18,12 +23,14 @@ class CfgMovesMaleSdr: CfgMovesBasic {
class StandBase; class StandBase;
class States { class States {
class AmovPercMstpSnonWnonDnon: StandBase { class AmovPercMstpSnonWnonDnon: StandBase {
ConnectTo[] += {"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1}; ConnectTo[] += {"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1,"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon",0.1};
}; };
class CutSceneAnimationBase; class CutSceneAnimationBase;
//Handcuffed Anims:
class ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon: CutSceneAnimationBase { class ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon: CutSceneAnimationBase {
actions = "ACE_CivilStandCaptiveActions"; actions = "ACE_CivilStandHandcuffedActions";
file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_EaseIn"; file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_EaseIn";
speed = 1; speed = 1;
looped = 0; looped = 0;
@ -31,7 +38,6 @@ class CfgMovesMaleSdr: CfgMovesBasic {
ConnectTo[] = {"ACE_AmovPercMstpScapWnonDnon",0.1}; ConnectTo[] = {"ACE_AmovPercMstpScapWnonDnon",0.1};
InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1};
}; };
class ACE_AmovPercMstpScapWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon { class ACE_AmovPercMstpScapWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon {
file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_Ease"; file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_Ease";
speed = 0; speed = 0;
@ -39,52 +45,37 @@ class CfgMovesMaleSdr: CfgMovesBasic {
InterpolateTo[] = {"Unconscious",0.01}; InterpolateTo[] = {"Unconscious",0.01};
looped = 1; looped = 1;
}; };
class ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon { class ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon {
actions = "CivilStandActions"; actions = "CivilStandActions";
file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\amovpercmstpsnonwnondnon_easeout"; file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\amovpercmstpsnonwnondnon_easeout";
ConnectTo[] = {"AmovPercMstpSnonWnonDnon",0.1}; ConnectTo[] = {"AmovPercMstpSnonWnonDnon",0.1};
InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1}; InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1};
}; };
//Surrender Anims:
class ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon: CutSceneAnimationBase {
actions = "ACE_CivilStandSurrenderActions";
file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon";
speed = 1;
looped = 0;
interpolationRestart = 2;
ConnectTo[] = {"ACE_AmovPercMstpSsurWnonDnon",0.1};
InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon",0.1};
};
class ACE_AmovPercMstpSsurWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon {
file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\sur\non\AmovPercMstpSsurWnonDnon";
speed = 0;
looped = 1;
ConnectTo[] = {"ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon",0.1};
InterpolateTo[] = {"Unconscious",0.01};
};
class ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon {
speed = 0.4; //for gameplay reasons, slow this down
actions = "CivilStandActions";
file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\sur\non\AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon";
ConnectTo[] = {"AmovPercMstpSnonWnonDnon",0.1};
InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon",0.1};
};
}; };
}; };
/*
player playMove "ACE_AmovPercMstpScapWnonDnon";
player switchMove "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon";
*/
/*class CfgMovesBasic;
class CfgMovesMaleSdr: CfgMovesBasic {
class States {
class CutSceneAnimationBase;
class AmovPercMstpSnonWnonDnon_EaseIn: CutSceneAnimationBase {
head = "headDefault";
static = 1;
disableWeapons = 0;
forceAim = 0;
InterpolateTo[] = {"AmovPercMstpSnonWnonDnon_EaseOut",0.02,"Unconscious",0.1};
};
class AmovPercMstpSnonWnonDnon_Ease: AmovPercMstpSnonWnonDnon_EaseIn {
looped = 1;
InterpolateTo[] = {"Unconscious",0.1};
};
class AmovPercMstpSnonWnonDnon_EaseOut: AmovPercMstpSnonWnonDnon_EaseIn {
InterpolateTo[] = {"AmovPercMstpSnonWnonDnon_EaseIn",0.02,"Unconscious",0.1};
};
class AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon: CutSceneAnimationBase {
InterpolateTo[] = {"Unconscious",0.01,"AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon",0.1};
};
class AmovPercMstpSsurWnonDnon: AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon {
looped = 1;
InterpolateTo[] = {"Unconscious",0.01};
};
class AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon: AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon {
InterpolateTo[] = {"Unconscious",0.01,"AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon",0.1};
};
};
};*/

View File

@ -78,16 +78,23 @@ class CfgVehicles {
showDisabled = 0; showDisabled = 0;
priority = 2.3; priority = 2.3;
hotkey = "C"; hotkey = "C";
};
class ACE_StartSurrenderingSelf {
displayName = "$STR_ACE_Captives_StartSurrendering";
condition = QUOTE([ARR_2(_player, true)] call FUNC(canSurrender));
statement = QUOTE([ARR_2(_player, true)] call FUNC(surrender));
exceptions[] = {};
showDisabled = 0;
priority = 0;
};
class ACE_StopSurrenderingSelf {
displayName = "$STR_ACE_Captives_StopSurrendering";
condition = QUOTE([ARR_2(_player, false)] call FUNC(canSurrender));
statement = QUOTE([ARR_2(_player, false)] call FUNC(surrender));
exceptions[] = {QGVAR(isNotSurrendering)};
showDisabled = 0;
priority = 0;
}; };
/*class ACE_LoadCaptiveSelf {
displayName = "$STR_ACE_Captives_LoadCaptive";
condition = "[_player, objNull, objNull] call ACE_Captives_fnc_canLoadCaptiveIntoVehicle";
statement = "[_player, objNull, objNull] call ACE_Captives_fnc_loadCaptiveIntoVehicle";
exceptions[] = {QGVAR(isNotEscorting)};
showDisabled = 0;
priority = 2.2;
hotkey = "K";
};*/
}; };
}; };

View File

@ -8,6 +8,7 @@ PREP(canFriskPerson);
PREP(canLoadCaptive); PREP(canLoadCaptive);
PREP(canRemoveHandcuffs); PREP(canRemoveHandcuffs);
PREP(canStopEscorting); PREP(canStopEscorting);
PREP(canSurrender);
PREP(canUnloadCaptive); PREP(canUnloadCaptive);
PREP(doApplyHandcuffs); PREP(doApplyHandcuffs);
PREP(doEscortCaptive); PREP(doEscortCaptive);

View File

@ -26,6 +26,6 @@ class ACE_canInteractConditions {
condition = QUOTE(!(GETVAR(player,QGVAR(isHandcuffed),false))); condition = QUOTE(!(GETVAR(player,QGVAR(isHandcuffed),false)));
}; };
class GVAR(isNotSurrendering) { class GVAR(isNotSurrendering) {
condition = QUOTE(!(GETVAR(player,QGVAR(isSurrender),false))); condition = QUOTE(!(GETVAR(player,QGVAR(isSurrendering),false)));
}; };
}; };

View File

@ -0,0 +1,22 @@
/*
* Author: PabstMirror
* Checks the conditions for being able to surrender
*
* Arguments:
* 0: caller (player) <OBJECT>
* 1: New Surrender State to test <BOOL>
*
* Return Value:
* The return value <BOOL>
*
* Example:
* [player, true] call ACE_captives_fnc_canSurrender;
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_unit,_newSurrenderState);
//TODO: any other conditions??
(!((_unit getVariable [QGVAR(isSurrendering), false]) isEqualTo _newSurrenderState))

View File

@ -18,7 +18,7 @@
PARAMS_1(_unit); PARAMS_1(_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]}, {hint format ["%1 - debug throw prevented",time];}] call EFUNC(common,addActionEventhandler); [_unit, "Throw", {((_this select 1) getVariable [QGVAR(isHandcuffed), false]) || {(_this select 1) getVariable [QGVAR(isSurrendering), false]}}, {}] call EFUNC(common,addActionEventhandler);
if (local _unit) then { if (local _unit) then {
// reset status on mission start // reset status on mission start
@ -26,4 +26,9 @@ if (local _unit) then {
_unit setVariable [QGVAR(isHandcuffed), false]; _unit setVariable [QGVAR(isHandcuffed), false];
[_unit, true] call FUNC(setHandcuffed); [_unit, true] call FUNC(setHandcuffed);
}; };
if (_unit getVariable [QGVAR(isSurrendering), false]) then {
_unit setVariable [QGVAR(isSurrendering), false];
[_unit, true] call FUNC(surrender);
};
}; };

View File

@ -32,7 +32,6 @@ if (_state) then {
[_unit, QGVAR(Handcuffed), true] call EFUNC(common,setCaptivityStatus); [_unit, QGVAR(Handcuffed), true] call EFUNC(common,setCaptivityStatus);
// fix anim on mission start (should work on dedicated servers) // fix anim on mission start (should work on dedicated servers)
_fixAnimationFnc = { _fixAnimationFnc = {
PARAMS_1(_unit); PARAMS_1(_unit);
if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then { if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then {

View File

@ -1,6 +1,6 @@
/* /*
* Author: commy2 * Author: commy2 PabstMirror
* TODO * Lets a unit surrender
* *
* Arguments: * Arguments:
* 0: Unit <OBJECT> * 0: Unit <OBJECT>
@ -18,39 +18,42 @@
PARAMS_2(_unit,_state); PARAMS_2(_unit,_state);
if (!local _unit) exitWith {[_this, _fnc_scriptName, _unit] call ACE_Core_fnc_execRemoteFnc};
if (_state) then { if (_state) then {
if (_unit getVariable [QGVAR(isSurrender), false]) exitWith {}; if (_unit getVariable [QGVAR(isSurrendering), false]) exitWith {};
_unit setVariable [QGVAR(isSurrender), true, true];
[_unit, "ACE_Surrendered", true] call EFUNC(common,setCaptivityStatus);
_unit setVariable [QGVAR(isSurrendering), true, true];
[_unit, QGVAR(Surrendered), true] call EFUNC(common,setCaptivityStatus);
[_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation);
private "_surrenderFnc"; private "_surrenderFnc";
_surrenderFnc = { _surrenderFnc = {
EXPLODE_1_PVT((_this select 0),_unit); EXPLODE_1_PVT((_this select 0),_unit);
if (_unit getVariable [QGVAR(isSurrender), false]) then {
if (_unit getVariable [QGVAR(isSurrendering), false]) then {
if ((!alive _unit) || {_unit getVariable ["ACE_isUnconscious", false]} || {_unit getVariable [QGVAR(isHandcuffed), false]}) then { if ((!alive _unit) || {_unit getVariable ["ACE_isUnconscious", false]} || {_unit getVariable [QGVAR(isHandcuffed), false]}) then {
_unit setVariable [QGVAR(isSurrender), false, true]; [_unit, false] call FUNC(surrender);
} else { [(_this select 1)] call cba_fnc_removePerFrameHandler;
[_unit, "amovpercmstpsnonwnondnon_amovpercmstpssurwnondnon", 0] call EFUNC(common,doAnimation);
}; };
}; } else {
if (!(_unit getVariable [QGVAR(isSurrender), false])) then {
[(_this select 1)] call cba_fnc_removePerFrameHandler; [(_this select 1)] call cba_fnc_removePerFrameHandler;
if !(_unit getVariable ["ACE_isUnconscious", false]) then {
[_unit, "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon", 1] call EFUNC(common,doAnimation);
} else {
[_unit, "unconscious", 1] call EFUNC(common,doAnimation);
};
[_unit, "ACE_Surrendered", false] call EFUNC(common,setCaptivityStatus);
if (isPlayer _unit) then {showHUD true};
}; };
}; };
[_surrenderFnc, 0.0, [_unit]] call CBA_fnc_addPerFrameHandler; [_surrenderFnc, 0.0, [_unit]] call CBA_fnc_addPerFrameHandler;
} else { } else {
_unit setVariable [QGVAR(isSurrender), false, true]; _unit setVariable [QGVAR(isSurrendering), false, true];
if !(_unit getVariable ["ACE_isUnconscious", false]) then {
//Break out of hands up animation loop
//don't want to step on animations from medical (TODO: testing medical integration)
[_unit, "ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);
};
[_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus);
if (_unit == ACE_player) then {
//only enable if not handcuffed
if (!(_unit getVariable [QGVAR(isHandcuffed), false])) then {
showHUD true;
};
};
}; };

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Edited with tabler - 2014-12-16 --> <!-- Edited with tabler - 2015-02-06 -->
<Project name="ACE"> <Project name="ACE">
<Package name="Captives"> <Package name="Captives">
<Key ID="STR_ACE_Captives_SetCaptive"> <Key ID="STR_ACE_Captives_SetCaptive">
@ -71,6 +71,7 @@
<Czech>Naložit zajatce</Czech> <Czech>Naložit zajatce</Czech>
<Hungarian>Fogoly berakása</Hungarian> <Hungarian>Fogoly berakása</Hungarian>
<Russian>Загрузить пленного</Russian> <Russian>Загрузить пленного</Russian>
<Portuguese>Embarcar Prisioneiro</Portuguese>
</Key> </Key>
<Key ID="STR_ACE_Captives_UnloadCaptive"> <Key ID="STR_ACE_Captives_UnloadCaptive">
<English>Unload Captive</English> <English>Unload Captive</English>
@ -81,6 +82,7 @@
<Czech>Vyložit zajatce</Czech> <Czech>Vyložit zajatce</Czech>
<Hungarian>Fogoly kivevése</Hungarian> <Hungarian>Fogoly kivevése</Hungarian>
<Russian>Выгрузить пленного</Russian> <Russian>Выгрузить пленного</Russian>
<Portuguese>Desembarcar Prisioneiro</Portuguese>
</Key> </Key>
<Key ID="STR_ACE_Captives_CableTie"> <Key ID="STR_ACE_Captives_CableTie">
<English>Cable Tie</English> <English>Cable Tie</English>
@ -115,6 +117,7 @@
<Czech>Inventář prohledávané osoby</Czech> <Czech>Inventář prohledávané osoby</Czech>
<Polish>Ekwipunek rewidowanej osoby</Polish> <Polish>Ekwipunek rewidowanej osoby</Polish>
<Russian>Инвентарь обысканных лиц</Russian> <Russian>Инвентарь обысканных лиц</Russian>
<Portuguese>Inventário da pessoa revistada</Portuguese>
</Key> </Key>
<Key ID="STR_ACE_Captives_FriskPerson"> <Key ID="STR_ACE_Captives_FriskPerson">
<English>Frisk person</English> <English>Frisk person</English>
@ -125,6 +128,13 @@
<Polish>Rewiduj osobę</Polish> <Polish>Rewiduj osobę</Polish>
<Hungarian>Motozás</Hungarian> <Hungarian>Motozás</Hungarian>
<Russian>Обыскать человека</Russian> <Russian>Обыскать человека</Russian>
<Portuguese>Revistar</Portuguese>
</Key>
<Key ID="STR_ACE_Captives_StartSurrendering">
<English>Surrender</English>
</Key>
<Key ID="STR_ACE_Captives_StopSurrendering">
<English>Stop Surrendering</English>
</Key> </Key>
</Package> </Package>
</Project> </Project>

View File

@ -56,7 +56,7 @@ GVAR(isOpeningDoor) = false;
localize "STR_ACE_Interaction_InteractionMenuSelf", localize "STR_ACE_Interaction_InteractionMenuSelf",
{ {
// Conditions: canInteract // Conditions: canInteract
_exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", QEGVAR(captives,isNotEscorting), "ACE_Interaction_isNotSwimming", "ACE_Common_notOnMap"]; _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", QEGVAR(captives,isNotEscorting), QEGVAR(captives,isNotSurrendering), "ACE_Interaction_isNotSwimming", "ACE_Common_notOnMap"];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
// Conditions: specific // Conditions: specific
if !(isNull (findDisplay 1713999)) exitWith {false}; if !(isNull (findDisplay 1713999)) exitWith {false};
@ -74,7 +74,7 @@ GVAR(isOpeningDoor) = false;
localize "STR_ACE_Interaction_InteractionMenuSelf", localize "STR_ACE_Interaction_InteractionMenuSelf",
{ {
// Conditions: canInteract // Conditions: canInteract
_exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", QEGVAR(captives,isNotEscorting), "ACE_Interaction_isNotSwimming"]; _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", QEGVAR(captives,isNotEscorting), QEGVAR(captives,isNotSurrendering), "ACE_Interaction_isNotSwimming"];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
// Conditions: specific // Conditions: specific
if !(!isNull (findDisplay 1713999) && {profileNamespace getVariable [QGVAR(AutoCloseMenu), 0] > 0}) exitWith {false}; if !(!isNull (findDisplay 1713999) && {profileNamespace getVariable [QGVAR(AutoCloseMenu), 0] > 0}) exitWith {false};