Skip to content

Commit

Permalink
Opensource e12_amf_a2
Browse files Browse the repository at this point in the history
  • Loading branch information
blang committed Aug 7, 2014
0 parents commit 9065d89
Show file tree
Hide file tree
Showing 121 changed files with 2,043 additions and 0 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License

Copyright (c) 2014 Benedikt Lang <github at benediktlang.de>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
1 change: 1 addition & 0 deletions e12_amf_dac/$PBOPREFIX$
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x\e12\addons\amf_dac
30 changes: 30 additions & 0 deletions e12_amf_dac/XEH_PostClientInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include "script_component.hpp"
TRACE_1("Process","PostInitClient");
waitUntil{!isNull player};

if(isMultiplayer) then {
LOG("Multiplayer");

//Only executed on hc client
if (!hasInterface && !isServer) then{
if(isNil "paramsArray") then{ paramsArray=[0,0,0]};

//HC should be used
if(paramsArray select 0 == 1) then{
if(!isNil QGVAR(DELAYED_START)) then {
waitUntil{!isNil QGVAR(DELAYED_START_GO)};
};
LOG("HC present and activated");
HCName = name player;
publicVariable "HCName";
HCPresent = true;
publicVariable "HCPresent";
[] call FUNC(callUserScripts);
}else{
LOG("HC present but not activated");
};
};
}else{
LOG("No Multiplayer - nothing to do for the client");
};

35 changes: 35 additions & 0 deletions e12_amf_dac/XEH_PostServerInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include "script_component.hpp"
TRACE_1("Process","PostInitServer");

if(isMultiplayer) then {
LOG("Multiplayer - Check if server should run AI");
if(isNil "paramsArray") then{ paramsArray=[0,0,0]};

//HC should be used
if(paramsArray select 0 == 0) then{
if(!isNil QGVAR(DELAYED_START)) then {
waitUntil{!isNil QGVAR(DELAYED_START_GO)};
};
LOG("Server should run AI");
HCPresent = false;
HCName = "NONE";
publicVariable "HCPresent";
publicVariable "HCName";
[] call FUNC(callUserScripts);
LOG("Server runs AI");
}else{
LOG("Server will not run AI");
};
}else{
if(!isNil QGVAR(DELAYED_START)) then {
waitUntil{!isNil QGVAR(DELAYED_START_GO)};
};
LOG("No Multiplayer - Server/Client is starting DAC");
HCPresent = false;
HCName = "NONE";
publicVariable "HCPresent";
publicVariable "HCName";
[] call FUNC(callUserScripts);
};


4 changes: 4 additions & 0 deletions e12_amf_dac/XEH_PreClientInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include "script_component.hpp"
TRACE_1("Process","PreInitClient");

PREP(callUserScripts);
4 changes: 4 additions & 0 deletions e12_amf_dac/XEH_PreServerInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include "script_component.hpp"
TRACE_1("Process","PreInitClient");

PREP(callUserScripts);
37 changes: 37 additions & 0 deletions e12_amf_dac/config.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
class CfgPatches
{
class e12_amf_dac
{
units[] = {};
weapons[] = {};
requiredVersion = 1.62;
requiredAddons[] = {"e12_amf_main"};
author[] = {"Coati - Echo12 Development Team"};
version = "0.1";
authorUrl = "http://www.echo12.de";
};
};




class Extended_PreInit_EventHandlers
{
class e12_amf_dac {
clientInit = "call compile preprocessFileLineNumbers 'x\e12\addons\amf_dac\XEH_PreClientInit.sqf'";
serverInit = "call compile preprocessFileLineNumbers 'x\e12\addons\amf_dac\XEH_PreServerInit.sqf'";
};
};

class Extended_PostInit_EventHandlers
{
class e12_amf_dac {
clientInit = "e12retnull = [] spawn compile preprocessFileLineNumbers 'x\e12\addons\amf_dac\XEH_PostClientInit.sqf'";
serverInit = "e12retnull = [] spawn compile preprocessFileLineNumbers 'x\e12\addons\amf_dac\XEH_PostServerInit.sqf'";
};
};





