client/addons/org/functions/fnc_addAsset.sqf
Jacob Schmidt d474b3676a
All checks were successful
Build / Build (push) Successful in 28s
Refactor: Standardize function descriptions and variable handling
This commit refactors several client-side functions to improve code consistency and readability.

- Standardizes function descriptions by removing redundant "Function: forge_client..." prefixes and "[Description]" sections, focusing on concise descriptions of the function's purpose.
- Updates variable handling in arsenal functions to use GVAR and EGVARS for default values, improving consistency and reducing code duplication.
- Removes the bank init function as it is no longer needed.
- Adds a done variable to the preinit file.
2025-05-25 11:30:26 -05:00

43 lines
1.3 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Author: IDSolutions
* Adds an asset to an organization's inventory
*
* Arguments:
* 0: Asset Type <STRING> - Type of asset (vehicle, building, etc.)
* 1: Class Name <STRING> - Class name of the asset
*
* Return Value:
* Asset ID <STRING> - Unique ID of the added asset, or nil if failed
*
* Example:
* ["vehicle", "B_MRAP_01_F"] call forge_client_org_fnc_addAsset
*
* Public: Yes
*/
params [["_assetType", "", [""]], ["_className", "", [""]]];
// Validate input parameters
if (_assetType == "" || _className == "") exitWith {
["Invalid parameters for adding asset", "error", 5, "right"] call forge_client_misc_fnc_notify;
nil
};
// Get the organization store interface
private _store = call FUNC(verifyOrgStore);
// Add the asset to the organization's inventory
// This will generate a unique ID and store all asset information
private _assetId = _store call ["addAsset", [_assetType, _className]];
// Provide feedback based on success or failure
if (_assetId != "") then {
[format ["Asset added: %1 (%2)", _className, _assetType], "success", 5, "right"] call forge_client_misc_fnc_notify;
} else {
["Failed to add asset to organization", "error", 5, "right"] call forge_client_misc_fnc_notify;
};
// Return the asset ID for further operations
_assetId