ACE3/addons/medical/functions/fnc_onPropagateWound.sqf

37 lines
868 B
Plaintext
Raw Normal View History

/*
* Author: Glowbal
* Adds a new injury to the wounds collection from remote clients. Is used to split up the large collection of injuries broadcasting across network.
*
* Arguments:
* 0: The remote unit <OBJECT>
* 1: injury <ARRAY>
*
* Return Value:
2015-08-22 14:25:10 +00:00
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_unit", "_injury", "_openWounds", "_injuryID", "_exists"];
2015-08-22 14:25:10 +00:00
params ["_unit", "_injury"];
if (!local _unit) then {
_openWounds = _unit getVariable[QGVAR(openWounds), []];
2015-03-07 12:57:36 +00:00
_injuryID = _injury select 0;
2015-03-07 12:57:36 +00:00
_exists = false;
{
2015-11-30 16:14:05 +00:00
if (_x select 0 == _injuryID) exitWith {
2015-03-07 12:57:36 +00:00
_exists = true;
2015-11-30 16:23:48 +00:00
_openWounds set [_forEachIndex, _injury];
2015-03-07 12:57:36 +00:00
};
2015-11-30 16:23:48 +00:00
} forEach _openWounds;
2015-03-07 12:57:36 +00:00
if (!_exists) then {
2015-11-30 16:21:28 +00:00
_openWounds pushBack _injury;
2015-03-07 12:57:36 +00:00
};
_unit setVariable [QGVAR(openWounds), _openWounds];
};