Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Common - Add ability to check for skill levels for isMedic and isEngineer #10500

Merged
merged 3 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions addons/common/functions/fnc_isEngineer.sqf
DartRuffian marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#include "..\script_component.hpp"
/*
* Author: marc_book, edited by commy2
* Author: marc_book, commy2, DartRuffian
* Checks if a unit is an engineer.
*
* Arguments:
* 0: unit to be checked <OBJECT>
* 0: Unit to be checked <OBJECT>
* 1: Engineer level <NUMBER><OPTIONAL>
* - Only relevant if ace_repair is loaded
*
* Return Value:
* is the unit an engineer <BOOL>
Expand All @@ -15,10 +17,10 @@
* Public: Yes
*/

params ["_unit"];
params ["_unit", ["_engineerN", 1]];

private _isEngineer = _unit getVariable ["ACE_isEngineer", _unit getUnitTrait "engineer"];
//Handle ace_repair modules setting this to a number
if (_isEngineer isEqualType 0) then {_isEngineer = _isEngineer > 0};
// Handle ace_repair modules setting this to a number
if (_isEngineer isEqualType 0) then {_isEngineer = _isEngineer >= _engineerN};

_isEngineer
8 changes: 5 additions & 3 deletions addons/common/functions/fnc_isMedic.sqf
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#include "..\script_component.hpp"
/*
* Author: kymckay
* Author: kymckay, DartRuffian
* Check if a unit is a medic
*
* Arguments:
* 0: The Unit <OBJECT>
* 1: Medic level <NUMBER><OPTIONAL>
DartRuffian marked this conversation as resolved.
Show resolved Hide resolved
* - Only relevant if ace_medical is loaded
*
* Return Value:
* Unit is medic <BOOL>
Expand All @@ -15,8 +17,8 @@
* Public: Yes
*/

params ["_unit"];
params ["_unit", ["_medicN", 1]];

private _isMedic = _unit getVariable [QEGVAR(medical,medicClass), getNumber (configOf _unit >> "attendant")];

_isMedic > 0
_isMedic >= _medicN