client/addons/interaction/functions/fnc_initInteraction.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

100 lines
2.7 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Author: IDSolutions
* Initialize player interaction
*
* Arguments:
* N/A
*
* Return Value:
* N/A
*
* Examples:
* [] spawn forge_client_interaction_fnc_initInteraction;
*
* Public: Yes
*/
FORGE_Team_Coord = "TEAM_COORD" call BFUNC(getParamValue);
FORGE_VA_Enable = "VA_ENABLE" call BFUNC(getParamValue);
FORGE_InteractionButtons = [1600, 1601, 1602, 1603, 1604, 1605, 1606, 1607, 1608];
FORGE_InteractionItems = [
[
["isPlayer cursorObject", "(player distance cursorObject) <= 5"],
["Give Cash", "[cursorObject] spawn forge_client_money_fnc_giveCash"]
],
[
["isPlayer cursorObject", "(player distance cursorObject) <= 5"],
["Add Contact", "[cursorObject] call forge_client_phone_fnc_addContact"]
],
[
["!(isNil {
cursorObject getVariable 'isBank'
})", "(player distance cursorObject) <= 5"],
["Access ATM", "[cursorObject] spawn forge_client_bank_fnc_openBank"]
],
[
["!(isNil {
cursorObject getVariable 'isCPOF'
})", "(player distance cursorObject) <= 5 && (getPlayerUID player) in companyShareholders"],
["Access CPOF", "[cursorObject] spawn forge_client_admin_fnc_openAdmin"]
],
[
["!(isNil {
cursorObject getVariable 'isCash'
})", "(player distance cursorObject) <= 5"],
["Take Cash", "[cursorObject] spawn forge_client_money_fnc_takeCash"]
],
[
["!(isNil {
cursorObject getVariable 'isLocker'
})", "(player distance cursorObject) <= 5"],
["Open Locker", "[cursorObject] spawn forge_client_locker_fnc_openLocker"]
],
[
["!(isNil {
cursorObject getVariable 'isStore'
})", "(player distance cursorObject) <= 5"],
["Access the Store", "[cursorObject] spawn forge_client_store_fnc_openStore"]
]
];
if (FORGE_Team_Coord == 1) then {
FORGE_InteractionItems append [
[
["!(isNil {
cursorObject getVariable 'isGarage'
})", "(player distance cursorObject) <= 5 && (getPlayerUID player) in companyShareholders"],
["Open Company Garage", "[cursorObject] spawn forge_client_garage_fnc_openGarage"]
]
];
} else {
FORGE_InteractionItems append [
[
["!(isNil {
cursorObject getVariable 'isGarage'
})", "(player distance cursorObject) <= 5"],
["Open Garage", "[cursorObject] spawn forge_client_garage_fnc_openGarage"]
]
];
};
if (FORGE_VA_Enable == 1) then {
FORGE_InteractionItems append [
[
["!(isNil {
cursorObject getVariable 'isLocker'
})", "(player distance cursorObject) <= 5"],
["Virtual Armory", "[] spawn forge_client_arsenal_fnc_openArmory"]
],
[
["!(isNil {
cursorObject getVariable 'isGarage'
})", "(player distance cursorObject) <= 5"],
["Virtual Garage", "[cursorObject] spawn forge_client_arsenal_fnc_openGarage"]
]
];
};