Skip to content

Commit

Permalink
Update HEMTT and tools + lint cleanup (#104)
Browse files Browse the repository at this point in the history
* Update HEMTT & tools

* Fix unused format param

* Config duplication

* Remove unnecessary macro padding

* Fix command casing

* Use select instead of if

* Remove repeated calls to global marker

* Sort stringtables

* Add (not exactly) missing semicolon

* Add missing `isNotEqualTo` keyword to validator

* Replace multi-line with single-line comment

* List files with docblock

* Validate only fnc_*.sqf files

* Fix return types

* Fix stringtable validator prefix
  • Loading branch information
3Mydlo3 authored Dec 27, 2024
1 parent 01473e2 commit 9cc62c3
Show file tree
Hide file tree
Showing 74 changed files with 760 additions and 504 deletions.
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners
#
* @ArmaForces/sqf-devs
38 changes: 38 additions & 0 deletions .github/labels.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[
{
"name": "bug",
"color": "#d73a4a",
"description": "Something isn't working"
},
{
"name": "bugfix",
"color": "#52ed47",
"description": "Fixes something wasn't working"
},
{
"name": "documentation",
"color": "#0075ca",
"description": "Improvements or additions to documentation"
},
{
"name": "duplicate",
"color": "#cfd3d7",
"description": "This issue or pull request already exists"
},
{
"name": "enhancement",
"color": "#a2eeef",
"description": "New feature or request"
},
{
"name": "ignore changelog",
"color": "#fff",
"description": "Do not add to changelog"
},
{
"name": "scenario",
"color": "#3BC4B8",
"description": "Improvements or additions to a scenario"
}
]

33 changes: 33 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
branches:
- master

name-template: 'v$NEXT_PATCH_VERSION'
tag-template: 'v$NEXT_PATCH_VERSION'

categories:
- title: '**ADDED:**'
labels:
- feature
- title: '**FIXED:**'
labels:
- bugfix
- title: '**CHANGED:**'
labels:
- cleanup
- enhancement

exclude-labels:
- 'ignore changelog'

change-template: '- $TITLE (#$NUMBER)'
template: |
_ArmaForces SerialKillers release._
## Change Log Summary
$CHANGES
replacers:
# Category titles
- search: '/\#\# (\*\*(ADDED|FIXED|CHANGED):\*\*)/g'
replace: '$1'
33 changes: 13 additions & 20 deletions .github/workflows/arma.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,26 @@ jobs:
uses: actions/checkout@master
- name: Validate SQF
run: python3 tools/sqf_validator.py
- name: Validate Return Types
run: python3 tools/return_checker.py
- name: Validate Config
run: python3 tools/config_style_checker.py
- name: Validate Stringtables
run: python3 tools/stringtable_validator.py
- name: Check for BOM
uses: arma-actions/bom-check@master

lint:
build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout the source code
uses: actions/checkout@master
- name: Lint (sqflint)
uses: arma-actions/sqflint@master
continue-on-error: true # No failure due to many false-positives

# build:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout the source code
# uses: actions/checkout@master
# - name: Build using HEMTT
# uses: arma-actions/hemtt@master
# with:
# command: build --release --ci
# https://github.com/actions/upload-artifact/issues/3#issuecomment-524442814
# - uses: actions/upload-artifact@master
# with:
# name: armaforces_mods_VERSION
# path: releases/VERSION
uses: actions/checkout@v4
- name: Setup HEMTT
uses: arma-actions/hemtt@v1
- name: Run HEMTT build
run: hemtt build
- uses: actions/upload-artifact@v4
with:
name: afsk_${{ github.sha }}-nobin
path: .hemttout/@*
include-hidden-files: true # Because .hemttout is a hidden directory
16 changes: 16 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Release Drafter

on:
push:
branches:
- master

jobs:
draft:
runs-on: ubuntu-latest
steps:
- name: Release Drafter
if: github.repository == 'ArmaForces/SerialKillers'
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release

on:
release:
types:
- published

jobs:
build_addon:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set VERSION env
run: echo VERSION=${GITHUB_REF:11} >> $GITHUB_ENV
- name: Setup HEMTT
uses: arma-actions/hemtt@v1
- name: Run HEMTT release
run: hemtt release
# Upload to GitHub
- uses: softprops/action-gh-release@v1
with:
files: 'releases/afsk-${{ env.VERSION }}-*.zip'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Upload to Steam Workshop
- uses: arma-actions/workshop-upload@v1
with:
itemId: '1993094302' # Id of item to update
contentPath: '.hemttout/release'
changelog: 'https://github.com/ArmaForces/SerialKillers/releases/tag/v${{ env.VERSION }}'
env:
STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }}
STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }}
14 changes: 14 additions & 0 deletions .hemtt/hooks/pre_build/set_version.rhai
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

