Merge pull request #129 from KoffeinFlummi/agmCaptivesPort

Port: AGM Captives
This commit is contained in:
Nicolás Badano 2015-02-11 18:09:33 -03:00
commit 681d83f922
63 changed files with 1443 additions and 816 deletions

View File

@ -1,3 +0,0 @@
// by commy2
[missionNamespace, "playerChanged", {_this call AGM_Captives_fnc_handlePlayerChanged}] call AGM_Core_fnc_addCustomEventhandler;

View File

@ -1,363 +0,0 @@
class CfgPatches {
class AGM_Captives {
units[] = {};
weapons[] = {"AGM_CableTie"};
requiredVersion = 0.60;
requiredAddons[] = {AGM_Core, AGM_Interaction};
version = "0.95";
versionStr = "0.95";
versionAr[] = {0,95,0};
author[] = {"commy2", "KoffeinFlummi"};
authorUrl = "https://github.com/commy2/";
};
};
class CfgFunctions {
class AGM_Captives {
class AGM_Captives {
file = "\AGM_Captives\functions";
class canFriskPerson;
class canLoadCaptive;
class canUnloadCaptive;
class escortCaptive;
class handleGetOut;
class handleKnockedOut;
class handlePlayerChanged;
class handleWokeUp;
class initPost;
class initUnit;
class loadCaptive;
class openFriskMenu;
class setCaptive;
class surrender;
class unloadCaptive;
};
};
};
//release escorted captive when entering a vehicle
class Extended_GetIn_EventHandlers {
class All {
class AGM_Captives_AutoDetachCaptive {
getIn = "if (local (_this select 2) && {(_this select 2) getVariable ['AGM_isEscorting', false]}) then {(_this select 2) setVariable ['AGM_isEscorting', false, true]}";
};
};
};
//reset captive animation after leaving vehicle
class Extended_GetOut_EventHandlers {
class All {
class AGM_Captives_LeaveVehicle {
getOut = "if (local (_this select 2) && {(_this select 2) getVariable ['AGM_isCaptive', false]}) then {_this call AGM_Captives_fnc_handleGetOut}";
};
};
};
//reset captivity and escorting status when getting killed
class Extended_Killed_EventHandlers {
class CAManBase {
class AGM_Captives_AutoDetachCaptive {
killed = "if ((_this select 0) getVariable ['AGM_isCaptive', false]) then {(_this select 0) setVariable ['AGM_isCaptive', false, true]}; if ((_this select 0) getVariable ['AGM_isEscorting', false]) then {(_this select 0) setVariable ['AGM_isEscorting', false, true]};";
};
};
};
//handle captive and unconsciousness state
class Extended_Init_EventHandlers {
class CAManBase {
class AGM_Captives_AutoDetachCaptive {
init = "_this call AGM_Captives_fnc_initUnit";
};
};
};
//mission start
class Extended_InitPost_EventHandlers {
class CAManBase {
class AGM_Captives_InitPost {
init = "if (local (_this select 0)) then {_this call AGM_Captives_fnc_initPost};";
};
};
};
class Extended_PostInit_EventHandlers {
class AGM_Captives {
clientInit = "call compile preprocessFileLineNumbers '\AGM_Captives\clientInit.sqf'";
};
};
class AGM_Core_canInteractConditions {
class AGM_Interaction_isNotEscorting {
condition = "!(_player getVariable ['AGM_isEscorting', false])";
};
class AGM_Interaction_isNotCaptive {
condition = "!(_player getVariable ['AGM_isCaptive', false])";
};
class AGM_Interaction_isNotSurrendering {
condition = "!(_player getVariable ['AGM_isSurrender', false])";
};
};
class CfgVehicles {
class Man;
class CAManBase: Man {
class AGM_Actions {
class AGM_SetCaptive {
displayName = "$STR_AGM_Captives_SetCaptive";
distance = 4;
condition = "'AGM_CableTie' in items _player && {alive _target} && {!(_target getVariable ['AGM_isCaptive', false])}";
statement = "player removeItem 'AGM_CableTie'; [_target, true] call AGM_Captives_fnc_setCaptive";
showDisabled = 0;
priority = 2.4;
icon = "\AGM_Captives\UI\handcuff_ca.paa";
hotkey = "C";
};
class AGM_ReleaseCaptive {
displayName = "$STR_AGM_Captives_ReleaseCaptive";
distance = 4;
condition = "_target getVariable ['AGM_isCaptive', false] && {isNull (attachedTo _target)}";
statement = "[_target, false] call AGM_Captives_fnc_setCaptive";
exceptions[] = {"AGM_Interaction_isNotEscorting"};
showDisabled = 0;
priority = 2.4;
icon = "\AGM_Captives\UI\handcuff_ca.paa";
hotkey = "R";
};
class AGM_EscortCaptive {
displayName = "$STR_AGM_Captives_EscortCaptive";
distance = 4;
condition = "_target getVariable ['AGM_isCaptive', false] && {isNull (attachedTo _target)} && {alive _target} && {!(_target getVariable ['AGM_isUnconscious', false])}";
statement = "[_target, true] call AGM_Captives_fnc_escortCaptive";
exceptions[] = {"AGM_Interaction_isNotEscorting"};
showDisabled = 0;
icon = "\AGM_Captives\UI\captive_ca.paa";
priority = 2.3;
hotkey = "E";
};
class AGM_StopEscorting {
displayName = "$STR_AGM_Captives_StopEscorting";
distance = 4;
condition = "_target getVariable ['AGM_isCaptive', false] && {_target in attachedObjects _player}";
statement = "[_target, false] call AGM_Captives_fnc_escortCaptive";
exceptions[] = {"AGM_Interaction_isNotEscorting"};
showDisabled = 0;
icon = "\AGM_Captives\UI\captive_ca.paa";
priority = 2.3;
hotkey = "E";
};
class AGM_LoadCaptive {
displayName = "$STR_AGM_Captives_LoadCaptive";
distance = 4;
condition = "[_player, _target, objNull] call AGM_Captives_fnc_canLoadCaptive";
statement = "[_player, _target, objNull] call AGM_Captives_fnc_loadCaptive";
exceptions[] = {"AGM_Interaction_isNotEscorting"};
showDisabled = 0;
icon = "\AGM_Captives\UI\captive_ca.paa";
priority = 2.2;
hotkey = "L";
};
class AGM_FriskPerson {
displayName = "$STR_AGM_Captives_FriskPerson";
distance = 2;
condition = "[_player, _target] call AGM_Captives_fnc_canFriskPerson";
statement = "[_player, _target] call AGM_Captives_fnc_openFriskMenu";
showDisabled = 0;
//icon = ""; //@todo
priority = 3;
hotkey = "F";
};
};
class AGM_SelfActions {
class AGM_StopEscortingSelf {
displayName = "$STR_AGM_Captives_StopEscorting";
condition = "(_player getVariable ['AGM_escortedUnit', objNull]) getVariable ['AGM_isCaptive', false] && {(_player getVariable ['AGM_escortedUnit', objNull]) in attachedObjects _player}";
statement = "[_player getVariable ['AGM_escortedUnit', objNull], false] call AGM_Captives_fnc_escortCaptive;";
exceptions[] = {"AGM_Interaction_isNotEscorting"};
showDisabled = 0;
priority = 2.3;
hotkey = "C";
};
/*class AGM_LoadCaptiveSelf {
displayName = "$STR_AGM_Captives_LoadCaptive";
condition = "[_player, objNull, objNull] call AGM_Captives_fnc_canLoadCaptiveIntoVehicle";
statement = "[_player, objNull, objNull] call AGM_Captives_fnc_loadCaptiveIntoVehicle";
exceptions[] = {"AGM_Interaction_isNotEscorting"};
showDisabled = 0;
priority = 2.2;
hotkey = "K";
};*/
};
};
#define MACRO_LOADUNLOADCAPTIVE \
class AGM_Actions { \
class AGM_LoadCaptive { \
displayName = "$STR_AGM_Captives_LoadCaptive"; \
distance = 4; \
condition = "[_player, objNull, _target] call AGM_Captives_fnc_canLoadCaptive"; \
statement = "[_player, objNull, _target] call AGM_Captives_fnc_loadCaptive"; \
exceptions[] = {"AGM_Interaction_isNotEscorting"}; \
showDisabled = 0; \
priority = 1.2; \
hotkey = "L"; \
}; \
class AGM_UnloadCaptive { \
displayName = "$STR_AGM_Captives_UnloadCaptive"; \
distance = 4; \
condition = "[_player, _target] call AGM_Captives_fnc_canUnloadCaptive"; \
statement = "[_player, _target] call AGM_Captives_fnc_unloadCaptive"; \
showDisabled = 0; \
priority = 1.2; \
hotkey = "C"; \
}; \
};
class LandVehicle;
class Car: LandVehicle {
MACRO_LOADUNLOADCAPTIVE
};
class Tank: LandVehicle {
MACRO_LOADUNLOADCAPTIVE
};
class Air;
class Helicopter: Air {
MACRO_LOADUNLOADCAPTIVE
};
class Plane: Air {
MACRO_LOADUNLOADCAPTIVE
};
class Ship;
class Ship_F: Ship {
MACRO_LOADUNLOADCAPTIVE
};
class StaticWeapon: LandVehicle {
MACRO_LOADUNLOADCAPTIVE
};
class StaticMortar;
class Mortar_01_base_F: StaticMortar {
MACRO_LOADUNLOADCAPTIVE
};
#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \
name = #ITEM; \
count = COUNT; \
};
class Box_NATO_Support_F;
class AGM_Box_Misc: Box_NATO_Support_F {
class TransportItems {
MACRO_ADDITEM(AGM_CableTie,12)
};
};
};
class CfgWeapons {
class AGM_ItemCore;
class InventoryItem_Base_F;
class AGM_CableTie: AGM_ItemCore {
displayName = "$STR_AGM_Captives_CableTie";
descriptionShort = "$STR_AGM_Captives_CableTieDescription";
model = "\AGM_Captives\agm_cabletie.p3d";
picture = "\AGM_Captives\UI\agm_cabletie_x_ca.paa";
scope = 2;
class ItemInfo: InventoryItem_Base_F {
mass = 1;
};
};
};
/*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};
};
};
};*/
class CfgMovesBasic {
class Actions {
class CivilStandActions;
class AGM_CivilStandCaptiveActions: CivilStandActions {
turnL = "";
turnR = "";
stop = "AGM_AmovPercMstpScapWnonDnon";
StopRelaxed = "AGM_AmovPercMstpScapWnonDnon";
default = "AGM_AmovPercMstpScapWnonDnon";
getOver = "";
throwPrepare = "";
throwGrenade[] = {"","Gesture"};
};
};
};
class CfgMovesMaleSdr: CfgMovesBasic {
class StandBase;
class States {
class AmovPercMstpSnonWnonDnon: StandBase {
ConnectTo[] += {"AGM_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1};
};
class CutSceneAnimationBase;
class AGM_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon: CutSceneAnimationBase {
actions = "AGM_CivilStandCaptiveActions";
file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_EaseIn";
speed = 1;
looped = 0;
interpolationRestart = 2;
ConnectTo[] = {"AGM_AmovPercMstpScapWnonDnon",0.1};
InterpolateTo[] = {"Unconscious",0.01,"AGM_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1};
};
class AGM_AmovPercMstpScapWnonDnon: AGM_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon {
file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_Ease";
speed = 0;
ConnectTo[] = {"AGM_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1};
InterpolateTo[] = {"Unconscious",0.01};
looped = 1;
};
class AGM_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon: AGM_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,"AGM_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1};
};
};
};
/*
player playMove "AGM_AmovPercMstpScapWnonDnon";
player switchMove "AGM_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon";
*/

View File

@ -1,21 +0,0 @@
/*
* By: bux578
*
* Checks the conditions for being able to frisk a unit
*
* Arguments:
* 0: caller (player) (Object)
* 1: target (Object)
*
* Return Value:
* Boolean
*/
private ["_unit", "_target"];
_unit = _this select 0;
_target = _this select 1;
_target getVariable ["AGM_isCaptive", false]
|| {_target getVariable ["AGM_isSearchable", false]}
|| {_target getVariable ["AGM_isUnconscious", false]}

View File

@ -1,35 +0,0 @@
/*
* Author: commy2
*
* Check if the unit can load the target object into a vehicle.
*
* Argument:
* 0: Unit that wants to load a captive (Object)
* 1: A captive. ObjNull for the first escorted captive (Object)
* 2: Vehicle to load the captive into. ObjNull for the nearest vehicle (Object)
*
* Return value:
* Boolean (Bool)
*/
private ["_unit", "_target", "_vehicle", "_objects"];
_unit = _this select 0;
_target = _this select 1;
_vehicle = _this select 2;
if (isNull _target) then {
_objects = attachedObjects _unit;
_objects = [_objects, {_this getVariable ["AGM_isCaptive", false]}] call AGM_Core_fnc_filter;
_target = _objects select 0;
};
if (isNull _vehicle) then {
_objects = nearestObjects [_unit, ["Car", "Tank", "Helicopter", "Plane", "Ship_F"], 10];
_vehicle = _objects select 0;
};
_unit getVariable ["AGM_isEscorting", false]
&& {!isNil "_target"}
&& {!isNil "_vehicle"}
&& {_vehicle emptyPositions "cargo" > 0}

View File

@ -1,23 +0,0 @@
/*
* Author: commy2
*
* Check if the unit can unload a captive from the vehicle.
*
* Argument:
* 0: Unit that wants to unload a captive (Object)
* 1: Vehicle to unload a captive from. (Object)
*
* Return value:
* Boolean (Bool)
*/
private ["_unit", "_vehicle", "_cargo"];
_unit = _this select 0;
_vehicle = _this select 1;
_cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turret positions. They shouldn't be there anyway.
_cargo = [_cargo, {_this getVariable ["AGM_isCaptive", false]}] call AGM_Core_fnc_filter;
count _cargo > 0

View File

@ -1,43 +0,0 @@
//author : Nic547
//Attaches a Captive to the player
private ["_unit", "_state"];
_unit = _this select 0;
_state = _this select 1;
if !("AGM_Handcuffed" in ([_unit] call AGM_Core_fnc_getCaptivityStatus)) exitWith {
[localize "STR_AGM_Captives_NoCaptive"] call AGM_Core_fnc_displayTextStructured;
};
if (_state) then {
if (player getVariable ["AGM_isEscorting", false]) exitWith {};
[player, _unit] call AGM_Core_fnc_claim;
player setVariable ["AGM_isEscorting", true, true];
_unit attachTo [player, [0, 1, 0]];
player setVariable ["AGM_escortedUnit", _unit, true];
_actionID = player addAction [format ["<t color='#FF0000'>%1</t>", localize "STR_AGM_Captives_StopEscorting"], "[player getVariable ['AGM_escortedUnit', objNull], false] call AGM_Captives_fnc_escortCaptive;", nil, 20, false, true, "", "!isNull (player getVariable ['AGM_escortedUnit', objNull])"];
[_unit, _actionID] spawn {
_unit = _this select 0;
_actionID = _this select 1;
while {player getVariable ["AGM_isEscorting", false]} do {
sleep 0.2;
if (!alive _unit || {!alive player} || {!canStand _unit} || {!canStand player} || {_unit getVariable ["AGM_isUnconscious", false]} || {player getVariable ["AGM_isUnconscious", false]} || {!isNull (attachedTo player)}) then {
player setVariable ["AGM_isEscorting", false, true];
};
};
[objNull, _unit] call AGM_Core_fnc_claim;
detach _unit;
player removeAction _actionID;
};
} else {
player setVariable ["AGM_isEscorting", false, true];
player setVariable ["AGM_escortedUnit", objNull, true];
};

View File

@ -1,14 +0,0 @@
// by commy2
private ["_vehicle", "_unit", "_cargoIndex"];
_vehicle = _this select 0;
_unit = _this select 2;
_cargoIndex = _unit getVariable ["AGM_Captives_CargoIndex", -1];
if (_cargoIndex != -1) exitWith {
_unit moveInCargo [_vehicle, _cargoIndex];
};
[_unit, 'AGM_AmovPercMstpScapWnonDnon', 2] call AGM_Core_fnc_doAnimation;

View File

@ -1,12 +0,0 @@
// by commy2
private ["_unit", "_oldUnit"];
_unit = _this select 0;
_oldUnit = _this select 1;
if (_unit getVariable ["AGM_isCaptive", false]) then {
showHUD false;
} else {
showHUD true;
};

View File

@ -1,10 +0,0 @@
// by commy2
private "_unit";
_unit = _this select 0;
if (_unit getVariable ["AGM_isCaptive", false] && {vehicle _unit == _unit}) then {
[_unit] call AGM_Core_fnc_fixLoweredRifleAnimation;
[_unit, "AGM_AmovPercMstpScapWnonDnon", 0] call AGM_Core_fnc_doAnimation;
};

View File

@ -1,11 +0,0 @@
// by commy2
private "_unit";
_unit = _this select 0;
// reset status on mission start
if (_unit getVariable ["AGM_isCaptive", false]) then {
_unit setVariable ["AGM_isCaptive", false];
[_unit, true] call AGM_Captives_fnc_setCaptive;
};

View File

@ -1,12 +0,0 @@
// by commy2
[_this select 0, "knockedOut", {
if (local (_this select 0)) then {_this call AGM_Captives_fnc_handleKnockedOut};
}] call AGM_Core_fnc_addCustomEventhandler;
[_this select 0, "wokeUp", {
if (local (_this select 0)) then {_this call AGM_Captives_fnc_handleWokeUp};
}] call AGM_Core_fnc_addCustomEventhandler;
// prevent players from throwing grenades
[_this select 0, "Throw", {(_this select 1) getVariable ["AGM_isCaptive", false]}, {}] call AGM_Core_fnc_addActionEventhandler;

View File

@ -1,35 +0,0 @@
/*
* Author: commy2
*
* Unit loads the target object into a vehicle.
*
* Argument:
* 0: Unit that wants to load a captive (Object)
* 1: A captive. ObjNull for the first escorted captive (Object)
* 2: Vehicle to load the captive into. ObjNull for the nearest vehicle (Object)
*
* Return value:
* Nothing
*/
private ["_unit", "_target", "_vehicle", "_objects"];
_unit = _this select 0;
_target = _this select 1;
_vehicle = _this select 2;
if (isNull _target) then {
_objects = attachedObjects _unit;
_objects = [_objects, {_this getVariable ["AGM_isCaptive", false]}] call AGM_Core_fnc_filter;
_target = _objects select 0;
};
if (isNull _vehicle) then {
_objects = nearestObjects [_unit, ["Car_F", "Tank_F", "Helicopter_F", "Boat_F", "Plane_F"], 10];
_vehicle = _objects select 0;
};
if (!isNil "_target" && {!isNil "_vehicle"}) then {
_unit setVariable ["AGM_isEscorting", false];
[[_target, _vehicle], "{(_this select 0) moveInCargo (_this select 1); (_this select 0) assignAsCargo (_this select 1); (_this select 0) setVariable ['AGM_Captives_CargoIndex', (_this select 1) getCargoIndex (_this select 0), true];}", _target] call AGM_Core_fnc_execRemoteFnc;
};

View File

@ -1,70 +0,0 @@
/*
Name: AGM_Captives_fnc_openFriskMenu
Author: bux578
Description:
Open the select menu with the "personal" items of a frisked unit
It only shows "handgunWeapon", "uniformItems", "vestItems", "backpackItems" and "assignedItems" because every other item is visible on the character
Parameters:
0: Object - player unit
1: Object - unit
Returns:
Nothing
*/
private ["_player", "_unit", "_weapon", "_listedItemClasses", "_actions", "_allGear"];
_player = _this select 0;
_unit = _this select 1;
_weapon = currentWeapon _player;
if (_weapon == primaryWeapon _player && {_weapon != ""}) then {
[_player, "AmovPercMstpSlowWrflDnon", 0] call AGM_Core_fnc_doAnimation;
};
_listedItemClasses = [];
_actions = [localize "STR_AGM_Captives_FriskMenuHeader", localize "STR_AGM_Captives_CancelSelection"] call AGM_Interaction_fnc_prepareSelectMenu;
_allGear = [];
if ((handgunWeapon _unit) != "") then {
_allGear pushBack (handgunWeapon _unit);
};
if (count (uniformItems _unit) > 0) then {
_allGear = _allGear + (uniformItems _unit);
};
if (count (vestItems _unit) > 0) then {
_allGear = _allGear + (vestItems _unit);
};
if (count (backpackItems _unit) > 0) then {
_allGear = _allGear + (backpackItems _unit);
};
if (count (assignedItems _unit) > 0) then {
_allGear = _allGear + (assignedItems _unit);
};
// Handgun
// Uniform Items
// Vest Items
// Backpack Items
// Assigned Items
{
if (!(_x in _listedItemClasses)) then {
private "_item";
_item = configFile >> "CfgMagazines" >> _x;
if (isNil "_item" || str _item == "") then { //str _item ?
_item = configFile >> "CfgWeapons" >> _x;
};
_actions = [_actions, getText(_item >> "displayName"), getText(_item >> "picture"), _x] call AGM_Interaction_fnc_addSelectableItem;
_listedItemClasses pushBack _x;
};
} forEach (_allGear);
[_actions, {call AGM_Interaction_fnc_hideMenu;}, {call AGM_Interaction_fnc_hideMenu;}] call AGM_Interaction_fnc_openSelectMenu;
// don't need an "Ok" Button
ctrlShow [8860, false];

View File

@ -1,57 +0,0 @@
/*
* Author: Nic547, commy2
*
* Makes a civilian unable to move.
*
* Argument:
* 0: Unit (Object)
* 1: True to take captive, false to release captive (Object)
*
* Return value:
* Nothing
*/
private ["_unit", "_state"];
_unit = _this select 0;
_state = _this select 1;
if (!local _unit) exitWith {[[_unit, _state, true], _fnc_scriptName, _unit] call AGM_Core_fnc_execRemoteFnc};
if (_state) then {
if (_unit getVariable ["AGM_isCaptive", false]) exitWith {};
_unit setVariable ["AGM_isCaptive", true, true];
// fix anim on mission start (should work on dedicated servers)
_unit spawn {
[_this, "AGM_Handcuffed", true] call AGM_Core_fnc_setCaptivityStatus;
if (_this getVariable ["AGM_isCaptive", false] && {vehicle _this == _this}) then {
[_this] call AGM_Core_fnc_fixLoweredRifleAnimation;
[_this, "AGM_AmovPercMstpScapWnonDnon", 0] spawn AGM_Core_fnc_doAnimation;
};
};
_unit setVariable ["AGM_Captives_CargoIndex", vehicle _unit getCargoIndex _unit, true];
if (_unit == AGM_player) then {
showHUD false;
};
} else {
if !(_unit getVariable ["AGM_isCaptive", false]) exitWith {};
_unit setVariable ["AGM_isCaptive", false, true];
[_unit, "AGM_Handcuffed", false] call AGM_Core_fnc_setCaptivityStatus;
if (vehicle _unit == _unit) then {
[_unit, "AGM_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call AGM_Core_fnc_doAnimation;
};
if (_unit getVariable ["AGM_Captives_CargoIndex", -1] != -1) then {
_unit setVariable ["AGM_Captives_CargoIndex", -1, true];
};
if (_unit == AGM_player) then {
showHUD true;
};
};

View File

@ -1,50 +0,0 @@
// by commy2
private ["_unit", "_state"];
_unit = _this select 0;
_state = _this select 1;
if (!local _unit) exitWith {[_this, _fnc_scriptName, _unit] call AGM_Core_fnc_execRemoteFnc};
if (_state) then {
if (_unit getVariable ["AGM_isSurrender", false]) exitWith {};
_unit setVariable ["AGM_isSurrender", true, true];
[_unit, "AGM_Surrendered", true] call AGM_Core_fnc_setCaptivityStatus;
_unit spawn {
// fix for lowered rifle animation glitch
if (currentWeapon _this != "" && {currentWeapon _this == primaryWeapon _this} && {weaponLowered _this} && {stance _this == "STAND"}) then {
_this playMove "amovpercmstpsraswrfldnon";
};
while {_this getVariable ["AGM_isSurrender", false]} do {
sleep 0.001; //sleep in UI
if (isPlayer _this) then {showHUD false};
if (!alive _this || {_this getVariable ["AGM_isUnconscious", false]}) then {
_this setVariable ["AGM_isSurrender", false, true];
} else {
_this playMove "amovpercmstpsnonwnondnon_amovpercmstpssurwnondnon";
};
};
if !(_this getVariable ["AGM_isUnconscious", false]) then {
_this playMoveNow "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon";
} else {
_this playMoveNow "unconscious";
};
[_this, "AGM_Surrendered", false] call AGM_Core_fnc_setCaptivityStatus;
if (isPlayer _this) then {showHUD true};
};
} else {
_unit setVariable ["AGM_isSurrender", false, true];
};
/*
player playMove "AmovPercMstpSsurWnonDnon"
player switchMove "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon"
*/

View File

@ -1,31 +0,0 @@
/*
* Author: commy2
*
* Unit unloads a captive from a vehicle.
*
* Argument:
* 0: Unit that wants to unload a captive (Object)
* 1: Vehicle to unload a captive from. (Object)
*
* Return value:
* Nothing
*/
private ["_unit", "_vehicle", "_cargo", "_target"];
_unit = _this select 0;
_vehicle = _this select 1;
_cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turret positions. They shouldn't be there anyway.
_cargo = [_cargo, {_this getVariable ["AGM_isCaptive", false]}] call AGM_Core_fnc_filter;
if (count _cargo > 0) then {
_target = _cargo select 0;
_target setVariable ["AGM_Captives_CargoIndex", -1, true];
moveOut _target;
[_target, "AGM_AmovPercMstpScapWnonDnon", 2] call AGM_Core_fnc_doAnimation;
[_target, "{unassignVehicle _this}", _target] call AGM_Core_fnc_execRemoteFnc;
};

View File

@ -0,0 +1 @@
z\ace\addons\captives

View File

@ -0,0 +1,48 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_postInit));
};
};
//release escorted captive when entering a vehicle
class Extended_GetIn_EventHandlers {
class All {
class GVAR(AutoDetachCaptive) {
getIn = QUOTE(_this call FUNC(handleGetIn));
};
};
};
//reset captive animation after leaving vehicle
class Extended_GetOut_EventHandlers {
class All {
class GVAR(AutoDetachCaptive) {
getOut = QUOTE(_this call FUNC(handleGetOut));
};
};
};
//reset captivity and escorting status when getting killed
class Extended_Killed_EventHandlers {
class CAManBase {
class GVAR(AutoDetachCaptive) {
killed = QUOTE(_this call FUNC(handleKilled));
};
};
};
//mission start
class Extended_InitPost_EventHandlers {
class CAManBase {
class GVAR(InitPost) {
init = QUOTE(_this call FUNC(handleUnitInitPost));
};
};
};

