move to cfg, update createbox, create /defines
This commit is contained in:
@@ -5,24 +5,28 @@ if ( !hasInterface ) exitWith {};
|
||||
"Create Resupply Box",
|
||||
{
|
||||
params [["_pos", [0,0,0], [[]], 3], ["_target", objNull, [objNull]]];
|
||||
_keysSorted = keys milsim_resupply_crateDefinitions;
|
||||
_keysSorted sort true;
|
||||
_comboOptions = [];
|
||||
_comboOptions resize (count _keysSorted);
|
||||
for "_i" from 0 to (count _keysSorted) - 1 do {
|
||||
private _definition = milsim_resupply_crateDefinitions get (_keysSorted select _i);
|
||||
_comboOptions set [_i, [
|
||||
_definition getOrDefault ["displayName", "ERROR"], // display name
|
||||
_definition getOrDefault ["description", "No description"], // tooltip
|
||||
_definition getOrDefault ["icon", "No icon"] // icon
|
||||
]];
|
||||
// get parent definition
|
||||
private _supplyCratesCfg = call milsim_resupply_fnc_getSupplyCratesCfg;
|
||||
// get the subclass names
|
||||
private _boxTypesAvailable = _supplyCratesCfg call BIS_fnc_getCfgSubClasses;
|
||||
|
||||
_boxTypesAvailable sort true;
|
||||
_comboOptions = _boxTypesAvailable apply {
|
||||
[
|
||||
// display name
|
||||
[_supplyCratesCfg >> _x >> "displayName", "STRING", "ERROR"] call CBA_fnc_getConfigEntry,
|
||||
// tooltip
|
||||
[_supplyCratesCfg >> _x >> "tooltip", "STRING", "ERROR"] call CBA_fnc_getConfigEntry,
|
||||
// icon
|
||||
[_supplyCratesCfg >> _x >> "icon", "STRING", "ERROR"] call CBA_fnc_getConfigEntry
|
||||
]
|
||||
};
|
||||
|
||||
[
|
||||
"Resupply Box Options",
|
||||
[
|
||||
// [ "COMBO", "Box Type", [[1,2,3], [["Ammo"],["Weapons"],["Medical"]],0] ]
|
||||
["COMBO", "Box Type", [_keysSorted, _comboOptions, 0]]
|
||||
["COMBO", "Box Type", [_boxTypesAvailable, _comboOptions, 0]]
|
||||
],
|
||||
{
|
||||
|
||||
@@ -32,14 +36,14 @@ if ( !hasInterface ) exitWith {};
|
||||
_args params ["_pos", "_target", "_keysSorted"];
|
||||
|
||||
|
||||
private _box = [_target, _typeOptionSelected, _pos] call milsim_fnc_createBox;
|
||||
private _box = [_target, _typeOptionSelected, _pos] call milsim_resupply_fnc_createBox;
|
||||
if (isNull _box) exitWith {
|
||||
["Resupply Box", "WARNING: Failed to locate or create box!"] call BIS_fnc_curatorHint;
|
||||
};
|
||||
["Resupply Box", format["Created a %1 box", _typeOptionSelected]] call BIS_fnc_curatorHint;
|
||||
["Resupply Box", format["Created box from class %1", _typeOptionSelected]] call BIS_fnc_curatorHint;
|
||||
},
|
||||
{},
|
||||
[_pos, _target, _options]
|
||||
[_pos, _target]
|
||||
] call zen_dialog_fnc_create;
|
||||
}
|
||||
] call zen_custom_modules_fnc_register;
|
||||
|
||||
Reference in New Issue
Block a user