client/addons/medical/functions/fnc_initMedical.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

42 lines
1.3 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Author: IDSolutions
* Initializes the medical system
*
* Arguments:
* N/A
*
* Return Value:
* None
*
* Example:
* [] call forge_client_medical_fnc_initMedical;
*
* Public: Yes
*/
private _worldCenter = getArray (configFile >> "CfgWorlds" >> worldName >> "centerPosition");
private _stretcherTypes = ["Land_Stretcher_01_F", "Land_Stretcher_01_olive_F", "Land_Stretcher_01_sand_F"];
private _stretchers = nearestObjects [_worldCenter, _stretcherTypes, 500000];
{
private _stretcher = _x;
private _triggerPos = getPos _stretcher;
private _trigger = createTrigger ["EmptyDetector", _triggerPos];
_trigger setVariable ["isOccupied", false, true];
_trigger setTriggerArea [5, 5, 0, true, 5];
_trigger setTriggerActivation ["ANYPLAYER", "PRESENT", true];
_trigger setTriggerStatements [
"{ (_x isKindOf 'CAManBase') && _x distance thisTrigger < 0.5 } count thisList > 0",
"thisTrigger setVariable ['isOccupied', true, true];",
"thisTrigger setVariable ['isOccupied', false, true];"
];
GVAR(occupancyTriggers) pushBack _trigger;
} forEach _stretchers;
if (count GVAR(occupancyTriggers) == 0) then {
diag_log text format ["[FORGE Medical] Warning: No Stretchers found in the world for medical system initialization."];
};