Merge pull request #1295 from SilentSpike/master

New zeus modules (#130)
This commit is contained in:
Glowbal 2015-06-01 22:04:36 +02:00
commit 4356b169d8
25 changed files with 339 additions and 101 deletions

View File

@ -164,8 +164,6 @@ class CfgVehicles {
displayName = "$STR_ACE_Captives_ModuleSurrender_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\Icon_Module_Make_Unit_Surrender_ca.paa));
@ -176,4 +174,4 @@ class CfgVehicles {
sync[] = {"AnyAI"};
};
};
};
};

View File

@ -23,37 +23,13 @@ private ["_bisMouseOver", "_mouseOverObject"];
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 {
TRACE_2("Debug - module surrendering %1",_mouseOverObject,(name _mouseOverObject));
if (alive _mouseOverObject) then {
if (!(_mouseOverObject getVariable [QGVAR(isSurrendering), false])) then {
["SetSurrendered", [_mouseOverObject], [_mouseOverObject, true]] call EFUNC(common,targetEvent);
} else {
["SetSurrendered", [_mouseOverObject], [_mouseOverObject, false]] call EFUNC(common,targetEvent);
};
} else {
["STR_ACE_Captives_Zeus_OnlyAlive"] call EFUNC(common,displayTextStructured);
};
} else {
["STR_ACE_Captives_Zeus_OnlyInfantry"] call EFUNC(common,displayTextStructured);
};
} else {
["STR_ACE_Captives_Zeus_NothingSelected"] call EFUNC(common,displayTextStructured);
};
} else {
//an editor module
//Modules run before postInit can instal the event handler, so we need to wait a little bit
[{
PARAMS_1(_units);
{
["SetSurrendered", [_x], [_x, true]] call EFUNC(common,targetEvent);
} forEach _units;
}, [_units], 0.05, 0.05]call EFUNC(common,waitAndExecute);
};
//Modules run before postInit can instal the event handler, so we need to wait a little bit
[{
PARAMS_1(_units);
{
["SetSurrendered", [_x], [_x, true]] call EFUNC(common,targetEvent);
} forEach _units;
}, [_units], 0.05, 0.05]call EFUNC(common,waitAndExecute);
deleteVehicle _logic;
};

View File

@ -157,42 +157,6 @@
<Hungarian>Megadás abbahagyása</Hungarian>
<Italian>Smetti di arrenderti</Italian>
</Key>
<Key ID="STR_ACE_Captives_Zeus_OnlyAlive">
<English>Only use on alive units</English>
<French>Utiliser uniquement sur une unité vivante</French>
<German>Nur bei lebenden Einheiten verwendbar</German>
<Spanish>Utilizar solo en unidades vivas</Spanish>
<Czech>Použitelné jen na živé jednotky</Czech>
<Polish>Używaj tylko na żywych jednostkach</Polish>
<Russian>Применимо только к живым юнитам</Russian>
<Hungarian>Csak élő egységeken használni</Hungarian>
<Italian>Si può fare solo su persone vive</Italian>
<Portuguese>Usar somente em unidades vivas</Portuguese>
</Key>
<Key ID="STR_ACE_Captives_Zeus_OnlyInfantry">
<English>Only use on dismounted inf</English>
<French>Utiliser uniquement sur du personnel à pied</French>
<German>Nur bei abgesessener Infanterie verwendbar</German>
<Spanish>Utilizar solo en infanteria desmontada</Spanish>
<Czech>Použitelné jen na pěsích jednotkách</Czech>
<Polish>Używaj tylko na piechocie poza wszelkimi pojazdami</Polish>
<Russian>Применимо только к пехоте вне техники</Russian>
<Hungarian>Csak járműben kívül lévő egységeken használni</Hungarian>
<Italian>Si può usare solo su fanteria a piedi</Italian>
<Portuguese>Usar somente em infantaria desmontada</Portuguese>
</Key>
<Key ID="STR_ACE_Captives_Zeus_NothingSelected">
<English>Nothing under mouse</English>
<French>Rien sous le curseur</French>
<German>Es wurde nichts ausgewählt</German>
<Spanish>Nada bajo el ratón</Spanish>
<Portuguese>Nada debaixo do mouse</Portuguese>
<Czech>Nic není vybráno</Czech>
<Polish>Nie ma nic pod kursorem</Polish>
<Russian>Ничего не выделено</Russian>
<Hungarian>Semmi sincs az egér alatt</Hungarian>
<Italian>Nessuna selezione</Italian>
</Key>
<Key ID="STR_ACE_Captives_ModuleSurrender_DisplayName">
<English>Make Unit Surrender</English>
<Polish>Poddaj się!</Polish>

