mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
More Refactoring
This commit is contained in:
parent
435b3b8b86
commit
122a38a6aa
@ -2,21 +2,21 @@ class CfgVehicles {
|
||||
class Man;
|
||||
class CAManBase: Man {
|
||||
class ACE_Actions {
|
||||
class ACE_SetCaptive {
|
||||
class ACE_ApplyHandcuffs {
|
||||
displayName = "$STR_ACE_Captives_SetCaptive";
|
||||
distance = 4;
|
||||
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canTakeCaptive));
|
||||
statement = QUOTE([ARR_2(_player, _target)] call FUNC(doTakeCaptive));
|
||||
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canApplyHandcuffs));
|
||||
statement = QUOTE([ARR_2(_player, _target)] call FUNC(doApplyHandcuffs));
|
||||
showDisabled = 0;
|
||||
priority = 2.4;
|
||||
icon = QUOTE(PATHTOF(UI\handcuff_ca.paa));
|
||||
hotkey = "C";
|
||||
};
|
||||
class ACE_ReleaseCaptive {
|
||||
class ACE_RemoveHandcuffs {
|
||||
displayName = "$STR_ACE_Captives_ReleaseCaptive";
|
||||
distance = 4;
|
||||
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canReleaseCaptive));
|
||||
statement = QUOTE([ARR_2(_player, _target)] call FUNC(doReleaseCaptive));
|
||||
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canRemoveHandcuffs));
|
||||
statement = QUOTE([ARR_2(_player, _target)] call FUNC(doRemoveHandcuffs));
|
||||
exceptions[] = {"ACE_Interaction_isNotEscorting"};
|
||||
showDisabled = 0;
|
||||
priority = 2.4;
|
||||
@ -27,7 +27,7 @@ class CfgVehicles {
|
||||
displayName = "$STR_ACE_Captives_EscortCaptive";
|
||||
distance = 4;
|
||||
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canEscortCaptive));
|
||||
statement = QUOTE([ARR_2(_target, true)] call FUNC(doEscortCaptive));
|
||||
statement = QUOTE([ARR_3(_target, _target, true)] call FUNC(doEscortCaptive));
|
||||
exceptions[] = {"ACE_Interaction_isNotEscorting"};
|
||||
showDisabled = 0;
|
||||
icon = QUOTE(PATHTOF(UI\captive_ca.paa));
|
||||
|
@ -1,12 +1,9 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
[missionNamespace, "playerChanged", {_this call ACE_Captives_fnc_handlePlayerChanged}] call ACE_Core_fnc_addCustomEventhandler;
|
||||
|
||||
|
||||
|
||||
["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);
|
||||
["SetCaptive", {_this call FUNC(vehicleCaptiveMoveOut)}] call EFUNC(common,addEventHandler);
|
||||
["SetHandcuffed", {_this call FUNC(setHandcuffed)}] call EFUNC(common,addEventHandler);
|
||||
|
||||
//TODO: Medical Integration Events???
|
||||
|
||||
|
@ -2,18 +2,18 @@
|
||||
|
||||
ADDON = false;
|
||||
|
||||
PREP(canApplyHandcuffs);
|
||||
PREP(canEscortCaptive);
|
||||
PREP(canFriskPerson);
|
||||
PREP(canLoadCaptive);
|
||||
PREP(canReleaseCaptive);
|
||||
PREP(canRemoveHandcuffs);
|
||||
PREP(canStopEscorting);
|
||||
PREP(canTakeCaptive);
|
||||
PREP(canUnloadCaptive);
|
||||
PREP(doApplyHandcuffs);
|
||||
PREP(doEscortCaptive);
|
||||
PREP(doFriskPerson);
|
||||
PREP(doLoadCaptive);
|
||||
PREP(doReleaseCaptive);
|
||||
PREP(doTakeCaptive);
|
||||
PREP(doRemoveHandcuffs);
|
||||
PREP(doUnloadCaptive);
|
||||
PREP(handleGetIn);
|
||||
PREP(handleGetOut);
|
||||
@ -22,7 +22,7 @@ PREP(handleKnockedOut);
|
||||
PREP(handlePlayerChanged);
|
||||
PREP(handleUnitInitPost);
|
||||
PREP(handleWokeUp);
|
||||
PREP(setCaptive);
|
||||
PREP(setHandcuffed);
|
||||
PREP(surrender);
|
||||
PREP(vehicleCaptiveMoveIn);
|
||||
PREP(vehicleCaptiveMoveOut);
|
||||
|
@ -17,15 +17,13 @@ class CfgPatches {
|
||||
#include "CfgVehicles.hpp"
|
||||
#include "CfgWeapons.hpp"
|
||||
|
||||
#define GVARFIX(var1) getVariable [ARR_2(QUOTE(GVAR(var1)), false)]
|
||||
|
||||
|
||||
class ACE_canInteractConditions {
|
||||
class GVAR(isNotEscorting) {
|
||||
condition = QUOTE(!(GETVAR(player,QGVAR(isEscorting),false)));
|
||||
};
|
||||
class GVAR(isNotCaptive) {
|
||||
condition = QUOTE(!(GETVAR(player,QGVAR(isCaptive),false)));
|
||||
class GVAR(isNotHandcuffed) {
|
||||
condition = QUOTE(!(GETVAR(player,QGVAR(isHandcuffed),false)));
|
||||
};
|
||||
class GVAR(isNotSurrendering) {
|
||||
condition = QUOTE(!(GETVAR(player,QGVAR(isSurrender),false)));
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Checks the conditions for being able to take a unit captive
|
||||
* Checks the conditions for being able to apply handcuffs
|
||||
*
|
||||
* Arguments:
|
||||
* 0: caller (player) <OBJECT>
|
||||
@ -18,6 +18,8 @@
|
||||
|
||||
PARAMS_2(_unit,_target);
|
||||
|
||||
//Player has cableTie, target is alive and not already handcuffed
|
||||
|
||||
("ACE_CableTie" in (items _unit)) &&
|
||||
{alive _target} &&
|
||||
{!(_target getVariable [QGVAR(isCaptive), false])}
|
||||
{!(_target getVariable [QGVAR(isHandcuffed), false])}
|
@ -18,7 +18,7 @@
|
||||
|
||||
PARAMS_2(_unit,_target);
|
||||
|
||||
(_target getVariable [QGVAR(isCaptive), false]) &&
|
||||
(_target getVariable [QGVAR(isHandcuffed), false]) &&
|
||||
{isNull (attachedTo _target)} &&
|
||||
{alive _target} &&
|
||||
{!(_target getVariable [QGVAR(ACE_isUnconscious), false])}
|
||||
|
@ -18,6 +18,6 @@
|
||||
|
||||
PARAMS_2(_unit,_target);
|
||||
|
||||
_target getVariable [QGVAR(isCaptive), false]
|
||||
_target getVariable [QGVAR(isHandcuffed), false]
|
||||
|| {_target getVariable ["ACE_isSearchable", false]}
|
||||
|| {_target getVariable ["ACE_isUnconscious", false]}
|
||||
|
@ -23,7 +23,7 @@ PARAMS_3(_unit,_target,_vehicle);
|
||||
|
||||
if (isNull _target) then {
|
||||
_objects = attachedObjects _unit;
|
||||
_objects = [_objects, {_this getVariable [QGVAR(isCaptive), false]}] call EFUNC(common,filter);
|
||||
_objects = [_objects, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter);
|
||||
_target = _objects select 0;
|
||||
};
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Checks the conditions for being able to release a captive
|
||||
* Checks the conditions for being able to remove handcuffs
|
||||
*
|
||||
* Arguments:
|
||||
* 0: caller (player) <OBJECT>
|
||||
@ -18,6 +18,6 @@
|
||||
|
||||
PARAMS_2(_unit,_target);
|
||||
|
||||
//Unit is captive and not being escorted
|
||||
_target getVariable [QGVAR(isCaptive), false] &&
|
||||
//Unit is handcuffed and not currently being escorted
|
||||
_target getVariable [QGVAR(isHandcuffed), false] &&
|
||||
{isNull (attachedTo _target)}
|
@ -33,7 +33,7 @@ if (isNull _target) exitWith {
|
||||
|
||||
_isAttached = _target in (attachedObjects _unit);
|
||||
|
||||
if (_isAttached && (!(_target getVariable [QGVAR(isCaptive), false]))) exitWith {
|
||||
if (_isAttached && (!(_target getVariable [QGVAR(isHandcuffed), false]))) exitWith {
|
||||
ERROR("Attached But Not Captive");
|
||||
false
|
||||
};
|
||||
|
@ -23,6 +23,6 @@ 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(isCaptive), false]}] call EFUNC(common,filter);
|
||||
_cargo = [_cargo, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter);
|
||||
|
||||
count _cargo > 0
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Checks the conditions for being able to take a unit captive
|
||||
* Checks the conditions for being able to apply handcuffs
|
||||
*
|
||||
* Arguments:
|
||||
* 0: caller (player) <OBJECT>
|
||||
@ -18,5 +18,5 @@
|
||||
|
||||
PARAMS_2(_unit,_target);
|
||||
|
||||
_unit removeItem 'ACE_CableTie';
|
||||
["SetCaptive", [_target], [_target, true]] call EFUNC(common,targetEvent);
|
||||
_unit removeItem "ACE_CableTie";
|
||||
["SetHandcuffed", [_target], [_target, true]] call EFUNC(common,targetEvent);
|
@ -19,7 +19,7 @@
|
||||
|
||||
PARAMS_3(_unit,_target,_state);
|
||||
|
||||
if !("ACE_Handcuffed" in ([_target] call ACE_Core_fnc_getCaptivityStatus)) exitWith {
|
||||
if !("ACE_Handcuffed" in ([_target] call EFUNC(common,getCaptivityStatus))) exitWith {
|
||||
[localize "STR_ACE_Captives_NoCaptive"] call EFUNC(common,displayTextStructured);
|
||||
};
|
||||
|
||||
|
@ -21,14 +21,16 @@ PARAMS_3(_unit,_target,_vehicle);
|
||||
|
||||
if (isNull _target) then {
|
||||
_objects = attachedObjects _unit;
|
||||
_objects = [_objects, {_this getVariable [QGVAR(isCaptive), false]}] call EFUNC(common,filter);
|
||||
_target = _objects select 0;
|
||||
_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];
|
||||
_vehicle = _objects select 0;
|
||||
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];
|
||||
|
@ -18,4 +18,4 @@
|
||||
|
||||
PARAMS_2(_unit,_target);
|
||||
|
||||
["SetCaptive", [_target], [_target, false]] call EFUNC(common,targetEvent);
|
||||
["SetHandcuffed", [_target], [_target, false]] call EFUNC(common,targetEvent);
|
@ -22,7 +22,7 @@ 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(isCaptive), false]}] call EFUNC(common,filter);
|
||||
_cargo = [_cargo, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter);
|
||||
|
||||
if ((count _cargo) > 0) then {
|
||||
_target = _cargo select 0;
|
||||
|
@ -19,8 +19,7 @@
|
||||
|
||||
PARAMS_3(_vehicle,_dontcare,_unit);
|
||||
|
||||
if ((local _unit)&&(_unit getVariable [QGVAR(isCaptive), false])) then {
|
||||
|
||||
if ((local _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]}) then {
|
||||
private ["_cargoIndex"];
|
||||
|
||||
_cargoIndex = _unit getVariable ["ACE_Captives_CargoIndex", -1];
|
||||
|
@ -17,8 +17,8 @@
|
||||
|
||||
PARAMS_1(_oldUnit);
|
||||
|
||||
if (_oldUnit getVariable [QGVAR(isCaptive), false]) then {
|
||||
_oldUnit setVariable [QGVAR(isCaptive), false, true];
|
||||
if (_oldUnit getVariable [QGVAR(isHandcuffed), false]) then {
|
||||
_oldUnit setVariable [QGVAR(isHandcuffed), false, true];
|
||||
};
|
||||
|
||||
if (_oldUnit getVariable [QGVAR(isEscorting), false]) then {
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
PARAMS_2(_unit,_oldUnit);
|
||||
|
||||
if (_unit getVariable [QGVAR(isCaptive), false]) then {
|
||||
if (_unit getVariable [QGVAR(isHandcuffed), false]) then {
|
||||
showHUD false;
|
||||
} else {
|
||||
showHUD true;
|
||||
|
@ -17,13 +17,13 @@
|
||||
|
||||
PARAMS_1(_unit);
|
||||
|
||||
// prevent players from throwing grenades
|
||||
[_unit, "Throw", {(_this select 1) getVariable [QGVAR(isCaptive), false]}, {}] call EFUNC(common,addActionEventhandler);
|
||||
// prevent players from throwing grenades (added to all units)
|
||||
[_unit, "Throw", {(_this select 1) getVariable [QGVAR(isHandcuffed), false]}, {}] call EFUNC(common,addActionEventhandler);
|
||||
|
||||
if (local _unit) then {
|
||||
// reset status on mission start
|
||||
if (_unit getVariable [QGVAR(isCaptive), false]) then {
|
||||
_unit setVariable [QGVAR(isCaptive), false];
|
||||
[_unit, true] call FUNC(setCaptive);
|
||||
if (_unit getVariable [QGVAR(isHandcuffed), false]) then {
|
||||
_unit setVariable [QGVAR(isHandcuffed), false];
|
||||
[_unit, true] call FUNC(setHandcuffed);
|
||||
};
|
||||
};
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
PARAMS_1(_unit);
|
||||
|
||||
if (_unit getVariable [QGVAR(isCaptive), false] && {vehicle _unit == _unit}) then {
|
||||
if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then {
|
||||
[_unit] call EFUNC(common,fixLoweredRifleAnimation);
|
||||
[_unit, "ACE_AmovPercMstpScapWnonDnon", 0] call EFUNC(common,doAnimation);
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Author: Nic547, commy2
|
||||
* Makes a civilian unable to move.
|
||||
* Handcuffs a unit
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
@ -18,18 +18,26 @@
|
||||
|
||||
PARAMS_2(_unit,_state);
|
||||
|
||||
if (!local _unit) exitWith {[[_unit, _state, true], _fnc_scriptName, _unit] call ACE_Core_fnc_execRemoteFnc};
|
||||
systemChat format ["set %1", _this];
|
||||
|
||||
if (!local _unit) exitWith {
|
||||
ERROR("setHandcuffed unit not local");
|
||||
};
|
||||
|
||||
systemChat format ["set %1 %2 ", _state, (_unit getVariable [QGVAR(isHandcuffed), false])];
|
||||
|
||||
if (_state isEqualTo (_unit getVariable [QGVAR(isHandcuffed), false])) exitWith {
|
||||
ERROR("new state equals current");
|
||||
};
|
||||
|
||||
if (_state) then {
|
||||
if (_unit getVariable [QGVAR(isCaptive), false]) exitWith {};
|
||||
|
||||
_unit setVariable [QGVAR(isCaptive), true, true];
|
||||
_unit setVariable [QGVAR(isHandcuffed), true, true];
|
||||
|
||||
// fix anim on mission start (should work on dedicated servers)
|
||||
_unit spawn {
|
||||
[_this, "ACE_Handcuffed", true] call ACE_Core_fnc_setCaptivityStatus;
|
||||
[_this, QGVAR(Handcuffed), true] call EFUNC(common,setCaptivityStatus);
|
||||
|
||||
if (_this getVariable [QGVAR(isCaptive), false] && {vehicle _this == _this}) then {
|
||||
if (_this getVariable [QGVAR(isHandcuffed), false] && {vehicle _this == _this}) then {
|
||||
[_this] call EFUNC(common,fixLoweredRifleAnimation);
|
||||
[_this, "ACE_AmovPercMstpScapWnonDnon", 0] spawn EFUNC(common,doAnimation);
|
||||
};
|
||||
@ -41,10 +49,8 @@ if (_state) then {
|
||||
showHUD false;
|
||||
};
|
||||
} else {
|
||||
if !(_unit getVariable [QGVAR(isCaptive), false]) exitWith {};
|
||||
|
||||
_unit setVariable [QGVAR(isCaptive), false, true];
|
||||
[_unit, "ACE_Handcuffed", false] call ACE_Core_fnc_setCaptivityStatus;
|
||||
_unit setVariable [QGVAR(isHandcuffed), false, true];
|
||||
[_unit, "ACE_Handcuffed", false] call EFUNC(common,setCaptivityStatus);
|
||||
if (vehicle _unit == _unit) then {
|
||||
[_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);
|
||||
};
|
@ -24,7 +24,7 @@ if (_state) then {
|
||||
if (_unit getVariable [QGVAR(isSurrender), false]) exitWith {};
|
||||
|
||||
_unit setVariable [QGVAR(isSurrender), true, true];
|
||||
[_unit, "ACE_Surrendered", true] call ACE_Core_fnc_setCaptivityStatus;
|
||||
[_unit, "ACE_Surrendered", true] call EFUNC(common,setCaptivityStatus);
|
||||
|
||||
_unit spawn {
|
||||
// fix for lowered rifle animation glitch
|
||||
@ -49,7 +49,7 @@ if (_state) then {
|
||||
_this playMoveNow "unconscious";
|
||||
};
|
||||
|
||||
[_this, "ACE_Surrendered", false] call ACE_Core_fnc_setCaptivityStatus;
|
||||
[_this, "ACE_Surrendered", false] call EFUNC(common,setCaptivityStatus);
|
||||
|
||||
if (isPlayer _this) then {showHUD true};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user