Skip to content

Commit

Permalink
General - Fix and apply HEMTT suggestions (#792)
Browse files Browse the repository at this point in the history
  • Loading branch information
Timi007 authored Jan 30, 2025
1 parent a952920 commit f3d0e2e
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 30 deletions.
12 changes: 12 additions & 0 deletions .hemtt/lints.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,15 @@
options.ignore = [
"addPublicVariableEventHandler", # Alt syntax is broken, we are using main syntax
]

[sqf.var_all_caps]
options.ignore = [
# Debug macros
"ZEN_COUNTERS",
"ZEN_PFH_COUNTER",
"ZEN_PREP_RECOMPILE",
"ZEN_RECOMPILES",

# External variables
"AR_SUPPORTED_VEHICLES"
]
2 changes: 1 addition & 1 deletion addons/ai/functions/fnc_canThrowGrenade.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ params [["_unit", objNull, [objNull]], ["_magazine", "", [""]]];

alive _unit
&& {!isPlayer _unit}
&& {vehicle _unit == _unit}
&& {isNull objectParent _unit}
&& {_unit isKindOf "CAManBase"}
&& {lifeState _unit in ["HEALTHY", "INJURED"]}
&& {!(_unit call EFUNC(common,isSwimming))}
Expand Down
2 changes: 1 addition & 1 deletion addons/ai/functions/fnc_garrison.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ if (_topDown) then {
};

{
if (vehicle _x != _x) then {
if (!isNull objectParent _x) then {
moveOut _x;
};
} forEach _units;
Expand Down
4 changes: 2 additions & 2 deletions addons/ai/functions/fnc_searchBuilding.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private _groupState = [formation _group, behaviour _leader, speedMode _group, co
private _stances = [];

{
if (alive _x && {vehicle _x == _x} && {!isPlayer _x}) then {
if (alive _x && {isNull objectParent _x} && {!isPlayer _x}) then {
_stances pushBack [_x, unitPos _x];
[QEGVAR(common,setUnitPos), [_x, "UP"], _x] call CBA_fnc_targetEvent;
};
Expand All @@ -54,7 +54,7 @@ private _stances = [];

// Refresh units in case some died or left/joined the group
private _units = units _group select {
alive _x && {vehicle _x == _x} && {!isPlayer _x}
alive _x && {isNull objectParent _x} && {!isPlayer _x}
};

// Exit the search if the group has no units left
Expand Down
10 changes: 5 additions & 5 deletions addons/area_markers/functions/fnc_applyProperties.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@ private _marker = _ctrlConfigure getVariable [QGVAR(marker), ""];

private _sizeA = parseNumber ctrlText (_ctrlConfigure controlsGroupCtrl IDC_CONFIGURE_SIZE_A);
private _sizeB = parseNumber ctrlText (_ctrlConfigure controlsGroupCtrl IDC_CONFIGURE_SIZE_B);
_marker setMarkerSize [_sizeA, _sizeB];
_marker setMarkerSizeLocal [_sizeA, _sizeB];

private _ctrlRotationSlider = _ctrlConfigure controlsGroupCtrl IDC_CONFIGURE_ROTATION_SLIDER;
private _rotation = sliderPosition _ctrlRotationSlider;
_marker setMarkerDir _rotation;
_marker setMarkerDirLocal _rotation;

private _ctrlShape = _ctrlConfigure controlsGroupCtrl IDC_CONFIGURE_SHAPE;
private _shape = ["RECTANGLE", "ELLIPSE"] select lbCurSel _ctrlShape;
_marker setMarkerShape _shape;
_marker setMarkerShapeLocal _shape;

private _ctrlBrush = _ctrlConfigure controlsGroupCtrl IDC_CONFIGURE_BRUSH;
private _brush = _ctrlBrush lbData lbCurSel _ctrlBrush;
_marker setMarkerBrush _brush;
_marker setMarkerBrushLocal _brush;

private _ctrlColor = _ctrlConfigure controlsGroupCtrl IDC_CONFIGURE_COLOR;
private _color = _ctrlColor lbData lbCurSel _ctrlColor;
_marker setMarkerColor _color;
_marker setMarkerColorLocal _color;

private _ctrlAlphaSlider = _ctrlConfigure controlsGroupCtrl IDC_CONFIGURE_ALPHA_SLIDER;
private _alpha = sliderPosition _ctrlAlphaSlider;
Expand Down
2 changes: 1 addition & 1 deletion addons/area_markers/functions/fnc_createMarker.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
params ["_position", ["_shape", "RECTANGLE"]];

private _marker = createMarker [format [QGVAR(%1), GVAR(nextID)], _position];
_marker setMarkerShape _shape;
_marker setMarkerShapeLocal _shape;
_marker setMarkerSize [50, 50];

GVAR(nextID) = GVAR(nextID) + 1;
2 changes: 1 addition & 1 deletion addons/common/functions/fnc_displayCuratorLoad.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
params ["_display"];

// Remove "Gear" animation when entering Zeus
if (GVAR(disableGearAnim) && {vehicle player == player}) then {
if (GVAR(disableGearAnim) && {isNull objectParent player}) then {
[{player switchMove _this}, animationState player] call CBA_fnc_execNextFrame;
};

Expand Down
2 changes: 1 addition & 1 deletion addons/common/functions/fnc_serializeObjects.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ params [["_objects", [], [[]]], ["_centerPos", nil, [[]], [2, 3]], ["_includeWay

// Filter destroyed objects and any objects that are attached to or "part of" another
// The data for these objects will be included in the parent object's data
_objects = _objects select {alive _x && {vehicle _x == _x} && {isNull attachedTo _x} && {isNull ropeAttachedTo _x}};
_objects = _objects select {alive _x && {isNull objectParent _x} && {isNull attachedTo _x} && {isNull ropeAttachedTo _x}};
_objects = _objects arrayIntersect _objects;

// Find the center position of all objects if one is not given
Expand Down
8 changes: 4 additions & 4 deletions addons/common/gui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ class GVAR(RscCheckbox): RscCheckBox {
y = 0;
w = QUOTE(POS_W(1));
h = QUOTE(POS_H(1));
soundClick[] = {"\a3\ui_f\data\sound\rscbutton\soundclick", 0.09, 1};
soundEnter[] = {"\a3\ui_f\data\sound\rscbutton\soundenter", 0.09, 1};
soundEscape[] = {"\a3\ui_f\data\sound\rscbutton\soundescape", 0.09, 1};
soundPush[] = {"\a3\ui_f\data\sound\rscbutton\soundpush", 0.09, 1};
soundClick[] = {"\a3\ui_f\data\sound\rscbutton\soundclick.wss", 0.09, 1};
soundEnter[] = {"\a3\ui_f\data\sound\rscbutton\soundenter.wss", 0.09, 1};
soundEscape[] = {"\a3\ui_f\data\sound\rscbutton\soundescape.wss", 0.09, 1};
soundPush[] = {"\a3\ui_f\data\sound\rscbutton\soundpush.wss", 0.09, 1};
};

class GVAR(RscCombo): RscCombo {
Expand Down
2 changes: 1 addition & 1 deletion addons/context_actions/functions/fnc_teleportZeus.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
if (_hoveredEntity isEqualType objNull && {_hoveredEntity isKindOf "AllVehicles"} && {!(_hoveredEntity isKindOf "CAManBase")}) then {
[[player], _hoveredEntity] call EFUNC(common,teleportIntoVehicle);
} else {
if (vehicle player != player) then {
if (!isNull objectParent player) then {
moveOut player;
};

Expand Down
22 changes: 11 additions & 11 deletions addons/cover_map/functions/fnc_create.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ _size params [
];

private _markerCover = createMarker [format [QGVAR(cover_%1), _x], _coverPos];
_markerCover setMarkerShape "RECTANGLE";
_markerCover setMarkerBrush "Solid";
_markerCover setMarkerColor "ColorBlack";
_markerCover setMarkerSize [_sizeMarker, SIZE_OUT - _sizeA];
_markerCover setMarkerShapeLocal "RECTANGLE";
_markerCover setMarkerBrushLocal "Solid";
_markerCover setMarkerColorLocal "ColorBlack";
_markerCover setMarkerSizeLocal [_sizeMarker, SIZE_OUT - _sizeA];
_markerCover setMarkerDir _direction;

private _dotPos = [
Expand All @@ -63,16 +63,16 @@ _size params [
];

private _markerDot = createMarker [format [QGVAR(dot_%1), _x], _dotPos];
_markerDot setMarkerColor "ColorBlack";
_markerDot setMarkerType "mil_box_noShadow";
_markerDot setMarkerSize [0.75, 0.75];
_markerDot setMarkerColorLocal "ColorBlack";
_markerDot setMarkerTypeLocal "mil_box_noShadow";
_markerDot setMarkerSizeLocal [0.75, 0.75];
_markerDot setMarkerDir _direction;
} forEach [0, 90, 180, 270];

// Create border marker
private _markerBorder = createMarker [QGVAR(border), [_centerX, _centerY]];
_markerBorder setMarkerShape "RECTANGLE";
_markerBorder setMarkerBrush "Border";
_markerBorder setMarkerColor "ColorBlack";
_markerBorder setMarkerSize [_sizeX, _sizeY];
_markerBorder setMarkerShapeLocal "RECTANGLE";
_markerBorder setMarkerBrushLocal "Border";
_markerBorder setMarkerColorLocal "ColorBlack";
_markerBorder setMarkerSizeLocal [_sizeX, _sizeY];
_markerBorder setMarkerDir _angle;
2 changes: 1 addition & 1 deletion addons/editor/initKeybinds.inc.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@
[[ELSTRING(main,DisplayName), LSTRING(AIControl)], QGVAR(toggleAIPATH), [LSTRING(ToggleAIPATH), LSTRING(ToggleAIPATH_Description)], {
if (!isNull curatorCamera && {!GETMVAR(RscDisplayCurator_search,false)}) then {
{
if (!isPlayer _x && {_x == vehicle _x || {_x == driver vehicle _x}}) then {
if (!isPlayer _x && {isNull objectParent _x || {_x == driver vehicle _x}}) then {
private _isPathEnabled = _x checkAIFeature "PATH";
private _eventName = [QEGVAR(common,enableAI), QEGVAR(common,disableAI)] select _isPathEnabled;
[_eventName, [_x, "PATH"], _x] call CBA_fnc_globalEvent;
Expand Down
2 changes: 1 addition & 1 deletion addons/modules/functions/fnc_moduleTeleportPlayers.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ params ["_logic"];
} else {
// Need special handling for players in vehicles
// Without this they are teleported back inside the vehicle
if (_x isKindOf "CAManBase" && {vehicle _x != _x}) then {
if (_x isKindOf "CAManBase" && {!isNull objectParent _x}) then {
[QGVAR(teleportOutOfVehicle), [_x, _position], _x] call CBA_fnc_targetEvent;
} else {
_x setVehiclePosition [_position, [], 0, "NONE"];
Expand Down

0 comments on commit f3d0e2e

Please sign in to comment.