# Package

Updated for version 3.38.

## Module Definition

The module is inherited from [ModuleBase](https://luffyyy.gitbook.io/beardlib/modules/modulebase). So base parameters can be found there.

The main purpose of this module is to emulate a 'package' that the game normally uses to load assets for various purposes (such as levels). Everything in PackageManager should support your 'added' package, except the PackageManager:package function.

Imagine PackageModule module as a delayed AddFilesModule. Instead of loading it right away it will load when you need it.

### Module name

The name of the module you use as the meta of the module definition is 'Package' or 'PackageModule' if `_force_search` is set to true in the module definition.

### XML Structure

```markup
<Package id directory>
    <extension path force load reload unload/>
</Package>
```

#### `<Package id directory>`

| Parameter | Type   | Description                                                                                 |
| --------- | ------ | ------------------------------------------------------------------------------------------- |
| id        | String | The id/path of the package which is used when it is being called to be loaded, unloaded etc |
| directory | String | string directory/path relative to the mods directory which contains all files to be added   |

#### `<extension path force load reload unload/>`

See: [AddFilesModule](https://luffyyy.gitbook.io/beardlib/modules/addfilesmodule)

### Example

This example is what you would put inside your main node within your [mod config](https://github.com/GreatBigBushyBeard/PAYDAY-2-BeardLib/wiki/Module-Config)

```markup
<Package id="packages/my_test_package" directory="mod_assets">
    <texture path="guis/textures/my_texture"/>
</Package>
```

For this example you would have your custom texture like this: mods/MyMod/mod\_assets/guis/textures/my\_texture.texture

And you could load the package by doing PackageManager:load("packages/my\_test\_package")

If you are using this module in a BLT mod.

### Functions

| Function | Description                                                                                                                         |
| -------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| Load()   | This function is used to add/load all the assets defined in the package. This is usually called by the PackageManager:load function |
| Unload() | This will remove all the added files from the game's database. This is usually called by the PackageManager:unload function         |
| Loaded() | Returns a value that determines if the package has been 'loaded'. This is usually called by PackageManager:loaded                   |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://luffyyy.gitbook.io/beardlib/modules/packagemodule.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
