ACE3/addons/medical/functions/fnc_addToLog.sqf
Dedmen Miller e2ac18a05d [WIP] Fix script errors reporting wrong line numbers (#6407)
* advanced_ballistics

* advanced_fatigue

* advanced_throwing

* ai

* aircraft

* arsenal

* atragmx

* attach

* backpacks

* ballistics

* captives

* cargo

* chemlights

* common

* concertina_wire

* cookoff

* dagr

* disarming

* disposable

* dogtags

* dragging

* explosives

* fastroping

* fcs

* finger

* frag

* gestures

* gforces

* goggles

* grenades

* gunbag

* hearing

* hitreactions

* huntir

* interact_menu

* interaction

* inventory

* kestrel4500

* laser

* laserpointer

* logistics_uavbattery

* logistics_wirecutter

* magazinerepack

* map

* map_gestures

* maptools

* markers

* medical

* medical_ai

* medical_blood

* medical_menu

* microdagr

* minedetector

* missileguidance

* missionmodules

* mk6mortar

* modules

* movement

* nametags

* nightvision

* nlaw

* optics

* optionsmenu

* overheating

* overpressure

* parachute

* pylons

* quickmount

* rangecard

* rearm

* recoil

* refuel

* reload

* reloadlaunchers

* repair

* respawn

* safemode

* sandbag

* scopes

* slideshow

* spectator

* spottingscope

* switchunits

* tacticalladder

* tagging

* trenches

* tripod

* ui

* vector

* vehiclelock

* vehicles

* viewdistance

* weaponselect

* weather

* winddeflection

* yardage450

* zeus

* arsenal defines.hpp

* optionals

* DEBUG_MODE_FULL 1

* DEBUG_MODE_FULL 2

* Manual fixes

* Add SQF Validator check for #include after block comment

* explosives fnc_openTimerUI

* fix uniqueItems
2018-09-17 14:19:29 -05:00

53 lines
1.3 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: Glowbal
* Add an entry to the specified log
*
* Arguments:
* 0: The patient <OBJECT>
* 1: The log type <STRING>
* 2: The message <STRING>
* 3: The arguments for localization <ARRAY>
*
* Return Value:
* None
*
* Example:
* [bob, "type", "message", [_args]] call ace_medical_fnc_addToLog
*
* Public: Yes
*/
params ["_unit", "_type", "_message", "_arguments"];
if (!local _unit) exitWith {
[QGVAR(addToMedicalLog), _this, _unit] call CBA_fnc_targetEvent;
};
date params ["", "", "", "_hour", "_minute"];
private _moment = format [ (["%1:%2", "%1:0%2"] select (_minute < 10)), _hour, _minute];
private _logVarName = format[QGVAR(logFile_%1), _type];
private _log = _unit getVariable [_logVarName, []];
if (count _log >= 8) then {
private _newLog = [];
{
// ensure the first element will not be added
if (_forEachIndex > 0) then {
_newLog pushBack _x;
};
} forEach _log;
_log = _newLog;
};
_log pushBack [_message, _moment, _type, _arguments];
_unit setVariable [_logVarName, _log, true];
["ace_medicalLogEntryAdded", [_unit, _type, _message, _arguments]] call CBA_fnc_localEvent;
private _logs = _unit getVariable [QGVAR(allLogs), []];
if !(_logVarName in _logs) then {
_logs pushBack _logVarName;
_unit setVariable [QGVAR(allLogs), _logs, true];
};