diff --git a/addons/tagging/functions/fnc_addCustomTag.sqf b/addons/tagging/functions/fnc_addCustomTag.sqf index cb426493b36..6dccf3bfb2d 100644 --- a/addons/tagging/functions/fnc_addCustomTag.sqf +++ b/addons/tagging/functions/fnc_addCustomTag.sqf @@ -9,6 +9,7 @@ * 2: Required Item * 3: Textures Paths * 4: Icon Path (default: "") + * 5: Material Paths (optional) * * Return Value: * Sucessfully Added Tag @@ -24,7 +25,8 @@ params [ ["_displayName", "", [""]], ["_requiredItem", "", [""]], ["_textures", [], [[]]], - ["_icon", "", [""]] + ["_icon", "", [""]], + ["_materials", [], [[]]] ]; // Verify @@ -50,4 +52,4 @@ if (_textures isEqualTo []) exitWith { _identifier = [_identifier] call CBA_fnc_removeWhitespace; // Add -[QGVAR(applyCustomTag), [_identifier, _displayName, _requiredItem, _textures, _icon]] call CBA_fnc_globalEventJIP; +[QGVAR(applyCustomTag), [_identifier, _displayName, _requiredItem, _textures, _icon, _materials]] call CBA_fnc_globalEventJIP; diff --git a/addons/tagging/functions/fnc_addTagActions.sqf b/addons/tagging/functions/fnc_addTagActions.sqf index a5fdcd219ae..f9add50829a 100644 --- a/addons/tagging/functions/fnc_addTagActions.sqf +++ b/addons/tagging/functions/fnc_addTagActions.sqf @@ -19,7 +19,7 @@ params ["_unit"]; private _actions = []; { - _x params ["_class", "_displayName", "_requiredItem", "_textures", "_icon"]; + _x params ["_class", "_displayName", "_requiredItem", "_textures", "_icon", "_materials"]; _actions pushBack [ [ @@ -27,8 +27,18 @@ private _actions = []; _displayName, _icon, { - (_this select 2) params ["_unit", "_class", "_textures"]; - [_unit, selectRandom _textures] call FUNC(tag); + (_this select 2) params ["_unit", "_class", "_textures", "", "_materials"]; + + ( + if (count _textures == count _materials) then { + private _textureIndex = floor random count _textures; + [_textures select _textureIndex, _materials select _textureIndex] + } else { + [selectRandom _textures, selectRandom _materials] + } + ) params ["_randomTexture", "_randomMaterial"]; + + [_unit, _randomTexture, _randomMaterial] call FUNC(tag); _unit setVariable [QGVAR(lastUsedTag), _class]; }, { @@ -36,7 +46,7 @@ private _actions = []; _requiredItem in (_unit call EFUNC(common,uniqueItems)) }, {}, - [_unit, _class, _textures, _requiredItem] + [_unit, _class, _textures, _requiredItem, _materials] ] call EFUNC(interact_menu,createAction), [], _unit diff --git a/addons/tagging/functions/fnc_applyCustomTag.sqf b/addons/tagging/functions/fnc_applyCustomTag.sqf index be73d85021b..d7a14820a89 100644 --- a/addons/tagging/functions/fnc_applyCustomTag.sqf +++ b/addons/tagging/functions/fnc_applyCustomTag.sqf @@ -9,6 +9,7 @@ * 2: Required Item * 3: Textures Paths * 4: Icon Path (default: "") + * 5: Material Paths * * Return Value: * None diff --git a/addons/tagging/functions/fnc_compileConfigTags.sqf b/addons/tagging/functions/fnc_compileConfigTags.sqf index c9aaca95062..df9f01ac453 100644 --- a/addons/tagging/functions/fnc_compileConfigTags.sqf +++ b/addons/tagging/functions/fnc_compileConfigTags.sqf @@ -44,10 +44,12 @@ _failure = true; }; + private _materials = getArray (_x >> "materials"); + private _icon = getText (_x >> "icon"); if (!_failure) then { - GVAR(cachedTags) pushBack [_class, _displayName, _requiredItem, _textures, _icon]; + GVAR(cachedTags) pushBack [_class, _displayName, _requiredItem, _textures, _icon, _materials]; GVAR(cachedRequiredItems) pushBackUnique _requiredItem; }; } forEach ("true" configClasses (configFile >> "ACE_Tags")); diff --git a/addons/tagging/functions/fnc_createTag.sqf b/addons/tagging/functions/fnc_createTag.sqf index 296fc4503f6..5f2a60cf86a 100644 --- a/addons/tagging/functions/fnc_createTag.sqf +++ b/addons/tagging/functions/fnc_createTag.sqf @@ -9,6 +9,7 @@ * 2: Colour of the tag (valid colours are black, red, green and blue or full path to custom texture) * 3: Object it should be tied to * 4: Unit that created the tag + * 5: Material of the tag (Optional) * * Return Value: * Tag created @@ -19,7 +20,7 @@ * Public: No */ -params ["_tagPosASL", "_vectorDirAndUp", "_texture", "_object", "_unit"]; +params ["_tagPosASL", "_vectorDirAndUp", "_texture", "_object", "_unit", ["_material","",[""]]]; TRACE_5("createTag:",_tagPosASL,_vectorDirAndUp,_texture,_object,_unit); if (_texture == "") exitWith { @@ -29,9 +30,10 @@ if (_texture == "") exitWith { private _tag = createSimpleObject ["UserTexture1m_F", _tagPosASL]; _tag setObjectTextureGlobal [0, _texture]; +if (_material != "") then { _tag setObjectMaterialGlobal [0, _material] }; _tag setVectorDirAndUp _vectorDirAndUp; -// Throw a global event for mision makers +// Throw a global event for mission makers ["ace_tagCreated", [_tag, _texture, _object, _unit]] call CBA_fnc_globalEvent; if (isNull _object) exitWith {true}; diff --git a/addons/tagging/functions/fnc_quickTag.sqf b/addons/tagging/functions/fnc_quickTag.sqf index bb672ed9471..1939ce16798 100644 --- a/addons/tagging/functions/fnc_quickTag.sqf +++ b/addons/tagging/functions/fnc_quickTag.sqf @@ -49,5 +49,16 @@ if (GVAR(quickTag) == 3) then { // Tag if !(_possibleTags isEqualTo []) then { private _availableTags = _possibleTags select {(_x select 2) in (_unit call EFUNC(common,uniqueItems))}; - [_unit, selectRandom ((selectRandom _availableTags) select 3)] call FUNC(tag); + (selectRandom _availableTags) params ["", "", "", "_textures", "", "_materials"]; + + ( + if (count _textures == count _materials) then { + private _textureIndex = floor random count _textures; + [_textures select _textureIndex, _materials select _textureIndex] + } else { + [selectRandom _textures, selectRandom _materials] + } + ) params ["_randomTexture", "_randomMaterial"]; + + [_unit, _randomTexture, _randomMaterial] call FUNC(tag); }; diff --git a/addons/tagging/functions/fnc_tag.sqf b/addons/tagging/functions/fnc_tag.sqf index 2f129ece285..2e14906d43a 100644 --- a/addons/tagging/functions/fnc_tag.sqf +++ b/addons/tagging/functions/fnc_tag.sqf @@ -6,6 +6,7 @@ * Arguments: * 0: Unit * 1: The colour of the tag (valid colours are black, red, green and blue or full path to custom texture) + * 2: Material of the tag (Optional) * * Return Value: * Sucess @@ -18,7 +19,8 @@ params [ ["_unit", objNull, [objNull]], - ["_texture", "", [""]] + ["_texture", "", [""]], + ["_material", "", [""]] ]; if (isNull _unit || {_texture == ""}) exitWith { @@ -110,6 +112,6 @@ private _vectorDirAndUp = [_surfaceNormal vectorMultiply -1, _v3]; // Tell the server to create the tag and handle its destruction [QGVAR(createTag), _this] call CBA_fnc_serverEvent; -}, [_touchingPoint vectorAdd (_surfaceNormal vectorMultiply 0.06), _vectorDirAndUp, _texture, _object, _unit], 0.6] call CBA_fnc_waitAndExecute; +}, [_touchingPoint vectorAdd (_surfaceNormal vectorMultiply 0.06), _vectorDirAndUp, _texture, _object, _unit, _material], 0.6] call CBA_fnc_waitAndExecute; true