View File

@ -0,0 +1,83 @@
class CfgMovesBasic {
class Actions {
class CivilStandActions;
class ACE_CivilStandHandcuffedActions: CivilStandActions {
turnL = "";
turnR = "";
stop = "ACE_AmovPercMstpScapWnonDnon";
StopRelaxed = "ACE_AmovPercMstpScapWnonDnon";
default = "ACE_AmovPercMstpScapWnonDnon";
PutDown = "";
getOver = "";
throwPrepare = "";
throwGrenade[] = {"","Gesture"};
};
class ACE_CivilStandSurrenderActions: ACE_CivilStandHandcuffedActions {
stop = "ACE_AmovPercMstpSsurWnonDnon";
StopRelaxed = "ACE_AmovPercMstpSsurWnonDnon";
default = "ACE_AmovPercMstpSsurWnonDnon";
PutDown = "";
};
};
};
class CfgMovesMaleSdr: CfgMovesBasic {
class StandBase;
class States {
class AmovPercMstpSnonWnonDnon: StandBase {
ConnectTo[] += {"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1,"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon",0.1};
};
class CutSceneAnimationBase;
//Handcuffed Anims:
class ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon: CutSceneAnimationBase {
actions = "ACE_CivilStandHandcuffedActions";
file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_EaseIn";
speed = 1;
looped = 0;
interpolationRestart = 2;
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;
ConnectTo[] = {"ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1};
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.333; //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};
};
};
};

View File

@ -0,0 +1,191 @@
class CfgVehicles {
class Man;
class CAManBase: Man {
class ACE_Actions {
class ACE_ApplyHandcuffs {
displayName = "$STR_ACE_Captives_SetCaptive";
distance = 4;
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canApplyHandcuffs));
statement = QUOTE([ARR_2(_player, _target)] call FUNC(doApplyHandcuffs));
exceptions[] = {};
showDisabled = 0;
priority = 2.4;
icon = QUOTE(PATHTOF(UI\handcuff_ca.paa));
hotkey = "C";
};
class ACE_RemoveHandcuffs {
displayName = "$STR_ACE_Captives_ReleaseCaptive";
distance = 4;
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canRemoveHandcuffs));
statement = QUOTE([ARR_2(_player, _target)] call FUNC(doRemoveHandcuffs));
exceptions[] = {};
showDisabled = 0;
priority = 2.4;
icon = QUOTE(PATHTOF(UI\handcuff_ca.paa));
hotkey = "R";
};
class ACE_EscortCaptive {
displayName = "$STR_ACE_Captives_EscortCaptive";
distance = 4;
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canEscortCaptive));
statement = QUOTE([ARR_3(_player, _target, true)] call FUNC(doEscortCaptive));
exceptions[] = {};
showDisabled = 0;
icon = QUOTE(PATHTOF(UI\captive_ca.paa));
priority = 2.3;
hotkey = "E";
};
class ACE_StopEscorting {
displayName = "$STR_ACE_Captives_StopEscorting";
distance = 4;
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canStopEscorting));
statement = QUOTE([ARR_3(_player,_target, false)] call FUNC(doEscortCaptive));
exceptions[] = {QGVAR(isNotEscorting)};
showDisabled = 0;
icon = QUOTE(PATHTOF(UI\captive_ca.paa));
priority = 2.3;
hotkey = "E";
};
class ACE_LoadCaptive {
displayName = "$STR_ACE_Captives_LoadCaptive";
distance = 4;
condition = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(canLoadCaptive));
statement = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(doLoadCaptive));
exceptions[] = {QGVAR(isNotEscorting)};
showDisabled = 0;
icon = QUOTE(PATHTOF(UI\captive_ca.paa));
priority = 2.2;
hotkey = "L";
};
class ACE_FriskPerson {
displayName = "$STR_ACE_Captives_FriskPerson";
distance = 2;
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canFriskPerson));
statement = QUOTE([ARR_2(_player, _target)] call FUNC(doFriskPerson));
showDisabled = 0;
//icon = ""; //@todo
priority = 3;
hotkey = "F";
};
};
class ACE_SelfActions {
class ACE_StopEscortingSelf {
displayName = "$STR_ACE_Captives_StopEscorting";
condition = QUOTE([ARR_2(_player, objNull)] call FUNC(canStopEscorting));
statement = QUOTE([ARR_3(_player,objNull, false)] call FUNC(doEscortCaptive));
exceptions[] = {QGVAR(isNotEscorting)};
showDisabled = 0;
priority = 2.3;
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;
};
};
};
#define MACRO_LOADUNLOADCAPTIVE \
class ACE_Actions { \
class ACE_LoadCaptive { \
displayName = "$STR_ACE_Captives_LoadCaptive"; \
distance = 4; \
condition = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(canLoadCaptive)); \
statement = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(doLoadCaptive)); \
exceptions[] = {QGVAR(isNotEscorting)}; \
showDisabled = 0; \
priority = 1.2; \
hotkey = "L"; \
}; \
class ACE_UnloadCaptive { \
displayName = "$STR_ACE_Captives_UnloadCaptive"; \
distance = 4; \
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canUnloadCaptive)); \
statement = QUOTE([ARR_2(_player, _target)] call FUNC(doUnloadCaptive)); \
showDisabled = 0; \
priority = 1.2; \
hotkey = "C"; \
}; \
};
class LandVehicle;
class Car: LandVehicle {
MACRO_LOADUNLOADCAPTIVE
};
class Tank: LandVehicle {
MACRO_LOADUNLOADCAPTIVE
};
class Air;
class Helicopter: Air {
MACRO_LOADUNLOADCAPTIVE
};
class Plane: Air {
MACRO_LOADUNLOADCAPTIVE
};
class Ship;
class Ship_F: Ship {
MACRO_LOADUNLOADCAPTIVE
};
class StaticWeapon: LandVehicle {
MACRO_LOADUNLOADCAPTIVE
};
class StaticMortar;
class Mortar_01_base_F: StaticMortar {
MACRO_LOADUNLOADCAPTIVE
};
#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \
name = #ITEM; \
count = COUNT; \
};
class Box_NATO_Support_F;
class ACE_Box_Misc: Box_NATO_Support_F {
class TransportItems {
MACRO_ADDITEM(ACE_CableTie,12)
};
};
class Logic;
class Module_F: Logic {
class ArgumentsBaseUnits {};
class ModuleDescription {};
};
class GVAR(ModuleSurrender): Module_F {
author = "$STR_ACE_Common_ACETeam";
category = "ACE";
displayName = "Make Unit Surrender";
function = QUOTE(DFUNC(moduleSurrender));
scope = 2; //show in editor
scopeCurator = 2; //show in zeus
curatorCost = 0; //???
isGlobal = 1; //run global
isTriggerActivated = 1; //Wait for triggers
// icon = QUOTE(PATHTOF(ui\todo.paa));
functionPriority = 0;
class Arguments {};
class ModuleDescription: ModuleDescription {
description = "Sync a unit to make them surrender.<br/>Source: ace_captives";
sync[] = {"AnyAI"};
};
};
};

