mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Implemented surrender module
Improved knockout module
This commit is contained in:
parent
3702d0b671
commit
a4512e4740
@ -4,23 +4,23 @@ class CfgVehicles {
|
||||
class ACE_Module;
|
||||
|
||||
class ModuleCurator_F: Module_F {
|
||||
function = QUOTE(DFUNC(bi_moduleCurator));
|
||||
function = QFUNC(bi_moduleCurator);
|
||||
};
|
||||
class ModuleMine_F: ModuleEmpty_F {
|
||||
function = QUOTE(DFUNC(bi_moduleMine));
|
||||
function = QFUNC(bi_moduleMine);
|
||||
};
|
||||
class ModuleOrdnance_F: Module_F {
|
||||
function = QUOTE(DFUNC(bi_moduleProjectile));
|
||||
function = QFUNC(bi_moduleProjectile);
|
||||
};
|
||||
class ModuleRemoteControl_F: Module_F {
|
||||
function = QUOTE(DFUNC(bi_moduleRemoteControl));
|
||||
function = QFUNC(bi_moduleRemoteControl);
|
||||
};
|
||||
class GVAR(moduleZeusSettings): ACE_Module {
|
||||
scope = 2;
|
||||
displayName = "$STR_ACE_Zeus_Module_DisplayName";
|
||||
//icon = QUOTE(PATHTOF(iconGoesHere));
|
||||
category = "ACE_zeus";
|
||||
function = QUOTE(DFUNC(moduleZeusSettings));
|
||||
function = QFUNC(moduleZeusSettings);
|
||||
functionPriority = 1;
|
||||
isGlobal = 1;
|
||||
isTriggerActivated = 0;
|
||||
@ -76,19 +76,26 @@ class CfgVehicles {
|
||||
sync[] = {};
|
||||
};
|
||||
};
|
||||
class GVAR(moduleKnockout): Module_F {
|
||||
scopeCurator = 2;
|
||||
displayName = "Knockout/Wakeup Unit";
|
||||
//icon = QUOTE(PATHTOF(iconGoesHere));
|
||||
category = "ACE_zeus";
|
||||
function = QUOTE(DFUNC(moduleKnockout));
|
||||
functionPriority = 1;
|
||||
isGlobal = 1;
|
||||
isTriggerActivated = 0;
|
||||
curatorCanAttach = 1;
|
||||
class GVAR(moduleBase): Module_F {
|
||||
author = "SilentSpike";
|
||||
category = "ACE";
|
||||
scopeCurator = 2;
|
||||
};
|
||||
class GVAR(moduleKnockout): GVAR(moduleBase) {
|
||||
curatorCanAttach = 1;
|
||||
displayName = "Knockout/Wakeup Unit";
|
||||
function = QFUNC(moduleKnockout);
|
||||
class ModuleDescription {
|
||||
description = "Knocks out or wakes up the specified unit.";
|
||||
description = "Flips the unconscious state of the specified unit.";
|
||||
sync[] = {};
|
||||
};
|
||||
};
|
||||
class GVAR(moduleSurrender): GVAR(moduleBase) {
|
||||
curatorCanAttach = 1;
|
||||
displayName = "Force Surrender";
|
||||
function = QFUNC(moduleSurrender);
|
||||
class ModuleDescription {
|
||||
description = "Flips the surrender state of the specified unit.";
|
||||
sync[] = {};
|
||||
};
|
||||
};
|
||||
|
@ -7,6 +7,7 @@ PREP(bi_moduleMine);
|
||||
PREP(bi_moduleProjectile);
|
||||
PREP(bi_moduleRemoteControl);
|
||||
PREP(moduleKnockout);
|
||||
PREP(moduleSurrender);
|
||||
PREP(moduleZeusSettings);
|
||||
|
||||
ADDON = true;
|
||||
|
@ -3,7 +3,8 @@
|
||||
class CfgPatches {
|
||||
class ADDON {
|
||||
units[] = {
|
||||
QGVAR(moduleKnockout)
|
||||
QGVAR(moduleKnockout),
|
||||
QGVAR(moduleSurrender)
|
||||
};
|
||||
weapons[] = {};
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
|
@ -15,30 +15,31 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_logic","_unit","_conscious","_previous"];
|
||||
PARAMS_3(_logic,_units,_activated);
|
||||
private ["_activated","_unit","_logic","_conscious"];
|
||||
|
||||
_logic = _this select 0;
|
||||
_unit = attachedTo _logic;
|
||||
if (!_activated) exitWith {};
|
||||
|
||||
if (isNil QEFUNC(medical,setUnconscious)) exitWith {
|
||||
["Requires ACE_Medical to work."] call DEFUNC(common,displayTextStructured);
|
||||
deleteVehicle _logic;
|
||||
};
|
||||
if (isNull _unit) exitWith {
|
||||
["Module must be placed on a unit."] call DEFUNC(common,displayTextStructured);
|
||||
deleteVehicle _logic;
|
||||
if (isNil QEFUNC(medical,setUnconscious)) then {
|
||||
["Requires ACE_Medical"] 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 {
|
||||
_conscious = GETVAR(_unit,ACE_isUnconscious,false);
|
||||
// Function handles locality for me
|
||||
[_unit, !_conscious, true] call DEFUNC(medical,setUnconscious);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
_conscious = _unit getVariable ["ACE_isUnconscious", false];
|
||||
|
||||
//Hacky method, will be replaced once #1205 is complete
|
||||
_previous = _unit getvariable [QEGVAR(medical,enableUnconsciousnessAI), EGVAR(medical,enableUnconsciousnessAI)];
|
||||
if (_previous < 2) then {_unit setvariable [QEGVAR(medical,enableUnconsciousnessAI), 2];};
|
||||
|
||||
[_unit, !_conscious] call DEFUNC(medical,setUnconscious);
|
||||
|
||||
if (_previous < 2) then {
|
||||
_unit setvariable [QEGVAR(medical,enableUnconsciousnessAI), _previous];
|
||||
};
|
||||
|
||||
deleteVehicle _logic;
|
||||
deleteVehicle _logic;
|
||||
|
47
addons/zeus/functions/fnc_moduleSurrender.sqf
Normal file
47
addons/zeus/functions/fnc_moduleSurrender.sqf
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Author: SilentSpike
|
||||
* Flips the surrender 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"
|
||||
|
||||
[_unit,!_surrendering] call DEFUNC(captives,setSurrendered);
|
||||
|
||||
PARAMS_3(_logic,_units,_activated);
|
||||
private ["_logic","_activated","_unit","_conscious","_previous"];
|
||||
|
||||
if (!_activated) exitWith {};
|
||||
|
||||
if (isNil QEFUNC(captives,setSurrendered)) 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 {
|
||||
_surrendering = GETVAR(_unit,QEGVAR(captives,isSurrendering),false);
|
||||
// Event initalized by ACE_Captives
|
||||
["SetSurrendered", _unit, [_unit, !_surrendering]] call DEFUNC(common,targetEvent);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
deleteVehicle _logic;
|
Loading…
Reference in New Issue
Block a user