From 7afce2a2417a5812aeea06116faea9adab371a06 Mon Sep 17 00:00:00 2001 From: jodav Date: Mon, 12 Jan 2015 15:09:07 +0100 Subject: [PATCH] more work --- addons/_switchunits/stringtable.xml | 6 +++--- addons/switchunits/CfgEventHandlers.hpp | 8 +++++++- addons/switchunits/XEH_postInit.sqf | 23 +++++++++++++++++++++++ addons/switchunits/config.cpp | 12 ++++++------ addons/switchunits/script_component.hpp | 10 +++++----- addons/switchunits/stringtable.xml | 22 ++++++++++++++++++++++ 6 files changed, 66 insertions(+), 15 deletions(-) create mode 100644 addons/switchunits/XEH_postInit.sqf create mode 100644 addons/switchunits/stringtable.xml diff --git a/addons/_switchunits/stringtable.xml b/addons/_switchunits/stringtable.xml index 76e9782e5d..b12e8dc17d 100644 --- a/addons/_switchunits/stringtable.xml +++ b/addons/_switchunits/stringtable.xml @@ -1,8 +1,8 @@  - + - + Switched unit Einheit gewechselt Юнит переключен @@ -10,7 +10,7 @@ Przełącz jednostkę Cambiado de unidad - + This unit is too close to the enemy. Diese Einheit ist zu nah am Feind. Юнит слишком близок к противнику diff --git a/addons/switchunits/CfgEventHandlers.hpp b/addons/switchunits/CfgEventHandlers.hpp index 8af0265fe2..35185e3a45 100644 --- a/addons/switchunits/CfgEventHandlers.hpp +++ b/addons/switchunits/CfgEventHandlers.hpp @@ -2,4 +2,10 @@ class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE( call compile preprocessFileLineNumbers PATHTOF(XEH_preInit.sqf) ); }; -}; \ No newline at end of file +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + postInit = QUOTE(call COMPILE_FILE(XEH_postInit) ); + }; +}; diff --git a/addons/switchunits/XEH_postInit.sqf b/addons/switchunits/XEH_postInit.sqf new file mode 100644 index 0000000000..6c769a5903 --- /dev/null +++ b/addons/switchunits/XEH_postInit.sqf @@ -0,0 +1,23 @@ +/* + Author(s): + bux578 +*/ + +0 spawn { + private ["_side"]; + + waitUntil {sleep 0.5; AGM_SwitchUnits_EnableSwitchUnits}; + + //_side = [west, east, independent, civilian] select AGM_SwitchUnits_SwitchUnitsAllowedForSide; + + _sides = []; + + if(AGM_SwitchUnits_SwitchToWest) then {_sides pushBack west}; + if(AGM_SwitchUnits_SwitchToEast) then {_sides pushBack east}; + if(AGM_SwitchUnits_SwitchToIndependent) then {_sides pushBack independent}; + if(AGM_SwitchUnits_SwitchToCivilian) then {_sides pushBack civilian}; + + if (player getVariable ["AGM_CanSwitchUnits", false]) then { + [player, _sides] call AGM_SwitchUnits_fnc_initPlayer; + }; +}; diff --git a/addons/switchunits/config.cpp b/addons/switchunits/config.cpp index 628865c703..f69ceb691b 100644 --- a/addons/switchunits/config.cpp +++ b/addons/switchunits/config.cpp @@ -6,12 +6,12 @@ class CfgPatches { weapons[] = {}; requiredVersion = 0.60; requiredAddons[] = {"ace_core"}; - version = "0.95"; - versionStr = "0.95"; - versionAr[] = {0,95,0}; - author[] = {""}; - authorUrl = ""; + version = QUOTE(VERSION); + versionStr = QUOTE(VERSION); + versionAr[] = {VERSION_AR}; + author[] = {"bux578"}; + authorUrl = "https://github.com/bux578/"; }; }; -#include "CfgEventHandlers.hpp" \ No newline at end of file +#include "CfgEventHandlers.hpp" diff --git a/addons/switchunits/script_component.hpp b/addons/switchunits/script_component.hpp index 40058509c2..3c4c77c007 100644 --- a/addons/switchunits/script_component.hpp +++ b/addons/switchunits/script_component.hpp @@ -1,12 +1,12 @@ -#define COMPONENT blank +#define COMPONENT SwitchUnits #include "\z\ace\addons\main\script_mod.hpp" -#ifdef DEBUG_ENABLED_BLANK +#ifdef DEBUG_ENABLED_SwitchUnits #define DEBUG_MODE_FULL #endif -#ifdef DEBUG_SETTINGS_BLANK - #define DEBUG_SETTINGS DEBUG_SETTINGS_BLANK +#ifdef DEBUG_SETTINGS_SwitchUnits + #define DEBUG_SETTINGS DEBUG_SETTINGS_SwitchUnits #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/switchunits/stringtable.xml b/addons/switchunits/stringtable.xml new file mode 100644 index 0000000000..76e9782e5d --- /dev/null +++ b/addons/switchunits/stringtable.xml @@ -0,0 +1,22 @@ + + + + + + Switched unit + Einheit gewechselt + Юнит переключен + Prohozená jednotka + Przełącz jednostkę + Cambiado de unidad + + + This unit is too close to the enemy. + Diese Einheit ist zu nah am Feind. + Юнит слишком близок к противнику + Tato jednotka je moc blízko k nepříteli. + Ta jednostka jest zbyt blisko przeciwnika. + Esta unidad está demasiado cerca del enemigo. + + +