mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
First draft
This commit is contained in:
parent
12cadc603f
commit
d7e43ce28e
1
addons/modules/$PBOPREFIX$
Normal file
1
addons/modules/$PBOPREFIX$
Normal file
@ -0,0 +1 @@
|
||||
z\ace\addons\blank
|
13
addons/modules/CfgEventHandlers.hpp
Normal file
13
addons/modules/CfgEventHandlers.hpp
Normal 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));
|
||||
};
|
||||
};
|
44
addons/modules/XEH_postInit.sqf
Normal file
44
addons/modules/XEH_postInit.sqf
Normal 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);
|
8
addons/modules/XEH_preInit.sqf
Normal file
8
addons/modules/XEH_preInit.sqf
Normal file
@ -0,0 +1,8 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
ADDON = false;
|
||||
|
||||
PREP(moduleInit);
|
||||
GVAR(moduleInitCollection) = [];
|
||||
|
||||
ADDON = true;
|
28
addons/modules/config.cpp
Normal file
28
addons/modules/config.cpp
Normal 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"
|
19
addons/modules/functions/fnc_moduleInit.sqf
Normal file
19
addons/modules/functions/fnc_moduleInit.sqf
Normal 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);
|
||||
};
|
1
addons/modules/functions/script_component.hpp
Normal file
1
addons/modules/functions/script_component.hpp
Normal file
@ -0,0 +1 @@
|
||||
#include "\z\ace\addons\modules\script_component.hpp"
|
12
addons/modules/script_component.hpp
Normal file
12
addons/modules/script_component.hpp
Normal 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"
|
Loading…
Reference in New Issue
Block a user