let modCpp = HEMTT_VFS
.join("mod.cpp")
.open_file()
.read()
;

modCpp.replace("0.0.0", HEMTT.project().version().to_string_short());

HEMTT_VFS
.join("mod.cpp")
.create_file()
.write(modCpp)
;
43 changes: 43 additions & 0 deletions .hemtt/launch.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[default]
workshop = [
"450814997", # CBA_A3
"2369477168", # ADT
]
parameters = [
"-name=dev_sk",
]

[ace]
extends = "default"
workshop = [
"463939057", # ACE
# "766491311", # KKA3 ACE Extension
]

[cup]
extends = "default"
workshop = [
"583496184", # CUP Terrains - Core
"583544987", # CUP Terrains - Maps
"497660133", # CUP Weapons
"497661914", # CUP Units
"541888371", # CUP Vehicles
]

[vn]
extends = "default"
dlc = [
"S.O.G. Prairie Fire",
]

[ww2]
extends = "default"
dlc = [
"Spearhead 1944",
]

[gm]
extends = "default"
dlc = [
"Global Mobilization",
]
6 changes: 6 additions & 0 deletions .hemtt/lints.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[sqf.command_case]
options.ignore = [
"CIVILIAN",
"EAST",
"WEST",
]
31 changes: 1 addition & 30 deletions .hemtt/project.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

name = "ArmaForces SerialKillers"
mainprefix = "z"
prefix = "afsk"
Expand All @@ -16,33 +17,3 @@ author = "ArmaForces"

[version]
path = "addons/main/script_version.hpp"

[asc]
exclude = [
".inc.sqf"
]

[hemtt.launch]
workshop = [
"450814997", # CBA_A3
"2369477168", # ADT
]
parameters = [
"-name=dev_sk",
"-window",
]

[hemtt.launch.cup]
workshop = [
"450814997", # CBA_A3
"2369477168", # ADT
"583496184", # CUP Terrains - Core
"583544987", # CUP Terrains - Maps
"497660133", # CUP Weapons
"497661914", # CUP Units
"541888371", # CUP Vehicles
]
parameters = [
"-name=dev_sk",
"-window",
]
8 changes: 4 additions & 4 deletions addons/briefing/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<English>SerialKillers - Briefing</English>
<Polish>SerialKillers - Odprawa</Polish>
</Key>
<Key ID="STR_AFSK_Briefing_Rules">
<English>Rules</English>
<Polish>Zasady</Polish>
</Key>
<Key ID="STR_AFSK_Briefing_RulesEnabled">
<English>Enable rules</English>
<Polish>Włącz zasady</Polish>
Expand All @@ -13,10 +17,6 @@
<English>If enabled, suggested rules will be visible on the map in "SerialKillers" briefing section.</English>
<Polish>Jeżeli włączone, proponowane zasady będą widoczne na odprawnie na mapie w zakładce "SerialKillers".</Polish>
</Key>
<Key ID="STR_AFSK_Briefing_Rules">
<English>Rules</English>
<Polish>Zasady</Polish>
</Key>
<Key ID="STR_AFSK_Briefing_Rules_1">
<English>Cops are not allowed to use terrorist stashes/weapons. They may only use radios they find after neutralizing a terrorist.</English>
<Polish>Policjanci nie mogą używać broni terrorystów ani skrytek z bronią. Mogą używać jedynie radia, które znajdą przy zneutralizowanym terroryście.</Polish>
Expand Down
2 changes: 1 addition & 1 deletion addons/civilian/functions/fnc_assignCityCivilian.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

