<commit_before>#include "hull_macros.h"

#define GEAR_TEMPLATE_CONTAINER_CLASS       "HullGearTemplates"
#define GEAR_TEMPLATE_BASE_CLASS            "Rifleman"



hull_gear_fnc_assign = {
    FUN_ARGS_3(_unit,_manualClass,_manualTemplate);

    if (!([_unit, _manualClass, _manualTemplate] call hull_gear_fnc_validateTemplate)) then {
        private ["_template", "_class"];
        _template = [faction _unit, _manualTemplate] call hull_gear_fnc_getTemplate;
        _class = [_template, _manualClass] call hull_gear_fnc_getClass;
        [_unit, _class, _template] call hull_gear_fnc_assignInit;
        [_unit, _class, _template] call hull_gear_fnc_assignTemplate;
    };
};

hull_gear_fnc_assignInit = {
    FUN_ARGS_3(_unit,_class,_template);

    _unit setVariable ["hull_gear_class", _class, true];
    _unit setVariable ["hull_gear_template", _template, true];
    removeAllWeapons _unit;
    removeBackpack _unit;
    [_unit] call hull_gear_fnc_removeNVGs;
};

hull_gear_fnc_removeNVGs = {
    FUN_ARGS_1(_unit);

    private "_nvgs" = ["NVGoggles", "NVGoggles_OPFOR", "NVGoggles_INDEP"];
    {
        _unit unassignItem _x;
        _unit removeItem _x;
    } foreach _nvgs;
};

hull_gear_fnc_getTemplate = {
    FUN_ARGS_2(_faction,_manualTemplate);

    private "_template";
    _template = _manualTemplate;
    if (isNil {_template} || {!isClass (HULL_CONFIGFILE >> _manualTemplate)}) then {
        _template = [_faction] call hull_gear_fnc_getTemplateByFaction;
    };

    _template;
};

hull_gear_fnc_getClass = {
    FUN_ARGS_2(_template,_manualClass);

    if (!isClass (HULL_CONFIGFILE >> _template >> _manualClass)) then {
        GEAR_TEMPLATE_BASE_CLASS;
    } else {
        _manualClass;
    };
};

hull_gear_fnc_getTemplateByFaction = {
    FUN_ARGS_1(_faction);<commit_msg>fixed declaration bug for nvg removal<commit_after>#include "hull_macros.h"

#define GEAR_TEMPLATE_CONTAINER_CLASS       "HullGearTemplates"
#define GEAR_TEMPLATE_BASE_CLASS            "Rifleman"



hull_gear_fnc_assign = {
    FUN_ARGS_3(_unit,_manualClass,_manualTemplate);

    if (!([_unit, _manualClass, _manualTemplate] call hull_gear_fnc_validateTemplate)) then {
        private ["_template", "_class"];
        _template = [faction _unit, _manualTemplate] call hull_gear_fnc_getTemplate;
        _class = [_template, _manualClass] call hull_gear_fnc_getClass;
        [_unit, _class, _template] call hull_gear_fnc_assignInit;
        [_unit, _class, _template] call hull_gear_fnc_assignTemplate;
    };
};

hull_gear_fnc_assignInit = {
    FUN_ARGS_3(_unit,_class,_template);

    _unit setVariable ["hull_gear_class", _class, true];
    _unit setVariable ["hull_gear_template", _template, true];
    removeAllWeapons _unit;
    removeBackpack _unit;
    [_unit] call hull_gear_fnc_removeNVGs;
};

hull_gear_fnc_removeNVGs = {
    FUN_ARGS_1(_unit);

    private "_nvgs";
    _nvgs = ["NVGoggles", "NVGoggles_OPFOR", "NVGoggles_INDEP"];
    {
        _unit unassignItem _x;
        _unit removeItem _x;
    } foreach _nvgs;
};

hull_gear_fnc_getTemplate = {
    FUN_ARGS_2(_faction,_manualTemplate);

    private "_template";
    _template = _manualTemplate;
    if (isNil {_template} || {!isClass (HULL_CONFIGFILE >> _manualTemplate)}) then {
        _template = [_faction] call hull_gear_fnc_getTemplateByFaction;
    };

    _template;
};

hull_gear_fnc_getClass = {
    FUN_ARGS_2(_template,_manualClass);

    if (!isClass (HULL_CONFIGFILE >> _template >> _manualClass)) then {
        GEAR_TEMPLATE_BASE_CLASS;
    } else {
        _manualClass;
    };
};

hull_gear_fnc_getTemplateByFaction = {
    FUN_ARGS_1(_faction);
{'fraction_non_alphanumeric': 0.09870772614792411, 'fraction_numerical': 0.003299422601044817, 'mean_word_length': 4.1167369901547115, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1967185', 'n_tokens_mistral': 1376, 'n_tokens_neox': 1301, 'n_words': 217}