View File

@ -1,6 +0,0 @@
class CfgFactionClasses {
class NO_CATEGORY;
class ADDON: NO_CATEGORY {
displayName = "$STR_ACE_Zeus_category";
};
};

View File

@ -3,12 +3,24 @@ class CfgVehicles {
class ModuleEmpty_F;
class ACE_Module;
class GVAR(moduleZeusSettings): ACE_Module {
class ModuleCurator_F: Module_F {
function = QFUNC(bi_moduleCurator);
};
class ModuleMine_F: ModuleEmpty_F {
function = QFUNC(bi_moduleMine);
};
class ModuleOrdnance_F: Module_F {
function = QFUNC(bi_moduleProjectile);
};
class ModuleRemoteControl_F: Module_F {
function = QFUNC(bi_moduleRemoteControl);
};
class GVAR(moduleSettings): ACE_Module {
scope = 2;
displayName = "$STR_ACE_Zeus_Module_DisplayName";
//icon = QUOTE(PATHTOF(iconGoesHere));
category = "ACE_zeus";
function = QUOTE(DFUNC(moduleZeusSettings));
icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Settings_ca.paa));
category = "ACE";
function = QFUNC(moduleZeusSettings);
functionPriority = 1;
isGlobal = 1;
isTriggerActivated = 0;
@ -64,17 +76,39 @@ class CfgVehicles {
sync[] = {};
};
};
class ModuleCurator_F: Module_F {
function = QUOTE(DFUNC(bi_moduleCurator));
class GVAR(moduleBase): Module_F {
author = "SilentSpike";
category = "ACE";
scopeCurator = 2;
};
class ModuleMine_F: ModuleEmpty_F {
function = QUOTE(DFUNC(bi_moduleMine));
class GVAR(moduleCaptive): GVAR(moduleBase) {
curatorCanAttach = 1;
displayName = "$STR_ACE_Zeus_ModuleCaptive_DisplayName";
function = QFUNC(moduleCaptive);
icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Captive_ca.paa));
class ModuleDescription {
description = "Flips the capture state of the specified unit.";
sync[] = {};
};
};
class ModuleOrdnance_F: Module_F {
function = QUOTE(DFUNC(bi_moduleProjectile));
class GVAR(moduleSurrender): GVAR(moduleBase) {
curatorCanAttach = 1;
displayName = "$STR_ACE_Zeus_ModuleSurrender_DisplayName";
function = QFUNC(moduleSurrender);
icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Surrender_ca.paa));
class ModuleDescription {
description = "Flips the surrender state of the specified unit.";
sync[] = {};
};
};
class ModuleRemoteControl_F: Module_F {
function = QUOTE(DFUNC(bi_moduleRemoteControl));
class GVAR(moduleUnconscious): GVAR(moduleBase) {
curatorCanAttach = 1;
displayName = "$STR_ACE_Zeus_ModuleUnconscious_DisplayName";
function = QFUNC(moduleUnconscious);
icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Unconscious_ca.paa));
class ModuleDescription {
description = "Flips the unconscious state of the specified unit.";
sync[] = {};
};
};
};

View File

