Improvements and fixes for injured loop and enabledFor check

This commit is contained in:
Glowbal 2015-03-05 18:42:08 +01:00
parent 8215abb69d
commit 10f30fa543
6 changed files with 14 additions and 11 deletions

View File

@ -3,6 +3,7 @@
#include "script_component.hpp"
if (!hasInterface) exitwith{};
GVAR(enabledFor) = 1; // TODO remove this once we implement settings. Just here to get the vitals working.
GVAR(heartBeatSounds_Fast) = ["ACE_heartbeat_fast_1", "ACE_heartbeat_fast_2", "ACE_heartbeat_fast_3"];
GVAR(heartBeatSounds_Normal) = ["ACE_heartbeat_norm_1", "ACE_heartbeat_norm_2"];

View File

@ -15,15 +15,16 @@
private "_unit";
_unit = _this select 0;
if !(local _unit) exitwith{
[[_unit], QUOTE(DFUNC(addToInjuredCollection)), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
};
if !(_unit getvariable[QGVAR(addedToUnitLoop),false]) then{
_unit setvariable [QGVAR(addedToUnitLoop),true, true];
};
if ([_unit] call FUNC(hasMedicalEnabled) || true) then {
if !(local _unit) exitwith{
[[_unit], QUOTE(DFUNC(addToInjuredCollection)), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
};
if !(_unit getvariable[QGVAR(addedToUnitLoop),false]) then{
_unit setvariable [QGVAR(addedToUnitLoop),true, true];
};
if ([_unit] call FUNC(hasMedicalEnabled)) then {
[{
private "_unit";
_unit = (_this select 0) select 0;

View File

@ -24,7 +24,7 @@ if (GVAR(level) >= 1) then {
//_cardiacOutput = [_this] call FUNC(getCardiacOutput);
{
if ((_tourniquets select (_x select 2)) < 1) then {
if ((_tourniquets select (_x select 2)) == 0) then {
// total bleeding ratio * percentage of injury left
_totalBloodLoss = _totalBloodLoss + ((_x select 4) * (_x select 3));

View File

@ -60,6 +60,7 @@ if (GVAR(level) >= 1) then {
};
};
};
[_unit] call FUNC(addToInjuredCollection);
if (_unit getVariable [QGVAR(preventDeath), false] && {_damageReturn >= 0.9} && {_selection in ["", "head", "body"]}) exitWith {
if (vehicle _unit != _unit and {damage _vehicle >= 1}) then {

View File

@ -36,7 +36,7 @@ _allInjuriesForDamageType = _injuryTypeInfo select 2;
// find the available injuries for this damage type and damage amount
_highestPossibleSpot = -1;
_highestPossibleDamage = 0;
_highestPossibleDamage = -1;
_allPossibleInjuries = [];
{
_minDamage = _x select 4;
@ -82,7 +82,7 @@ _woundsCreated = [];
for "_i" from 0 to (1+ floor(random(_x select 1)-1)) /* step +1 */ do {
// Find the injury we are going to add. Format [ classID, allowdSelections, bloodloss, painOfInjury, minimalDamage]
_toAddInjury = if (random(1) >= 0.5) then {_allPossibleInjuries select _highestPossibleSpot} else {_allPossibleInjuries select (floor(random (count _allPossibleInjuries)));};
_toAddInjury = if (random(1) >= 0.5) then {_allInjuriesForDamageType select _highestPossibleSpot} else {_allPossibleInjuries select (floor(random (count _allPossibleInjuries)));};
_toAddClassID = _toAddInjury select 0;
_foundIndex = -1;

View File

@ -15,7 +15,7 @@ _unit = _this select 0;
_medicalEnabled = _unit getvariable QGVAR(enableMedical);
if (isnil "_medicalEnabled") exitwith {
(((GVAR(setting_enableForUnits) == 0 && (isPlayer _unit || (_unit getvariable [QEGVAR(common,isDeadPlayer), false])))) || (GVAR(setting_enableForUnits) == 1));
(((GVAR(enabledFor) == 0 && (isPlayer _unit || (_unit getvariable [QEGVAR(common,isDeadPlayer), false])))) || (GVAR(enabledFor) == 1));
};
_medicalEnabled;