params ["_civilian", "_cityNamespace"];

// Get city civilians array and pushback new civilian. No need for setVariable as getVariable returns array pointer.
// Get city civilians array and pushBack new civilian. No need for setVariable as getVariable returns array pointer.
_cityCivilians = _cityNamespace getVariable QGVAR(CiviliansList);
_cityCivilians pushBack _civilian;
_cityNamespace setVariable [QGVAR(CiviliansCount), count _cityCivilians];
Expand Down
2 changes: 1 addition & 1 deletion addons/civilian/functions/fnc_civilianKilled.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if (count GVAR(civilians) isEqualTo 0) then {
[QEGVAR(score,allCiviliansDead)] call CBA_fnc_serverEvent;
};

private _time = [daytime] call BIS_fnc_timeToString;
private _time = [dayTime] call BIS_fnc_timeToString;
// Call function to create marker at killed unit's position.
[_civilian, _time] call FUNC(civilianKilledMarker);
// Show message for all cops that cop has been killed near some location with timestamp
Expand Down
2 changes: 1 addition & 1 deletion addons/civilian/functions/fnc_civilianKilledMarker.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

params ["_unit", "_time"];

private _markerName = format ["killed_civilian_%1_%2", _unit];
private _markerName = format ["killed_civilian_%1", _unit];
private _markerText = format ["%1", _time];
private _marker = createMarkerLocal [_markerName, getPosATL _unit];
_marker setMarkerTypeLocal "mil_objective";
Expand Down
2 changes: 1 addition & 1 deletion addons/civilian/functions/fnc_civilianKilledMsg.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Public: No
*/

params ["_unit", ["_killer", objNull], ["_timeOfDeath", daytime], ["_nearestTown", locationNull]];
params ["_unit", ["_killer", objNull], ["_timeOfDeath", dayTime], ["_nearestTown", locationNull]];

if (_timeOfDeath isEqualType 0) then {
_timeOfDeath = [_timeOfDeath] call BIS_fnc_timeToString;
Expand Down
4 changes: 2 additions & 2 deletions addons/civilian/functions/fnc_createCivilian.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ private _unit = selectRandom GVAR(units);
private _civilian = _newGroup createUnit [_unit, _position, [], 0, "NONE"];

if (_civilian isEqualTo objNull) exitWith {
WARNING_2("Failed creating civilian %1 at %2", _unit, _position);
WARNING_2("Failed creating civilian %1 at %2",_unit,_position);
};

[_civilian] call FUNC(initCivilian);
[_civilian] call FUNC(initCivilian)
3 changes: 2 additions & 1 deletion addons/civilian/functions/fnc_getNearestCity.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ _nearestTown = [_position, _searchRadius] call EFUNC(common,getNearestCityLocati

// Return city namespace or objNull if not found
if (_nearestTown isEqualTo locationNull) exitWith {objNull};
[_nearestTown] call FUNC(getCityByLocation);

[_nearestTown] call FUNC(getCityByLocation)
2 changes: 1 addition & 1 deletion addons/civilian/functions/fnc_getNearestVehicle.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* 2: Filter function returning true for valid vehicles <FUNC> (Optional)
*
* Return Value:
* None
* Nearest vehicle or objNull if not found <OBJECT>
*
* Example:
* [player] call afsk_civilian_fnc_getNearestVehicle
Expand Down
2 changes: 2 additions & 0 deletions addons/civilian/functions/fnc_initCivilian.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ _civilian addEventHandler ["Killed", {
[_civilian, _cityNamespace] call FUNC(assignCityCivilian);
GVAR(civilians) pushBack _civilian;
_civilian setVariable [QGVAR(initialized), true];

_civilian
Loading

0 comments on commit 9cc62c3

Please sign in to comment.