changed variable initialization - everything is now done local

This commit is contained in:
Glowbal 2015-04-17 22:43:31 +02:00
parent cbc3584f9d
commit bc4d102d08
3 changed files with 28 additions and 29 deletions

View File

@ -4,7 +4,4 @@ private ["_unit"];
_unit = _this select 0;
_unit addEventHandler ["HandleDamage", {_this call FUNC(handleDamage)}];
if (local _unit) then {
[_unit] call FUNC(init);
};
[_unit] call FUNC(init);

View File

@ -6,8 +6,7 @@ _unit = _this select 0;
if !(local _unit) exitWith {};
diag_log "running respawn";
[_unit] call FUNC(init);
[_unit, true] call FUNC(init);
//Reset captive status for respawning unit
if (!(_unit getVariable ["ACE_isUnconscious", false])) then {

View File

@ -13,21 +13,24 @@
#include "script_component.hpp"
private ["_unit", "_allUsedMedication", "_logs"];
private ["_unit", "_allUsedMedication", "_logs", "_forceNew"];
_unit = _this select 0;
_forceNew = if (count _this > 1) then {_this select 1} else {false};
_unit setVariable [QGVAR(pain), 0, true];
_unit setVariable [QGVAR(morphine), 0, true];
_unit setVariable [QGVAR(bloodVolume), 100, true];
if (!(isnil {_unit getvariable QGVAR(triageLevel)}) && !_forceNew) exitwith {};
_unit setVariable [QGVAR(pain), 0];
_unit setVariable [QGVAR(morphine), 0];
_unit setVariable [QGVAR(bloodVolume), 100];
// tourniquets
_unit setvariable [QGVAR(tourniquets), [0,0,0,0,0,0], true];
_unit setvariable [QGVAR(tourniquets), [0,0,0,0,0,0]];
// wounds and injuries
_unit setvariable [QGVAR(openWounds), [], true];
_unit setvariable [QGVAR(bandagedWounds), [], true];
_unit setVariable [QGVAR(internalWounds), [], true];
_unit setvariable [QGVAR(openWounds), []];
_unit setvariable [QGVAR(bandagedWounds), []];
_unit setVariable [QGVAR(internalWounds), []];
_unit setvariable [QGVAR(lastUniqueWoundID), 1];
// vitals
@ -40,8 +43,8 @@ _unit setVariable [QGVAR(peripheralResistance), 100];
_unit setVariable [QGVAR(fractures), []];
// triage card and logs
_unit setvariable [QGVAR(triageLevel), 0, true];
_unit setvariable [QGVAR(triageCard), [], true];
_unit setvariable [QGVAR(triageLevel), 0];
_unit setvariable [QGVAR(triageCard), []];
// IVs
_unit setVariable [QGVAR(salineIVVolume), 0];
@ -49,21 +52,21 @@ _unit setVariable [QGVAR(plasmaIVVolume), 0];
_unit setVariable [QGVAR(bloodIVVolume), 0];
// damage storage
_unit setvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0], true];
_unit setvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]];
// airway
_unit setvariable [QGVAR(airwayStatus), 100, true];
_unit setVariable [QGVAR(airwayOccluded), false, true];
_unit setvariable [QGVAR(airwayCollapsed), false, true];
_unit setvariable [QGVAR(airwayStatus), 100];
_unit setVariable [QGVAR(airwayOccluded), false];
_unit setvariable [QGVAR(airwayCollapsed), false];
// generic medical admin
_unit setvariable [QGVAR(addedToUnitLoop), false, true];
_unit setvariable [QGVAR(inCardiacArrest), false, true];
_unit setVariable ["ACE_isUnconscious", false, true];
_unit setvariable [QGVAR(hasLostBlood), false, true];
_unit setvariable [QGVAR(isBleeding), false, true];
_unit setvariable [QGVAR(hasPain), false, true];
_unit setvariable [QGVAR(amountOfReviveLives), GVAR(amountOfReviveLives), true];
_unit setvariable [QGVAR(addedToUnitLoop), false];
_unit setvariable [QGVAR(inCardiacArrest), false];
_unit setVariable ["ACE_isUnconscious", false];
_unit setvariable [QGVAR(hasLostBlood), false];
_unit setvariable [QGVAR(isBleeding), false];
_unit setvariable [QGVAR(hasPain), false];
_unit setvariable [QGVAR(amountOfReviveLives), GVAR(amountOfReviveLives)];
// medication
_allUsedMedication = _unit getVariable [QGVAR(allUsedMedication), []];
@ -74,9 +77,9 @@ _unit setVariable [QGVAR(allUsedMedication), []];
_logs = _unit getvariable [QGVAR(allLogs), []];
{
_unit setvariable [_x, nil, true];
_unit setvariable [_x, nil];
} foreach _logs;
_unit setvariable [QGVAR(allLogs), [], true];
_unit setvariable [QGVAR(allLogs), []];
// items
[{