17 changes: 17 additions & 0 deletions e12_amf_dac/fnc_callUserScripts.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "script_component.hpp"
LOG("Userscripts called");
if(!isNil QGVAR(userscripts)) then {
LOG("Userscripts not nil");
TRACE_1("Userscripts", GVAR(userscripts));
if(IS_ARRAY(GVAR(userscripts))) then {
{
TRACE_1("Userscript foreach", _x);
if(IS_CODE(_x)) then {
LOG("Userscript is code and is called");
[isServer] call _x;
};

} foreach GVAR(userscripts);

};
};
4 changes: 4 additions & 0 deletions e12_amf_dac/script_component.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#define COMPONENT amf_dac
#define PREFIX e12

#include "script_macros.hpp"
2 changes: 2 additions & 0 deletions e12_amf_dac/script_macros.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//#define DEBUG_MODE_FULL
#include "\x\cba\addons\main\script_macros_common.hpp"
1 change: 1 addition & 0 deletions e12_amf_debugging/$PBOPREFIX$
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x\e12\addons\amf_debugging
10 changes: 10 additions & 0 deletions e12_amf_debugging/XEH_PostServerInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "script_component.hpp"
TRACE_1("Process","PostInitServer");

//Activate Debug in Singleplayer/Editor
if(!isMultiplayer && (!isNil "e12_amf_debug") && e12_amf_debug) then {
LOG("Debug is active");
[] spawn FUNC(missionDebug);
}else{
LOG("Debug is NOT active");
};
20 changes: 20 additions & 0 deletions e12_amf_debugging/XEH_PreServerInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include "script_component.hpp"
TRACE_1("Process","PreInitServer");

//Only prepare checks in singleplayer
if(!isMultiplayer) then {
PREP(checkMarkers);
PREP(checkMedics);
PREP(checkHC);
PREP(checkACE);
PREP(checkDAC);
PREP(checkDescription);
PREP(checkLoadout);
PREP(checkLoadoutPreInit);
PREP(checkTools);
PREP(checkAMFSettings);
PREP(debugMsg);
PREP(missionDebug);

[] call FUNC(checkLoadoutPreInit);
};
47 changes: 47 additions & 0 deletions e12_amf_debugging/config.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
class CfgPatches
{
class e12_amf_debugging
{
units[] = {};
weapons[] = {};
requiredVersion = 1.62;
requiredAddons[] = {"e12_amf_main","ace_sys_ruck"};
author[] = {"Coati - Echo12 Development Team"};
version = "0.1";
authorUrl = "http://www.echo12.de";
};
};


class Logic;
class E12_AMF_Logic;
class CfgVehicles {
class E12_AMF_Debug_Logic: E12_AMF_Logic {
displayName = "$STR_E12AMF_MOD_DEBUGGING";
vehicleClass = "Modules";
class Eventhandlers {
init = "if (isServer) then {e12_amf_debug = true;publicVariable 'e12_amf_debug'};";
};
};
};

class Extended_PreInit_EventHandlers
{
class e12_amf_debugging {
serverInit = "call compile preprocessFileLineNumbers 'x\e12\addons\amf_debugging\XEH_PreServerInit.sqf'";
};
};

class Extended_PostInit_EventHandlers
{
class e12_amf_debugging {
serverInit = "e12retnull = [] spawn compile preprocessFileLineNumbers 'x\e12\addons\amf_debugging\XEH_PostServerInit.sqf'";
};

};






63 changes: 63 additions & 0 deletions e12_amf_debugging/fnc_checkACE.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#include "script_component.hpp"
LOG("ACE Check init");

TRACE_2("Grass viewblock",(isNil "ace_sys_viewblock_blockgrass"), ace_sys_viewblock_blockgrass);
_errorgrass = {
["ace settings", "ACE AI Viewblock not activated"] call FUNC(debugMsg);
};

_errorwounds = {
["ace settings", "ACE Wounding System not activated"] call FUNC(debugMsg);
};

_errormarkers = {
["ace settings", "ACE Force-Group-Markers-Off not activated"] call FUNC(debugMsg);
};

_errorstamina = {
["ace settings", "ACE NoStamina activated, Rucks will be disabled!"] call FUNC(debugMsg);
};

