First draft

This commit is contained in:
Glowbal 2015-03-22 12:39:26 +01:00
parent 12cadc603f
commit d7e43ce28e
8 changed files with 126 additions and 0 deletions

View File

@ -0,0 +1 @@
z\ace\addons\blank

View File

@ -0,0 +1,13 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};
class Extended_PostInit_EventHandlers {
class _ACE_modules { // using a _ so it is the first postInit to be executed
init = QUOTE(call COMPILE_FILE(XEH_postInit));
};
};

View File

@ -0,0 +1,44 @@
#include "script_component.hpp"
// TODO This is a basic and limited implementation that mimics some of the functionality from the A3 module framework, but not all of it.
// We have to execute this in the postInit XEH because on object init, the parameters of the modules are not yet available. They are if we execute it at the start of postInit execution.
{
[_x] call {
private ["_logic", "_logicType", "_config", "_isGlobal", "_isDisposable", "_isPersistent","_function"];
_logic = _this select 0;
_logicType = typeof _logic;
_logic hideobject true;
if (_logic getvariable [QGVAR(initalized), false]) exitwith {};
_config = (configFile >> "CfgVehicles" >> _logicType);
if !(isClass _config) exitwith {};
// isGlobal = 1;
_isGlobal = getNumber (_config >> "isGlobal") > 0;
_isDisposable = getNumber (_config >> "isDisposable") > 0;
_isPersistent = getNumber (_config >> "isPersistent") > 0 || getnumber (_config >> "isGlobal") > 1;
_function = getText (_config >> "function");
if (isnil _function) then {
_function = compile _function;
} else {
_function = missionNamespace getvariable _function;
};
if (_isGlobal) then {
[_logic, [], true] call _function;
} else {
if (isServer) then {
[_logic, [], true] call _function;
};
};
if !(_isPersistent) then {
_logic setvariable [QGVAR(initalized), true];
};
if (_isDisposable) then {
deleteVehicle _logic;
};
};
}foreach GVAR(moduleInitCollection);

View File

@ -0,0 +1,8 @@
#include "script_component.hpp"
ADDON = false;
PREP(moduleInit);
GVAR(moduleInitCollection) = [];
ADDON = true;

28
addons/modules/config.cpp Normal file
View File

@ -0,0 +1,28 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common"};
author[] = {"Glowbal"};
authorUrl = "";
VERSION_CONFIG;
};
};
class CfgVehicles {
class Logic;
class Module_F: Logic {
class ArgumentsBaseUnits {
};
};
class ACE_Module: Module_F {
class EventHandlers {
init = QUOTE(_this call DFUNC(moduleInit));
};
};
};
#include "CfgEventHandlers.hpp"

View File

@ -0,0 +1,19 @@
/*
* Author: Glowbal
* IV Treatment local callback
*
* Arguments:
* 0: The logic object <OBJECT>
*
*
* Return Value:
* nil
*
* Public: No
*/
#include "script_component.hpp"
if ((_this select 0) isKindOf "Module_F") then {
GVAR(moduleInitCollection) pushback (_this select 0);
};

View File

@ -0,0 +1 @@
#include "\z\ace\addons\modules\script_component.hpp"

View File

@ -0,0 +1,12 @@
#define COMPONENT modules
#include "\z\ace\addons\main\script_mod.hpp"
#ifdef DEBUG_ENABLED_MODULES
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_MODULES
#define DEBUG_SETTINGS DEBUG_SETTINGS_MODULES
#endif
#include "\z\ace\addons\main\script_macros.hpp"