Implemented capture module

This commit is contained in:
SilentSpike 2015-05-18 13:28:13 +01:00
parent 6251248a09
commit 44ca13fe3a
5 changed files with 65 additions and 5 deletions

View File

@ -81,9 +81,18 @@ class CfgVehicles {
category = "ACE_zeus";
scopeCurator = 2;
};
class GVAR(moduleCapture): GVAR(moduleBase) {
curatorCanAttach = 1;
displayName = "Capture/Release";
function = QFUNC(moduleCapture);
class ModuleDescription {
description = "Flips the capture state of the specified unit.";
sync[] = {};
};
};
class GVAR(moduleKnockout): GVAR(moduleBase) {
curatorCanAttach = 1;
displayName = "Knockout/Wakeup Unit";
displayName = "Knockout/Wakeup";
function = QFUNC(moduleKnockout);
class ModuleDescription {
description = "Flips the unconscious state of the specified unit.";
@ -92,7 +101,7 @@ class CfgVehicles {
};
class GVAR(moduleSurrender): GVAR(moduleBase) {
curatorCanAttach = 1;
displayName = "Force Surrender";
displayName = "Surrender/Fight";
function = QFUNC(moduleSurrender);
class ModuleDescription {
description = "Flips the surrender state of the specified unit.";

View File

@ -6,6 +6,7 @@ PREP(bi_moduleCurator);
PREP(bi_moduleMine);
PREP(bi_moduleProjectile);
PREP(bi_moduleRemoteControl);
PREP(moduleCapture);
PREP(moduleKnockout);
PREP(moduleSurrender);
PREP(moduleZeusSettings);

View File

@ -3,6 +3,7 @@
class CfgPatches {
class ADDON {
units[] = {
QGVAR(moduleCapture),
QGVAR(moduleKnockout),
QGVAR(moduleSurrender)
};

View File

@ -0,0 +1,45 @@
/*
* Author: SilentSpike
* Flips the capture state of the unit the module is attached to.
*
* Arguments:
* 0: The module logic <LOGIC>
* 1: units <ARRAY>
* 2: activated <BOOL>
*
* ReturnValue:
* nil
*
* Public: no
*/
#include "script_component.hpp"
PARAMS_3(_logic,_units,_activated);
private ["_unit","_captive"];
if (!_activated) exitWith {};
if (isNil QEFUNC(captives,setHandcuffed)) then {
["Requires ACE_Captives"] call DEFUNC(common,displayTextStructured);
} else {
_unit = attachedTo _logic;
if (isNull _unit) then {
["Place on a unit"] call DEFUNC(common,displayTextStructured);
} else {
if !(_unit isKindOf "CAManBase") then {
["Unit must be infantry"] call DEFUNC(common,displayTextStructured);
} else {
if !(alive _unit) then {
["Unit must be alive"] call DEFUNC(common,displayTextStructured);
} else {
_captive = GETVAR(_unit,EGVAR(captives,isHandcuffed),false);
// Event initalized by ACE_Captives
["SetHandcuffed", _unit, [_unit, !_captive]] call DEFUNC(common,targetEvent);
};
};
};
};
deleteVehicle _logic;

View File

@ -34,9 +34,13 @@ if (isNil QEFUNC(captives,setSurrendered)) then {
if !(alive _unit) then {
["Unit must be alive"] call DEFUNC(common,displayTextStructured);
} else {
_surrendering = GETVAR(_unit,EGVAR(captives,isSurrendering),false);
// Event initalized by ACE_Captives
["SetSurrendered", _unit, [_unit, !_surrendering]] call DEFUNC(common,targetEvent);
if (GETVAR(_unit,EGVAR(captives,isHandcuffed),false)) then {
["Unit is a captive"] call DEFUNC(common,displayTextStructured);
} else {
_surrendering = GETVAR(_unit,EGVAR(captives,isSurrendering),false);
// Event initalized by ACE_Captives
["SetSurrendered", _unit, [_unit, !_surrendering]] call DEFUNC(common,targetEvent);
};
};
};
};