Use function documentation script (#6897)

Co-authored-by: Björn Dahlgren <bjorn@dahlgren.io>
This commit is contained in:
jonpas 2023-04-30 23:03:35 +02:00 committed by GitHub
parent f67ae06d21
commit 76e1aafb33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 378 additions and 900 deletions

View File

@ -22,6 +22,8 @@ jobs:
run: python3 tools/check_strings.py run: python3 tools/check_strings.py
- name: Check for BOM - name: Check for BOM
uses: arma-actions/bom-check@master uses: arma-actions/bom-check@master
- name: Validate function headers
run: python3 docs/tools/document_functions.py --debug
lint: lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -4,13 +4,23 @@ on:
push: push:
branches: branches:
- master - master
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs: jobs:
update: update:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout the source code - name: Checkout the source code
uses: actions/checkout@master uses: actions/checkout@v3
- name: Install Python packages - name: Install Python packages
run: | run: |
pip3 install wheel pip3 install wheel
@ -22,3 +32,39 @@ jobs:
env: env:
GH_TOKEN: ${{ secrets.DOCS_TOKEN }} GH_TOKEN: ${{ secrets.DOCS_TOKEN }}
run: python3 tools/deploy.py 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

View File

@ -4,7 +4,7 @@
* Add a listbox row. * Add a listbox row.
* *
* Arguments: * Arguments:
* 0: Config category <STRING> (must be "CfgWeapons", "CfgVehicles", "CfgMagazines", "CfgVoice") * 0: Config category, must be "CfgWeapons", "CfgVehicles", "CfgMagazines", "CfgVoice" <STRING>
* 1: Classname <STRING> * 1: Classname <STRING>
* 2: Panel control <CONTROL> * 2: Panel control <CONTROL>
* 3: Name of the picture entry in that Cfg class <STRING> * 3: Name of the picture entry in that Cfg class <STRING>
@ -12,8 +12,12 @@
* Return Value: * Return Value:
* None * None
* *
* Example:
* ["CfgWeapons", "launch_NLAW_F", _ctrl, "icon"] call ace_arsenal_fnc_addListBoxItem
*
* Public: Yes * Public: Yes
*/ */
params ["_configCategory", "_className", "_ctrlPanel", ["_pictureEntryName", "picture", [""]]]; params ["_configCategory", "_className", "_ctrlPanel", ["_pictureEntryName", "picture", [""]]];
private _cacheNamespace = _ctrlPanel; //For better readability. private _cacheNamespace = _ctrlPanel; //For better readability.

View File

@ -5,15 +5,15 @@
* *
* Arguments: * Arguments:
* 0: Tabs to add stat to <ARRAY> * 0: Tabs to add stat to <ARRAY>
* 0: Left Tab Indexes <ARRAY> * 0.0: Left Tab Indexes <ARRAY>
* 1: Right Tab Indexes <ARRAY> * 0.1: Right Tab Indexes <ARRAY>
* 1: Sort Class (a unique string for each algorithm) <STRING> * 1: Sort Class (a unique string for each algorithm) <STRING>
* 2: Display Name <STRING> * 2: Display Name <STRING>
* 3: Algorithm <CODE> * 3: Algorithm <CODE>
* 4: Condition (Optional)<CODE> * 4: Condition <CODE> (default: true)
* *
* Return Value: * Return Value:
* 0: Array of IDs (ARRAY of STRINGS) * 0: Array of IDs <ARRAY of STRINGS>
* *
* Example: * Example:
* [[[0, 1], []], "fireRateSort", "Sort by fire rate", { * [[[0, 1], []], "fireRateSort", "Sort by fire rate", {

View File

@ -4,32 +4,33 @@
* Add a stat to ACE Arsenal. * Add a stat to ACE Arsenal.
* *
* Arguments: * Arguments:
* 0: Tabs to add the stat to (ARRAY of ARRAYS) * 0: Tabs to add the stat to <ARRAY of ARRAYS>
* 0.1 Left tab indexes (ARRAY of NUMBERS) * 0.0: Left tab indexes <ARRAY of NUMBERS>
* 0.2 Right tab indexes (ARRAY of NUMBERS) * 0.1: Right tab indexes <ARRAY of NUMBERS>
* 1: Stat class (STRING) (A unique string for each stat) * 1: Stat class (unique string for each stat) <STRING>
* 2: Config entries to pass (ARRAY of STRINGS) * 2: Config entries to pass <ARRAY of STRINGS>
* 3: Title (STRING) * 3: Title <STRING>
* 4: Show bar / show text bools (ARRAY of BOOLS) * 4: Show bar / show text bools <ARRAY of BOOLS>
* 4.1 Show bar (BOOL) * 4.0: Show bar <BOOL>
* 4.2 Show text (BOOL) * 4.1: Show text <BOOL>
* 5: Array of statements (ARRAY of ARRAYS) * 5: Array of statements <ARRAY of ARRAYS>
* 5.1 Bar code (CODE) * 5.0: Bar code <CODE>
* 5.2 Text code (CODE) * 5.1: Text code <CODE>
* 5.3 Condition code (CODE) * 5.2: Condition code <CODE>
* 6: Priority (NUMBER) (Optional) * 6: Priority <NUMBER> (default: 0)
* *
* Return Value: * Return Value:
* 0: Array of IDs (ARRAY of STRINGS) * 0: Array of IDs <ARRAY of STRINGS>
* *
* Example: * Example:
* [[[0,1,2], [7]], "scopeStat", ["scope"], "Scope", [false, true], [{}, { * [[[0,1,2], [7]], "scopeStat", ["scope"], "Scope", [false, true], [{}, {
params ["_statsArray", "_itemCfg"]; * params ["_statsArray", "_itemCfg"];
getNumber (_itemCfg >> _statsArray select 0) * getNumber (_itemCfg >> _statsArray select 0)
}, {true}]] call ACE_arsenal_fnc_addStat * }, {true}]] call ACE_arsenal_fnc_addStat
* *
* Public: Yes * Public: Yes
*/ */
params [ params [
["_tabs", [[], []], [[]], 2], ["_tabs", [[], []], [[]], 2],
["_class", "", [""]], ["_class", "", [""]],

View File

@ -1,4 +1,9 @@
#include "script_component.hpp" #include "script_component.hpp"
/*
* Author: commy2
*
* Public: No
*/
params ["", "_args"]; params ["", "_args"];
_args params ["", "_buttonPressed", "_xPos", "_yPos"]; _args params ["", "_buttonPressed", "_xPos", "_yPos"];

View File

@ -1,4 +1,9 @@
#include "script_component.hpp" #include "script_component.hpp"
/*
* Author: commy2
*
* Public: No
*/
params ["", "_args"]; params ["", "_args"];
_args params ["", "_buttonPressed"]; _args params ["", "_buttonPressed"];

View File

@ -9,6 +9,9 @@
* Return Value: * Return Value:
* None * None
* *
* Example:
* call ace_arsenal_fnc_portVALoadouts
*
* Public: Yes * Public: Yes
*/ */

View File

@ -4,7 +4,7 @@
* Remove a stat from ACE Arsenal. * Remove a stat from ACE Arsenal.
* *
* Arguments: * Arguments:
* 0: Array of IDs (ARRAY) * 0: Array of IDs <ARRAY>
* *
* Return Value: * Return Value:
* None * None

View File

@ -11,7 +11,7 @@
* 2.2: Bar limits (ARRAY of SCALAR) * 2.2: Bar limits (ARRAY of SCALAR)
* *
* Return Value: * Return Value:
* Number * <NUMBER>
* *
* Public: No * Public: No
*/ */

View File

@ -4,18 +4,21 @@
* Generic bar statement for stats. * Generic bar statement for stats.
* *
* Arguments: * Arguments:
* 0: stat (STRING) * 0: Stat <STRING>
* 1: item config path (CONFIG) * 1: Item config path <CONFIG>
* 2: Args for configExtreme * 2: Args for configExtreme <ARRAY>
* 2.1: Stat limits (ARRAY of BOOL) * 2.1: Stat limits <ARRAY of BOOLS>
* 2.2: Bar limits (ARRAY of SCALAR) * 2.2: Bar limits <ARRAY of NUMBERS>
* 2.3: Evaluate as a logarithmic number (BOOL) * 2.3: Evaluate as a logarithmic number <BOOL>
* *
* Return Value: * Return Value:
* Number * Bar statement <NUMBER>
*
* Example:
* ["ACE_maxZeroing", _config, [[0, 2500], [0.01, 1], false]] call ace_arsenal_fnc_statBarStatement_default
* *
* Public: Yes * Public: Yes
*/ */
params ["_stat", "_config", "_args"]; params ["_stat", "_config", "_args"];
_args params ["_statMinMax", "_barLimits", "_configExtremeBool"]; _args params ["_statMinMax", "_barLimits", "_configExtremeBool"];

View File

@ -10,8 +10,11 @@
* Return Value: * Return Value:
* None * None
* *
* Example:
* call ace_arsenal_fnc_updateCamPos
*
* Public: Yes * Public: Yes
*/ */
GVAR(cameraPosition) params ["_distance", "_dirH", "_dirV"]; GVAR(cameraPosition) params ["_distance", "_dirH", "_dirV"];
[GVAR(cameraHelper), [_dirH + 180, - _dirV, 0]] call bis_fnc_setobjectrotation; [GVAR(cameraHelper), [_dirH + 180, - _dirV, 0]] call bis_fnc_setobjectrotation;

View File

@ -1,4 +1,9 @@
#include "script_component.hpp" #include "script_component.hpp"
/*
* Author: commy2
*
* Public: No
*/
params ["_type", "_position", ["_group", grpNull], "_varName"]; params ["_type", "_position", ["_group", grpNull], "_varName"];
private _player = player; private _player = player;

View File

@ -1,4 +1,9 @@
#include "script_component.hpp" #include "script_component.hpp"
/*
* Author: commy2
*
* Public: No
*/
params ["_display"]; params ["_display"];

View File

@ -4,7 +4,7 @@
* Returns a orthonormal system of reference aligned with the supplied vector * Returns a orthonormal system of reference aligned with the supplied vector
* *
* Arguments: * Arguments:
* Vector to align the coordinate system with <ARRAY> * 0: Vector to align the coordinate system with <ARRAY>
* *
* Return Value: * Return Value:
* 0: Vector Normalized <ARRAY> * 0: Vector Normalized <ARRAY>

View File

@ -6,7 +6,7 @@
* Should be equivalent to `allUnits select {local _x}` * Should be equivalent to `allUnits select {local _x}`
* *
* Arguments: * Arguments:
* Nothing * None
* *
* Return Value: * Return Value:
* Array of local Units <ARRAY> * Array of local Units <ARRAY>

View File

@ -4,7 +4,7 @@
* Function used to get the vehicle icon for provided object (cached for repeat use) * Function used to get the vehicle icon for provided object (cached for repeat use)
* *
* Arguments: * Arguments:
* 0: Object to get icon of <OBJECT/STRING> * 0: Object to get icon of <OBJECT, STRING>
* *
* Return Value: * Return Value:
* Icon of vehicle <STRING> * Icon of vehicle <STRING>

View File

@ -6,7 +6,7 @@
* Arguments: * Arguments:
* 0: The Unit <OBJECT> * 0: The Unit <OBJECT>
* *
* ReturnValue: * Return Value:
* Unit is medic <BOOL> * Unit is medic <BOOL>
* *
* Example: * Example:

View File

@ -4,7 +4,7 @@
* hint retun value of given function every frame * hint retun value of given function every frame
* *
* Arguments: * Arguments:
* <CODE> * 0: Code to monitor <CODE>
* *
* Return Value: * Return Value:
* None * None

View File

@ -5,7 +5,7 @@
* *
* Arguments: * Arguments:
* 0: Number to 'digitize' <NUMBER> * 0: Number to 'digitize' <NUMBER>
* 1: Set the minimal length of the returned array. Useful for getting left hand zeroes. <NUMBER>, optional * 1: Set the minimal length of the returned array. Useful for getting left hand zeroes. <NUMBER> (optional)
* *
* Return Value: * Return Value:
* Digits. The maximum count is six digits. <ARRAY> * Digits. The maximum count is six digits. <ARRAY>

View File

@ -14,7 +14,7 @@
* Example: * Example:
* ["2d", [0,0,0], 1] call ace_common_fnc_rscObjectHelper * ["2d", [0,0,0], 1] call ace_common_fnc_rscObjectHelper
* *
* Public: Maybe * Public: No
*/ */
params ["_func", "_array", ["_scale", 1]]; params ["_func", "_array", ["_scale", 1]];

View File

@ -4,7 +4,8 @@
* Converts number to binary number * Converts number to binary number
* *
* Arguments: * Arguments:
* A number <NUMBER> * 0: A number <NUMBER>
* 1: Minumum length of numbers <NUMBER> (default: 1)
* *
* Return Value: * Return Value:
* A binary number as string <STRING> * A binary number as string <STRING>

View File

@ -4,7 +4,10 @@
* Convert an array of booleans into a number. * Convert an array of booleans into a number.
* *
* Arguments: * Arguments:
* N: Booleans <ARRAY> * 0: Boolean <BOOL>
* 1: Boolean <BOOL>
* 2: Boolean <BOOL>
* ...
* *
* Return Value: * Return Value:
* Bitmask <NUMBER> * Bitmask <NUMBER>

View File

@ -4,7 +4,7 @@
* Converts number to hexadecimal number * Converts number to hexadecimal number
* *
* Arguments: * Arguments:
* A number between 0 and 255 <NUMBER> * 0: A number between 0 and 255 <NUMBER>
* *
* Return Value: * Return Value:
* A hexadecimal number as string <STRING> * A hexadecimal number as string <STRING>

View File

@ -7,12 +7,12 @@
* 0: Title (var name) <STRING> (default: "") * 0: Title (var name) <STRING> (default: "")
* 1: Code to generate result (passed nothing, can return any) <CODE> (default: {}) * 1: Code to generate result (passed nothing, can return any) <CODE> (default: {})
* 2: Array containing modifiers <ARRAY> (default: []) * 2: Array containing modifiers <ARRAY> (default: [])
* For Numbers: * For Numbers:
* 0: Show Delta change <BOOL> (default: true) * 2.0: Show Delta change <BOOL> (default: true)
* 1: Slider Min Value <NUMBER> (default: 0) * 2.1: Slider Min Value <NUMBER> (default: 0)
* 1: Slider Max Value <NUMBER> (default: 0) * 2.1: Slider Max Value <NUMBER> (default: 0)
* For Anything else: * For Anything else:
* 0: Number of structured text lines <NUMBER> (default: 1) * 2.0: Number of structured text lines <NUMBER> (default: 1)
* *
* Return Value: * Return Value:
* None * None

View File

@ -5,7 +5,7 @@
* *
* Arguments: * Arguments:
* 0: Unit <OBJECT> * 0: Unit <OBJECT>
* 0: Target (ACE_DefuseObject) <OBJECT> * 1: Target (ACE_DefuseObject) <OBJECT>
* *
* Return Value: * Return Value:
* Able to defuse <BOOL> * Able to defuse <BOOL>

View File

@ -7,8 +7,8 @@
* 0: Unit <OBJECT> * 0: Unit <OBJECT>
* 1: Max range (-1 to ignore) <NUMBER> * 1: Max range (-1 to ignore) <NUMBER>
* 2: Explosive <ARRAY> * 2: Explosive <ARRAY>
* 0: Explosive <OBJECT> * 2.0: Explosive <OBJECT>
* 1: Fuse time <NUMBER> * 2.1: Fuse time <NUMBER>
* 3: Trigger Item Classname <STRING> * 3: Trigger Item Classname <STRING>
* *
* Return Value: * Return Value:

View File

@ -7,7 +7,7 @@
* Arguments: * Arguments:
* 0: Unit <OBJECT> * 0: Unit <OBJECT>
* 1: Item <STRING> * 1: Item <STRING>
* 3: Data <STRING> * 2: Data <STRING>
* *
* Return Value: * Return Value:
* Successful <BOOL> * Successful <BOOL>

View File

@ -1,5 +1,10 @@
#include "script_component.hpp" #include "script_component.hpp"
#include "\a3\ui_f\hpp\defineResincl.inc" #include "\a3\ui_f\hpp\defineResincl.inc"
/*
* Author: commy2
*
* Public: No
*/
params ["_display"]; params ["_display"];
if (ctrlIDD _display != IDD_MAIN_MAP) exitWith {}; if (ctrlIDD _display != IDD_MAIN_MAP) exitWith {};

View File

@ -7,7 +7,7 @@
* 0: Unit <OBJECT> * 0: Unit <OBJECT>
* *
* Return Value: * Return Value:
* Serialized state as JSON string * Serialized state as JSON string <STRING>
* *
* Example: * Example:
* [player] call ace_medical_fnc_serializeState * [player] call ace_medical_fnc_serializeState

View File

@ -17,6 +17,8 @@
* *
* Example: * Example:
* [player, "Morphine", 120, 60, -10, 0.8, -10] call ace_medical_status_fnc_addMedicationAdjustment * [player, "Morphine", 120, 60, -10, 0.8, -10] call ace_medical_status_fnc_addMedicationAdjustment
*
* Public: No
*/ */
params ["_unit", "_medication", "_timeToMaxEffect", "_maxTimeInSystem", "_hrAdjust", "_painAdjust", "_flowAdjust"]; params ["_unit", "_medication", "_timeToMaxEffect", "_maxTimeInSystem", "_hrAdjust", "_painAdjust", "_flowAdjust"];
TRACE_7("addMedicationAdjustment",_unit,_medication,_timeToMaxEffect,_maxTimeInSystem,_hrAdjust,_painAdjust,_flowAdjust); TRACE_7("addMedicationAdjustment",_unit,_medication,_timeToMaxEffect,_maxTimeInSystem,_hrAdjust,_painAdjust,_flowAdjust);

View File

@ -5,7 +5,7 @@
* *
* Arguments: * Arguments:
* 0: Vehicle <OBJECT> * 0: Vehicle <OBJECT>
* 1: Disable <BOOL>(optional) * 1: Disable <BOOL> (optional)
* *
* Return Value: * Return Value:
* None * None

View File

@ -8,7 +8,7 @@
* 1: Controller Objects <ARRAY> * 1: Controller Objects <ARRAY>
* 2: Image Paths <ARRAY> * 2: Image Paths <ARRAY>
* 3: Action Names <ARRAY> * 3: Action Names <ARRAY>
* 4: Slide Duration <NUMBER> (0 disables automatic transitions) * 4: Slide Duration, 0 disables automatic transitions <NUMBER>
* 5: Set Name <STRING> (default: localized "Slides") * 5: Set Name <STRING> (default: localized "Slides")
* 6: Texture Selection <NUMBER> (default: 0) * 6: Texture Selection <NUMBER> (default: 0)
* *

View File

@ -1,24 +1,24 @@
#include "script_component.hpp" #include "script_component.hpp"
/* /*
* Author: PabstMirror * Author: PabstMirror
* Runs each frame while inside of a vehicle with viewports * Runs each frame while inside of a vehicle with viewports
* *
* Arguments: * Arguments:
* 0: PFEH Args <ARRAY> * 0: PFEH Args <ARRAY>
* 0: Player <OBJECT> * 0: Player <OBJECT>
* 1: Vehicle <OBJECT> * 1: Vehicle <OBJECT>
* 2: Viewport configuration <ARRAY> * 2: Viewport configuration <ARRAY>
* 3: Viewport index shown (-1 for none) <NUMBER> * 3: Viewport index shown (-1 for none) <NUMBER>
* 4: Last visionmode <NUMBER> * 4: Last visionmode <NUMBER>
* *
* Return Value: * Return Value:
* None * None
* *
* Example: * Example:
* [] call ace_viewports_fnc_eachFrame * [] call ace_viewports_fnc_eachFrame
* *
* Public: No * Public: No
*/ */
params ["_args", "_pfID"]; params ["_args", "_pfID"];
_args params ["_player", "_vehicle", "_viewports", "_shownIndex", "_lastVisionMode"]; _args params ["_player", "_vehicle", "_viewports", "_shownIndex", "_lastVisionMode"];
@ -37,7 +37,7 @@ if (cba_events_control) then {
}; };
([_player] call FUNC(getSeatInfo)) params ["_role", "", "", "_comparment"]; ([_player] call FUNC(getSeatInfo)) params ["_role", "", "", "_comparment"];
private _newIndexAngle = 45; // Controls the max angle private _newIndexAngle = 45; // Controls the max angle
private _eyesPosASL = AGLtoASL (positionCameraToWorld [0, 0, 0]); private _eyesPosASL = AGLtoASL (positionCameraToWorld [0, 0, 0]);
private _eyesDir = (AGLtoASL (positionCameraToWorld [0, 0, 1])) vectorDiff _eyesPosASL; 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]; systemChat format ["%1: %2 @ %3",_forEachIndex,round _viewAngle, vectorMagnitude _viewDiff];
#endif #endif
if ( if (
(_viewAngle < _newIndexAngle) (_viewAngle < _newIndexAngle)
&& {(_compartments isEqualTo []) || {(toLower _comparment) in _compartments}} && {(_compartments isEqualTo []) || {(toLower _comparment) in _compartments}}
&& {(_roles isEqualTo []) || {(toLower _role) in _roles}} && {(_roles isEqualTo []) || {(toLower _role) in _roles}}
&& {(vectorMagnitude _viewDiff) < _maxDistance} && {(vectorMagnitude _viewDiff) < _maxDistance}

View File

@ -1,19 +1,19 @@
#include "script_component.hpp" #include "script_component.hpp"
/* /*
* Author: PabstMirror * Author: PabstMirror
* Gets viewports for a vehicle from config. Caches results to a setVar on the vic. * Gets viewports for a vehicle from config. Caches results to a setVar on the vic.
* *
* Arguments: * Arguments:
* 0: vehicle <OBJECT> * 0: vehicle <OBJECT>
* *
* Return Value: * Return Value:
* ARRAY * ARRAY
* *
* Example: * Example:
* [vehicle player] call ace_viewports_fnc_getViewports * [vehicle player] call ace_viewports_fnc_getViewports
* *
* Public: No * Public: No
*/ */
params ["_vehicle"]; params ["_vehicle"];
@ -46,12 +46,12 @@ if (isNil "_viewports") then {
if (_screenLocation isEqualType "") then { if (_screenLocation isEqualType "") then {
// screens should be on the hull (IE non-animated) so we can do all the mem-point calculations here // 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 if (_screenLocation == "") exitWith { // use generic periscope drop height from cam
private _camLocArray = if (_camLocation isEqualType []) then { private _camLocArray = if (_camLocation isEqualType []) then {
_camLocation _camLocation
} else { } else {
_vehicle selectionPosition [_camLocation, "Memory"]; _vehicle selectionPosition [_camLocation, "Memory"];
}; };
_screenLocation =_camLocArray vectorAdd [0,0,-0.175] _screenLocation =_camLocArray vectorAdd [0,0,-0.175]
}; };
_screenLocation = _vehicle selectionPosition [_screenLocation, "Memory"]; _screenLocation = _vehicle selectionPosition [_screenLocation, "Memory"];
}; };

View File

@ -1,19 +1,19 @@
#include "script_component.hpp" #include "script_component.hpp"
/* /*
* Author: PabstMirror * Author: PabstMirror
* Cleans up existing viewport display and camera * Cleans up existing viewport display and camera
* *
* Arguments: * Arguments:
* None * None
* *
* Return Value: * Return Value:
* None * None
* *
* Example: * Example:
* [] call ace_viewports_fnc_viewCleanup * [] call ace_viewports_fnc_viewCleanup
* *
* Public: No * Public: No
*/ */
TRACE_1("camCleanup",_this); TRACE_1("camCleanup",_this);

View File

@ -1,21 +1,21 @@
#include "script_component.hpp" #include "script_component.hpp"
/* /*
* Author: PabstMirror * Author: PabstMirror
* Creates a viewport display and camera * Creates a viewport display and camera
* *
* Arguments: * Arguments:
* 0: Vehicle <OBJECT> * 0: Vehicle <OBJECT>
* 1: Viewport <ARRAY> * 1: Viewport <ARRAY>
* 2: Player's vision mode <NUMBER> * 2: Player's vision mode <NUMBER>
* *
* Return Value: * Return Value:
* None * None
* *
* Example: * Example:
* [...] call ace_viewports_fnc_viewCreate * [...] call ace_viewports_fnc_viewCreate
* *
* Public: No * Public: No
*/ */
params ["_vehicle", "_viewport", "_visionMode"]; params ["_vehicle", "_viewport", "_visionMode"];
_viewport params ["_name", "_type", "_camLocation", "_camAttach"]; _viewport params ["_name", "_type", "_camLocation", "_camAttach"];
@ -79,7 +79,7 @@ switch (true) do {
if (_usingGoggles) then { if (_usingGoggles) then {
// Screen will be out of focus, too bright and not in IR; should be almost impossible to see anything useful // 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]]; _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]; private _ctrlNVG = _display ctrlCreate ["RscPicture", -1];
_ctrlNVG ctrlSetText "#(argb,8,8,3)color(1,1,0.6,0.9)"; _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]; _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 { if (_usingGoggles) then {
_camEffect = [_visionMode]; // pass-thru _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 // 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... // 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; private _viewWidth = _stretch * _viewHeight * _screenAR / 1.3333333333333;

View File

@ -10,6 +10,8 @@
* *
* Return Value: * Return Value:
* None * None
*
* Public: No
*/ */
params ["_logic", "_units", "_activated"]; params ["_logic", "_units", "_activated"];

5
docs/.gitignore vendored
View File

@ -20,3 +20,8 @@ CNAME
tools/temp tools/temp
Gemfile.lock Gemfile.lock
# Generated
_includes/dependencies_list.md
wiki/functions/*.md
!wiki/functions/index.md

View File

@ -1,708 +1 @@
{% if include.component == "advanced_ballistics" %} Placeholder - generated in CI.
- `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 %}

View File

@ -20,12 +20,14 @@ import sys
import re import re
import argparse import argparse
class FunctionFile: class FunctionFile:
def __init__(self, directory="."): def __init__(self, directory="."):
self.directory = directory self.directory = directory
# False unless specified in processing # False unless specified in processing
self.debug = False self.debug = False
self.lint_private = False
# Empty until imported from file # Empty until imported from file
self.path = "" self.path = ""
@ -42,13 +44,16 @@ class FunctionFile:
# Filepath should only be logged once # Filepath should only be logged once
self.logged = False self.logged = False
# Count parse results
self.errors = 0
def import_header(self, file_path): def import_header(self, file_path):
self.path = 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() code = file.read()
header_match = re.match(r"\s*/\*.+?\*/", code, re.S) header_match = re.search(r"\s*/\*.+?\*/", code, re.S)
if header_match: if header_match:
self.header = header_match.group(0) self.header = header_match.group(0)
else: else:
@ -57,9 +62,10 @@ class FunctionFile:
def has_header(self): def has_header(self):
return bool(self.header) 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 # Detailed debugging occurs here so value is set
self.debug = debug self.debug = debug
self.lint_private = lint_private
# Preemptively cut away the comment characters (and leading/trailing whitespace) # Preemptively cut away the comment characters (and leading/trailing whitespace)
self.header_text = "\n".join([x[3:].strip() for x in self.header.splitlines()]) 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") public_raw = self.get_section("Public")
if not public_raw: if not public_raw:
self.feedback("Public value undefined", 3) self.feedback("Public value undefined", 3)
return return self.errors
# Determine whether the header is public # Determine whether the header is public
self.public = self.process_public(public_raw) self.public = self.process_public(public_raw)
# Don't bother to process the rest if private # Don't bother to process the rest if private
# Unless in debug mode # Unless in debug mode
if not self.public and not self.debug: if not self.public and not self.lint_private:
return return self.errors
# Retrieve the raw sections text for processing # Retrieve the raw sections text for processing
author_raw = self.get_section("Author") author_raw = self.get_section("Author")
@ -103,6 +109,8 @@ class FunctionFile:
if example_raw: if example_raw:
self.example = example_raw.strip() self.example = example_raw.strip()
return self.errors
def get_section(self, section_name): def get_section(self, section_name):
try: try:
section_text = self.sections[self.sections.index(section_name) + 1] section_text = self.sections[self.sections.index(section_name) + 1]
@ -153,19 +161,19 @@ class FunctionFile:
arguments = [] arguments = []
for argument in lines: 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: if valid:
arg_index = valid.group(1) arg_index = valid.group(1)
arg_name = valid.group(2) arg_name = valid.group(2)
arg_types = valid.group(3) arg_types = valid.group(3)
arg_default = valid.group(5) arg_default = valid.group(6)
arg_notes = [] arg_notes = []
if arg_index != str(len(arguments)): if arg_index != str(len(arguments)):
self.feedback("Argument index {} does not match listed order".format(arg_index), 1) self.feedback("Argument index {} does not match listed order".format(arg_index), 1)
if arg_default == None: if arg_default is None:
arg_default = "" arg_default = ""
arguments.append([arg_index, arg_name, arg_types, arg_default, arg_notes]) arguments.append([arg_index, arg_name, arg_types, arg_default, arg_notes])
@ -193,7 +201,7 @@ class FunctionFile:
return_types = valid.group(2) return_types = valid.group(2)
else: else:
self.feedback("Malformed return value \"{}\"".format(return_value), 2) self.feedback("Malformed return value \"{}\"".format(return_value), 2)
return ["Malformed",""] return ["Malformed", ""]
return [return_name, return_types] return [return_name, return_types]
@ -201,7 +209,7 @@ class FunctionFile:
str_list = [] str_list = []
# Title # 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 # Description
str_list.append("__Description__\n\n" + self.description) str_list.append("__Description__\n\n" + self.description)
# Arguments # Arguments
@ -238,27 +246,71 @@ class FunctionFile:
self.logged = True self.logged = True
def feedback(self, message, level=0): 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.log_file(level > 0)
self.write("{0}: {1}".format(priority_str, message)) self.write("{0}: {1}".format(priority_str, message))
if priority_str in ["Error", "Aborted"]:
self.errors += 1
def write(self, message, indent=2): def write(self, message, indent=2):
to_print = [" "]*indent to_print = [" "]*indent
to_print.append(message) to_print.append(message)
print("".join(to_print)) 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: for component in components:
output = os.path.join('../wiki/functions/',component) + ".md" print(" Documenting... {}.md".format(component))
with open(output, "w") as file: 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]: 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)) 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 = {} components = {}
errors = 0
for root, dirs, files in os.walk(directory): for root, dirs, files in os.walk(directory):
for file in files: for file in files:
@ -271,16 +323,27 @@ def crawl_dir(directory, debug=False):
# Undergo data extraction and detailed debug # Undergo data extraction and detailed debug
if function.has_header(): if function.has_header():
function.process_header(debug) errors += function.process_header(debug, lint_private)
if function.is_public() and not debug: if function.is_public() and not debug:
# Add functions to component key (initalise key if necessary) # Add functions to component key (initalise key if necessary)
component = os.path.basename(os.path.dirname(root)) component = os.path.basename(os.path.dirname(root))
components.setdefault(component,[]).append(function) components.setdefault(component, []).append(function)
function.feedback("Publicly documented") 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(): def main():
print(""" print("""
@ -292,15 +355,21 @@ def main():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('directory', nargs="?", type=str, default=".", help='only crawl specified module addon folder') 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('--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() args = parser.parse_args()
# abspath is just used for the terminal output # Allow calling from anywhere and work our way to addons from this file
prospective_dir = os.path.abspath(os.path.join('../../addons/',args.directory)) 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): if os.path.isdir(prospective_dir):
print("Directory: {}".format(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: else:
print("Invalid directory: {}".format(prospective_dir)) print("Invalid directory: {}".format(prospective_dir))
return 1
if __name__ == "__main__": if __name__ == "__main__":
main() sys.exit(main())

View File

@ -1,5 +1,5 @@
--- ---
title: Development Documentation title: Development
layout: default layout: default
group: subNav group: subNav
order: 1 order: 1

View File

@ -1,5 +1,5 @@
--- ---
title: ACE3 Feature documentation title: Features
layout: default layout: default
group: subNav group: subNav
order: 1 order: 1
@ -10,7 +10,7 @@ redirect_from: "/wiki/featurex"
<div class="row"> <div class="row">
<div class="large-12 columns"> <div class="large-12 columns">
<h1>ACE3 Features</h1> <h1>Features</h1>
<p>Overviews and details of ACE3 features, their usage and implementations.</p> <p>Overviews and details of ACE3 features, their usage and implementations.</p>
</div> </div>
</div> </div>

View File

@ -1,5 +1,5 @@
--- ---
title: ACE3 Framework documentation title: Frameworks
layout: default layout: default
group: subNav group: subNav
order: 1 order: 1
@ -12,13 +12,20 @@ redirect_from:
- "/wiki/frameworkx" - "/wiki/frameworkx"
--- ---
<style type="text/css">
ul {
columns: 2;
}
</style>
<div class="row"> <div class="row">
<div class="large-4 medium-4 columns"> <div class="large-12 columns">
<h1>Frameworks</h1> <h1>Frameworks</h1>
<p>Public API implemented by ACE3 which mission makers, modders and scripters can use.</p> <p>Public API implemented by ACE3 which mission makers, modders and scripters can use.</p>
</div> </div>
<div class="large-8 medium-8 columns"> </div>
<div class="row">
<div class="large-12 columns">
<nav> <nav>
<ul> <ul>
{% assign pages_list = site.pages | sort: "title" %} {% assign pages_list = site.pages | sort: "title" %}

View File

@ -0,0 +1,32 @@
---
title: Functions
layout: default
group: subNav
order: 1
short: wiki
parent: wiki
---
<style type="text/css">
ul {
columns: 2;
}
</style>
<div class="row">
<div class="large-12 columns">
<h1>Functions</h1>
<p>Public API functions for use by mission makers and other mods to interface with ACE3. Backwards compatibility is supported for the following functions as much as possible.</p>
</div>
</div>
<div class="row">
<div class="large-12 columns">
<nav>
<ul>
{% assign pages_list = site.pages | sort: "title" %}
{% assign group = 'functions' %}
{% include pages_list %}
</ul>
</nav>
</div>
</div>

View File

@ -71,4 +71,9 @@ parent:
<p>Information about developing ACE3, from setting up the development environment to guidelines and tips.</p> <p>Information about developing ACE3, from setting up the development environment to guidelines and tips.</p>
<a href="{{ site.baseurl }}/wiki/development/" class="button">Learn more</a> <a href="{{ site.baseurl }}/wiki/development/" class="button">Learn more</a>
</div> </div>
<div class="large-6 medium-2 columns">
<h3>Functions</h3>
<p>Public API functions for use by mission makers and other mods to interface with ACE3.</p>
<a href="{{ site.baseurl }}/wiki/functions/" class="button">Learn more</a>
</div>
</div> </div>

View File

@ -1,5 +1,5 @@
--- ---
title: User documentation title: User
layout: default layout: default
group: subNav group: subNav
order: 1 order: 1

View File

@ -9,10 +9,9 @@
import os import os
import sys import sys
import shutil
import traceback import traceback
import subprocess as sp import subprocess as sp
from github import Github, InputGitAuthor from github import Github
TRANSLATIONISSUE = 367 TRANSLATIONISSUE = 367
@ -21,11 +20,9 @@ TRANSLATIONBODY = """**[ACE3 Translation Guide](http://ace3.acemod.org/wiki/deve
{} {}
""" """
DEPENDENCIESPATH = "docs/_includes/dependencies_list.md"
REPOUSER = "acemod" REPOUSER = "acemod"
REPONAME = "ACE3" REPONAME = "ACE3"
REPOPATH = "{}/{}".format(REPOUSER,REPONAME) REPOPATH = "{}/{}".format(REPOUSER, REPONAME)
BRANCH = "master" BRANCH = "master"
@ -36,23 +33,6 @@ def update_translations(repo):
issue = repo.get_issue(TRANSLATIONISSUE) issue = repo.get_issue(TRANSLATIONISSUE)
issue.edit(body=TRANSLATIONBODY.format(diag)) 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(): def main():
print("Obtaining token ...") print("Obtaining token ...")
@ -76,14 +56,6 @@ def main():
else: else:
print("Translation issue successfully updated.") 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 return 0