2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-04-22 19:01:22 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal, KoffeinFlummi, commy2
|
2015-08-16 18:14:54 +00:00
|
|
|
* Check if a unit is any engineer class.
|
2015-04-22 19:01:22 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2015-08-16 18:14:54 +00:00
|
|
|
* 0: Unit <OBJECT>
|
2015-08-16 21:05:26 +00:00
|
|
|
* 1: Class <NUMBER> (default: 1)
|
2015-04-22 19:01:22 +00:00
|
|
|
*
|
2015-08-16 18:14:54 +00:00
|
|
|
* Return Value:
|
|
|
|
* Is Engineer Class <BOOL>
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [unit, 1] call ace_repair_fnc_isEngineer
|
2015-04-22 19:01:22 +00:00
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*/
|
|
|
|
|
2015-08-09 06:54:44 +00:00
|
|
|
params ["_unit", ["_engineerN", 1]];
|
2015-04-22 19:01:22 +00:00
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _class = _unit getVariable ["ACE_IsEngineer", _unit getUnitTrait "engineer"];
|
2015-04-22 19:01:22 +00:00
|
|
|
|
2015-08-14 18:49:51 +00:00
|
|
|
// This if statement is here for copmatability with the common variant of isEngineer, which requires a bool.
|
|
|
|
// We cannot move this function to common because we require the GVAR(engineerSetting_Repair), which only makes sense to include in the repair module.
|
2024-02-04 17:50:24 +00:00
|
|
|
if (_class isEqualType false) then {_class = parseNumber _class};
|
2015-04-22 19:01:22 +00:00
|
|
|
|
2018-04-19 17:31:00 +00:00
|
|
|
TRACE_3("isEngineer",_unit,_engineerN,_class);
|
2021-10-12 20:53:45 +00:00
|
|
|
if (_class >= _engineerN) exitWith {true};
|
|
|
|
if (!GVAR(locationsBoostTraining)) exitWith {false};
|
|
|
|
|
|
|
|
if ([_unit] call FUNC(isInRepairFacility) || {[_unit] call FUNC(isNearRepairVehicle)}) then {
|
|
|
|
_class = _class + 1; // Boost engineer training by one: untrained becomes engineer, engineer becomes advanced engineer
|
|
|
|
};
|
|
|
|
|
|
|
|
_class >= _engineerN
|