mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
#130 - Surrender Module Prototype
This commit is contained in:
parent
fcf39a3916
commit
6d534e8846
@ -162,4 +162,30 @@ class CfgVehicles {
|
|||||||
MACRO_ADDITEM(ACE_CableTie,12)
|
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"};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
@ -23,6 +23,7 @@ PREP(handleKnockedOut);
|
|||||||
PREP(handlePlayerChanged);
|
PREP(handlePlayerChanged);
|
||||||
PREP(handleUnitInitPost);
|
PREP(handleUnitInitPost);
|
||||||
PREP(handleWokeUp);
|
PREP(handleWokeUp);
|
||||||
|
PREP(moduleSurrender);
|
||||||
PREP(setHandcuffed);
|
PREP(setHandcuffed);
|
||||||
PREP(surrender);
|
PREP(surrender);
|
||||||
PREP(vehicleCaptiveMoveIn);
|
PREP(vehicleCaptiveMoveIn);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
class CfgPatches {
|
class CfgPatches {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
units[] = {};
|
units[] = {QGVAR(ModuleSurrender)};
|
||||||
weapons[] = {"ACE_CableTie"};
|
weapons[] = {"ACE_CableTie"};
|
||||||
requiredVersion = REQUIRED_VERSION;
|
requiredVersion = REQUIRED_VERSION;
|
||||||
requiredAddons[] = {"ACE_Interaction"};
|
requiredAddons[] = {"ACE_Interaction"};
|
||||||
|
@ -18,8 +18,10 @@
|
|||||||
|
|
||||||
PARAMS_2(_newUnit,_oldUnit);
|
PARAMS_2(_newUnit,_oldUnit);
|
||||||
|
|
||||||
if ((_newUnit getVariable [QGVAR(isHandcuffed), false]) || {_unit getVariable [QGVAR(isSurrendering), false]}) then {
|
if ((_newUnit getVariable [QGVAR(isHandcuffed), false]) || {_newUnit getVariable [QGVAR(isSurrendering), false]}) then {
|
||||||
|
TRACE_1("Player Change (showHUD false)",_newUnit);
|
||||||
showHUD false;
|
showHUD false;
|
||||||
} else {
|
} else {
|
||||||
|
TRACE_1("Player Change (showHUD true)",_newUnit);
|
||||||
showHUD true;
|
showHUD true;
|
||||||
};
|
};
|
||||||
|
46
addons/captives/functions/fnc_moduleSurrender.sqf
Normal file
46
addons/captives/functions/fnc_moduleSurrender.sqf
Normal 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;
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user