View File

@ -0,0 +1,15 @@
class CfgWeapons {
class ACE_ItemCore;
class InventoryItem_Base_F;
class ACE_CableTie: ACE_ItemCore {
displayName = "$STR_ACE_Captives_CableTie";
descriptionShort = "$STR_ACE_Captives_CableTieDescription";
model = QUOTE(PATHTOF(models\ace_cabletie.p3d));
picture = QUOTE(PATHTOF(UI\ace_cabletie_ca.paa));
scope = 2;
class ItemInfo: InventoryItem_Base_F {
mass = 1;
};
};
};

14
addons/captives/README.md Normal file
View File

@ -0,0 +1,14 @@
ace_captives
============
Allows taking people captive/handcuffed
####Items:
`ACE_CableTie` - adds ability to take someone captive
## Maintainers
The people responsible for merging changes to this component or answering potential questions.
- [PabstMirror](https://github.com/PabstMirror)

View File

@ -0,0 +1,32 @@
#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
//This is normaly handled by the PFEH in doEscortCaptive, but that won't be running if they DC
if (isServer) then {
addMissionEventHandler ["HandleDisconnect", {
PARAMS_1(_disconnectedPlayer);
_escortedUnit = _disconnectedPlayer getVariable [QGVAR(escortedUnit), objNull];
if ((!isNull _escortedUnit) && {(attachedTo _escortedUnit) == _disconnectedPlayer}) then {
detach _escortedUnit;
systemChat "debug: DC detach";
};
if (_disconnectedPlayer getVariable [QGVAR(isEscorting), false]) then {
_disconnectedPlayer setVariable [QGVAR(isEscorting), false, true];
};
}];
};
//TODO: Medical Integration Events???
// [_unit, "knockedOut", {
// if (local (_this select 0)) then {_this call ACE_Captives_fnc_handleKnockedOut};
// }] call ACE_Core_fnc_addCustomEventhandler;
// [_unit, "wokeUp", {
// if (local (_this select 0)) then {_this call ACE_Captives_fnc_handleWokeUp};
// }] call ACE_Core_fnc_addCustomEventhandler;

View File

@ -0,0 +1,32 @@
#include "script_component.hpp"
ADDON = false;
PREP(canApplyHandcuffs);
PREP(canEscortCaptive);
PREP(canFriskPerson);
PREP(canLoadCaptive);
PREP(canRemoveHandcuffs);
PREP(canStopEscorting);
PREP(canSurrender);
PREP(canUnloadCaptive);
PREP(doApplyHandcuffs);
PREP(doEscortCaptive);
PREP(doFriskPerson);
PREP(doLoadCaptive);
PREP(doRemoveHandcuffs);
PREP(doUnloadCaptive);
PREP(handleGetIn);
PREP(handleGetOut);
PREP(handleKilled);
PREP(handleKnockedOut);
PREP(handlePlayerChanged);
PREP(handleUnitInitPost);
PREP(handleWokeUp);
PREP(moduleSurrender);
PREP(setHandcuffed);
PREP(surrender);
PREP(vehicleCaptiveMoveIn);
PREP(vehicleCaptiveMoveOut);
ADDON = true;

View File

@ -0,0 +1,31 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
units[] = {QGVAR(ModuleSurrender)};
weapons[] = {"ACE_CableTie"};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ACE_Interaction"};
author[] = {"commy2", "KoffeinFlummi"};
authorUrl = "https://github.com/commy2/";
VERSION_CONFIG;
};
};
#include "CfgEventHandlers.hpp"
#include "CfgMoves.hpp"
#include "CfgVehicles.hpp"
#include "CfgWeapons.hpp"
class ACE_canInteractConditions {
class GVAR(isNotEscorting) {
condition = QUOTE(!(GETVAR(player,QGVAR(isEscorting),false)));
};
class GVAR(isNotHandcuffed) {
condition = QUOTE(!(GETVAR(player,QGVAR(isHandcuffed),false)));
};
class GVAR(isNotSurrendering) {
condition = QUOTE(!(GETVAR(player,QGVAR(isSurrendering),false)));
};
};

