Captives - Module to set handcuffing

also add player check for GVAR(requireSurrender) in canApplyHandcuffes
This commit is contained in:
PabstMirror 2015-10-23 14:17:31 -05:00
parent ef681e4332
commit 1c26f6c9f5
9 changed files with 77 additions and 19 deletions

View File

@ -153,16 +153,32 @@ class CfgVehicles {
class GVAR(ModuleSurrender): Module_F { class GVAR(ModuleSurrender): Module_F {
author = ECSTRING(common,ACETeam); author = ECSTRING(common,ACETeam);
category = "ACE"; category = "ACE";
displayName = CSTRING(ModuleSurrender_DisplayName); //Make Unit Surrender displayName = CSTRING(ModuleSurrender_DisplayName);
function = QFUNC(moduleSurrender); function = QFUNC(moduleSurrender);
scope = 2; //show in editor scope = 2; //show in editor
isGlobal = 1; //run global isGlobal = 0; //run on server
isTriggerActivated = 1; //Wait for triggers isTriggerActivated = 1; //Wait for triggers
icon = QUOTE(PATHTOF(UI\Icon_Module_Make_Unit_Surrender_ca.paa)); icon = QUOTE(PATHTOF(UI\Icon_Module_Make_Unit_Surrender_ca.paa));
functionPriority = 0; functionPriority = 0;
class Arguments {}; class Arguments {};
class ModuleDescription: ModuleDescription { class ModuleDescription: ModuleDescription {
description = CSTRING(ModuleSurrender_Description); //Sync a unit to make them surrender.<br/>Source: ace_captives description = CSTRING(ModuleSurrender_Description);
sync[] = {"AnyAI"};
};
};
class GVAR(ModuleHandcuffed): Module_F {
author = ECSTRING(common,ACETeam);
category = "ACE";
displayName = CSTRING(ModuleHandcuffed_DisplayName);
function = QFUNC(moduleHandcuffed);
scope = 2; //show in editor
isGlobal = 0; //run on server
isTriggerActivated = 1; //Wait for triggers
icon = QUOTE(PATHTOF(UI\Icon_Module_Make_Unit_Handcuffed_ca.paa));
functionPriority = 0;
class Arguments {};
class ModuleDescription: ModuleDescription {
description = CSTRING(ModuleHandcuffed_Description);
sync[] = {"AnyAI"}; sync[] = {"AnyAI"};
}; };
}; };

View File

@ -24,6 +24,7 @@ PREP(handlePlayerChanged);
PREP(handleRespawn); PREP(handleRespawn);
PREP(handleUnitInitPost); PREP(handleUnitInitPost);
PREP(handleZeusDisplayChanged); PREP(handleZeusDisplayChanged);
PREP(moduleHandcuffed);
PREP(moduleSettings); PREP(moduleSettings);
PREP(moduleSurrender); PREP(moduleSurrender);
PREP(setHandcuffed); PREP(setHandcuffed);

View File

@ -2,7 +2,7 @@
class CfgPatches { class CfgPatches {
class ADDON { class ADDON {
units[] = {QGVAR(ModuleSettings), QGVAR(ModuleSurrender)}; units[] = {QGVAR(ModuleSettings), QGVAR(ModuleSurrender), QGVAR(ModuleHandcuffed)};
weapons[] = {"ACE_CableTie"}; weapons[] = {"ACE_CableTie"};
requiredVersion = REQUIRED_VERSION; requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ACE_Interaction"}; requiredAddons[] = {"ACE_Interaction"};

View File

@ -20,11 +20,12 @@ params ["_unit", "_target"];
//Check sides, Player has cableTie, target is alive and not already handcuffed //Check sides, Player has cableTie, target is alive and not already handcuffed
(GVAR(allowHandcuffOwnSide) || {(side _unit) != (side _target)}) && (GVAR(allowHandcuffOwnSide) || {(side _unit) != (side _target)}) &&
("ACE_CableTie" in (items _unit)) && {"ACE_CableTie" in (items _unit)} &&
{alive _target} && {alive _target} &&
{!(_target getVariable [QGVAR(isHandcuffed), false])} && {!(_target getVariable [QGVAR(isHandcuffed), false])} &&
{ {
(_target getVariable ["ACE_isUnconscious", false]) || //isUnconscious (_target getVariable ["ACE_isUnconscious", false]) || //isUnconscious
{!([_target] call EFUNC(common,isPlayer))} || //is an AI (not a player)
{GVAR(requireSurrender) == 0} || //or don't require surrendering {GVAR(requireSurrender) == 0} || //or don't require surrendering
{_target getVariable [QGVAR(isSurrendering), false]} || //or is surrendering {_target getVariable [QGVAR(isSurrendering), false]} || //or is surrendering
{(GVAR(requireSurrender) == 2) && {(currentWeapon _target) == ""}} //or "SurrenderOrNoWeapon" and no weapon {(GVAR(requireSurrender) == 2) && {(currentWeapon _target) == ""}} //or "SurrenderOrNoWeapon" and no weapon

View File

@ -0,0 +1,35 @@
/*
* Author: PabstMirror
* Module Function to make a unit handcuffed (can be called from editor)
*
* Arguments:
* 0: The Module Logic <OBJECT>
* 1: synced objects <ARRAY>
* 2: Activated <BOOL>
*
* Return Value:
* Nothing
*
* Example:
* Called from module
*
* Public: No
*/
#include "script_component.hpp"
params ["_logic", "_units", "_activated"];
TRACE_3("params",_logic,_units,_activated);
if (!_activated) exitWith {};
if (!isServer) exitWith {};
//Modules run before postInit can instal the event handler, so we need to wait a little bit
[{
params ["_units"];
{
["SetHandcuffed", [_x], [_x, true]] call EFUNC(common,targetEvent);
} forEach _units;
}, [_units], 0.05] call EFUNC(common,waitAndExecute);
deleteVehicle _logic;

View File

@ -1,9 +1,9 @@
/* /*
* Author: PabstMirror * Author: PabstMirror
* Module Function to make a unit surrender (can be called from editor, or placed with zeus) * Module Function to make a unit surrender (can be called from editor)
* *
* Arguments: * Arguments:
* 0: The Module Logic Object <OBJECT> * 0: The Module Logic <OBJECT>
* 1: synced objects <ARRAY> * 1: synced objects <ARRAY>
* 2: Activated <BOOL> * 2: Activated <BOOL>
* *
@ -17,20 +17,19 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_bisMouseOver", "_mouseOverObject"];
params ["_logic", "_units", "_activated"]; params ["_logic", "_units", "_activated"];
TRACE_3("params",_logic,_units,_activated);
if (!_activated) exitWith {}; if (!_activated) exitWith {};
if (!isServer) exitWith {};
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 ["_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] call EFUNC(common,waitAndExecute);
}, [_units], 0.05]call EFUNC(common,waitAndExecute);
deleteVehicle _logic; deleteVehicle _logic;
};

View File

@ -179,6 +179,12 @@
<Hungarian>Egység szinkronizálása, hogy kapituláljon.&lt;br /&gt;Forrás: ace_captives</Hungarian> <Hungarian>Egység szinkronizálása, hogy kapituláljon.&lt;br /&gt;Forrás: ace_captives</Hungarian>
<Russian>Синхронизируйте с юнитами, чтобы сделать их пленными.&lt;br /&gt;Источник: ace_captives</Russian> <Russian>Синхронизируйте с юнитами, чтобы сделать их пленными.&lt;br /&gt;Источник: ace_captives</Russian>
</Key> </Key>
<Key ID="STR_ACE_Captives_ModuleHandcuffed_DisplayName">
<English>Make Unit Handcuffed</English>
</Key>
<Key ID="STR_ACE_Captives_ModuleHandcuffed_Description">
<English>Sync a unit to make them handcuffed.&lt;br /&gt;Source: ace_captives</English>
</Key>
<Key ID="STR_ACE_Captives_ModuleSettings_DisplayName"> <Key ID="STR_ACE_Captives_ModuleSettings_DisplayName">
<English>Captives Settings</English> <English>Captives Settings</English>
<Polish>Ustawienia więźniów</Polish> <Polish>Ustawienia więźniów</Polish>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB