mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Surrendering
This commit is contained in:
parent
7a3029b9fd
commit
98564fae68
@ -1,7 +1,7 @@
|
||||
class CfgMovesBasic {
|
||||
class Actions {
|
||||
class CivilStandActions;
|
||||
class ACE_CivilStandCaptiveActions: CivilStandActions {
|
||||
class ACE_CivilStandHandcuffedActions: CivilStandActions {
|
||||
turnL = "";
|
||||
turnR = "";
|
||||
stop = "ACE_AmovPercMstpScapWnonDnon";
|
||||
@ -11,6 +11,11 @@ class CfgMovesBasic {
|
||||
throwPrepare = "";
|
||||
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 States {
|
||||
class AmovPercMstpSnonWnonDnon: StandBase {
|
||||
ConnectTo[] += {"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1};
|
||||
ConnectTo[] += {"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1,"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon",0.1};
|
||||
};
|
||||
|
||||
class CutSceneAnimationBase;
|
||||
|
||||
//Handcuffed Anims:
|
||||
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";
|
||||
speed = 1;
|
||||
looped = 0;
|
||||
@ -31,7 +38,6 @@ class CfgMovesMaleSdr: CfgMovesBasic {
|
||||
ConnectTo[] = {"ACE_AmovPercMstpScapWnonDnon",0.1};
|
||||
InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1};
|
||||
};
|
||||
|
||||
class ACE_AmovPercMstpScapWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon {
|
||||
file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_Ease";
|
||||
speed = 0;
|
||||
@ -39,52 +45,37 @@ class CfgMovesMaleSdr: CfgMovesBasic {
|
||||
InterpolateTo[] = {"Unconscious",0.01};
|
||||
looped = 1;
|
||||
};
|
||||
|
||||
class ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon {
|
||||
actions = "CivilStandActions";
|
||||
file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\amovpercmstpsnonwnondnon_easeout";
|
||||
ConnectTo[] = {"AmovPercMstpSnonWnonDnon",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};
|
||||
};
|
||||
};
|
||||
};*/
|
||||
|
||||
|
@ -79,15 +79,22 @@ class CfgVehicles {
|
||||
priority = 2.3;
|
||||
hotkey = "C";
|
||||
};
|
||||
/*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";
|
||||
};*/
|
||||
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;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -8,6 +8,7 @@ PREP(canFriskPerson);
|
||||
PREP(canLoadCaptive);
|
||||
PREP(canRemoveHandcuffs);
|
||||
PREP(canStopEscorting);
|
||||
PREP(canSurrender);
|
||||
PREP(canUnloadCaptive);
|
||||
PREP(doApplyHandcuffs);
|
||||
PREP(doEscortCaptive);
|
||||
|
@ -26,6 +26,6 @@ class ACE_canInteractConditions {
|
||||
condition = QUOTE(!(GETVAR(player,QGVAR(isHandcuffed),false)));
|
||||
};
|
||||
class GVAR(isNotSurrendering) {
|
||||
condition = QUOTE(!(GETVAR(player,QGVAR(isSurrender),false)));
|
||||
condition = QUOTE(!(GETVAR(player,QGVAR(isSurrendering),false)));
|
||||
};
|
||||
};
|
||||
|
22
addons/captives/functions/fnc_canSurrender.sqf
Normal file
22
addons/captives/functions/fnc_canSurrender.sqf
Normal 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))
|
@ -18,7 +18,7 @@
|
||||
PARAMS_1(_unit);
|
||||
|
||||
// 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 {
|
||||
// reset status on mission start
|
||||
@ -26,4 +26,9 @@ if (local _unit) then {
|
||||
_unit setVariable [QGVAR(isHandcuffed), false];
|
||||
[_unit, true] call FUNC(setHandcuffed);
|
||||
};
|
||||
|
||||
if (_unit getVariable [QGVAR(isSurrendering), false]) then {
|
||||
_unit setVariable [QGVAR(isSurrendering), false];
|
||||
[_unit, true] call FUNC(surrender);
|
||||
};
|
||||
};
|
||||
|
@ -32,7 +32,6 @@ if (_state) then {
|
||||
[_unit, QGVAR(Handcuffed), true] call EFUNC(common,setCaptivityStatus);
|
||||
|
||||
// fix anim on mission start (should work on dedicated servers)
|
||||
|
||||
_fixAnimationFnc = {
|
||||
PARAMS_1(_unit);
|
||||
if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* TODO
|
||||
* Author: commy2 PabstMirror
|
||||
* Lets a unit surrender
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
@ -18,39 +18,42 @@
|
||||
|
||||
PARAMS_2(_unit,_state);
|
||||
|
||||
if (!local _unit) exitWith {[_this, _fnc_scriptName, _unit] call ACE_Core_fnc_execRemoteFnc};
|
||||
|
||||
if (_state) then {
|
||||
if (_unit getVariable [QGVAR(isSurrender), false]) exitWith {};
|
||||
|
||||
_unit setVariable [QGVAR(isSurrender), true, true];
|
||||
[_unit, "ACE_Surrendered", true] call EFUNC(common,setCaptivityStatus);
|
||||
if (_unit getVariable [QGVAR(isSurrendering), false]) exitWith {};
|
||||
|
||||
_unit setVariable [QGVAR(isSurrendering), true, true];
|
||||
[_unit, QGVAR(Surrendered), true] call EFUNC(common,setCaptivityStatus);
|
||||
[_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation);
|
||||
|
||||
private "_surrenderFnc";
|
||||
_surrenderFnc = {
|
||||
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 {
|
||||
_unit setVariable [QGVAR(isSurrender), false, true];
|
||||
} else {
|
||||
[_unit, "amovpercmstpsnonwnondnon_amovpercmstpssurwnondnon", 0] call EFUNC(common,doAnimation);
|
||||
[_unit, false] call FUNC(surrender);
|
||||
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
||||
};
|
||||
};
|
||||
|
||||
if (!(_unit getVariable [QGVAR(isSurrender), false])) then {
|
||||
} else {
|
||||
[(_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;
|
||||
} 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;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Edited with tabler - 2014-12-16 -->
|
||||
<!-- Edited with tabler - 2015-02-06 -->
|
||||
<Project name="ACE">
|
||||
<Package name="Captives">
|
||||
<Key ID="STR_ACE_Captives_SetCaptive">
|
||||
@ -71,6 +71,7 @@
|
||||
<Czech>Naložit zajatce</Czech>
|
||||
<Hungarian>Fogoly berakása</Hungarian>
|
||||
<Russian>Загрузить пленного</Russian>
|
||||
<Portuguese>Embarcar Prisioneiro</Portuguese>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Captives_UnloadCaptive">
|
||||
<English>Unload Captive</English>
|
||||
@ -81,6 +82,7 @@
|
||||
<Czech>Vyložit zajatce</Czech>
|
||||
<Hungarian>Fogoly kivevése</Hungarian>
|
||||
<Russian>Выгрузить пленного</Russian>
|
||||
<Portuguese>Desembarcar Prisioneiro</Portuguese>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Captives_CableTie">
|
||||
<English>Cable Tie</English>
|
||||
@ -115,6 +117,7 @@
|
||||
<Czech>Inventář prohledávané osoby</Czech>
|
||||
<Polish>Ekwipunek rewidowanej osoby</Polish>
|
||||
<Russian>Инвентарь обысканных лиц</Russian>
|
||||
<Portuguese>Inventário da pessoa revistada</Portuguese>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Captives_FriskPerson">
|
||||
<English>Frisk person</English>
|
||||
@ -125,6 +128,13 @@
|
||||
<Polish>Rewiduj osobę</Polish>
|
||||
<Hungarian>Motozás</Hungarian>
|
||||
<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>
|
||||
</Package>
|
||||
</Project>
|
@ -56,7 +56,7 @@ GVAR(isOpeningDoor) = false;
|
||||
localize "STR_ACE_Interaction_InteractionMenuSelf",
|
||||
{
|
||||
// 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};
|
||||
// Conditions: specific
|
||||
if !(isNull (findDisplay 1713999)) exitWith {false};
|
||||
@ -74,7 +74,7 @@ GVAR(isOpeningDoor) = false;
|
||||
localize "STR_ACE_Interaction_InteractionMenuSelf",
|
||||
{
|
||||
// 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};
|
||||
// Conditions: specific
|
||||
if !(!isNull (findDisplay 1713999) && {profileNamespace getVariable [QGVAR(AutoCloseMenu), 0] > 0}) exitWith {false};
|
||||
|
Loading…
Reference in New Issue
Block a user