View File

@ -0,0 +1,25 @@
/*
* Author: PabstMirror
* Checks the conditions for being able to apply handcuffs
*
* Arguments:
* 0: caller (player) <OBJECT>
* 1: target <OBJECT>
*
* Return Value:
* The return value <BOOL>
*
* Example:
* [player, bob] call ACE_captives_fnc_canApplyHandcuffs
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_unit,_target);
//Player has cableTie, target is alive and not already handcuffed
("ACE_CableTie" in (items _unit)) &&
{alive _target} &&
{!(_target getVariable [QGVAR(isHandcuffed), false])}

View File

@ -0,0 +1,26 @@
/*
* Author: PabstMirror
* Tests if can escort target (attach)
*
* Arguments:
* 0: caller (player) <OBJECT>
* 1: target <OBJECT>
*
* Return Value:
* The return value <BOOL>
*
* Example:
* [player, bob] call ACE_captives_fnc_canEscortCaptive
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_unit,_target);
//Alive, handcuffed, not being escored, and not unconscious
(_target getVariable [QGVAR(isHandcuffed), false]) &&
{isNull (attachedTo _target)} &&
{alive _target} &&
{!(_target getVariable ["ACE_isUnconscious", false])}

View File

@ -0,0 +1,24 @@
/*
* Author: bux578
* Checks the conditions for being able to frisk a unit
*
* Arguments:
* 0: caller (player) <OBJECT>
* 1: target <OBJECT>
*
* Return Value:
* The return value <BOOL>
*
* Example:
* [player, bob] call ACE_captives_fnc_canFriskPerson
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_unit,_target);
_target getVariable [QGVAR(isHandcuffed), false]
|| {_target getVariable [QGVAR(isSurrendering), false]}
|| {_target getVariable ["ACE_isSearchable", false]}
|| {_target getVariable ["ACE_isUnconscious", false]}

View File

@ -0,0 +1,39 @@
/*
* Author: commy2
* Check if the unit can load the target object into a vehicle.
*
* Arguments:
* 0: Unit that wants to load a captive <OBJECT>
* 1: A captive. ObjNull for the first escorted captive (may be null) <OBJECT>
* 2: Vehicle to load the captive into. ObjNull for the nearest vehicle (may be null) <OBJECT>
*
* Return Value:
* The return value <BOOL>
*
* Example:
* [player, bob] call ACE_captives_fnc_canLoadCaptive
*
* Public: No
*/
#include "script_component.hpp"
private ["_objects"];
PARAMS_3(_unit,_target,_vehicle);
if (isNull _target) then {
_objects = attachedObjects _unit;
_objects = [_objects, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter);
if ((count _objects) > 0) then {_target = _objects select 0;};
};
if (isNull _vehicle) then {
_objects = nearestObjects [_unit, ["Car", "Tank", "Helicopter", "Plane", "Ship_F"], 10];
if ((count _objects) > 0) then {_vehicle = _objects select 0;};
};
(!isNull _target)
&& {!isNull _vehicle}
&& {_unit getVariable [QGVAR(isEscorting), false]}
&& {_target getVariable [QGVAR(isHandcuffed), false]}
&& {_vehicle emptyPositions "cargo" > 0}

