Added triage card and activity log

This commit is contained in:
Glowbal 2015-02-21 21:47:10 +01:00
parent 0d24ad5c0a
commit 46f28763b6
7 changed files with 105 additions and 0 deletions

View File

@ -37,6 +37,8 @@ PREP(teatmentIV);
PREP(treatmentIVLocal);
PREP(treatmentTourniquet);
PREP(treatmentTourniquetLocal);
PREP(addToLog);
PREP(addToTriageCard);
GVAR(injuredUnitCollection) = [];
call FUNC(parseConfigForInjuries);

View File

@ -0,0 +1,44 @@
/**
* fn_addActivityToLog.sqf
* @Descr: adds an item to the activity log
* @Author: Glowbal
*
* @Arguments: [unit OBJECT, type STRING, message STRING]
* @Return:
* @PublicAPI: false
*/
#include "script_component.hpp"
private ["_unit", "_type", "_message", "_arguments", "_lastNumber", "_moment", "_logVarName", "_log","_newLog"];
_unit = _this select 0;
_type = _this select 1;
_message = _this select 2;
_arguments = _this select 3;
if (!local _unit) exitwith {
[_this, QUOTE(FUNC(addToLog)), _unit] call EFUNC(common,execRemoteFnc);
};
_lastNumber = date select 4;
_moment = format["%1:%2",date select 3, _lastNumber];
if (_lastNumber < 10) then {
_moment = format["%1:0%2",date select 3, _lastNumber];
};
_logVarName = format[QGVAR(logFile_%1), _type];
_log = _unit getvariable [_logVarName, []];
if (count _log >= 8) then {
_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];
["medical_onLogEntryAdded", [_unit, _type, _message, _arguments]] call ace_common_fnc_localEvent;

View File

@ -0,0 +1,41 @@
/**
* fn_addToTriageList.sqf
* @Descr: N/A
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
#include "script_component.hpp"
private ["_unit","_caller","_newItem","_log", "_inList","_amount"];
_unit = _this select 0;
_newItem = _this select 1;
if (!local _unit) exitwith {
[_this, QUOTE(FUNC(addToTriageList)), _unit] call EFUNC(common,execRemoteFnc);
};
_log = _unit getvariable [QGVAR(triageCard), []];
_inList = false;
_amount = 1;
{
if ((_x select 0) == _newItem) exitwith {
private "_info";
_info = _log select _foreachIndex;
_info set [1,(_info select 1) + 1];
_info set [2, time];
_log set [_foreachIndex, _info];
_amount = (_info select 1);
_inList = true;
};
}foreach _log;
if (!_inList) then {
_log pushback [_newItem, 1, time];
};
_unit setvariable [QGVAR(triageCard), _log, true];
["Medical_onItemAddedToTriageCard", [_unit, _newItem, _amount]] call ace_common_fnc_localEvent;

View File

@ -28,6 +28,13 @@ if (count _items == 0) exitwith {};
if ([_caller, _target, _items] call FUNC(useEquipment)) then {
[[_target, _className], QUOTE(FUNC(treatmentBandageLocal)), _target] call EFUNC(common,execRemoteFnc);
{
if (_x != "") then {
[_target, _x] call FUNC(addToTriageCard);
};
}foreach _items;
[_target, "activity", "STR_ACE_HAS_BANDAGED_ACTIVITY", [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog);
};
true;

View File

@ -28,6 +28,13 @@ if (count _items == 0) exitwith {};
if ([_caller, _target, _items] call FUNC(useEquipment)) then {
[[_target, _className], QUOTE(FUNC(treatmentMedicationLocal)), _target] call EFUNC(common,execRemoteFnc);
{
if (_x != "") then {
[_target, _x] call FUNC(addToTriageCard);
};
}foreach _items;
[_target, "activity", "STR_ACE_HAS_MEDICATION_ACTIVITY", [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog);
};
true;

View File

@ -29,4 +29,6 @@ if (count _items == 0) exitwith {};
if ([_caller, _target, _items] call FUNC(useEquipment)) then {
_removeItem = _items select 0;
[[_target, _removeItem], QUOTE(FUNC(treatmentIVLocal)), _target] call EFUNC(common,execRemoteFnc);
[_target, _removeItem] call FUNC(addToTriageCard);
[_target, "activity", "STR_ACE_HAS_GIVEN_IV_ACTIVITY", [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog);
};

View File

@ -41,6 +41,8 @@ if ((_tourniquets select _part) > 0) exitwith {
if ([_caller, _target, _items] call FUNC(useEquipment)) then {
_removeItem = _items select 0;
[[_target, _removeItem], QUOTE(FUNC(treatmentTourniquetLocal)), _target] call EFUNC(common,execRemoteFnc);
[_target, _removeItem] call FUNC(addToTriageCard);
[_target, "activity", "STR_ACE_HAS_APPLIED_TOURNIQUET_ACTIVITY", [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog);
};
true;