@ -6,6 +6,14 @@ PREP(bi_moduleCurator);
PREP(bi_moduleMine);
PREP(bi_moduleProjectile);
PREP(bi_moduleRemoteControl);
PREP(handleZeusUnitAssigned);
PREP(moduleCaptive);
PREP(moduleSurrender);
PREP(moduleUnconscious);
PREP(moduleZeusSettings);
if (isServer) then {
["zeusUnitAssigned", FUNC(handleZeusUnitAssigned)] call EFUNC(common,addEventHandler);
};
ADDON = true;

View File

@ -10,9 +10,25 @@ class CfgPatches {
authorUrl = "https://github.com/SilentSpike";
VERSION_CONFIG;
};
// Use additional cfgPatches to contextually remove modules from zeus
class GVAR(captives): ADDON {
units[] = {
QGVAR(moduleCaptive),
QGVAR(moduleSurrender)
};
};
class GVAR(medical): ADDON {
units[] = {
QGVAR(moduleUnconscious)
};
};
};
class ACE_Curator {
GVAR(captives) = "ace_captives";
GVAR(medical) = "ace_medical";
};
#include "CfgEventHandlers.hpp"
#include "CfgFactionClasses.hpp"
#include "CfgVehicles.hpp"
#include "ACE_Settings.hpp"

View File