View File

@ -0,0 +1,23 @@
/*
* Author: PabstMirror
* Checks the conditions for being able to remove handcuffs
*
* Arguments:
* 0: caller (player) <OBJECT>
* 1: target <OBJECT>
*
* Return Value:
* The return value <BOOL>
*
* Example:
* [player, bob] call ACE_captives_fnc_canRemoveHandcuffs
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_unit,_target);
//Unit is handcuffed and not currently being escorted
_target getVariable [QGVAR(isHandcuffed), false] &&
{isNull (attachedTo _target)}

View File

@ -0,0 +1,40 @@
/*
* Author: PabstMirror
* Tests if player can stop escorting
*
* Arguments:
* 0: caller (player) <OBJECT>
* 1: target <OBJECT><OPTIONAL>
*
* Return Value:
* The return value <BOOL>
*
* Example:
* [player, bob] call ACE_captives_fnc_canStopEscorting
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_1(_unit);
DEFAULT_PARAM(1,_target,objNull);
private ["_isAttached"];
if (isNull _target) then {
_target = _unit getVariable [QGVAR(escortedUnit), objNull];
};
if (isNull _target) exitWith {
ERROR("Null Target (no ACE_escortedUnit)");
false
};
_isAttached = _target in (attachedObjects _unit);
if (_isAttached && (!(_target getVariable [QGVAR(isHandcuffed), false]))) exitWith {
ERROR("Attached But Not Captive");
false
};
_isAttached

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:
* [Jean, 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

@ -0,0 +1,28 @@
/*
* Author: commy2
* Check if the unit can unload a captive from the vehicle.
*
* Arguments:
* 0: Unit that wants to unload a captive <OBJECT>
* 1: A captive. ObjNull for the first escorted captive <OBJECT>
* 2: Vehicle to unload a captive from <OBJECT>
*
* Return Value:
* The return value <BOOL>
*
* Example:
* [player, bob, car1] call ACE_captives_fnc_canUnloadCaptive;
*
* Public: No
*/
#include "script_component.hpp"
private ["_cargo"];
PARAMS_2(_unit,_vehicle);
_cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turret positions. They shouldn't be there anyway.
_cargo = [_cargo, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter);
count _cargo > 0

View File

@ -0,0 +1,25 @@
/*
* Author: PabstMirror
* Checks the conditions for being able to apply handcuffs
*
* Arguments:
* 0: caller (player) <OBJECT>
* 1: target <OBJECT>
*
* Return Value:
* The return value <BOOL>
*
* Example:
* [player, bob] call ACE_captives_fnc_doApplyHandcuffs;
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_unit,_target);
_unit removeItem "ACE_CableTie";
playSound3D [QUOTE(PATHTO_R(sounds\cable_tie_zipping.ogg)), objNull, false, (getPosASL _target), 1, 1, 10];
["SetHandcuffed", [_target], [_target, true]] call EFUNC(common,targetEvent);

View File

@ -0,0 +1,59 @@
/*
* Author: Nic547
* Attaches a Captive to the _unit
*
* Arguments:
* 0: _unit-Player <OBJECT>
* 1: target <OBJECT>
* 2: _state <BOOL>
*
* Return Value:
* The return value <BOOL>
*
* Example:
* [player, bob, true] call ACE_captives_fnc_doEscorteCaptive;
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_3(_unit,_target,_state);
if (_state) then {
if (_unit getVariable [QGVAR(isEscorting), false]) exitWith {};
[_unit, _target] call EFUNC(common,claim);
_unit setVariable [QGVAR(isEscorting), true, true];
_target attachTo [_unit, [0, 1, 0]];
_unit setVariable [QGVAR(escortedUnit), _target, true];
//Add Actionmenu to release captive
_actionID = _unit addAction [format ["<t color='#FF0000'>%1</t>", localize "STR_ACE_Captives_StopEscorting"],
{[(_this select 0), ((_this select 0) getVariable [QGVAR(escortedUnit), objNull]), false] call FUNC(doEscortCaptive);},
nil, 20, false, true, "", QUOTE(!isNull (GETVAR(_target,QGVAR(escortedUnit),objNull)))];
private "_escortFnc";
_escortFnc = {
EXPLODE_3_PVT((_this select 0),_unit,_target,_actionID);
if (_unit getVariable [QGVAR(isEscorting), false]) then {
if (!alive _target || {!alive _unit} || {!canStand _target} || {!canStand _unit} || {_target getVariable ["ACE_isUnconscious", false]} || {_unit getVariable ["ACE_isUnconscious", false]} || {!isNull (attachedTo _unit)}) then {
_unit setVariable [QGVAR(isEscorting), false, true];
};
};
if (!(_unit getVariable [QGVAR(isEscorting), false])) then {
[(_this select 1)] call cba_fnc_removePerFrameHandler;
[objNull, _target] call EFUNC(common,claim);
detach _target;
_unit removeAction _actionID;
_unit setVariable [QGVAR(escortedUnit), objNull, true];
};
};
[_escortFnc, 0.2, [_unit, _target, _actionID]] call CBA_fnc_addPerFrameHandler;
} else {
_unit setVariable [QGVAR(isEscorting), false, true];
_unit setVariable [QGVAR(escortedUnit), objNull, true];
};

View File

@ -0,0 +1,70 @@
/*
* Author: bux578
* Open the select menu with the "personal" items of a frisked unit. It only shows "handgunWeapon", "uniformItems", "vestItems", "backpackItems" and "assignedItems" because every other item is visible on the character
*
* Arguments:
* 0: player unit <OBJECT>
* 1: unit <OBJECT>
*
* Return Value:
* Nothing
*
* Example:
* [player, bob] call ACE_captives_fnc_doFristPerson;
*
* Public: No
*/
#include "script_component.hpp"
private ["_weapon", "_listedItemClasses", "_actions", "_allGear"];
PARAMS_2(_player,_unit);
_weapon = currentWeapon _player;
if (_weapon == primaryWeapon _player && {_weapon != ""}) then {
[_player, "AmovPercMstpSlowWrflDnon", 0] call EFUNC(common,doAnimation);
};
_listedItemClasses = [];
_actions = [localize "STR_ACE_Captives_FriskMenuHeader", localize "STR_ACE_Captives_CancelSelection"] call ACE_Interaction_fnc_prepareSelectMenu;
_allGear = [];
if ((handgunWeapon _unit) != "") then {
_allGear pushBack (handgunWeapon _unit);
};
if (count (uniformItems _unit) > 0) then {
_allGear = _allGear + (uniformItems _unit);
};
if (count (vestItems _unit) > 0) then {
_allGear = _allGear + (vestItems _unit);
};
if (count (backpackItems _unit) > 0) then {
_allGear = _allGear + (backpackItems _unit);
};
if (count (assignedItems _unit) > 0) then {
_allGear = _allGear + (assignedItems _unit);
};
// Handgun
// Uniform Items
// Vest Items
// Backpack Items
// Assigned Items
{
if (!(_x in _listedItemClasses)) then {
private "_item";
_item = configFile >> "CfgMagazines" >> _x;
if (isNil "_item" || str _item == "") then { //str _item ?
_item = configFile >> "CfgWeapons" >> _x;
};
_actions = [_actions, getText(_item >> "displayName"), getText(_item >> "picture"), _x] call ACE_Interaction_fnc_addSelectableItem;
_listedItemClasses pushBack _x;
};
} forEach (_allGear);
[_actions, {call ACE_Interaction_fnc_hideMenu;}, {call ACE_Interaction_fnc_hideMenu;}] call ACE_Interaction_fnc_openSelectMenu;
// don't need an "Ok" Button
ctrlShow [8860, false];

View File

@ -0,0 +1,38 @@
/*
* Author: commy2
* Unit loads the target object into a vehicle.
*
* Arguments:
* 0: Unit that wants to load a captive <OBJECT>
* 1: A captive. ObjNull for the first escorted captive <OBJECT>
* 2: Vehicle to load the captive into. ObjNull for the nearest vehicle <OBJECT>
*
* Return Value:
* Nothing
*
* Example:
* [bob, tom, car] call ACE_captives_fnc_doLoadCaptive
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_3(_unit,_target,_vehicle);
if (isNull _target) then {
_objects = attachedObjects _unit;
_objects = [_objects, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter);
if ((count _objects) > 0) then {_target = _objects select 0;};
};
if (isNull _target) exitWith {};
if (isNull _vehicle) then {
_objects = nearestObjects [_unit, ["Car_F", "Tank_F", "Helicopter_F", "Boat_F", "Plane_F"], 10];
if ((count _objects) > 0) then {_vehicle = _objects select 0;};
};
if (isNull _vehicle) exitWith {};
if ((!isNil "_target") && {!isNil "_vehicle"}) then {
_unit setVariable [QGVAR(isEscorting), false, true];
["MoveInCaptive", [_target], [_target, _vehicle]] call EFUNC(common,targetEvent);
};

View File

@ -0,0 +1,20 @@
/*
* Author: PabstMirror
* Remove handcuffs from a target
*
* Arguments:
* 0: target <OBJECT>
*
* Return Value:
* The return value <BOOL>
*
* Example:
* [bob, false] call ACE_captives_fnc_doRemoveHandcuffs
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_unit,_target);
["SetHandcuffed", [_target], [_target, false]] call EFUNC(common,targetEvent);

View File

@ -0,0 +1,32 @@
/*
* Author: commy2
* Unit unloads a captive from a vehicle.
*
* Arguments:
* 0: Unit that wants to unload a captive <OBJECT>
* 1: Vehicle to unload a captive from. <BOOL>
*
* Return Value:
* Nothing
*
* Example:
* [bob, car] call ACE_captives_fnc_doUnloadCaptive
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_unit,_vehicle);
private ["_cargo", "_target"];
_cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turret positions. They shouldn't be there anyway.
_cargo = [_cargo, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter);
if ((count _cargo) > 0) then {
_target = _cargo select 0;
["MoveOutCaptive", [_target], [_target]] call EFUNC(common,targetEvent);
} else {
ERROR("No captive to unload");
};

View File

@ -0,0 +1,24 @@
/*
* Author: commy2
* Handles when a unit gets in to a vehicle. Release escorted captive when entering a vehicle
*
* Arguments:
* 0: _vehicle <OBJECT>
* 2: dunno <OBJECT>
* 1: _unit <OBJECT>
*
* Return Value:
* The return value <BOOL>
*
* Example:
* [car2, x, player] call ACE_captives_fnc_handleGetIn
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_3(_vehicle,_dontcare,_unit);
if ((local _unit) && (_unit getVariable [QGVAR(isEscorting), false])) then {
_unit setVariable [QGVAR(isEscorting), false, true];
};

View File

@ -0,0 +1,33 @@
/*
* Author: commy2
* Handles when a captive unit gets out of a vehicle.
*
* Arguments:
* 0: _vehicle <OBJECT>
* 2: dunno <OBJECT>
* 1: _unit <OBJECT>
*
* Return Value:
* The return value <BOOL>
*
* Example:
* [car2, x, player] call ACE_captives_fnc_handleGetOut
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_3(_vehicle,_dontcare,_unit);
if ((local _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]}) then {
private ["_cargoIndex"];
_cargoIndex = _unit getVariable [QGVAR(CargoIndex), -1];
//If captive was not "unloaded", then move them back into the vehicle.
if (_cargoIndex != -1) exitWith {
_unit moveInCargo [_vehicle, _cargoIndex];
};
[_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation);
};

View File

@ -0,0 +1,30 @@
/*
* Author: PabstMirror
* Handles when a unit is kill. Reset captivity and escorting status
*
* Arguments:
* 0: _oldUnit <OBJECT>
*
* Return Value:
* None
*
* Example:
* [bob1] call ACE_captives_fnc_handleKilled
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_1(_oldUnit);
if (_oldUnit getVariable [QGVAR(isHandcuffed), false]) then {
_oldUnit setVariable [QGVAR(isHandcuffed), false, true];
};
if (_oldUnit getVariable [QGVAR(isEscorting), false]) then {
_oldUnit setVariable [QGVAR(isEscorting), false, true];
};
if (_oldUnit getVariable [QGVAR(isSurrendering), false]) then {
_oldUnit setVariable [QGVAR(isSurrendering), false, true];
};

View File

@ -0,0 +1,27 @@
/*
* Author: commy2
* Handles playerChanged. Resets "showHUD" based on handcuff status
*
* Arguments:
* 0: _newUnit <OBJECT>
* 1: _oldUnit <OBJECT>
*
* Return Value:
* The return value <BOOL>
*
* Example:
* [bob1, bob2] call ACE_captives_fnc_handlePlayerChange
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_newUnit,_oldUnit);
if ((_newUnit getVariable [QGVAR(isHandcuffed), false]) || {_newUnit getVariable [QGVAR(isSurrendering), false]}) then {
TRACE_1("Player Change (showHUD false)",_newUnit);
showHUD false;
} else {
TRACE_1("Player Change (showHUD true)",_newUnit);
showHUD true;
};

View File

@ -0,0 +1,34 @@
/*
* Author: commy2
* handle captive and unconsciousness state and prevent grenades
*
* Arguments:
* 0: _unit <OBJECT>
*
* Return Value:
* The return value <BOOL>
*
* Example:
* [bob] call ACE_captives_fnc_handleUnitInitPost
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_1(_unit);
// prevent players from throwing grenades (added to all units)
[_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
if (_unit getVariable [QGVAR(isHandcuffed), false]) 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);
};
};

View File

@ -0,0 +1,23 @@
/*
* Author: commy2
* TODO
*
* Arguments:
* 0: _unit <OBJECT>
*
* Return Value:
* The return value <BOOL>
*
* Example:
* [bob] call ACE_captives_fnc_handleWokeUp
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_1(_unit);
if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then {
[_unit] call EFUNC(common,fixLoweredRifleAnimation);
[_unit, "ACE_AmovPercMstpScapWnonDnon", 0] call EFUNC(common,doAnimation);
};

View File

@ -0,0 +1,46 @@
/*
* Author: PabstMirror
* Module Function to make a unit surrender (can be called from editor, or placed with zeus)
*
* Arguments:
* 0: The Module Logic Object <OBJECT>
* 1: synced objects <ARRAY>
* 2: Activated <BOOL>
*
* Return Value:
* Nothing
*
* Example:
* Called from module
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_3(_logic,_units,_activated);
if (!_activated) exitWith {};
if (local _logic) then {
if ((!isnull curatorcamera) && {((count curatorMouseOver) == 2) && {(curatorMouseOver select 1) == _logic}}) then {//in zeus interface and we placed the module
_bisMouseOver = missionNamespace getVariable ["bis_fnc_curatorObjectPlaced_mouseOver", []];//bis caches the previous curatorMouseOver
if ((count _bisMouseOver) == 2) then {//check what mouse was over before the module was placed
_mouseOverObject = _bisMouseOver select 1;
if ((_mouseOverObject isKindOf "CAManBase") && {(vehicle _mouseOverObject) == _mouseOverObject}) then {
systemChat format ["Debug - module surrendering %1", (name _mouseOverObject)];
[_mouseOverObject, true] call FUNC(surrender);
} else {
systemChat format ["Only use on dismounted inf"];
};
} else {
systemChat format ["Nothing under mouse"];
};
} else {//an editor module
{
systemChat format ["Debug - module surrendering %1", (name _x)];
[_x, true] call FUNC(surrender);
} forEach _units;
};
deleteVehicle _logic;
};

View File

@ -0,0 +1,63 @@
/*
* Author: Nic547, commy2
* Handcuffs a unit.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: True to take captive, false to release captive <BOOL>
*
* Return Value:
* Nothing
*
* Example:
* [bob, true] call ACE_captives_fnc_setHandcuffed;
*
* 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(setHandcuffed)), _unit] call EFUNC(common,execRemoteFnc);
TRACE_2("running setHandcuffed on remote unit",_unit,_state);
};
if (_state isEqualTo (_unit getVariable [QGVAR(isHandcuffed), false])) then {
LOG("setHandcuffed: current state same as new");
};
if (_state) then {
_unit setVariable [QGVAR(isHandcuffed), true, true];
[_unit, QGVAR(Handcuffed), true] call EFUNC(common,setCaptivityStatus);
_unit setVariable [QGVAR(CargoIndex), ((vehicle _unit) getCargoIndex _unit), true];
if (_unit == ACE_player) then {
showHUD false;
};
// fix anim on mission start (should work on dedicated servers)
[{
PARAMS_1(_unit);
if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then {
[_unit] call EFUNC(common,fixLoweredRifleAnimation);
[_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation);
};
}, [_unit], 0.01, 0] call EFUNC(common,waitAndExecute);
} else {
_unit setVariable [QGVAR(isHandcuffed), false, true];
[_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus);
if ((vehicle _unit) == _unit) then {
//Break out of hands up animation loop (doAnimation handles Unconscious prioity)
[_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);
};
if (_unit getVariable [QGVAR(CargoIndex), -1] != -1) then {
_unit setVariable [QGVAR(CargoIndex), -1, true];
};
if (_unit == ACE_player) then {
showHUD true;
};
};

View File

@ -0,0 +1,76 @@
/*
* 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;
};
};
};

View File

@ -0,0 +1,26 @@
/*
* Author: PabstMirror
* Loads a captive into a vehicle
*
* Arguments:
* 0: The Captive <OBJECT>
* 1: The Vehicle <OBJECT>
*
* Return Value:
* Nothing
*
* Example:
* [bob, car1] call ACE_captives_fnc_vehicleCaptiveMoveIn;
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_target,_vehicle);
private ["_cargoIndex"];
_target moveInCargo _vehicle;
_target assignAsCargo _vehicle;
_cargoIndex = _vehicle getCargoIndex _target;
_target setVariable [QGVAR(CargoIndex), _cargoIndex, true];

View File

@ -0,0 +1,24 @@
/*
* Author: PabstMirror
* Unloads a captive from a vehicle.
*
* Arguments:
* 0: Captive Unit being unloaded <OBJECT>
*
* Return Value:
* Nothing
*
* Example:
* [bob] call ACE_captives_fnc_vehicleCaptiveMoveOut;
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_1(_unit);
_unit setVariable [QGVAR(CargoIndex), -1, true];
moveOut _unit;
[_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation);
unassignVehicle _unit;

View File

@ -0,0 +1 @@
#include "\z\ace\addons\captives\script_component.hpp"

Binary file not shown.

View File

@ -0,0 +1,79 @@
ambient[]={1,1,1,1};
diffuse[]={1,1,1,1};
forcedDiffuse[]={0,0,0,0};
emmisive[]={0,0,0,1};
specular[]={0.01,0.01,0.01,1}; //amount of glossiness - the higher the number, the higher the glossiness
specularPower=500; //area of glossiness - the higher the number, the smaller the area
PixelShaderID="Super";
VertexShaderID="Super";
class Stage1 {
texture="#(rgb,1,1,1)color(0.5,0.5,1,1)";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage2 {
texture="#(argb,8,8,3)color(0.5,0.5,0.5,1,dt)";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage3 {
texture="#(argb,8,8,3)color(0,0,0,0,mc)";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage4 {
texture="#(argb,8,8,3)color(1,1,1,1,as)";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,1};
pos[]={0,0,1};
};
};
class Stage5 {
texture="#(rgb,1,1,1)color(0.2,0.2,1,1)";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,0};
pos[]={0,0,0};
};
};
class Stage6 {
texture="#(ai,64,64,1)fresnel(4.7,1.2)";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,1};
pos[]={0,0,0};
};
};
class Stage7 {
texture="a3\data_f\env_land_ca.paa";
uvSource="tex";
class uvTransform {
aside[]={1,0,0};
up[]={0,1,0};
dir[]={0,0,1};
pos[]={0,0,0};
};
};

View File

@ -0,0 +1,12 @@
#define COMPONENT captives
#include "\z\ace\addons\main\script_mod.hpp"
#ifdef DEBUG_ENABLED_CAPTIVES
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_CAPTIVES
#define DEBUG_SETTINGS DEBUG_SETTINGS_CAPTIVES
#endif
#include "\z\ace\addons\main\script_macros.hpp"

Binary file not shown.

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Edited with tabler - 2014-12-16 -->
<Project name="AGM">
<!-- Edited with tabler - 2015-02-06 -->
<Project name="ACE">
<Package name="Captives">
<Key ID="STR_AGM_Captives_SetCaptive">
<Key ID="STR_ACE_Captives_SetCaptive">
<English>Take Prisoner</English>
<German>Gefangen nehmen</German>
<Spanish>Tomar prisionero</Spanish>
@ -14,7 +14,7 @@
<Hungarian>Foglyul ejtés</Hungarian>
<Russian>Взять в плен</Russian>
</Key>
<Key ID="STR_AGM_Captives_ReleaseCaptive">
<Key ID="STR_ACE_Captives_ReleaseCaptive">
<English>Free Prisoner</English>
<German>Gefangenen freilassen</German>
<Spanish>Liberar prisionero</Spanish>
@ -26,7 +26,7 @@
<Hungarian>Fogoly szabadon elengedése</Hungarian>
<Russian>Освободить пленника</Russian>
</Key>
<Key ID="STR_AGM_Captives_EscortCaptive">
<Key ID="STR_ACE_Captives_EscortCaptive">
<English>Escort Prisoner</English>
<German>Gefangenen eskortieren</German>
<Spanish>Escoltar prisionero</Spanish>
@ -38,7 +38,7 @@
<Hungarian>Fogoly kísérése</Hungarian>
<Russian>Конвоировать пленника</Russian>
</Key>
<Key ID="STR_AGM_Captives_StopEscorting">
<Key ID="STR_ACE_Captives_StopEscorting">
<English>Release Prisoner</English>
<German>Gefangenen loslassen</German>
<Spanish>Soltar prisionero</Spanish>
@ -50,7 +50,7 @@
<Hungarian>Fogoly elengedése</Hungarian>
<Russian>Прекратить конвоирование</Russian>
</Key>
<Key ID="STR_AGM_Captives_NoCaptive">
<Key ID="STR_ACE_Captives_NoCaptive">
<English>You need to take him as prisoner first!</English>
<German>Du must ihn zuerst gefangen nehmen.</German>
<Spanish>Necesitas hacerle prisionero primero!</Spanish>
@ -62,7 +62,7 @@
<Hungarian>Először foglyul kell ejtened!</Hungarian>
<Russian>Вы должны сначала взять его в плен!</Russian>
</Key>
<Key ID="STR_AGM_Captives_LoadCaptive">
<Key ID="STR_ACE_Captives_LoadCaptive">
<English>Load Captive</English>
<German>Gefangenen einladen</German>
<Spanish>Cargar prisionero</Spanish>
@ -71,8 +71,9 @@
<Czech>Naložit zajatce</Czech>
<Hungarian>Fogoly berakása</Hungarian>
<Russian>Загрузить пленного</Russian>
<Portuguese>Embarcar Prisioneiro</Portuguese>
</Key>
<Key ID="STR_AGM_Captives_UnloadCaptive">
<Key ID="STR_ACE_Captives_UnloadCaptive">
<English>Unload Captive</English>
<German>Gefangenen ausladen</German>
<Spanish>Descargar prisionero</Spanish>
@ -81,8 +82,9 @@
<Czech>Vyložit zajatce</Czech>
<Hungarian>Fogoly kivevése</Hungarian>
<Russian>Выгрузить пленного</Russian>
<Portuguese>Desembarcar Prisioneiro</Portuguese>
</Key>
<Key ID="STR_AGM_Captives_CableTie">
<Key ID="STR_ACE_Captives_CableTie">
<English>Cable Tie</English>
<German>Kabelbinder</German>
<Polish>Opaska zaciskowa</Polish>
@ -94,7 +96,7 @@
<Hungarian>Gyorskötöző</Hungarian>
<Russian>Кабельная стяжка</Russian>
</Key>
<Key ID="STR_AGM_Captives_CableTieDescription">
<Key ID="STR_ACE_Captives_CableTieDescription">
<English>Cable ties that allow you to restrain prisoners.</English>
<German>Kabelbinder ermöglichen es, Gefangene zu fesseln.</German>
<Polish>Opaska zaciskowa pozwala na skrępowanie dłoni u więźnia.</Polish>
@ -106,7 +108,7 @@
<Hungarian>Gyorskötöző emberek fogjulejtéséhez.</Hungarian>
<Russian>Кабельные стяжки позволяют связывать пленников.</Russian>
</Key>
<Key ID="STR_AGM_Captives_FriskMenuHeader">
<Key ID="STR_ACE_Captives_FriskMenuHeader">
<English>Inventory of frisked person</English>
<German>Inventar der durchsuchten Person</German>
<French>Inventaire de la fouille</French>
@ -115,8 +117,9 @@
<Czech>Inventář prohledávané osoby</Czech>
<Polish>Ekwipunek rewidowanej osoby</Polish>
<Russian>Инвентарь обысканных лиц</Russian>
<Portuguese>Inventário da pessoa revistada</Portuguese>
</Key>
<Key ID="STR_AGM_Captives_FriskPerson">
<Key ID="STR_ACE_Captives_FriskPerson">
<English>Frisk person</English>
<German>Person durchsuchen</German>
<French>Fouiller</French>
@ -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>

View File

@ -20,7 +20,7 @@ GVAR(isOpeningDoor) = false;
localize "STR_ACE_Interaction_InteractionMenu",
{
// Conditions: canInteract
_exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", "ACE_Interaction_isNotEscorting", "ACE_Interaction_isNotSwimming"];
_exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", QEGVAR(captives,isNotEscorting), "ACE_Interaction_isNotSwimming"];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
// Conditions: specific
if !(isNull (findDisplay 1713999)) exitWith {false};
@ -38,7 +38,7 @@ GVAR(isOpeningDoor) = false;
localize "STR_ACE_Interaction_InteractionMenu",
{
// Conditions: canInteract
_exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", "ACE_Interaction_isNotEscorting", "ACE_Interaction_isNotSwimming"];
_exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", QEGVAR(captives,isNotEscorting), "ACE_Interaction_isNotSwimming"];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
// Conditions: specific
if !(!isNull (findDisplay 1713999) && {QGVAR(AutoCloseMenu)}) exitWith {false};
@ -56,7 +56,7 @@ GVAR(isOpeningDoor) = false;
localize "STR_ACE_Interaction_InteractionMenuSelf",
{
// Conditions: canInteract
_exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", "ACE_Interaction_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", "ACE_Interaction_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) && {QGVAR(AutoCloseMenu)}) exitWith {false};

View File

@ -44,15 +44,6 @@ class ACE_Settings {
};
class ACE_canInteractConditions {
class GVAR(isNotEscorting) {
condition = QUOTE( !(ACE_player getVariable [ARR_2('ACE_isEscorting', false)]) );
};
class GVAR(isNotCaptive) {
condition = QUOTE( !(ACE_player getVariable [ARR_2('ACE_isCaptive', false)]) );
};
class GVAR(isNotSurrendering) {
condition = QUOTE( !(ACE_player getVariable [ARR_2('ACE_isSurrender', false)]) );
};
class GVAR(isNotSwimming) {
condition = QUOTE( !underwater ACE_player );
};