Implemented knockout module

This commit is contained in:
SilentSpike 2015-05-14 23:04:58 +01:00
parent 47acb0f470
commit 3702d0b671
4 changed files with 75 additions and 13 deletions

View File

@ -3,6 +3,18 @@ class CfgVehicles {
class ModuleEmpty_F;
class ACE_Module;
class ModuleCurator_F: Module_F {
function = QUOTE(DFUNC(bi_moduleCurator));
};
class ModuleMine_F: ModuleEmpty_F {
function = QUOTE(DFUNC(bi_moduleMine));
};
class ModuleOrdnance_F: Module_F {
function = QUOTE(DFUNC(bi_moduleProjectile));
};
class ModuleRemoteControl_F: Module_F {
function = QUOTE(DFUNC(bi_moduleRemoteControl));
};
class GVAR(moduleZeusSettings): ACE_Module {
scope = 2;
displayName = "$STR_ACE_Zeus_Module_DisplayName";
@ -64,17 +76,20 @@ class CfgVehicles {
sync[] = {};
};
};
class ModuleCurator_F: Module_F {
function = QUOTE(DFUNC(bi_moduleCurator));
};
class ModuleMine_F: ModuleEmpty_F {
function = QUOTE(DFUNC(bi_moduleMine));
};
class ModuleOrdnance_F: Module_F {
function = QUOTE(DFUNC(bi_moduleProjectile));
};
class ModuleRemoteControl_F: Module_F {
function = QUOTE(DFUNC(bi_moduleRemoteControl));
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;
author = "SilentSpike";
class ModuleDescription {
description = "Knocks out or wakes up the specified unit.";
sync[] = {};
};
};
};

View File

@ -6,6 +6,7 @@ PREP(bi_moduleCurator);
PREP(bi_moduleMine);
PREP(bi_moduleProjectile);
PREP(bi_moduleRemoteControl);
PREP(moduleKnockout);
PREP(moduleZeusSettings);
ADDON = true;

View File

@ -2,7 +2,9 @@
class CfgPatches {
class ADDON {
units[] = {};
units[] = {
QGVAR(moduleKnockout)
};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common"};

View File

@ -0,0 +1,44 @@
/*
* Author: SilentSpike
* Flips the unconscious 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"
private ["_logic","_unit","_conscious","_previous"];
_logic = _this select 0;
_unit = attachedTo _logic;
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;
};
_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;