Tagging - Allow tagging vehicles (overwrite "clan" tag) (#8852)

* Tagging - Allow tagging vehicles (overwrite "clan" tag, req 2.10)

* Update addons/tagging/functions/fnc_createTag.sqf

Co-authored-by: Neil Evers <neil.evers.1995@gmail.com>

* fix var

* set REQUIRED_VERSION to 2.10

* don't tag if veh has no valid selectionClan

Co-authored-by: Neil Evers <neil.evers.1995@gmail.com>
This commit is contained in:
PabstMirror 2022-09-04 16:38:09 -05:00 committed by GitHub
parent 66801bb0ed
commit a339074659
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 38 additions and 5 deletions

View File

@ -10,7 +10,7 @@
#define VERSION_AR MAJOR,MINOR,PATCHLVL,BUILD
// MINIMAL required version for the Mod. Components can specify others..
#define REQUIRED_VERSION 2.08
#define REQUIRED_VERSION 2.10
#define REQUIRED_CBA_VERSION {3,15,7}
#ifdef COMPONENT_BEAUTIFIED

View File

@ -53,6 +53,17 @@ class CfgVehicles {
};
};
class LandVehicle;
class Car: LandVehicle {
GVAR(canTag) = 1;
};
class Tank: LandVehicle {
GVAR(canTag) = 1;
};
class Air;
class Helicopter: Air {
GVAR(canTag) = 1;
};
class Item_Base_F;
class ACE_Item_SpraypaintBlack: Item_Base_F {

View File

@ -42,6 +42,12 @@
// If the class is alright, do not exit
if (_object isKindOf "Static") exitWith {false};
// Taggable vehicle, do not exit
if (((_object getVariable [QGVAR(canTag), getNumber (configOf _object >> QGVAR(canTag))]) in [1, true])
&& {getText (configOf _object >> "selectionClan") in selectionNames _object}) exitWith {
false
};
// If the class is not categorized correctly search the cache
private _modelName = (getModelInfo _object) select 0;
private _isStatic = GVAR(cacheStaticModels) getVariable [_modelName, false];

View File

@ -10,6 +10,7 @@
* 3: Object it should be tied to <OBJECT>
* 4: Unit that created the tag <OBJECT>
* 5: Material of the tag <STRING> (Optional)
* 6: Vehicle Tag <BOOL> (Optional)
*
* Return Value:
* Tag created <BOOL>
@ -20,7 +21,7 @@
* Public: No
*/
params ["_tagPosASL", "_vectorDirAndUp", "_texture", "_object", "_unit", ["_material","",[""]], ["_tagModel", "UserTexture1m_F", [""]]];
params ["_tagPosASL", "_vectorDirAndUp", "_texture", "_object", "_unit", ["_material","",[""]], ["_tagModel", "UserTexture1m_F", [""]], ["_isVehicleTag", false, [false]]];
TRACE_5("createTag:",_tagPosASL,_vectorDirAndUp,_texture,_object,_unit);
if (_texture == "") exitWith {
@ -28,6 +29,12 @@ if (_texture == "") exitWith {
false
};
if (_isVehicleTag) exitWith {
TRACE_3("tagging vehicle",_object,typeOf _object,_texture);
_object setObjectTextureGlobal [getText (configOf _object >> "selectionClan"), _texture];
// if (_material != "") then { _object setObjectMaterialGlobal ["clan", _material] }; // ??
};
private _tag = createSimpleObject [_tagModel, _tagPosASL];
_tag setObjectTextureGlobal [0, _texture];
if (_material != "") then { _tag setObjectMaterialGlobal [0, _material] };

View File

@ -29,6 +29,7 @@ if (isNull _unit || {_texture == ""}) exitWith {
ERROR_2("Tag parameters invalid. Unit: %1, Texture: %2",_unit,_texture);
};
private _isVehicleTag = false;
private _startPosASL = eyePos _unit;
private _cameraPosASL = AGLToASL positionCameraToWorld [0, 0, 0];
private _cameraDir = (AGLToASL positionCameraToWorld [0, 0, 1]) vectorDiff _cameraPosASL;
@ -51,6 +52,13 @@ if ((!isNull _object) && {
// If the class is alright, do not exit
if (_object isKindOf "Static") exitWith {false};
// Taggable vehicle, do not exit and tell server to change "clan" tag
if (((_object getVariable [QGVAR(canTag), getNumber (configOf _object >> QGVAR(canTag))]) in [1, true])
&& {getText (configOf _object >> "selectionClan") in selectionNames _object}) exitWith {
_isVehicleTag = true;
false
};
// If the class is not categorized correctly search the cache
private _modelName = (getModelInfo _object) select 0;
private _isStatic = GVAR(cacheStaticModels) getVariable [_modelName, false];
@ -100,10 +108,11 @@ private _fnc_isOk = {
true
};
if ( !([ 0.5 * TAG_SIZE, 0.5 * TAG_SIZE] call _fnc_isOk) ||
if ( (!_isVehicleTag) && {
!([ 0.5 * TAG_SIZE, 0.5 * TAG_SIZE] call _fnc_isOk) ||
{!([ 0.5 * TAG_SIZE,-0.5 * TAG_SIZE] call _fnc_isOk) ||
{!([-0.5 * TAG_SIZE, 0.5 * TAG_SIZE] call _fnc_isOk) ||
{!([-0.5 * TAG_SIZE,-0.5 * TAG_SIZE] call _fnc_isOk)}}}) exitWith {
{!([-0.5 * TAG_SIZE,-0.5 * TAG_SIZE] call _fnc_isOk)}}}}) exitWith {
TRACE_1("Unsuitable location:",_touchingPoint);
false
};
@ -120,6 +129,6 @@ if ( !([ 0.5 * TAG_SIZE, 0.5 * TAG_SIZE] call _fnc_isOk) ||
// 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, _material, _tagModel], 0.6] call CBA_fnc_waitAndExecute;
}, [_touchingPoint vectorAdd (_surfaceNormal vectorMultiply 0.06), _vectorDirAndUp, _texture, _object, _unit, _material, _tagModel, _isVehicleTag], 0.6] call CBA_fnc_waitAndExecute;
true