Item interaction support for ConfigFile fallback

Experimental EPOCH_returnConfigV2 function that allows falling back to
configFile if specific config class does not exist in missionConfig.
This commit is contained in:
vbawol 2016-11-26 10:21:37 -06:00
parent 8e1d960496
commit 7c7f8a4aa0
4 changed files with 41 additions and 2 deletions

View File

@ -19,7 +19,8 @@ private ["_buildClass","_buildingCountLimit","_buildingJammerRange","_canCapacit
EPOCH_InteractedItem params ["_text","_item","_pic"];
_cfgBaseBuilding = 'CfgBaseBuilding' call EPOCH_returnConfig;
_cfgItemInteractions = (('CfgItemInteractions' call EPOCH_returnConfig) >> _item);
_cfgItemInteractions = ["CfgItemInteractions", _item] call EPOCH_returnConfigV2;
// _cfgItemInteractions = (('CfgItemInteractions' call EPOCH_returnConfig) >> _item);
_interactOption = getNumber(_cfgItemInteractions >> "interactAction");
_interactAttributes = getArray(_cfgItemInteractions >> "interactAttributes");

View File

@ -0,0 +1,36 @@
/*
Author: Aaron Clark - EpochMod.com
Contributors:
Description:
Returns missionConfigFile if exists otherwise uses configFile
Licence:
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
Github:
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/functions/EPOCH_returnConfig.sqf
Example:
[['CfgCrafting', 'item1']] call EPOCH_returnConfigV2;
Parameter(s):
_this: ARRAY of STRING/s - Config class name Array
Returns:
CONFIG
*/
//[[[cog import generate_private_arrays ]]]
private ["_missionconfig","_return"];
//[[[end]]]
_return = configfile;
_missionconfig = missionConfigFile;
{
_return = (_return >> _x);
_missionconfig = (_missionconfig >> _x);
} forEach _this;
if (isClass _missionconfig) then{
_return = _missionconfig;
};
_return

View File

@ -21,7 +21,8 @@ _buttonTXT = "";
_magCount = 1;
_interactActions = [];
_config = (configfile >> "CfgWeapons" >> _data);
_cfgItemInteractions = (('CfgItemInteractions' call EPOCH_returnConfig) >> _data);
// _cfgItemInteractions = (('CfgItemInteractions' call EPOCH_returnConfig) >> _data);
_cfgItemInteractions = ["CfgItemInteractions", _data] call EPOCH_returnConfigV2;
if (isClass (_config)) then {
_type = getNumber (_config >> "type");
_interactOption = getNumber (_cfgItemInteractions >> "interactAction");

View File

@ -104,6 +104,7 @@ class CfgClientFunctions
{
class worldObjectType {};
class returnConfig {};
class returnConfigV2 {};
class colorRange {};
class convertTemp {};
class fnc_playerDeath {};