_errormapsystem = {
["ace settings", "ACE MapSystem activated, GPS will not work properly!"] call FUNC(debugMsg);
};

//isNil "ace_sys_viewblock_blockgrass" || !ace_sys_viewblock_blockgrass DOES NOT WORK, ANSWER TO [email protected] plz

if(isNil "ace_sys_viewblock_blockgrass") then {
[] call _errorgrass;
}else{
if(!ace_sys_viewblock_blockgrass) then {
[] call _errorgrass;
};
};

if(isNil "ace_sys_wounds_enabled") then {
[] call _errorwounds;
}else{
if(!ace_sys_wounds_enabled) then {
[] call _errorwounds;
};
};

if(isNil "ace_sys_tracking_markers_enabled") then {
[] call _errormarkers;
}else{
if(ace_sys_tracking_markers_enabled) then {
[] call _errormarkers;
};
};

if(!isNil "ACE_NoStaminaEffects") then {
if(ACE_NoStaminaEffects) then {
[] call _errorstamina;
};
};

if(!isNil "ace_sys_map_enabled") then {
if(ace_sys_map_enabled) then {
[] call _errormapsystem;
};
};


6 changes: 6 additions & 0 deletions e12_amf_debugging/fnc_checkAMFSettings.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "script_component.hpp"

LOG("AMF Settings Check init");
if((!isNil "e12_amf_settings_internal") && (!isNil "e12_amf_settings_external")) then {
["e12 amf settings", "Internal _AND_ External Settings Modules are set, only use one of them"] call FUNC(debugMsg);
};
49 changes: 49 additions & 0 deletions e12_amf_debugging/fnc_checkDAC.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#include "script_component.hpp"

LOG("DAC Check init");
if(!isNil "e12_amf_dac_userscripts") then {
if(!IS_ARRAY(e12_amf_dac_userscripts)) then {
["e12 amf dac settings", "Userscripts 'e12_amf_dac_userscripts' is set but not an array, Recommendation:e12_amf_dac_userscripts=[{script1},{script2}]"] call FUNC(debugMsg);
}else{
{
if(!IS_CODE(_x)) then {
["e12 amf dac settings", format["Userscripts 'e12_amf_dac_userscripts' has an entry which is not executable code: '%1', Recommendation:e12_amf_dac_userscripts=[{[_this] execVM ""script.sqf""},{script2}]",_x]] call FUNC(debugMsg);
};

} foreach e12_amf_dac_userscripts;

};
};
if(!(isNil "DAC_Basic_Value")) then {
if(!isNil "DAC_Marker" && DAC_Marker != 0) then {
["dac settings", "DAC_Markers are visible, Recommendation: DAC_Marker=0"] call FUNC(debugMsg);
};

if(!isNil "DAC_Com_Values" && (DAC_Com_Values select 0 != 0) || (DAC_Com_Values select 1 != 1) || (DAC_Com_Values select 2 != 0)) then {
["dac settings", "DAC_Com_Values are changed, Recommendation: DAC_Com_Values=[0,1,0]"] call FUNC(debugMsg);
};

if(!isNil "DAC_STRPlayers" && IS_ARRAY(DAC_STRPlayers)) then {
//DAC_STRPlayers =
_missingunits = [];
_noname = 0;
{
TRACE_1("Unit name: ",vehicleVarName _x);
if(vehicleVarName _x != "" && !((vehicleVarName _x) in DAC_STRPlayers)) then {
PUSH(_missingunits, vehicleVarName _x);
};
if(vehicleVarName _x == "") then {
INC(_noname);
};
} foreach switchableUnits;

if(_noname > 0) then {
["dac settings", format["There are %1 Playable Units without a variable name needed for DAC",_noname]] call FUNC(debugMsg);
};
if(count _missingunits > 0) then {
["dac settings", format["There are %1 Playable Units without a valid variable name inside DAC_STRPlayers: %2", count _missingunits, str(_missingunits)]] call FUNC(debugMsg);
};
};
}else{
LOG("DAC not activated");
};
Loading

0 comments on commit 9065d89

Please sign in to comment.