Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Captives - Blindfold captive units #9361

Merged
merged 15 commits into from
Sep 24, 2023
Merged
8 changes: 8 additions & 0 deletions addons/captives/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ class CfgVehicles {
statement = QUOTE([ARR_2(_player, _target)] call FUNC(doUnloadCaptive));
exceptions[] = {"isNotSwimming"};
};
class ACE_BlindfoldCaptive {
mrschick marked this conversation as resolved.
Show resolved Hide resolved
displayName = CSTRING(BlindfoldCaptive);
distance = 4;
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canBlindfoldCaptive));
statement = QUOTE([ARR_3(_player, _target, true)] call FUNC(doBlindfoldCaptive));
exceptions[] = {"isNotSwimming"};
showDisabled = 0;
};
mrschick marked this conversation as resolved.
Show resolved Hide resolved
};
};

Expand Down
2 changes: 2 additions & 0 deletions addons/captives/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
PREP(addLoadCaptiveActions);
PREP(canApplyHandcuffs);
PREP(canBlindfoldCaptive);
PREP(canEscortCaptive);
PREP(canLoadCaptive);
mrschick marked this conversation as resolved.
Show resolved Hide resolved
PREP(canRemoveHandcuffs);
PREP(canStopEscorting);
PREP(canSurrender);
PREP(canUnloadCaptive);
PREP(doApplyHandcuffs);
PREP(doBlindfoldCaptive);
PREP(doEscortCaptive);
PREP(doLoadCaptive);
PREP(doRemoveHandcuffs);
Expand Down
28 changes: 28 additions & 0 deletions addons/captives/functions/fnc_canBlindfoldCaptive.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include "script_component.hpp"
mrschick marked this conversation as resolved.
Show resolved Hide resolved
/*
* Author: mrschick
* Checks if caller can blindfold the captive
mrschick marked this conversation as resolved.
Show resolved Hide resolved
*
* Arguments:
* 0: Caller (player) <OBJECT>
* 1: Target <OBJECT>
*
* Return Value:
* Can blindfold <BOOL>
*
* Example:
* [player, bob] call ACE_captives_fnc_canBlindfoldCaptive
*
* Public: No
*/

params ["_unit", "_target"];
// Alive, handcuffed, not being escorted, and caller has a Contact DLC blindfold in their inventory

(_target getVariable [QGVAR(isHandcuffed), false]) &&
{isNull (attachedTo _target)} &&
{alive _target} &&
{(vehicle _unit) == _unit} &&
{(vehicle _target) == _target} &&
mrschick marked this conversation as resolved.
Show resolved Hide resolved
{(GVAR(validBlindfolds) findAny (items _unit)) != -1}

8 changes: 4 additions & 4 deletions addons/captives/functions/fnc_canEscortCaptive.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
* Tests if can escort target (attach)
*
* Arguments:
* 0: caller (player) <OBJECT>
* 1: target <OBJECT>
* 0: Caller (player) <OBJECT>
* 1: Target <OBJECT>
*
* Return Value:
* The return value <BOOL>
* Can escort <BOOL>
*
* Example:
* [player, bob] call ACE_captives_fnc_canEscortCaptive
Expand All @@ -17,7 +17,7 @@
*/

params ["_unit", "_target"];
//Alive, handcuffed, not being escored, and not unconscious
// Alive, handcuffed, not being escorted, and not unconscious

(_target getVariable [QGVAR(isHandcuffed), false]) &&
{isNull (attachedTo _target)} &&
Expand Down
44 changes: 44 additions & 0 deletions addons/captives/functions/fnc_doBlindfoldCaptive.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#include "script_component.hpp"
mrschick marked this conversation as resolved.
Show resolved Hide resolved
/*
* Author: mrschick
* Puts a blindfold on a captive unit if the player has a blindfold in their inventory
*
* Arguments:
* 0: _unit-Player <OBJECT>
* 1: target <OBJECT>
mrschick marked this conversation as resolved.
Show resolved Hide resolved
*
* Return Value:
* The return value <BOOL>
*
* Example:
* [player, bob, true] call ACE_captives_fnc_doBlindfoldCaptive;
*
* Public: No
*/

params ["_unit", "_target", "_state"];

// check if _unit has a Contact DLC blindfold in its inventory, abort otherwise.
private _validBlindfolds = GVAR(validBlindfolds);
private _carriedBlindfoldIdx = _validBlindfolds findAny (items _unit);
if (_carriedBlindfoldIdx == -1) exitWith {};

_unit removeItem (_validBlindfolds select _carriedBlindfoldIdx);

// Remove _target goggles if it is wearing any and move them to _unit or _target inventory (if they can hold them)
private _previousGoggles = goggles _target;
if (_previousGoggles != "") then {
if ([_unit, _previousGoggles] call CBA_fnc_canAddItem) exitWith {
removeGoggles _target;
_unit addItem _previousGoggles;
};
if ([_target, _previousGoggles] call CBA_fnc_canAddItem) exitWith {
removeGoggles _target;
_target addItem _previousGoggles;
};
// if the target goggles can fit in neither _unit nor _target inventory, drop them on the ground
[_target, _previousGoggles] call CBA_fnc_dropItem;
};

_target addGoggles (_validBlindfolds select _carriedBlindfoldIdx);

mrschick marked this conversation as resolved.
Show resolved Hide resolved
9 changes: 9 additions & 0 deletions addons/captives/initSettings.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,12 @@ private _category = format ["ACE %1", localize LSTRING(DisplayName)];
false,
1
] call CBA_fnc_addSetting;

[
QGVAR(validBlindfolds), "EDITBOX",
mrschick marked this conversation as resolved.
Show resolved Hide resolved
[LSTRING(ModuleSettings_validBlindfolds_name), LSTRING(ModuleSettings_validBlindfolds_description)],
_category,
'["G_Blindfold_01_black_F","G_Blindfold_01_white_F"]',
1,
{GVAR(validBlindfolds) = call compile GVAR(validBlindfolds);}
] call CBA_fnc_addSetting;
47 changes: 47 additions & 0 deletions addons/captives/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,23 @@
<Chinesesimp>将俘虏带出载具</Chinesesimp>
<Turkish>Tutukluyu indir</Turkish>
</Key>
<Key ID="STR_ACE_Captives_BlindfoldCaptive">
<English>Blindfold Captive</English>
<German>Augen verbinden</German>
<Spanish>Vendas los ojos al cautivo</Spanish>
<French>Bandes les yeux</French>
mrschick marked this conversation as resolved.
Show resolved Hide resolved
<Polish>zawiązujesz oczy jeńcowi</Polish>
<Czech>zavážete zajatci oči</Czech>
<Hungarian>bekötöd a fogoly szemét</Hungarian>
<Russian>Вы завязываете пленнику глаза</Russian>
<Portuguese>Vendas os olhos</Portuguese>
mrschick marked this conversation as resolved.
Show resolved Hide resolved
<Italian>Benda gli occhi</Italian>
<Japanese>捕虜に目隠しをする</Japanese>
<Korean>포로에게 눈을 가리고</Korean>
<Chinese>蒙住囚犯的眼睛</Chinese>
<Chinesesimp>蒙住囚犯的眼睛</Chinesesimp>
<Turkish>Esirin Gözlerini Bağlayın</Turkish>
</Key>
mrschick marked this conversation as resolved.
Show resolved Hide resolved
<Key ID="STR_ACE_Captives_CableTie">
<English>Cable Tie</English>
<German>Kabelbinder</German>
Expand Down Expand Up @@ -456,6 +473,36 @@
<Czech>Vyžadovat, aby se AI prvně vzdala před umožněním zajetí</Czech>
<Spanish>Requiere la rendición de la IA antes de poder arrestarlas</Spanish>
</Key>
<Key ID="STR_ACE_Captives_ModuleSettings_validBlindfolds_name">
<English>Goggles that count as blindfolds</English>
<German>Brillen-Items die Augenbinden sind</German>
<Italian>Occhiali che sono bende per gli occhi</Italian>
<Japanese>目隠しにもなるゴーグル</Japanese>
<Chinese>可用作眼罩的護目鏡</Chinese>
<Chinesesimp>可用作眼罩的护目镜</Chinesesimp>
<Korean>눈가리개로 사용할 수 있는 고글</Korean>
<Polish>Gogle, które liczą się jako opaski na oczy</Polish>
<Russian>Очки, которые можно считать повязками на глаза</Russian>
<Portuguese>Óculos que valem como vendas</Portuguese>
<French>Lunettes pouvant être utilisées comme bandeau</French>
<Czech>Brýle, které lze použít jako pásky přes oči</Czech>
<Spanish>Gafas que se pueden utilizar como vendas</Spanish>
</Key>
<Key ID="STR_ACE_Captives_ModuleSettings_validBlindfolds_description">
<English>List of goggle items that ACE should consider as valid blindfolds to blind captives with</English>
<German>Liste von items die ACE als funktionierende Augenbinden werten sollte</German>
<Italian>Lista di occhiali che ACE considera bende per gli occhi</Italian>
<Japanese>捕虜の目隠しとして有効なゴーグルのリスト</Japanese>
<Chinese>應被視為對失明俘虜有效的眼罩的護目鏡物品列表</Chinese>
<Chinesesimp>应视为有效眼罩的护目镜物品清单,可用于蒙住俘虏的眼睛</Chinesesimp>
<Korean>포로의 눈을 가릴 때 유효한 눈가리개로 간주해야 하는 고글 품목 목록은 다음과 같습니다.</Korean>
<Polish>Lista elementów gogli, które powinny być uważane za ważne opaski do oślepienia jeńców</Polish>
<Russian>Перечень очков, которые следует рассматривать как действительные повязки для ослепления пленных</Russian>
<Portuguese>Lista de artigos de óculos que devem ser considerados como vendas válidas para cegar os prisioneiros com</Portuguese>
<French>Liste des lunettes qui devraient être considérées comme des bandeaux valables pour aveugler les captifs.</French>
<Czech>Seznam brýlí, které by měly být považovány za platné pásky přes oči, jimiž lze oslepit zajatce</Czech>
<Spanish>Lista de gafas que deben considerarse como vendas válidas con las que cegar a los cautivos</Spanish>
</Key>
<Key ID="STR_ACE_Captives_KeyComb_Description">
<English>Sets the unit under the cursor captive.</English>
<German>Nimmt die Einheit unter dem Cursor fest.</German>
Expand Down