@ -2,9 +2,12 @@
* Author: Bohemia Interactive
* Module function for initalizing zeus
* Edited to remove eagle and global ascension message
* Added "zeusUnitAssigned" event call
*
* Arguments:
* 0: The logic object <OBJECT>
* 0: The module logic <LOGIC>
* 1: units <ARRAY>
* 2: activated <BOOL>
*
* Return Value:
* nil
@ -169,6 +172,9 @@ if (_activated) then {
[_logic,"curatorUnitAssigned",[_logic,_player]] call bis_fnc_callscriptedeventhandler;
// Added by ACE_zeus
["zeusUnitAssigned", [_logic,_player]] call EFUNC(common,globalEvent);
//--- Forced interface
//if (_forced) then {
// [[true,true],"bis_fnc_forceCuratorInterface",_player] call bis_fnc_mp;

View File

@ -4,7 +4,9 @@
* Edited to remove forced map markers and mines being revealed to players
*
* Arguments:
* 0: The logic object <OBJECT>
* 0: The module logic <LOGIC>
* 1: units <ARRAY>
* 2: activated <BOOL>
*
* Return Value:
* nil

View File

@ -5,7 +5,9 @@
* Edited to remove radio warning and add ballistics support
*
* Arguments:
* 0: The logic object <OBJECT>
* 0: The module logic <LOGIC>
* 1: units <ARRAY>
* 2: activated <BOOL>
*
* Return Value:
* nil

View File

@ -4,7 +4,9 @@
* Edited to remove global wind sound
*
* Arguments:
* 0: The logic object <OBJECT>
* 0: The module logic <LOGIC>
* 1: units <ARRAY>
* 2: activated <BOOL>
*
* Return Value:
* nil

View File

@ -0,0 +1,50 @@
/*
* Author: SilentSpike
* Contextually removes addons (given in ACE_Curator) from zeus based on their required addon(s)
*
* ACE_Curator format:
* ModuleAddon = "RequiredAddon";
* OR
* ModuleAddon[] = {"RequiredAddon1","RequiredAddon2",...}
*
* Arguments:
* 0: The zeus logic <LOGIC>
* 1: The zeus player <UNIT>
*
* Return Value:
* nil
*
* Public: No
*/
#include "script_component.hpp"
private ["_logic","_removeAddons","_numCfgs","_cfg","_requiredAddon"];
if !(isClass (configFile >> "ACE_Curator")) exitWith { ERROR("The ACE_Curator class does not exist") };
_logic = _this select 0;
_removeAddons = [];
_numCfgs = count (configFile >> "ACE_Curator");
for "_n" from 0 to (_numCfgs - 1) do {
_cfg = (configFile >> "ACE_Curator") select _n;
if (isArray _cfg) then {
_requiredAddon = getArray _cfg;
{
if !(isClass (configFile >> "CfgPatches" >> _x)) exitWith {
_removeAddons pushBack (configName _cfg);
};
} forEach _requiredAddon;
};
if (isText _cfg) then {
_requiredAddon = getText _cfg;
if !(isClass (configFile >> "CfgPatches" >> _requiredAddon)) then {
_removeAddons pushBack (configName _cfg);
};
};
};
_logic removeCuratorAddons _removeAddons;

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 {
["STR_ACE_Zeus_RequiresAddon"] call EFUNC(common,displayTextStructured);
} else {
_unit = attachedTo _logic;
if (isNull _unit) then {
["STR_ACE_Zeus_NothingSelected"] call EFUNC(common,displayTextStructured);
} else {
if !(_unit isKindOf "CAManBase") then {
["STR_ACE_Zeus_OnlyInfantry"] call EFUNC(common,displayTextStructured);
} else {
if !(alive _unit) then {
["STR_ACE_Zeus_OnlyAlive"] call EFUNC(common,displayTextStructured);
} else {
_captive = GETVAR(_unit,EGVAR(captives,isHandcuffed),false);
// Event initalized by ACE_Captives
["SetHandcuffed", _unit, [_unit, !_captive]] call EFUNC(common,targetEvent);
};
};
};
};
deleteVehicle _logic;

View File

@ -0,0 +1,49 @@
/*
* 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"
PARAMS_3(_logic,_units,_activated);
private ["_unit","_surrendering"];
if (!_activated) exitWith {};
if (isNil QEFUNC(captives,setSurrendered)) then {
["STR_ACE_Zeus_RequiresAddon"] call EFUNC(common,displayTextStructured);
} else {
_unit = attachedTo _logic;
if (isNull _unit) then {
["STR_ACE_Zeus_NothingSelected"] call EFUNC(common,displayTextStructured);
} else {
if !(_unit isKindOf "CAManBase") then {
["STR_ACE_Zeus_OnlyInfantry"] call EFUNC(common,displayTextStructured);
} else {
if !(alive _unit) then {
["STR_ACE_Zeus_OnlyAlive"] call EFUNC(common,displayTextStructured);
} else {
if (GETVAR(_unit,EGVAR(captives,isHandcuffed),false)) then {
["STR_ACE_Zeus_OnlyNonCaptive"] call EFUNC(common,displayTextStructured);
} else {
_surrendering = GETVAR(_unit,EGVAR(captives,isSurrendering),false);
// Event initalized by ACE_Captives
["SetSurrendered", _unit, [_unit, !_surrendering]] call EFUNC(common,targetEvent);
};
};
};
};
};
deleteVehicle _logic;

View File

@ -0,0 +1,45 @@
/*
* 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"
PARAMS_3(_logic,_units,_activated);
private ["_unit","_conscious"];
if (!_activated) exitWith {};
if (isNil QEFUNC(medical,setUnconscious)) then {
["STR_ACE_Zeus_RequiresAddon"] call EFUNC(common,displayTextStructured);
} else {
_unit = attachedTo _logic;
if (isNull _unit) then {
["STR_ACE_Zeus_NothingSelected"] call EFUNC(common,displayTextStructured);
} else {
if !(_unit isKindOf "CAManBase") then {
["STR_ACE_Zeus_OnlyInfantry"] call EFUNC(common,displayTextStructured);
} else {
if !(alive _unit) then {
["STR_ACE_Zeus_OnlyAlive"] call EFUNC(common,displayTextStructured);
} else {
_conscious = GETVAR(_unit,ACE_isUnconscious,false);
// Function handles locality for me
[_unit, !_conscious, round(random(10)+5), true] call EFUNC(medical,setUnconscious);
};
};
};
};
deleteVehicle _logic;

View File

@ -2,8 +2,8 @@
<Project name="ACE">
<Package name="Zeus">
<Key ID="STR_ACE_Zeus_Module_DisplayName">
<English>Zeus Settings [ACE]</English>
<Polish>Ustawienia Zeusa [ACE]</Polish>
<English>Zeus Settings</English>
<Polish>Ustawienia Zeusa</Polish>
</Key>
<Key ID="STR_ACE_Zeus_Module_Description">
<English>Provides control over various aspects of Zeus.</English>
@ -46,8 +46,8 @@
<Polish>Pokazuj miny</Polish>
</Key>
<Key ID="STR_ACE_Zeus_revealMines_Description">
<English>Reveal mines to allies and/or place map markers.</English>
<Polish>Pokazuj znaczniki min dla sojuszników i/lub twórz markery na mapie w miejscu min.</Polish>
<English>Reveal mines to allies and place map markers.</English>
<Polish>Pokazuj znaczniki min dla sojuszników i twórz markery na mapie w miejscu min.</Polish>
</Key>
<Key ID="STR_ACE_Zeus_revealMines_disable">
<English>Disabled</English>
@ -61,9 +61,56 @@
<English>Allies + Map Markers</English>
<Polish>Sojusznicy + markery na mapie</Polish>
</Key>
<Key ID="STR_ACE_Zeus_category">
<English>ACE Zeus</English>
<Polish>ACE Zeus</Polish>
<Key ID="STR_ACE_Zeus_ModuleCaptive_DisplayName">
<English>Toggle Captive</English>
</Key>
<Key ID="STR_ACE_Zeus_ModuleSurrender_DisplayName">
<English>Toggle Surrender</English>
</Key>
<Key ID="STR_ACE_Zeus_ModuleUnconscious_DisplayName">
<English>Toggle Unconscious</English>
</Key>
<Key ID="STR_ACE_Zeus_OnlyAlive">
<English>Unit must be alive</English>
<French>Utiliser uniquement sur une unité vivante</French>
<German>Nur bei lebenden Einheiten verwendbar</German>
<Spanish>Utilizar solo en unidades vivas</Spanish>
<Czech>Použitelné jen na živé jednotky</Czech>
<Polish>Używaj tylko na żywych jednostkach</Polish>
<Russian>Применимо только к живым юнитам</Russian>
<Hungarian>Csak élő egységeken használni</Hungarian>
<Italian>Si può fare solo su persone vive</Italian>
<Portuguese>Usar somente em unidades vivas</Portuguese>
</Key>
<Key ID="STR_ACE_Zeus_OnlyInfantry">
<English>Unit must be infantry</English>
<French>Utiliser uniquement sur du personnel à pied</French>
<German>Nur bei abgesessener Infanterie verwendbar</German>
<Spanish>Utilizar solo en infanteria desmontada</Spanish>
<Czech>Použitelné jen na pěsích jednotkách</Czech>
<Polish>Używaj tylko na piechocie poza wszelkimi pojazdami</Polish>
<Russian>Применимо только к пехоте вне техники</Russian>
<Hungarian>Csak járműben kívül lévő egységeken használni</Hungarian>
<Italian>Si può usare solo su fanteria a piedi</Italian>
<Portuguese>Usar somente em infantaria desmontada</Portuguese>
</Key>
<Key ID="STR_ACE_Zeus_OnlyNonCaptive">
<English>Unit must not be captive</English>
</Key>
<Key ID="STR_ACE_Zeus_NothingSelected">
<English>Place on a unit</English>
<French>Rien sous le curseur</French>
<German>Es wurde nichts ausgewählt</German>
<Spanish>Nada bajo el ratón</Spanish>
<Portuguese>Nada debaixo do mouse</Portuguese>
<Czech>Nic není vybráno</Czech>
<Polish>Nie ma nic pod kursorem</Polish>
<Russian>Ничего не выделено</Russian>
<Hungarian>Semmi sincs az egér alatt</Hungarian>
<Italian>Nessuna selezione</Italian>
</Key>
<Key ID="STR_ACE_Zeus_RequiresAddon">
<English>Requires an addon that is not present</English>
</Key>
</Package>
</Project>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB