diff --git a/.github/workflows/arma.yml b/.github/workflows/arma.yml index 33b08f2f81..669873d504 100644 --- a/.github/workflows/arma.yml +++ b/.github/workflows/arma.yml @@ -22,6 +22,8 @@ jobs: run: python3 tools/check_strings.py - name: Check for BOM uses: arma-actions/bom-check@master + - name: Validate function headers + run: python3 docs/tools/document_functions.py --debug lint: runs-on: ubuntu-latest diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index b0263abf8c..fd7bfa308d 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -4,13 +4,23 @@ on: push: branches: - master + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: false jobs: update: runs-on: ubuntu-latest steps: - name: Checkout the source code - uses: actions/checkout@master + uses: actions/checkout@v3 - name: Install Python packages run: | pip3 install wheel @@ -22,3 +32,39 @@ jobs: env: GH_TOKEN: ${{ secrets.DOCS_TOKEN }} run: python3 tools/deploy.py + + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Extract Dependencies + run: python3 tools/extract_dependencies.py --markdown + - name: Document Functions + run: python3 docs/tools/document_functions.py + + - name: Setup Pages + uses: actions/configure-pages@v3 + - name: Build with Jekyll + uses: actions/jekyll-build-pages@v1 + with: + source: docs/ + destination: docs/_site/ + - name: Upload artifact + uses: actions/upload-pages-artifact@v1 + with: + path: docs/_site/ + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + runs-on: ubuntu-latest + needs: [build] + + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 diff --git a/addons/arsenal/functions/fnc_addListBoxItem.sqf b/addons/arsenal/functions/fnc_addListBoxItem.sqf index 53bf321baf..baecd51e5f 100644 --- a/addons/arsenal/functions/fnc_addListBoxItem.sqf +++ b/addons/arsenal/functions/fnc_addListBoxItem.sqf @@ -4,7 +4,7 @@ * Add a listbox row. * * Arguments: - * 0: Config category (must be "CfgWeapons", "CfgVehicles", "CfgMagazines", "CfgVoice") + * 0: Config category, must be "CfgWeapons", "CfgVehicles", "CfgMagazines", "CfgVoice" * 1: Classname * 2: Panel control * 3: Name of the picture entry in that Cfg class @@ -12,8 +12,12 @@ * Return Value: * None * + * Example: + * ["CfgWeapons", "launch_NLAW_F", _ctrl, "icon"] call ace_arsenal_fnc_addListBoxItem + * * Public: Yes -*/ + */ + params ["_configCategory", "_className", "_ctrlPanel", ["_pictureEntryName", "picture", [""]]]; private _cacheNamespace = _ctrlPanel; //For better readability. diff --git a/addons/arsenal/functions/fnc_addSort.sqf b/addons/arsenal/functions/fnc_addSort.sqf index 9ecdcc03d2..81a3930954 100644 --- a/addons/arsenal/functions/fnc_addSort.sqf +++ b/addons/arsenal/functions/fnc_addSort.sqf @@ -5,15 +5,15 @@ * * Arguments: * 0: Tabs to add stat to - * 0: Left Tab Indexes - * 1: Right Tab Indexes + * 0.0: Left Tab Indexes + * 0.1: Right Tab Indexes * 1: Sort Class (a unique string for each algorithm) * 2: Display Name * 3: Algorithm - * 4: Condition (Optional) + * 4: Condition (default: true) * * Return Value: - * 0: Array of IDs (ARRAY of STRINGS) + * 0: Array of IDs * * Example: * [[[0, 1], []], "fireRateSort", "Sort by fire rate", { diff --git a/addons/arsenal/functions/fnc_addStat.sqf b/addons/arsenal/functions/fnc_addStat.sqf index ac13e97699..834a8bc6b9 100644 --- a/addons/arsenal/functions/fnc_addStat.sqf +++ b/addons/arsenal/functions/fnc_addStat.sqf @@ -4,32 +4,33 @@ * Add a stat to ACE Arsenal. * * Arguments: - * 0: Tabs to add the stat to (ARRAY of ARRAYS) - * 0.1 Left tab indexes (ARRAY of NUMBERS) - * 0.2 Right tab indexes (ARRAY of NUMBERS) - * 1: Stat class (STRING) (A unique string for each stat) - * 2: Config entries to pass (ARRAY of STRINGS) - * 3: Title (STRING) - * 4: Show bar / show text bools (ARRAY of BOOLS) - * 4.1 Show bar (BOOL) - * 4.2 Show text (BOOL) - * 5: Array of statements (ARRAY of ARRAYS) - * 5.1 Bar code (CODE) - * 5.2 Text code (CODE) - * 5.3 Condition code (CODE) - * 6: Priority (NUMBER) (Optional) + * 0: Tabs to add the stat to + * 0.0: Left tab indexes + * 0.1: Right tab indexes + * 1: Stat class (unique string for each stat) + * 2: Config entries to pass + * 3: Title + * 4: Show bar / show text bools + * 4.0: Show bar + * 4.1: Show text + * 5: Array of statements + * 5.0: Bar code + * 5.1: Text code + * 5.2: Condition code + * 6: Priority (default: 0) * * Return Value: - * 0: Array of IDs (ARRAY of STRINGS) + * 0: Array of IDs * * Example: * [[[0,1,2], [7]], "scopeStat", ["scope"], "Scope", [false, true], [{}, { - params ["_statsArray", "_itemCfg"]; - getNumber (_itemCfg >> _statsArray select 0) - }, {true}]] call ACE_arsenal_fnc_addStat + * params ["_statsArray", "_itemCfg"]; + * getNumber (_itemCfg >> _statsArray select 0) + * }, {true}]] call ACE_arsenal_fnc_addStat * * Public: Yes -*/ + */ + params [ ["_tabs", [[], []], [[]], 2], ["_class", "", [""]], diff --git a/addons/arsenal/functions/fnc_onMouseButtonDown.sqf b/addons/arsenal/functions/fnc_onMouseButtonDown.sqf index 0cb2c856a4..a633cab4dd 100644 --- a/addons/arsenal/functions/fnc_onMouseButtonDown.sqf +++ b/addons/arsenal/functions/fnc_onMouseButtonDown.sqf @@ -1,4 +1,9 @@ #include "script_component.hpp" +/* + * Author: commy2 + * + * Public: No +*/ params ["", "_args"]; _args params ["", "_buttonPressed", "_xPos", "_yPos"]; diff --git a/addons/arsenal/functions/fnc_onMouseButtonUp.sqf b/addons/arsenal/functions/fnc_onMouseButtonUp.sqf index 53848a4f8e..a21d2f0443 100644 --- a/addons/arsenal/functions/fnc_onMouseButtonUp.sqf +++ b/addons/arsenal/functions/fnc_onMouseButtonUp.sqf @@ -1,4 +1,9 @@ #include "script_component.hpp" +/* + * Author: commy2 + * + * Public: No +*/ params ["", "_args"]; _args params ["", "_buttonPressed"]; diff --git a/addons/arsenal/functions/fnc_portVALoadouts.sqf b/addons/arsenal/functions/fnc_portVALoadouts.sqf index 0e403eae92..ae57b4d74f 100644 --- a/addons/arsenal/functions/fnc_portVALoadouts.sqf +++ b/addons/arsenal/functions/fnc_portVALoadouts.sqf @@ -9,6 +9,9 @@ * Return Value: * None * + * Example: + * call ace_arsenal_fnc_portVALoadouts + * * Public: Yes */ diff --git a/addons/arsenal/functions/fnc_removeStat.sqf b/addons/arsenal/functions/fnc_removeStat.sqf index 79f2173798..8bb264f7cb 100644 --- a/addons/arsenal/functions/fnc_removeStat.sqf +++ b/addons/arsenal/functions/fnc_removeStat.sqf @@ -4,7 +4,7 @@ * Remove a stat from ACE Arsenal. * * Arguments: - * 0: Array of IDs (ARRAY) + * 0: Array of IDs * * Return Value: * None diff --git a/addons/arsenal/functions/fnc_statBarStatement_accuracy.sqf b/addons/arsenal/functions/fnc_statBarStatement_accuracy.sqf index 1cd3f149c3..7f591340e9 100644 --- a/addons/arsenal/functions/fnc_statBarStatement_accuracy.sqf +++ b/addons/arsenal/functions/fnc_statBarStatement_accuracy.sqf @@ -11,7 +11,7 @@ * 2.2: Bar limits (ARRAY of SCALAR) * * Return Value: - * Number + * * * Public: No */ diff --git a/addons/arsenal/functions/fnc_statBarStatement_default.sqf b/addons/arsenal/functions/fnc_statBarStatement_default.sqf index 4eb0a36f98..56f9db9426 100644 --- a/addons/arsenal/functions/fnc_statBarStatement_default.sqf +++ b/addons/arsenal/functions/fnc_statBarStatement_default.sqf @@ -4,18 +4,21 @@ * Generic bar statement for stats. * * Arguments: - * 0: stat (STRING) - * 1: item config path (CONFIG) - * 2: Args for configExtreme - * 2.1: Stat limits (ARRAY of BOOL) - * 2.2: Bar limits (ARRAY of SCALAR) - * 2.3: Evaluate as a logarithmic number (BOOL) + * 0: Stat + * 1: Item config path + * 2: Args for configExtreme + * 2.1: Stat limits + * 2.2: Bar limits + * 2.3: Evaluate as a logarithmic number * * Return Value: - * Number + * Bar statement + * + * Example: + * ["ACE_maxZeroing", _config, [[0, 2500], [0.01, 1], false]] call ace_arsenal_fnc_statBarStatement_default * * Public: Yes -*/ + */ params ["_stat", "_config", "_args"]; _args params ["_statMinMax", "_barLimits", "_configExtremeBool"]; diff --git a/addons/arsenal/functions/fnc_updateCamPos.sqf b/addons/arsenal/functions/fnc_updateCamPos.sqf index 66bad37936..07048150d5 100644 --- a/addons/arsenal/functions/fnc_updateCamPos.sqf +++ b/addons/arsenal/functions/fnc_updateCamPos.sqf @@ -10,8 +10,11 @@ * Return Value: * None * + * Example: + * call ace_arsenal_fnc_updateCamPos + * * Public: Yes -*/ + */ GVAR(cameraPosition) params ["_distance", "_dirH", "_dirV"]; [GVAR(cameraHelper), [_dirH + 180, - _dirV, 0]] call bis_fnc_setobjectrotation; diff --git a/addons/arsenal/missions/Arsenal.VR/fnc_createTarget.sqf b/addons/arsenal/missions/Arsenal.VR/fnc_createTarget.sqf index 30eac04a7f..b0d8800cf0 100644 --- a/addons/arsenal/missions/Arsenal.VR/fnc_createTarget.sqf +++ b/addons/arsenal/missions/Arsenal.VR/fnc_createTarget.sqf @@ -1,4 +1,9 @@ #include "script_component.hpp" +/* + * Author: commy2 + * + * Public: No +*/ params ["_type", "_position", ["_group", grpNull], "_varName"]; private _player = player; diff --git a/addons/arsenal/missions/Arsenal.VR/fnc_onPause.sqf b/addons/arsenal/missions/Arsenal.VR/fnc_onPause.sqf index 25e49405bf..40b6d3170d 100644 --- a/addons/arsenal/missions/Arsenal.VR/fnc_onPause.sqf +++ b/addons/arsenal/missions/Arsenal.VR/fnc_onPause.sqf @@ -1,4 +1,9 @@ #include "script_component.hpp" +/* + * Author: commy2 + * + * Public: No +*/ params ["_display"]; diff --git a/addons/common/functions/fnc_createOrthonormalReference.sqf b/addons/common/functions/fnc_createOrthonormalReference.sqf index d705086e85..8efce65220 100644 --- a/addons/common/functions/fnc_createOrthonormalReference.sqf +++ b/addons/common/functions/fnc_createOrthonormalReference.sqf @@ -4,7 +4,7 @@ * Returns a orthonormal system of reference aligned with the supplied vector * * Arguments: - * Vector to align the coordinate system with + * 0: Vector to align the coordinate system with * * Return Value: * 0: Vector Normalized diff --git a/addons/common/functions/fnc_getLocalUnits.sqf b/addons/common/functions/fnc_getLocalUnits.sqf index 17163d0e77..54fe1cae84 100644 --- a/addons/common/functions/fnc_getLocalUnits.sqf +++ b/addons/common/functions/fnc_getLocalUnits.sqf @@ -6,7 +6,7 @@ * Should be equivalent to `allUnits select {local _x}` * * Arguments: - * Nothing + * None * * Return Value: * Array of local Units diff --git a/addons/common/functions/fnc_getVehicleIcon.sqf b/addons/common/functions/fnc_getVehicleIcon.sqf index 7a4daba9c6..a1cf718952 100644 --- a/addons/common/functions/fnc_getVehicleIcon.sqf +++ b/addons/common/functions/fnc_getVehicleIcon.sqf @@ -4,7 +4,7 @@ * Function used to get the vehicle icon for provided object (cached for repeat use) * * Arguments: - * 0: Object to get icon of + * 0: Object to get icon of * * Return Value: * Icon of vehicle diff --git a/addons/common/functions/fnc_isMedic.sqf b/addons/common/functions/fnc_isMedic.sqf index 43d7f6a7ea..b6aade5fbc 100644 --- a/addons/common/functions/fnc_isMedic.sqf +++ b/addons/common/functions/fnc_isMedic.sqf @@ -6,7 +6,7 @@ * Arguments: * 0: The Unit * - * ReturnValue: + * Return Value: * Unit is medic * * Example: diff --git a/addons/common/functions/fnc_monitor.sqf b/addons/common/functions/fnc_monitor.sqf index 17d3087c53..c864bb1ae8 100644 --- a/addons/common/functions/fnc_monitor.sqf +++ b/addons/common/functions/fnc_monitor.sqf @@ -4,7 +4,7 @@ * hint retun value of given function every frame * * Arguments: - * + * 0: Code to monitor * * Return Value: * None diff --git a/addons/common/functions/fnc_numberToDigits.sqf b/addons/common/functions/fnc_numberToDigits.sqf index ff4cd23977..e4da7a6b43 100644 --- a/addons/common/functions/fnc_numberToDigits.sqf +++ b/addons/common/functions/fnc_numberToDigits.sqf @@ -5,7 +5,7 @@ * * Arguments: * 0: Number to 'digitize' - * 1: Set the minimal length of the returned array. Useful for getting left hand zeroes. , optional + * 1: Set the minimal length of the returned array. Useful for getting left hand zeroes. (optional) * * Return Value: * Digits. The maximum count is six digits. diff --git a/addons/common/functions/fnc_rscObjectHelper.sqf b/addons/common/functions/fnc_rscObjectHelper.sqf index 81eb707b3a..052c9a1e5e 100644 --- a/addons/common/functions/fnc_rscObjectHelper.sqf +++ b/addons/common/functions/fnc_rscObjectHelper.sqf @@ -14,7 +14,7 @@ * Example: * ["2d", [0,0,0], 1] call ace_common_fnc_rscObjectHelper * - * Public: Maybe + * Public: No */ params ["_func", "_array", ["_scale", 1]]; diff --git a/addons/common/functions/fnc_toBin.sqf b/addons/common/functions/fnc_toBin.sqf index c5da7ece8e..55c0cea8da 100644 --- a/addons/common/functions/fnc_toBin.sqf +++ b/addons/common/functions/fnc_toBin.sqf @@ -4,7 +4,8 @@ * Converts number to binary number * * Arguments: - * A number + * 0: A number + * 1: Minumum length of numbers (default: 1) * * Return Value: * A binary number as string diff --git a/addons/common/functions/fnc_toBitmask.sqf b/addons/common/functions/fnc_toBitmask.sqf index 2d46811c6b..2dc65a5f8d 100644 --- a/addons/common/functions/fnc_toBitmask.sqf +++ b/addons/common/functions/fnc_toBitmask.sqf @@ -4,7 +4,10 @@ * Convert an array of booleans into a number. * * Arguments: - * N: Booleans + * 0: Boolean + * 1: Boolean + * 2: Boolean + * ... * * Return Value: * Bitmask diff --git a/addons/common/functions/fnc_toHex.sqf b/addons/common/functions/fnc_toHex.sqf index 697fbb9b6d..8689b90541 100644 --- a/addons/common/functions/fnc_toHex.sqf +++ b/addons/common/functions/fnc_toHex.sqf @@ -4,7 +4,7 @@ * Converts number to hexadecimal number * * Arguments: - * A number between 0 and 255 + * 0: A number between 0 and 255 * * Return Value: * A hexadecimal number as string diff --git a/addons/common/functions/fnc_watchVariable.sqf b/addons/common/functions/fnc_watchVariable.sqf index b3ec33bddc..2bb2d053ef 100644 --- a/addons/common/functions/fnc_watchVariable.sqf +++ b/addons/common/functions/fnc_watchVariable.sqf @@ -7,12 +7,12 @@ * 0: Title (var name) (default: "") * 1: Code to generate result (passed nothing, can return any) (default: {}) * 2: Array containing modifiers (default: []) - * For Numbers: - * 0: Show Delta change (default: true) - * 1: Slider Min Value (default: 0) - * 1: Slider Max Value (default: 0) - * For Anything else: - * 0: Number of structured text lines (default: 1) + * For Numbers: + * 2.0: Show Delta change (default: true) + * 2.1: Slider Min Value (default: 0) + * 2.1: Slider Max Value (default: 0) + * For Anything else: + * 2.0: Number of structured text lines (default: 1) * * Return Value: * None diff --git a/addons/explosives/functions/fnc_canDefuse.sqf b/addons/explosives/functions/fnc_canDefuse.sqf index f42764ee38..a4ead7eb47 100644 --- a/addons/explosives/functions/fnc_canDefuse.sqf +++ b/addons/explosives/functions/fnc_canDefuse.sqf @@ -5,7 +5,7 @@ * * Arguments: * 0: Unit - * 0: Target (ACE_DefuseObject) + * 1: Target (ACE_DefuseObject) * * Return Value: * Able to defuse diff --git a/addons/explosives/functions/fnc_detonateExplosive.sqf b/addons/explosives/functions/fnc_detonateExplosive.sqf index de7772d4de..3b2740fab2 100644 --- a/addons/explosives/functions/fnc_detonateExplosive.sqf +++ b/addons/explosives/functions/fnc_detonateExplosive.sqf @@ -7,8 +7,8 @@ * 0: Unit * 1: Max range (-1 to ignore) * 2: Explosive - * 0: Explosive - * 1: Fuse time + * 2.0: Explosive + * 2.1: Fuse time * 3: Trigger Item Classname * * Return Value: diff --git a/addons/intelitems/functions/fnc_addIntel.sqf b/addons/intelitems/functions/fnc_addIntel.sqf index 101370e135..81eaf6311f 100644 --- a/addons/intelitems/functions/fnc_addIntel.sqf +++ b/addons/intelitems/functions/fnc_addIntel.sqf @@ -7,7 +7,7 @@ * Arguments: * 0: Unit * 1: Item - * 3: Data + * 2: Data * * Return Value: * Successful diff --git a/addons/map/functions/fnc_initMainMap.sqf b/addons/map/functions/fnc_initMainMap.sqf index 1617be33db..2a021f7481 100644 --- a/addons/map/functions/fnc_initMainMap.sqf +++ b/addons/map/functions/fnc_initMainMap.sqf @@ -1,5 +1,10 @@ #include "script_component.hpp" #include "\a3\ui_f\hpp\defineResincl.inc" +/* + * Author: commy2 + * + * Public: No +*/ params ["_display"]; if (ctrlIDD _display != IDD_MAIN_MAP) exitWith {}; diff --git a/addons/medical/functions/fnc_serializeState.sqf b/addons/medical/functions/fnc_serializeState.sqf index f48a714f9e..31f1dccad4 100644 --- a/addons/medical/functions/fnc_serializeState.sqf +++ b/addons/medical/functions/fnc_serializeState.sqf @@ -7,7 +7,7 @@ * 0: Unit * * Return Value: - * Serialized state as JSON string + * Serialized state as JSON string * * Example: * [player] call ace_medical_fnc_serializeState diff --git a/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf b/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf index 524b242b1a..2de0b22a18 100644 --- a/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf +++ b/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf @@ -17,6 +17,8 @@ * * Example: * [player, "Morphine", 120, 60, -10, 0.8, -10] call ace_medical_status_fnc_addMedicationAdjustment + * + * Public: No */ params ["_unit", "_medication", "_timeToMaxEffect", "_maxTimeInSystem", "_hrAdjust", "_painAdjust", "_flowAdjust"]; TRACE_7("addMedicationAdjustment",_unit,_medication,_timeToMaxEffect,_maxTimeInSystem,_hrAdjust,_painAdjust,_flowAdjust); diff --git a/addons/rearm/functions/fnc_disable.sqf b/addons/rearm/functions/fnc_disable.sqf index 4812c34cfb..ee99746916 100644 --- a/addons/rearm/functions/fnc_disable.sqf +++ b/addons/rearm/functions/fnc_disable.sqf @@ -5,7 +5,7 @@ * * Arguments: * 0: Vehicle - * 1: Disable (optional) + * 1: Disable (optional) * * Return Value: * None diff --git a/addons/slideshow/functions/fnc_createSlideshow.sqf b/addons/slideshow/functions/fnc_createSlideshow.sqf index 841365d4c4..23eb7690f2 100644 --- a/addons/slideshow/functions/fnc_createSlideshow.sqf +++ b/addons/slideshow/functions/fnc_createSlideshow.sqf @@ -8,7 +8,7 @@ * 1: Controller Objects * 2: Image Paths * 3: Action Names - * 4: Slide Duration (0 disables automatic transitions) + * 4: Slide Duration, 0 disables automatic transitions * 5: Set Name (default: localized "Slides") * 6: Texture Selection (default: 0) * diff --git a/addons/viewports/functions/fnc_eachFrame.sqf b/addons/viewports/functions/fnc_eachFrame.sqf index 247e9e26b5..b0b0606bf5 100644 --- a/addons/viewports/functions/fnc_eachFrame.sqf +++ b/addons/viewports/functions/fnc_eachFrame.sqf @@ -1,24 +1,24 @@ #include "script_component.hpp" /* -* Author: PabstMirror -* Runs each frame while inside of a vehicle with viewports -* -* Arguments: -* 0: PFEH Args -* 0: Player -* 1: Vehicle -* 2: Viewport configuration -* 3: Viewport index shown (-1 for none) -* 4: Last visionmode -* -* Return Value: -* None -* -* Example: -* [] call ace_viewports_fnc_eachFrame -* -* Public: No -*/ + * Author: PabstMirror + * Runs each frame while inside of a vehicle with viewports + * + * Arguments: + * 0: PFEH Args + * 0: Player + * 1: Vehicle + * 2: Viewport configuration + * 3: Viewport index shown (-1 for none) + * 4: Last visionmode + * + * Return Value: + * None + * + * Example: + * [] call ace_viewports_fnc_eachFrame + * + * Public: No + */ params ["_args", "_pfID"]; _args params ["_player", "_vehicle", "_viewports", "_shownIndex", "_lastVisionMode"]; @@ -37,7 +37,7 @@ if (cba_events_control) then { }; ([_player] call FUNC(getSeatInfo)) params ["_role", "", "", "_comparment"]; - + private _newIndexAngle = 45; // Controls the max angle private _eyesPosASL = AGLtoASL (positionCameraToWorld [0, 0, 0]); private _eyesDir = (AGLtoASL (positionCameraToWorld [0, 0, 1])) vectorDiff _eyesPosASL; @@ -51,7 +51,7 @@ if (cba_events_control) then { systemChat format ["%1: %2 @ %3",_forEachIndex,round _viewAngle, vectorMagnitude _viewDiff]; #endif if ( - (_viewAngle < _newIndexAngle) + (_viewAngle < _newIndexAngle) && {(_compartments isEqualTo []) || {(toLower _comparment) in _compartments}} && {(_roles isEqualTo []) || {(toLower _role) in _roles}} && {(vectorMagnitude _viewDiff) < _maxDistance} diff --git a/addons/viewports/functions/fnc_getViewports.sqf b/addons/viewports/functions/fnc_getViewports.sqf index ffa82fcc82..e43d99e2e0 100644 --- a/addons/viewports/functions/fnc_getViewports.sqf +++ b/addons/viewports/functions/fnc_getViewports.sqf @@ -1,19 +1,19 @@ #include "script_component.hpp" /* -* Author: PabstMirror -* Gets viewports for a vehicle from config. Caches results to a setVar on the vic. -* -* Arguments: -* 0: vehicle -* -* Return Value: -* ARRAY -* -* Example: -* [vehicle player] call ace_viewports_fnc_getViewports -* -* Public: No -*/ + * Author: PabstMirror + * Gets viewports for a vehicle from config. Caches results to a setVar on the vic. + * + * Arguments: + * 0: vehicle + * + * Return Value: + * ARRAY + * + * Example: + * [vehicle player] call ace_viewports_fnc_getViewports + * + * Public: No + */ params ["_vehicle"]; @@ -46,12 +46,12 @@ if (isNil "_viewports") then { if (_screenLocation isEqualType "") then { // screens should be on the hull (IE non-animated) so we can do all the mem-point calculations here if (_screenLocation == "") exitWith { // use generic periscope drop height from cam - private _camLocArray = if (_camLocation isEqualType []) then { + private _camLocArray = if (_camLocation isEqualType []) then { _camLocation } else { _vehicle selectionPosition [_camLocation, "Memory"]; }; - _screenLocation =_camLocArray vectorAdd [0,0,-0.175] + _screenLocation =_camLocArray vectorAdd [0,0,-0.175] }; _screenLocation = _vehicle selectionPosition [_screenLocation, "Memory"]; }; diff --git a/addons/viewports/functions/fnc_viewCleanup.sqf b/addons/viewports/functions/fnc_viewCleanup.sqf index b24a9cc31b..07c1592c4c 100644 --- a/addons/viewports/functions/fnc_viewCleanup.sqf +++ b/addons/viewports/functions/fnc_viewCleanup.sqf @@ -1,19 +1,19 @@ #include "script_component.hpp" /* -* Author: PabstMirror -* Cleans up existing viewport display and camera -* -* Arguments: -* None -* -* Return Value: -* None -* -* Example: -* [] call ace_viewports_fnc_viewCleanup -* -* Public: No -*/ + * Author: PabstMirror + * Cleans up existing viewport display and camera + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * [] call ace_viewports_fnc_viewCleanup + * + * Public: No + */ TRACE_1("camCleanup",_this); diff --git a/addons/viewports/functions/fnc_viewCreate.sqf b/addons/viewports/functions/fnc_viewCreate.sqf index 02e44c129d..2098f9ea47 100644 --- a/addons/viewports/functions/fnc_viewCreate.sqf +++ b/addons/viewports/functions/fnc_viewCreate.sqf @@ -1,21 +1,21 @@ #include "script_component.hpp" /* -* Author: PabstMirror -* Creates a viewport display and camera -* -* Arguments: -* 0: Vehicle -* 1: Viewport -* 2: Player's vision mode -* -* Return Value: -* None -* -* Example: -* [...] call ace_viewports_fnc_viewCreate -* -* Public: No -*/ + * Author: PabstMirror + * Creates a viewport display and camera + * + * Arguments: + * 0: Vehicle + * 1: Viewport + * 2: Player's vision mode + * + * Return Value: + * None + * + * Example: + * [...] call ace_viewports_fnc_viewCreate + * + * Public: No + */ params ["_vehicle", "_viewport", "_visionMode"]; _viewport params ["_name", "_type", "_camLocation", "_camAttach"]; @@ -79,7 +79,7 @@ switch (true) do { if (_usingGoggles) then { // Screen will be out of focus, too bright and not in IR; should be almost impossible to see anything useful _camEffect = [3,1,1,0.1,0,[0,0,0,0],[1,1,1,0],[1,1,1,1]]; - + private _ctrlNVG = _display ctrlCreate ["RscPicture", -1]; _ctrlNVG ctrlSetText "#(argb,8,8,3)color(1,1,0.6,0.9)"; _ctrlNVG ctrlSetPosition [safezoneX + 0.5 * safezoneW - 0.5 * _viewWidth, safezoneY + 0.5 * safeZoneH - 0.5 * _viewHeight, _viewWidth, _viewHeight]; @@ -97,10 +97,10 @@ switch (true) do { if (_usingGoggles) then { _camEffect = [_visionMode]; // pass-thru - // _camEffect = [3, true, 0.747773,0.791092,0,[0,0,0,0],[1.3,1.2,0,0.9],[6,1,1,0]]; + // _camEffect = [3, true, 0.747773,0.791092,0,[0,0,0,0],[1.3,1.2,0,0.9],[6,1,1,0]]; // Some periscope glass is IR Laser Safe (~1064nm) which is close to same wavelength as NVGs // And cannot apply nvg and ace_nightvision effects to pip at same time, so just make it small and shitty... - _viewHeight = 0.45 * _viewHeight; + _viewHeight = 0.45 * _viewHeight; }; private _viewWidth = _stretch * _viewHeight * _screenAR / 1.3333333333333; diff --git a/addons/viewrestriction/functions/fnc_moduleInit.sqf b/addons/viewrestriction/functions/fnc_moduleInit.sqf index 3859944761..8caf7d26ad 100644 --- a/addons/viewrestriction/functions/fnc_moduleInit.sqf +++ b/addons/viewrestriction/functions/fnc_moduleInit.sqf @@ -10,6 +10,8 @@ * * Return Value: * None + * + * Public: No */ params ["_logic", "_units", "_activated"]; diff --git a/docs/.gitignore b/docs/.gitignore index 7836aaf3f3..c2ef6dec77 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -20,3 +20,8 @@ CNAME tools/temp Gemfile.lock + +# Generated +_includes/dependencies_list.md +wiki/functions/*.md +!wiki/functions/index.md diff --git a/docs/_includes/dependencies_list.md b/docs/_includes/dependencies_list.md index 3404042be0..f4d7d300d4 100644 --- a/docs/_includes/dependencies_list.md +++ b/docs/_includes/dependencies_list.md @@ -1,708 +1 @@ -{% if include.component == "advanced_ballistics" %} -- `ace_ballistics` -- `ace_weather` -{% endif %} - -{% if include.component == "advanced_fatigue" %} -- `ace_common` -{% endif %} - -{% if include.component == "advanced_throwing" %} -- `ace_common` -- `ace_weaponselect` -{% endif %} - -{% if include.component == "ai" %} -- `ace_common` -{% endif %} - -{% if include.component == "aircraft" %} -- `ace_common` -{% endif %} - -{% if include.component == "apl" %} -- `ace_main` -{% endif %} - -{% if include.component == "arsenal" %} -- `ace_common` -{% endif %} - -{% if include.component == "artillerytables" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "atragmx" %} -- `ACE_Advanced_Ballistics` -- `ACE_common` -- `ACE_weather` -{% endif %} - -{% if include.component == "attach" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "backpacks" %} -- `ace_common` -{% endif %} - -{% if include.component == "ballistics" %} -- `ace_common` -{% endif %} - -{% if include.component == "captives" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "cargo" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "casings" %} -- `ace_common` -{% endif %} - -{% if include.component == "chemlights" %} -- `ace_common` -{% endif %} - -{% if include.component == "common" %} -- `ace_main` -- `ace_modules` -{% endif %} - -{% if include.component == "concertina_wire" %} -- `ace_apl` -- `ace_interaction` -{% endif %} - -{% if include.component == "cookoff" %} -- `ace_common` -{% endif %} - -{% if include.component == "csw" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "dagr" %} -- `ace_weather` -{% endif %} - -{% if include.component == "disarming" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "disposable" %} -- `ace_common` -{% endif %} - -{% if include.component == "dogtags" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "dragging" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "dragon" %} -- `ace_hot` -- `ace_csw` -{% endif %} - -{% if include.component == "explosives" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "fastroping" %} -- `ace_interaction` -- `ace_logistics_rope` -{% endif %} - -{% if include.component == "fcs" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "field_rations" %} -- `ace_interact_menu` -{% endif %} - -{% if include.component == "finger" %} -- `ace_common` -{% endif %} - -{% if include.component == "fire" %} -- `ace_common` -- `ace_medical_engine` -{% endif %} - -{% if include.component == "flashlights" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "flashsuppressors" %} -- `ace_common` -{% endif %} - -{% if include.component == "fonts" %} -- `ace_main` -{% endif %} - -{% if include.component == "fortify" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "frag" %} -- `ace_common` -{% endif %} - -{% if include.component == "gestures" %} -- `ace_interact_menu` -{% endif %} - -{% if include.component == "gforces" %} -- `ace_common` -{% endif %} - -{% if include.component == "goggles" %} -- `ace_common` -{% endif %} - -{% if include.component == "grenades" %} -- `ace_common` -{% endif %} - -{% if include.component == "gunbag" %} -- `ace_interaction` -- `ace_movement` -{% endif %} - -{% if include.component == "headless" %} -- `ace_common` -{% endif %} - -{% if include.component == "hearing" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "hellfire" %} -- `ace_interaction` -- `ace_missileguidance` -{% endif %} - -{% if include.component == "hitreactions" %} -- `ace_common` -{% endif %} - -{% if include.component == "hot" %} -- `ace_common` -- `ace_missileguidance` -{% endif %} - -{% if include.component == "hunterkiller" %} -- `ace_common` -{% endif %} - -{% if include.component == "huntir" %} -- `ace_common` -{% endif %} - -{% if include.component == "intelitems" %} -- `ace_interact_menu` -- `ace_zeus` -{% endif %} - -{% if include.component == "interact_menu" %} -- `ace_common` -{% endif %} - -{% if include.component == "interaction" %} -- `ace_interact_menu` -{% endif %} - -{% if include.component == "inventory" %} -- `ace_common` -{% endif %} - -{% if include.component == "javelin" %} -- `ace_main` -- `ace_common` -- `ace_missileguidance` -{% endif %} - -{% if include.component == "kestrel4500" %} -- `ACE_common` -- `ACE_weather` -{% endif %} - -{% if include.component == "killtracker" %} -- `ace_common` -{% endif %} - -{% if include.component == "laser" %} -- `ace_common` -{% endif %} - -{% if include.component == "laserpointer" %} -- `ace_common` -{% endif %} - -{% if include.component == "logistics_rope" %} -- `ace_common` -{% endif %} - -{% if include.component == "logistics_uavbattery" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "logistics_wirecutter" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "magazinerepack" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "map" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "map_gestures" %} -- `ace_common` -{% endif %} - -{% if include.component == "maptools" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "marker_flags" %} -- `ace_common` -- `ace_interaction` -- `ace_interact_menu` -{% endif %} - -{% if include.component == "markers" %} -- `ace_common` -{% endif %} - -{% if include.component == "maverick" %} -- `ace_missileguidance` -{% endif %} - -{% if include.component == "medical" %} -- `ace_medical_engine` -{% endif %} - -{% if include.component == "medical_ai" %} -- `ace_medical_treatment` -{% endif %} - -{% if include.component == "medical_blood" %} -- `ace_medical_status` -{% endif %} - -{% if include.component == "medical_damage" %} -- `ace_medical_engine` -{% endif %} - -{% if include.component == "medical_engine" %} -- `ace_common` -{% endif %} - -{% if include.component == "medical_feedback" %} -- `ace_medical_status` -{% endif %} - -{% if include.component == "medical_gui" %} -- `ace_medical_treatment` -- `ace_interaction` -{% endif %} - -{% if include.component == "medical_statemachine" %} -- `ace_medical_vitals` -{% endif %} - -{% if include.component == "medical_status" %} -- `ace_medical_engine` -{% endif %} - -{% if include.component == "medical_treatment" %} -- `ace_medical_status` -- `ace_medical_damage` -- `ace_apl` -{% endif %} - -{% if include.component == "medical_vitals" %} -- `ace_medical_status` -{% endif %} - -{% if include.component == "metis" %} -- `ace_missileguidance` -{% endif %} - -{% if include.component == "microdagr" %} -- `ace_common` -{% endif %} - -{% if include.component == "minedetector" %} -- `ace_explosives` -{% endif %} - -{% if include.component == "missileguidance" %} -- `ace_laser` -{% endif %} - -{% if include.component == "missionmodules" %} -- `ace_common` -{% endif %} - -{% if include.component == "mk6mortar" %} -- `ace_csw` -- `ace_artillerytables` -{% endif %} - -{% if include.component == "modules" %} -- `ace_main` -{% endif %} - -{% if include.component == "movement" %} -- `ace_common` -{% endif %} - -{% if include.component == "mx2a" %} -- `ace_apl` -{% endif %} - -{% if include.component == "nametags" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "nightvision" %} -- `ace_common` -{% endif %} - -{% if include.component == "nlaw" %} -- `ace_missileguidance` -{% endif %} - -{% if include.component == "noidle" %} -- `ace_common` -{% endif %} - -{% if include.component == "noradio" %} -- `ace_common` -{% endif %} - -{% if include.component == "norearm" %} -- `ace_common` -{% endif %} - -{% if include.component == "novehicleclanlogo" %} -- `ace_common` -{% endif %} - -{% if include.component == "optics" %} -- `ace_common` -{% endif %} - -{% if include.component == "optionsmenu" %} -- `ace_common` -{% endif %} - -{% if include.component == "overheating" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "overpressure" %} -- `ace_common` -{% endif %} - -{% if include.component == "parachute" %} -- `ace_common` -{% endif %} - -{% if include.component == "pylons" %} -- `ace_interact_menu` -{% endif %} - -{% if include.component == "quickmount" %} -- `ace_common` -{% endif %} - -{% if include.component == "rangecard" %} -- `ACE_Advanced_Ballistics` -- `ace_scopes` -{% endif %} - -{% if include.component == "realisticnames" %} -- `ace_common` -- `ace_optics` -{% endif %} - -{% if include.component == "realisticweights" %} -- `ace_common` -- `ace_disposable` -{% endif %} - -{% if include.component == "rearm" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "recoil" %} -- `ace_common` -{% endif %} - -{% if include.component == "refuel" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "reload" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "reloadlaunchers" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "repair" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "respawn" %} -- `ace_common` -{% endif %} - -{% if include.component == "safemode" %} -- `ace_common` -{% endif %} - -{% if include.component == "sandbag" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "scopes" %} -- `ace_common` -{% endif %} - -{% if include.component == "sitting" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "slideshow" %} -- `ace_common` -{% endif %} - -{% if include.component == "smallarms" %} -- `ace_common` -{% endif %} - -{% if include.component == "spectator" %} -- `ace_common` -{% endif %} - -{% if include.component == "spottingscope" %} -- `ace_apl` -- `ace_interaction` -{% endif %} - -{% if include.component == "switchunits" %} -- `ace_common` -{% endif %} - -{% if include.component == "tacticalladder" %} -- `ace_apl` -- `ace_interaction` -{% endif %} - -{% if include.component == "tagging" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "thermals" %} -- `ace_common` -{% endif %} - -{% if include.component == "towing" %} -- `ace_common` -- `ace_logistics_rope` -{% endif %} - -{% if include.component == "trenches" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "tripod" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "ui" %} -- `ace_common` -{% endif %} - -{% if include.component == "vector" %} -- `ace_common` -{% endif %} - -{% if include.component == "vehicle_damage" %} -- `ace_common` -- `ace_cookoff` -{% endif %} - -{% if include.component == "vehiclelock" %} -- `ace_interaction` -{% endif %} - -{% if include.component == "vehicles" %} -- `ace_common` -{% endif %} - -{% if include.component == "viewdistance" %} -- `ace_common` -{% endif %} - -{% if include.component == "viewports" %} -- `ace_common` -{% endif %} - -{% if include.component == "viewrestriction" %} -- `ace_common` -{% endif %} - -{% if include.component == "volume" %} -- `ace_common` -{% endif %} - -{% if include.component == "weaponselect" %} -- `ace_common` -{% endif %} - -{% if include.component == "weather" %} -- `ace_common` -{% endif %} - -{% if include.component == "winddeflection" %} -- `ace_common` -{% endif %} - -{% if include.component == "xm157" %} -- `ace_advanced_ballistics` -- `ace_scopes` -{% endif %} - -{% if include.component == "yardage450" %} -- `ace_apl` -- `ace_laser` -{% endif %} - -{% if include.component == "zeus" %} -- `ace_common` -- `ace_ai` -{% endif %} - -{% if include.component == "compat_gm" %} -- `ace_csw` -- `ace_explosives` -- `ace_rearm` -- `ace_refuel` -- `ace_repair` -- `gm_core` -{% endif %} - -{% if include.component == "compat_r3f" %} -- `r3f_armes_c` -- `r3f_acc` -- `R3F_G17_addons` -- `R3F_G_SCAR` -- `R3F_SCAR_H` -- `R3F_SCAR_L` -- `R3F_FN_MAG` -{% endif %} - -{% if include.component == "compat_rh_acc" %} -- `RH_acc` -{% endif %} - -{% if include.component == "compat_rh_de" %} -- `RH_de_cfg` -{% endif %} - -{% if include.component == "compat_rh_m4" %} -- `RH_m4_cfg` -{% endif %} - -{% if include.component == "compat_rh_pdw" %} -- `RH_PDW` -{% endif %} - -{% if include.component == "compat_rhs_afrf3" %} -- `ace_explosives` -- `ace_csw` -- `ace_rearm` -- `ace_refuel` -- `ace_repair` -- `rhs_main_loadorder` -{% endif %} - -{% if include.component == "compat_rhs_gref3" %} -- `ace_fastroping` -- `ace_explosives` -- `ace_csw` -- `rhsgref_main_loadorder` -{% endif %} - -{% if include.component == "compat_rhs_saf3" %} -- `ace_explosives` -- `rhssaf_main_loadorder` -{% endif %} - -{% if include.component == "compat_rhs_usf3" %} -- `ace_explosives` -- `ace_javelin` -- `ace_rearm` -- `ace_refuel` -- `ace_repair` -- `ace_csw` -- `rhsusf_main_loadorder` -{% endif %} - -{% if include.component == "compat_rksl_pm_ii" %} -- `RKSL_PMII` -- `RKSL_PMII_525` -{% endif %} - -{% if include.component == "compat_sma3_iansky" %} -- `iansky_opt` -{% endif %} - -{% if include.component == "compat_sog" %} -- `ace_trenches` -- `loadorder_f_vietnam` -{% endif %} - -{% if include.component == "compat_ws" %} -- `data_f_lxWS_Loadorder` -{% endif %} - -{% if include.component == "noactionmenu" %} -- `ace_common` -{% endif %} - -{% if include.component == "nocrosshair" %} -- `ace_common` -{% endif %} - -{% if include.component == "nouniformrestrictions" %} -- `ace_common` -{% endif %} - -{% if include.component == "particles" %} -- `ace_common` -{% endif %} - -{% if include.component == "realisticdispersion" %} -- `ace_ballistics` -{% endif %} - -{% if include.component == "tracers" %} -- `ace_ballistics` -{% endif %} - +Placeholder - generated in CI. diff --git a/docs/tools/document_functions.py b/docs/tools/document_functions.py index b51aae18a3..dc0e31b37a 100644 --- a/docs/tools/document_functions.py +++ b/docs/tools/document_functions.py @@ -20,12 +20,14 @@ import sys import re import argparse + class FunctionFile: def __init__(self, directory="."): self.directory = directory # False unless specified in processing self.debug = False + self.lint_private = False # Empty until imported from file self.path = "" @@ -42,13 +44,16 @@ class FunctionFile: # Filepath should only be logged once self.logged = False + # Count parse results + self.errors = 0 + def import_header(self, file_path): self.path = file_path - with open(file_path) as file: + with open(file_path, "r", encoding="utf-8") as file: code = file.read() - header_match = re.match(r"\s*/\*.+?\*/", code, re.S) + header_match = re.search(r"\s*/\*.+?\*/", code, re.S) if header_match: self.header = header_match.group(0) else: @@ -57,9 +62,10 @@ class FunctionFile: def has_header(self): return bool(self.header) - def process_header(self, debug=False): + def process_header(self, debug=False, lint_private=False): # Detailed debugging occurs here so value is set self.debug = debug + self.lint_private = lint_private # Preemptively cut away the comment characters (and leading/trailing whitespace) self.header_text = "\n".join([x[3:].strip() for x in self.header.splitlines()]) @@ -71,15 +77,15 @@ class FunctionFile: public_raw = self.get_section("Public") if not public_raw: self.feedback("Public value undefined", 3) - return + return self.errors # Determine whether the header is public self.public = self.process_public(public_raw) # Don't bother to process the rest if private # Unless in debug mode - if not self.public and not self.debug: - return + if not self.public and not self.lint_private: + return self.errors # Retrieve the raw sections text for processing author_raw = self.get_section("Author") @@ -103,6 +109,8 @@ class FunctionFile: if example_raw: self.example = example_raw.strip() + return self.errors + def get_section(self, section_name): try: section_text = self.sections[self.sections.index(section_name) + 1] @@ -153,19 +161,19 @@ class FunctionFile: arguments = [] for argument in lines: - valid = re.match(r"^(\d+):\s(.+?)\<([\s\w]+?)\>(\s\(default: (.+)\))?$", argument) + valid = re.match(r"^(\d+):\s(.+?)\<([\s\w,\|]+?)\>( \([Oo]ptional\))?(\s\(default: (.+)\))?$", argument) if valid: arg_index = valid.group(1) arg_name = valid.group(2) arg_types = valid.group(3) - arg_default = valid.group(5) + arg_default = valid.group(6) arg_notes = [] if arg_index != str(len(arguments)): self.feedback("Argument index {} does not match listed order".format(arg_index), 1) - if arg_default == None: + if arg_default is None: arg_default = "" arguments.append([arg_index, arg_name, arg_types, arg_default, arg_notes]) @@ -193,7 +201,7 @@ class FunctionFile: return_types = valid.group(2) else: self.feedback("Malformed return value \"{}\"".format(return_value), 2) - return ["Malformed",""] + return ["Malformed", ""] return [return_name, return_types] @@ -201,7 +209,7 @@ class FunctionFile: str_list = [] # Title - str_list.append("\n## ace_{}_fnc_{}\n".format(component,os.path.basename(self.path)[4:-4])) + str_list.append("\n## ace_{}_fnc_{}\n".format(component, os.path.basename(self.path)[4:-4])) # Description str_list.append("__Description__\n\n" + self.description) # Arguments @@ -238,27 +246,71 @@ class FunctionFile: self.logged = True def feedback(self, message, level=0): - priority_str = ["Info","Warning","Error","Aborted"][level] + priority_str = ["Info", "Warning", "Error", "Aborted"][level] self.log_file(level > 0) self.write("{0}: {1}".format(priority_str, message)) + if priority_str in ["Error", "Aborted"]: + self.errors += 1 + def write(self, message, indent=2): to_print = [" "]*indent to_print.append(message) print("".join(to_print)) -def document_functions(components): - os.makedirs('../wiki/functions/', exist_ok=True) + +def get_component_name(addons_dir, component): + errors = 0 + + script_component = os.path.join(addons_dir, component, 'script_component.hpp') + with open(script_component, "r", encoding="utf-8") as file: + code = file.read() + + name_match = re.search(r"#define COMPONENT_BEAUTIFIED (.*)", code) + if name_match: + name = name_match.group(1) + else: + name = component.title() + print(" Warning: Missing COMPONENT_BEAUTIFIED") + errors += 1 + + return name, errors + + + +def document_functions(addons_dir, components): + errors = 0 + + wiki_dir = os.path.abspath(os.path.join(addons_dir, '../docs/wiki/functions/')) + os.makedirs(wiki_dir, exist_ok=True) + print("Wiki: {}".format(wiki_dir)) for component in components: - output = os.path.join('../wiki/functions/',component) + ".md" - with open(output, "w") as file: + print(" Documenting... {}.md".format(component)) + component_name, error = get_component_name(addons_dir, component) + errors += error + + output = os.path.join(wiki_dir, component) + ".md" + with open(output, "w", encoding="utf-8") as file: for function in components[component]: + file.writelines([ + "---\n", + "layout: wiki\n", + "title: {} Functions\n".format(component_name), + "description: List of functions in {} component.\n".format(component_name), + "group: functions\n", + "parent: wiki\n", + "---\n", + ]) file.write(function.document(component)) -def crawl_dir(directory, debug=False): + return errors + + +def crawl_dir(addons_dir, directory, debug=False, lint_private=False): components = {} + errors = 0 for root, dirs, files in os.walk(directory): for file in files: @@ -271,16 +323,27 @@ def crawl_dir(directory, debug=False): # Undergo data extraction and detailed debug if function.has_header(): - function.process_header(debug) + errors += function.process_header(debug, lint_private) if function.is_public() and not debug: # Add functions to component key (initalise key if necessary) component = os.path.basename(os.path.dirname(root)) - components.setdefault(component,[]).append(function) + components.setdefault(component, []).append(function) function.feedback("Publicly documented") + else: + errors += 1 + + print() + errors += document_functions(addons_dir, components) + + if errors != 0: + print("\n Unclean!\n {} errors".format(errors)) + else: + print("\n Clean!") + + return errors - document_functions(components) def main(): print(""" @@ -292,15 +355,21 @@ def main(): parser = argparse.ArgumentParser() parser.add_argument('directory', nargs="?", type=str, default=".", help='only crawl specified module addon folder') parser.add_argument('--debug', action="store_true", help='only check for header debug messages') + parser.add_argument('--lint-private', action="store_true", help='lint private function headers as well') args = parser.parse_args() - # abspath is just used for the terminal output - prospective_dir = os.path.abspath(os.path.join('../../addons/',args.directory)) + # Allow calling from anywhere and work our way to addons from this file + addons_dir = os.path.abspath(os.path.join(__file__, '../../../addons/')) + prospective_dir = os.path.abspath(os.path.join(addons_dir, args.directory)) + if os.path.isdir(prospective_dir): print("Directory: {}".format(prospective_dir)) - crawl_dir(prospective_dir, args.debug) + errors = crawl_dir(addons_dir, prospective_dir, args.debug, args.lint_private) + return 0 if errors == 0 else 1 else: print("Invalid directory: {}".format(prospective_dir)) + return 1 + if __name__ == "__main__": - main() + sys.exit(main()) diff --git a/docs/wiki/development/index.md b/docs/wiki/development/index.md index 0dbfe501eb..a04e344a31 100644 --- a/docs/wiki/development/index.md +++ b/docs/wiki/development/index.md @@ -1,5 +1,5 @@ --- -title: Development Documentation +title: Development layout: default group: subNav order: 1 diff --git a/docs/wiki/feature/index.md b/docs/wiki/feature/index.md index 483b7677d4..41fd0fdeea 100644 --- a/docs/wiki/feature/index.md +++ b/docs/wiki/feature/index.md @@ -1,5 +1,5 @@ --- -title: ACE3 Feature documentation +title: Features layout: default group: subNav order: 1 @@ -10,7 +10,7 @@ redirect_from: "/wiki/featurex"
-

ACE3 Features

+

Features

Overviews and details of ACE3 features, their usage and implementations.

diff --git a/docs/wiki/framework/index.md b/docs/wiki/framework/index.md index 6d8a50858c..0b5321f91e 100644 --- a/docs/wiki/framework/index.md +++ b/docs/wiki/framework/index.md @@ -1,5 +1,5 @@ --- -title: ACE3 Framework documentation +title: Frameworks layout: default group: subNav order: 1 @@ -12,13 +12,20 @@ redirect_from: - "/wiki/frameworkx" --- + +
-
+

Frameworks

Public API implemented by ACE3 which mission makers, modders and scripters can use.

-
-
+
+
+
+
+

Functions

+

Public API functions for use by mission makers and other mods to interface with ACE3.

+ Learn more +
diff --git a/docs/wiki/user/index.md b/docs/wiki/user/index.md index 5d6e93cee1..79e897e394 100644 --- a/docs/wiki/user/index.md +++ b/docs/wiki/user/index.md @@ -1,5 +1,5 @@ --- -title: User documentation +title: User layout: default group: subNav order: 1 diff --git a/tools/deploy.py b/tools/deploy.py index 99dbc7ea50..b285bbc5b5 100644 --- a/tools/deploy.py +++ b/tools/deploy.py @@ -9,10 +9,9 @@ import os import sys -import shutil import traceback import subprocess as sp -from github import Github, InputGitAuthor +from github import Github TRANSLATIONISSUE = 367 @@ -21,11 +20,9 @@ TRANSLATIONBODY = """**[ACE3 Translation Guide](http://ace3.acemod.org/wiki/deve {} """ -DEPENDENCIESPATH = "docs/_includes/dependencies_list.md" - REPOUSER = "acemod" REPONAME = "ACE3" -REPOPATH = "{}/{}".format(REPOUSER,REPONAME) +REPOPATH = "{}/{}".format(REPOUSER, REPONAME) BRANCH = "master" @@ -36,23 +33,6 @@ def update_translations(repo): issue = repo.get_issue(TRANSLATIONISSUE) issue.edit(body=TRANSLATIONBODY.format(diag)) -def update_dependencies(repo): - dependencies = sp.check_output(["python3", "tools/extract_dependencies.py", "--markdown"]) - dependencies = str(dependencies, "utf-8") - diff = sp.check_output(["git", "diff", "--name-only", DEPENDENCIESPATH]) - diff = str(diff, "utf-8") - - if diff != "": - sha = repo.get_contents(DEPENDENCIESPATH, ref=BRANCH).sha - repo.update_file( - path="{}".format(DEPENDENCIESPATH), - message="[Docs] Update component dependencies\nAutomatically committed through CI.\n\n[ci skip]", - content=dependencies, sha=sha, committer=InputGitAuthor("ace3mod", "ace3mod@gmail.com"), branch=BRANCH - ) - print("Dependencies successfully updated.") - else: - print("Dependencies skipped - no change.") - def main(): print("Obtaining token ...") @@ -76,14 +56,6 @@ def main(): else: print("Translation issue successfully updated.") - print("\nUpdating dependencies list ...") - try: - update_dependencies(repo) - except: - print("Failed to update dependencies.") - print(traceback.format_exc()) - return 1 - return 0