### Install and Run cargo-nextest Source: https://github.com/brettmayson/hemtt/blob/main/CONTRIBUTING.md Install cargo-nextest for faster test execution and to detect slow or leaky tests. Then, run all tests using the installed tool. ```bash cargo install cargo-nextest cargo nextest run ``` -------------------------------- ### Addon Configuration Example Source: https://github.com/brettmayson/hemtt/blob/main/book/configuration/addon.md This TOML snippet shows a comprehensive example of an `addon.toml` file, demonstrating configurations for binarize, rapify, files, and properties. ```toml [binarize] enabled = false # Default: true exclude = [ "data/*.p3d", "data/anim/chop.rtm", ] [rapify] enabled = false # Default: true exclude = [ "missions/**/description.ext", ] [files] exclude = [ ".vscode/**/*", # Exclude all files in the .vscode folder "data/*.psd", ] [properties] iso = "14001" # ignore mismatched $PBOPREFIX$ for addon ignore_pboprefix = true # Default: false ``` -------------------------------- ### Example $PBOPREFIX$ File Content Source: https://github.com/brettmayson/hemtt/blob/main/book/configuration/index.md This example shows the expected content of a $PBOPREFIX$ file, demonstrating how the main prefix is used. ```txt z\abe\addons\main ``` -------------------------------- ### Install HEMTT on Windows using Winget Source: https://github.com/brettmayson/hemtt/blob/main/book/installation/index.md Use this command to install HEMTT via the Windows Package Manager. ```powershell winget install hemtt ``` -------------------------------- ### Trigonometric Function Examples Source: https://github.com/brettmayson/hemtt/blob/main/book/math/index.md Provides examples of using trigonometric functions like sine, cosine, and tangent with radian inputs. ```cpp sin(0) → 0 cos(0) → 1 sin(pi / 2) → 1 cos(pi) → -1 tan(0) → 0 ``` -------------------------------- ### Prefix Usage in Addon Path Source: https://github.com/brettmayson/hemtt/blob/main/book/configuration/minimum.md This example demonstrates how the 'prefix' variable is used within the `$PBOPREFIX$` placeholder in an addon's file path. It shows the general format and a concrete example with 'abe' as the prefix. ```text z{prefix}\addons\main ``` ```text z\abe\addons\main ``` -------------------------------- ### Install and Use cargo-insta for Lint Tests Source: https://github.com/brettmayson/hemtt/blob/main/CONTRIBUTING.md Install cargo-insta for snapshot testing of lints. After making changes that might fail lint tests, review and update snapshots. ```bash cargo install cargo-insta # Run the tests before reviewing, you can just run an individual test, or use any testing tool cargo nextest run # Review the changes cargo insta review ``` ```bash # Alternatively, you can run the tests with insta to review the changes in one command cargo insta test --review ``` -------------------------------- ### Examples with Constants Source: https://github.com/brettmayson/hemtt/blob/main/book/math/index.md Demonstrates the usage of predefined mathematical constants like 'pi' in calculations. ```cpp pi → 3.14159... 2 * pi → 6.28318... (circumference factor) pi * 5 ^ 2 → 78.539... (area of circle with radius 5) ``` -------------------------------- ### Install HEMTT from Source using Cargo Source: https://github.com/brettmayson/hemtt/blob/main/book/installation/index.md Compile and install HEMTT from its source code repository using the Rust Cargo build tool. Ensure you have the latest stable version of Rust installed. ```bash cargo install --path bin ``` -------------------------------- ### Install or Update HEMTT on Linux & MacOS Source: https://github.com/brettmayson/hemtt/blob/main/book/installation/index.md Run this script to install or update HEMTT on Linux and MacOS systems. ```bash curl -sSf https://hemtt.dev/install.sh | sh ``` -------------------------------- ### Operator Precedence Example Source: https://github.com/brettmayson/hemtt/blob/main/book/math/index.md Demonstrates standard operator precedence and how parentheses can override it in mathematical expressions. ```cpp 1 + 2 * 3 → 7 (1 + 2) * 3 → 9 ``` -------------------------------- ### Get Project Name Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/project.md Retrieve the name of the project. ```javascript HEMTT.project().name(); // "Advanced Banana Environment" ``` -------------------------------- ### Angle Conversion Examples Source: https://github.com/brettmayson/hemtt/blob/main/book/math/index.md Illustrates the use of functions to convert between degrees and radians, essential for trigonometric calculations. ```cpp rad(90) → 1.5708... (π/2) rad(180) → 3.14159... (π) deg(pi) → 180 deg(pi / 2) → 90 ``` -------------------------------- ### Launch Arma 3 with Your Mod Source: https://github.com/brettmayson/hemtt/blob/main/README.md Use the 'launch' command to start Arma 3 with your mod loaded. This command supports specifying additional mods and parameters via configuration. ```bash hemtt launch ``` -------------------------------- ### Get Project Main Prefix Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/project.md Retrieve the main prefix of the project. Returns an empty string if not set. ```javascript HEMTT.project().mainprefix(); // "z" ``` -------------------------------- ### Get Project Version Information Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/project.md Retrieve the full version string, short version string, or individual version components (major, minor, patch, build) of the project. ```javascript HEMTT.project().version().to_string(); // "1.3.0.1052" HEMTT.project().version().to_string_short(); // "1.3.0" HEMTT.project().version().major(); // 1 HEMTT.project().version().minor(); // 3 HEMTT.project().version().patch(); // 0 HEMTT.project().version().build(); // 1052 ``` -------------------------------- ### Get Project Prefix Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/project.md Retrieve the prefix associated with the project. ```javascript HEMTT.project().prefix(); // "abe" ``` -------------------------------- ### Get File Extension from Path Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/filesystem.md Demonstrates using the `file_ext` function to get the file extension of a path, returning an empty string if none exists. ```javascript HEMTT_VFS.join("addons").file_ext(); // "" HEMTT_VFS.join(".hemtt").join("project.toml").file_ext(); // "toml" ``` -------------------------------- ### Get Project Version Information Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/hemtt.md Retrieve the project's version information using `HEMTT.project().version().to_string()`. ```js HEMTT.project().version().to_string(); // "1.3.0.1052" ``` -------------------------------- ### Redefine Macro Warning Example Source: https://github.com/brettmayson/hemtt/blob/main/book/lints/preprocessor.md This example demonstrates the 'Redefine Macro' warning, which is emitted when a macro is defined more than once. This can occur within the same file or across included files. ```cpp #define FOO 1 #define FOO 2 ``` ```cpp // foo.hpp #define FOO 1 // bar.hpp #include "foo.hpp" #include "foo.hpp" ``` -------------------------------- ### Get Parent Directory Path Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/filesystem.md Illustrates how to use the `parent` function to retrieve the parent directory of a given path. Note potential panics with the real file system at the root. ```javascript HEMTT_VFS.join("addons").parent(); // Points to ./ HEMTT_VFS.join(".hemtt").join("project.toml").parent(); // Points to ./.hemtt ``` -------------------------------- ### Get HEMTT Version Information Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/hemtt.md Retrieve the HEMTT version and its components (major, minor, patch, build). Use `to_string()` to get the full version string. ```js HEMTT.version().to_string(); // "1.19.2" HEMTT.version().major(); // 1 HEMTT.version().minor(); // 19 HEMTT.version().patch(); // 2 HEMTT.version().build(); // "" ``` -------------------------------- ### Padded Argument Warning Example Source: https://github.com/brettmayson/hemtt/blob/main/book/lints/preprocessor.md This example illustrates the 'Padded Argument' warning, which occurs when a macro argument is padded with spaces, potentially leading to unintended formatting. The `pw3_ignore_format` flag can be used to ignore this warning for specific macro types. ```cpp #define Introduction(var1, var2) var1, meet var2 HELLO(Jim, Bob) ``` ```cpp #pragma hemtt flag pw3_ignore_format { scope = line } ``` -------------------------------- ### Invalid Expression Examples Source: https://github.com/brettmayson/hemtt/blob/main/book/math/index.md Illustrates common syntax errors and invalid expressions that will result in an error during evaluation. ```cpp 1 + → Error (incomplete expression) (1 + 1 → Error (mismatched parentheses) 1 & 1 → Error (invalid operator) ``` -------------------------------- ### Get File Name from Path Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/filesystem.md Shows how to extract the file name component from a given path using the `file_name` function. ```javascript HEMTT_VFS.join("addons").file_name(); // addons HEMTT_VFS.join(".hemtt").join("project.toml").file_name(); // project.toml ``` -------------------------------- ### Update HEMTT on Windows using Winget Source: https://github.com/brettmayson/hemtt/blob/main/book/installation/index.md Use this command to update an existing HEMTT installation via the Windows Package Manager. ```powershell winget upgrade hemtt ``` -------------------------------- ### Include Specific Files in Build Source: https://github.com/brettmayson/hemtt/blob/main/book/configuration/index.md Customize the 'include' list to add specific files or glob paths to be copied to the build directory. Default files like 'mod.cpp' and 'meta.cpp' are automatically included if present. ```toml [files] include = [ "mod.cpp", # These files are copied to the build directory by default "meta.cpp", # They do not need to be added to your list "LICENSE", "logo_ca.paa", "logo_co.paa", ] ``` -------------------------------- ### Update Version File with HEMTT_RFS and HEMTT_OUT Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/filesystem.md This script shows how to use the real file system (HEMTT_RFS) to read a version file and the build output path (HEMTT_OUT) to write the updated content during the pre_release phase. ```rhai // Read the current contents of the docs/version.txt // file from the project source let version = HEMTT_RFS.join("docs").join("version.txt").open_file().read(); // Replace the placeholder version with the actual version version.replace("0.0.0", HEMTT.project().version().to_string()); // Write the new contents to the build output // create_file will overwrite the file if it exists HEMTT_OUT.join("docs").join("version.txt").create_file().write(version); ``` -------------------------------- ### Set Main Project Prefix Source: https://github.com/brettmayson/hemtt/blob/main/book/configuration/index.md Configure the 'mainprefix' option to define the root prefix for your project. This is primarily used by the 'hemtt launch' command. ```toml mainprefix = "z" ``` -------------------------------- ### create_dir_all() Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/filesystem.md Creates a directory and any necessary parent directories that do not already exist. ```APIDOC ## create_dir_all() ### Description Creates the directory and all parent directories. ### Method `create_dir_all()` ### Example ```js HEMTT_VFS.join("docs").join("images").create_dir_all(); // Creates the images folder and the docs folder if they don't exist ``` ``` -------------------------------- ### Create Directory Recursively Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/filesystem.md Creates a directory and any necessary parent directories that do not already exist. ```javascript HEMTT_VFS.join("docs").join("images").create_dir_all(); // Creates the images folder and the docs folder if they don't exist ``` -------------------------------- ### Join Path Segments Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/filesystem.md Demonstrates how to use the `join` function to construct file paths by concatenating path segments. ```javascript HEMTT_VFS.join("addons"); // Points to ./addons in the project folder HEMTT_VFS.join("addons").join("main"); // Points to ./addons/main in the project folder ``` -------------------------------- ### Build a Single Addon Source: https://github.com/brettmayson/hemtt/blob/main/book/commands/index.md Use the `--just` flag with the `build` command to compile a single addon. This is recommended for large projects or when only specific addons need to be updated. Always ensure all addons are built periodically without this flag. ```bash hemtt build --just myAddon ``` -------------------------------- ### Complex Expression Examples Source: https://github.com/brettmayson/hemtt/blob/main/book/math/index.md Combines various operators, functions, and constants to form more intricate mathematical expressions. ```cpp 2 * sin(pi / 6) → 1 (sin(30°) = 0.5) deg(atan(1)) → 45 cos(rad(60)) + sin(rad(30)) → 1 (pi * 2) ^ 2 → 39.478... ``` -------------------------------- ### Create/Overwrite Script Version File with HEMTT_VFS Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/filesystem.md This script demonstrates how to use the virtual file system (HEMTT_VFS) to create or overwrite a header file with project version information during the pre_build phase. ```rhai // Get the path to the script_version.hpp file let version = HEMTT_VFS .join("addons") .join("main") .join("script_version.hpp"); // Create (or overwrite) the file let out = version.create_file(); out.write("#define MAJOR " + HEMTT.project().version().major() + "\n"); out.write("#define MINOR " + HEMTT.project().version().minor() + "\n"); out.write("#define PATCH " + HEMTT.project().version().patch() + "\n"); if HEMTT.project().version().build() != "" { out.write("#define BUILD " + HEMTT.project().version().build() + "\n"); } print("Set version to " + HEMTT.project().version().to_string()); ``` -------------------------------- ### Get Current HEMTT Mode Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/hemtt.md Returns the current mode of HEMTT, which can be one of 'dev', 'launch', 'build', or 'release'. ```js HEMTT.mode(); // "release" ``` -------------------------------- ### Minimum Project Configuration Source: https://github.com/brettmayson/hemtt/blob/main/book/configuration/minimum.md This TOML snippet shows the essential 'name' and 'prefix' settings for a Hemtt project. The 'name' identifies the mod, and 'prefix' is used for directory structures. ```toml name = "Advanced Banana Environment" prefix = "abe" ``` -------------------------------- ### Configure Files to Include and Exclude Source: https://github.com/brettmayson/hemtt/blob/main/book/configuration/index.md Specify lists of files to include or exclude from the build directory. Glob patterns can be used for directories. Note that 'mod.cpp' and 'meta.cpp' are included by default if they exist. ```toml [files] include = [ "mod.cpp", # These files are copied to the build directory by default "meta.cpp", # They do not need to be added to your list "LICENSE", "logo_ca.paa", "logo_co.paa", "python_code/**", # Copy the folder "python_code" including all its files ] exclude = [ "*.psd", # By default this list is empty "addons/main/README.md", ] ``` -------------------------------- ### Create Directory Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/filesystem.md Creates a single directory. If the parent directory does not exist, this operation will fail. ```javascript HEMTT_VFS.join("docs").create_dir(); // Creates the docs folder ``` -------------------------------- ### Move File or Directory Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/filesystem.md Shows how to use the `move` function to relocate files or directories to a new path. ```javascript HEMTT_VFS.join("docs").move(HEMTT_OUT.join("docs")); // Moves the docs folder to the build output ``` -------------------------------- ### Format Current Date and Time Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/time.md Use the `date` function to get the current date and time formatted according to specified components. Refer to the provided link for a full list of format specifiers. ```javascript date("[year]-[month]-[day] [hour]:[minute]:[second]"); // {{ time_1 }} ``` ```javascript date("[year repr:last_two][month][day]"); // {{ time_2 }} ``` -------------------------------- ### Project Main Prefix Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/project.md Retrieves the project main prefix, which is an empty string if not set. ```APIDOC ## `mainprefix()` ### Description Returns the project main prefix, empty if not set. ### Method N/A (Method call on an object) ### Endpoint N/A ### Parameters None ### Response - **mainprefix** (string) - The main prefix of the project, or an empty string if not set. ``` -------------------------------- ### Create and Navigate to a New Mod Source: https://github.com/brettmayson/hemtt/blob/main/README.md Use this command to add HEMTT to an existing mod or create a new one. Navigate into the newly created mod directory. ```bash hemtt new my-awesome-mod cd my-awesome-mod ``` -------------------------------- ### Default Version Configuration Source: https://github.com/brettmayson/hemtt/blob/main/book/configuration/version.md Sets the default path for the version macro file and defines major, minor, patch, and optional build versions. Overrides path when set. ```toml path = "addons/main/script_version.hpp" # Default major = 1 # Overrides path when set minor = 0 patch = 4 build = 3 # Optional git_hash = 0 # Default: 8 ``` -------------------------------- ### Enable Runtime Macros for Preprocessor Source: https://github.com/brettmayson/hemtt/blob/main/book/configuration/index.md Enable 'runtime_macros' to allow specific macros to be used in included files. Use with caution and only when necessary. ```toml [preprocessor] runtime_macros = true ``` -------------------------------- ### Specify BI Signing Version Source: https://github.com/brettmayson/hemtt/blob/main/book/configuration/index.md Configure the 'version' for BI Signing. The default is '3'. This setting should generally not be changed. ```toml [signing] version = 3 ``` -------------------------------- ### Create File for Writing Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/filesystem.md Creates a file for writing. Overwrites the file if it already exists. Returns a File object. ```javascript HEMTT_VFS.join("docs").join("readme.md").create_file(); // Returns a File object ``` -------------------------------- ### project() Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/hemtt.md Returns the project information. This function provides access to details about the current project, including its version. ```APIDOC ## project() ### Description Returns the project information. This function provides access to details about the current project, including its version. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters None ### Response An object representing the project information. This object has a `version()` method that returns the project's version information. ### Response Example ```js HEMTT.project().version().to_string(); // "1.3.0.1052" ``` ``` -------------------------------- ### Basic Config Value Calculations Source: https://github.com/brettmayson/hemtt/blob/main/book/math/index.md Shows how simple arithmetic operations can be directly embedded in Arma config values for automatic evaluation. ```cpp class MyClass { cost = 100 + 50; // Evaluates to 150 multiplier = 2 * 3.5; // Evaluates to 7 // Damage calculations maxDamage = 100 / 2; // Evaluates to 50 armorCoefficient = 1 / 0.8; // Evaluates to 1.25 }; ``` -------------------------------- ### Add Custom PBO Properties Source: https://github.com/brettmayson/hemtt/blob/main/book/configuration/addon.md Define custom properties for a PBO in `addon.toml`, similar to the project-level configuration, using the `properties` key. ```toml [properties] iso = "14001" ``` -------------------------------- ### Config Values with Constants and Functions Source: https://github.com/brettmayson/hemtt/blob/main/book/math/index.md Demonstrates using mathematical constants and functions like 'rad' and 'deg' within Arma config files for angle conversions and calculations. ```cpp class MyWeapon { // Angles and rotations rotationAngle = rad(45); // Convert 45° to radians deploymentAngle = deg(pi / 4); // Convert π/4 radians to degrees // Trigonometric calculations offsetX = cos(rad(45)) * 2; offsetY = sin(rad(30)) * 5; }; ``` -------------------------------- ### Open File for Reading Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/filesystem.md Opens a file for reading. Returns a File object. ```javascript HEMTT_VFS.join("docs").join("readme.md").open_file(); // Returns a File object ``` -------------------------------- ### Custom Version Path Configuration Source: https://github.com/brettmayson/hemtt/blob/main/book/configuration/version.md Specifies a custom path for the version macro file if it's not located at the default 'addons/main/script_version.hpp'. ```toml path = "addons/common/script_version.hpp" ``` -------------------------------- ### create_file() Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/filesystem.md Creates a file for writing. Overwrites the file if it already exists. Returns a File object. ```APIDOC ## create_file() ### Description Creates the file for writing. Overwrites the file if it exists. ### Method `create_file()` ### Example ```js HEMTT_VFS.join("docs").join("readme.md").create_file(); // Returns a File object ``` ``` -------------------------------- ### Project Prefix Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/project.md Retrieves the project prefix. ```APIDOC ## `prefix()` ### Description Returns the project prefix. ### Method N/A (Method call on an object) ### Endpoint N/A ### Parameters None ### Response - **prefix** (string) - The prefix of the project. ``` -------------------------------- ### list() Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/filesystem.md Lists the contents of a directory. If the path points to a file, an empty array is returned. ```APIDOC ## list() ### Description Lists the contents of the directory. If the path is a file, returns an empty array. ### Method `list()` ### Example ```js HEMTT_VFS.join("docs").list(); // Returns an array of paths of files and directories in the docs folder ``` ``` -------------------------------- ### Basic Arithmetic Calculations Source: https://github.com/brettmayson/hemtt/blob/main/book/math/index.md Illustrates fundamental arithmetic operations including addition, subtraction, multiplication, division, exponentiation, and modulo. ```cpp 1 + 1 → 2 10 - 3 → 7 4 * 5 → 20 20 / 4 → 5 2 ^ 10 → 1024 17 % 5 → 2 ``` -------------------------------- ### open_file() Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/filesystem.md Opens a file for reading. Returns a File object. ```APIDOC ## open_file() ### Description Opens the file for reading. ### Method `open_file()` ### Example ```js HEMTT_VFS.join("docs").join("readme.md").open_file(); // Returns a File object ``` ``` -------------------------------- ### Copy File or Directory Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/filesystem.md Illustrates the `copy` function for duplicating files or directories to a specified destination path. ```javascript HEMTT_VFS.join("docs").copy(HEMTT_OUT.join("docs")); // Copies the docs folder to the build output ``` -------------------------------- ### Calculations with Parentheses Source: https://github.com/brettmayson/hemtt/blob/main/book/math/index.md Shows how to use parentheses to control the order of operations in more complex mathematical expressions. ```cpp (1 + 2) * 3 → 9 1 + (2 * 3) → 7 ((2 + 3) * 4) - 1 → 19 ``` -------------------------------- ### Calculations with Negative Numbers Source: https://github.com/brettmayson/hemtt/blob/main/book/math/index.md Demonstrates the handling of negative numbers in various arithmetic contexts, including unary negation and subtraction of negative values. ```cpp -5 → -5 1 + -2 → -1 1 - -2 → 3 2 * -(3 + 1) → -8 ``` -------------------------------- ### Automate Arma 3 Mod Builds with GitHub Actions Source: https://github.com/brettmayson/hemtt/blob/main/README.md This GitHub Actions workflow automatically builds and releases your mod on every push. It uses the arma-actions/hemtt@v1 action to set up HEMTT and then runs the 'hemtt release' command. ```yaml name: Build on: [push] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Setup HEMTT uses: arma-actions/hemtt@v1 - name: Run HEMTT build run: hemtt release - name: Upload Release uses: actions/upload-artifact@v4 with: name: my-mod-latest path: release/my-mod-latest.zip ``` -------------------------------- ### Set Project Version in File Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/hooks/examples.md Use this hook during the `pre_build` phase to set the project version in a file (e.g., `mod.cpp`) using the virtual file system. This hook runs during both `hemtt build` and `hemtt release` commands. ```rhai let modcpp = HEMTT_VFS.join("mod.cpp").open_file().read(); // Read the contents of mod.cpp modcpp.replace("0.0.0", HEMTT.project().version().to_string_short()); // Replace the placeholder version with the actual version HEMTT_VFS.join("mod.cpp").create_file().write(modcpp); // Write the new contents over the old contents ``` -------------------------------- ### Configure SQF Lint Options Source: https://github.com/brettmayson/hemtt/blob/main/book/configuration/lints.md Set specific options for an SQF lint, such as ignoring certain values. Consult the lint's documentation for available options. ```toml [lints.sqf.command_case] severity = "Error" options.ignore = [ "AGLtoASL", "ASLtoAGL", ] ``` -------------------------------- ### Add Properties to PBOs Source: https://github.com/brettmayson/hemtt/blob/main/book/configuration/index.md Configure project-wide properties that will be added to every PBO. This is useful for metadata like author and URL. ```toml [properties] author = "ABE Team" url = "https://github.com/ABE-Mod/ABE" ``` -------------------------------- ### is_launch() Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/hemtt.md Checks if the current mode of HEMTT is 'launch'. ```APIDOC ## is_launch() ### Description Checks if the current mode of HEMTT is 'launch'. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters None ### Response A boolean value: `true` if the current mode is `launch`, `false` otherwise. ### Response Example ```js HEMTT.is_launch(); // false ``` ``` -------------------------------- ### Project Name Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/project.md Retrieves the project name. ```APIDOC ## `name()` ### Description Returns the project name. ### Method N/A (Method call on an object) ### Endpoint N/A ### Parameters None ### Response - **name** (string) - The name of the project. ``` -------------------------------- ### Project Version Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/project.md Retrieves the project version in various formats. The build number is 0 if not set. ```APIDOC ## `version()` ### Description Returns the project version. `.build()` will return `0` if the build number is not set. ### Method N/A (Method call on an object) ### Endpoint N/A ### Parameters None ### Response Returns a version object with methods to format the version string or access its components. #### Version Components: - `to_string()`: Returns the full version string (e.g., "1.3.0.1052"). - `to_string_short()`: Returns the short version string (e.g., "1.3.0"). - `major()`: Returns the major version number. - `minor()`: Returns the minor version number. - `patch()`: Returns the patch version number. - `build()`: Returns the build number. ``` -------------------------------- ### Check Path Existence Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/filesystem.md Illustrates the use of the `exists` function to verify if a given file or directory path exists within the file system. ```javascript HEMTT_VFS.join("addons").exists(); // true HEMTT_VFS.join(".hemtt").join("project.toml").exists(); // true ``` -------------------------------- ### read() Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/filesystem.md Reads the entire contents of a file and returns it as a string. ```APIDOC ## read() ### Description Reads the contents of the file. ### Method `read()` ### Example ```js HEMTT_VFS.join("docs").join("readme.md").open_file().read(); // Returns a string containing the contents of the file ``` ``` -------------------------------- ### List Directory Contents Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/filesystem.md Lists the contents of a directory. If the path points to a file, an empty array is returned. ```javascript HEMTT_VFS.join("docs").list(); // Returns an array of paths of files and directories in the docs folder ``` -------------------------------- ### Require P Drive in HEMTT Project Source: https://github.com/brettmayson/hemtt/blob/main/book/configuration/p-drive.md Configure HEMTT to require a P Drive for the build. The build will fail if required files cannot be resolved. HEMTT will only enable access to P:\a3\. This is set in the .hemtt/project.toml file. ```toml [hemtt.build] pdrive = "require" [hemtt.check] pdrive = "ignore" ``` -------------------------------- ### Build Your Arma 3 Mod with HEMTT Source: https://github.com/brettmayson/hemtt/blob/main/README.md HEMTT provides commands to check for errors without building, perform development builds, and create release builds for your Arma 3 mod. ```bash # Check for errors without building hemtt check # Development build hemtt dev # Release build hemtt release ``` -------------------------------- ### date(string) Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/time.md Returns the current date formatted according to the provided string specifiers. Refer to the [format specifiers documentation](https://time-rs.github.io/book/api/format-description.html#components) for a full list. ```APIDOC ## `date(string)` ### Description Returns the current date in the given format. ### Parameters #### Path Parameters - **format** (string) - Required - The format string for the date output. Supports various specifiers like `[year]`, `[month]`, `[day]`, `[hour]`, `[minute]`, `[second]`, `[year repr:last_two]` etc. ### Request Example ```js date("[year]-[month]-[day] [hour]:[minute]:[second]"); date("[year repr:last_two][month][day]"); ``` ``` -------------------------------- ### create_dir() Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/filesystem.md Creates a new directory. If the directory already exists, this operation has no effect. ```APIDOC ## create_dir() ### Description Creates the directory. ### Method `create_dir()` ### Example ```js HEMTT_VFS.join("docs").create_dir(); // Creates the docs folder ``` ``` -------------------------------- ### Version Macros in script_version.hpp Source: https://github.com/brettmayson/hemtt/blob/main/book/configuration/version.md Defines the major, minor, patch, and optional build versions using C++ preprocessor macros. `#define PATCHLVL` can also be used for patch. ```cpp #define MAJOR 1 #define MINOR 0 #define PATCH 4 // `#define PATCHLVL` can also be used #define BUILD 3 // Optional ``` -------------------------------- ### Exclude Specific Files from Build Source: https://github.com/brettmayson/hemtt/blob/main/book/configuration/index.md Define files or glob patterns in the 'exclude' list to prevent them from being copied to the build directory. This list is empty by default. ```toml [files] exclude = [ "*.psd", # By default this list is empty "addons/main/README.md", ] ``` -------------------------------- ### Declare Variables in Rhai Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/index.md Demonstrates variable declaration using 'let' and 'const' in Rhai. Variables are dynamically typed. ```js let x; // () let x = 1; // (i32) let x = 1.1; // (f32) const x = "hello"; // (string) ``` -------------------------------- ### Define Custom SQF Command with YAML Source: https://github.com/brettmayson/hemtt/blob/main/book/configuration/custom-commands.md Use this YAML structure to define a new custom SQF command. Specify the command's name, a description, its syntax, parameters, and where it can be executed (argument_loc, effect_loc). ```yaml name: bananize description: Bananize the player, forcing them to only throw bananas. syntax: - call: !Unary player ret: - Boolean - The success of the bananization params: - name: unit description: The unit to bananize type: Object argument_loc: Global effect_loc: Global examples: - bananize player ``` -------------------------------- ### Disallow P Drive in HEMTT Project Source: https://github.com/brettmayson/hemtt/blob/main/book/configuration/p-drive.md Configure HEMTT to disallow the use of a P Drive. The build will fail if any P Drive references are found. This is set in the .hemtt/project.toml file. ```toml [hemtt.build] pdrive = "disallow" [hemtt.check] pdrive = "ignore" ``` -------------------------------- ### version() Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/hemtt.md Returns the version of HEMTT. The version object provides methods to access major, minor, patch, and build components, as well as a string representation. ```APIDOC ## version() ### Description Returns the version of HEMTT. The version object provides methods to access major, minor, patch, and build components, as well as a string representation. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters None ### Response An object representing the HEMTT version with the following methods: - `to_string()`: Returns the full version string. - `major()`: Returns the major version number. - `minor()`: Returns the minor version number. - `patch()`: Returns the patch version number. - `build()`: Returns the build string. ### Response Example ```js HEMTT.version().to_string(); // "1.19.2" HEMTT.version().major(); // 1 HEMTT.version().minor(); // 19 HEMTT.version().patch(); // 2 HEMTT.version().build(); // "" ``` ``` -------------------------------- ### Check if Path is a File Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/filesystem.md Demonstrates the usage of the `is_file` function to check if a given path points to a file. ```javascript HEMTT_VFS.join("addons").is_file(); // false HEMTT_VFS.join(".hemtt").join("project.toml").is_file(); // true ``` -------------------------------- ### HEMTT Info Function Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/logging.md Use the `info` function provided by HEMTT for standard informational logging. It functions identically to Rhai's `print` function. ```js info("Hello World!"); ``` ```sh INFO [post_release/test.rhai] Hello World! ``` -------------------------------- ### Git Hash Configuration for Versioning Source: https://github.com/brettmayson/hemtt/blob/main/book/configuration/version.md Configures the inclusion of the git hash in the version. It can be disabled by setting `git_hash = 0` or set to a specific length, defaulting to 8 characters. ```toml git_hash = 0 # Disabled git_hash = 4 # 4 characters ``` -------------------------------- ### Check if Path is a Directory Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/filesystem.md Shows how to use the `is_dir` function to determine if a specified path refers to a directory. ```javascript HEMTT_VFS.join("addons").is_dir(); // true HEMTT_VFS.join(".hemtt").join("project.toml").is_dir(); // false ``` -------------------------------- ### HEMTT Hook Directory Structure Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/hooks/index.md Illustrates the organization of Rhai hook scripts within the .hemtt/hooks directory, categorized by build phase. ```text .hemtt └── hooks ├── pre_build │ ├── 01_example.rhai │ └── 02_example.rhai └── post_build ├── 01_example.rhai └── 02_example.rhai ``` -------------------------------- ### mode() Source: https://github.com/brettmayson/hemtt/blob/main/book/rhai/library/hemtt.md Returns the current mode of HEMTT. The mode indicates the current build or development stage. ```APIDOC ## mode() ### Description Returns the current mode of HEMTT. The mode indicates the current build or development stage. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters None ### Response A string representing the current mode. Possible values are: `dev`, `launch`, `build`, `release`. ### Response Example ```js HEMTT.mode(); // "release" ``` ```