client/addons/garage/functions/fnc_storeVehicle.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

67 lines
1.5 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Author: IDSolutions
* Stores a vehicle in the garage
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* None
*
* Public: No
*/
private _display = findDisplay IDD_GARAGEDIALOG;
private _garageList = _display displayCtrl IDC_GARAGEVEHICLELIST;
private _vehicleList = _display displayCtrl IDC_VEHICLELIST;
private _selectedVehicle = lbCurSel _vehicleList;
private _selectedVehicleData = _vehicleList lbData _selectedVehicle;
private _data = call compile _selectedVehicleData;
ctrlEnable [IDC_STOREBUTTON, false];
if ((isNil { _data })) exitWith { ctrlEnable [IDC_STOREBUTTON, true]; };
private _vehType = _data select 0;
private _className = _data select 1;
private _netID = _data select 2;
// private _netID = _data select 3;
private _veh = objectFromNetId _netID;
// private _hitPointsData = getAllHitPointsDamage _veh;
// private _vehData = [
// fuel _veh,
// damage _veh,
// str _hitPointsData
// ];
private _garage = GETVAR(player,FORGE_Garage,[]);
// _garage pushBack [_vehType, _className, _vehData];
_garage pushBack [_vehType, _className];
// player setVariable ["FORGE_Garage", _garage, true];
SETPVAR(player,FORGE_Garage,_garage);
lbClear _vehicleList;
lbClear _garageList;
_vehicleList lbSetCurSel -1;
_garageList lbSetCurSel -1;
_veh spawn {
deleteVehicle _this;
waitUntil { isNull _this };
sleep 0.5;
[] call FUNC(fetchGarage);
[] call FUNC(fetchNearby);
ctrlEnable [IDC_STOREBUTTON, true];
};
playSound "FD_Finish_F";