Fixed handleDamage wounds

This commit is contained in:
Glowbal 2015-02-28 22:37:39 +01:00
parent d50466ac67
commit 8f253620c1
4 changed files with 14 additions and 19 deletions

View File

@ -16,18 +16,18 @@ _part = _this select 1;
_withDamage = if (count _this > 2) then { _this select 2} else {0};
if (!alive _unit) exitwith {true};
if (_part < 0 || _part > 5) exitwith {};
if ((vehicle _unit != _unit) && {!alive (vehicle _unit)}) exitwith { true };
// Find the correct Damage threshold for unit.
_damageThreshold = [1,1,1];
if (isPlayer _unit) then {
_damageThreshold =_unit getvariable[QGVAR(unitDamageThreshold), [GVAR(damageThreshold_Players), GVAR(damageThreshold_Players), GVAR(damageThreshold_Players) * 1.7]];
//_damageThreshold =_unit getvariable[QGVAR(unitDamageThreshold), [GVAR(damageThreshold_Players), GVAR(damageThreshold_Players), GVAR(damageThreshold_Players) * 1.7]];
} else {
_damageThreshold =_unit getvariable[QGVAR(unitDamageThreshold), [GVAR(damageThreshold_AI), GVAR(damageThreshold_AI), GVAR(damageThreshold_AI) * 1.7]];
//_damageThreshold =_unit getvariable[QGVAR(unitDamageThreshold), [GVAR(damageThreshold_AI), GVAR(damageThreshold_AI), GVAR(damageThreshold_AI) * 1.7]];
};
_damageBodyPart = ((_unit getvariable [QGVAR(bodyPartStatus),[0,0,0,0,0,0]]) select _part) + _withDamage;
_damageBodyPart = ((_unit getvariable [QGVAR(bodyPartStatus),[0, 0, 0, 0, 0, 0]]) select _part) + _withDamage;
// Check if damage to body part is higher as damage head
if (_part == 0) exitwith {

View File

@ -26,7 +26,7 @@ _projectile = _this select 4;
if !(local _unit) exitWith {nil};
if !([_unit] call FUNC(hasMedicalEnabled)) exitwith {systemChat format["Has no medical enabled: %1", _unit];};
if !([_unit] call FUNC(hasMedicalEnabled)) exitwith {};
if (typeName _projectile == "OBJECT") then {
_projectile = typeOf _projectile;
@ -38,24 +38,20 @@ _hitSelections = ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"];
if !(_selection in (_hitSelections + [""])) exitWith {0};
_damageReturn = _damage;
_damageReturn = (_this select 2);
if (GVAR(level) == 0) then {
_damageReturn = (_this + [_damageReturn]) call FUNC(handleDamage_basic);
};
if (_damageReturn < 0.01) exitWith {0};
if (GVAR(level) >= 1) then {
[_unit, _selectionName, _damage, _source, _projectile, _damageReturn] call FUNC(handleDamage_caching);
[_unit, _selection, _damage, _source, _projectile, _damageReturn] call FUNC(handleDamage_caching);
if (_damageReturn > 0.9) then {
_hitPoints = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"];
_newDamage = _damage - (damage _unit);
if (_selectionName in _hitSelections) then {
_newDamage = _damage - (_unit getHitPointDamage (_hitPoints select (_hitSelections find _selectionName)));
if (_selection in _hitSelections) then {
_newDamage = _damage - (_unit getHitPointDamage (_hitPoints select (_hitSelections find _selection)));
};
if ([_unit, [_selectionName] call FUNC(selectionNameToNumber), _newDamage] call FUNC(determineIfFatal)) then {
if ([_unit, [_selection] call FUNC(selectionNameToNumber), _newDamage] call FUNC(determineIfFatal)) then {
if ([_unit] call FUNC(setDead)) then {
_damageReturn = 1;
};

View File

@ -33,10 +33,10 @@ _highestPossibleSpot = -1;
_highestPossibleDamage = 0;
_allPossibleInjuries = [];
{
/*_classType = _x select 0;
_classType = _x select 0;
_selections = _x select 1;
_bloodLoss = _x select 2;
_pain = _x select 3;*/
_pain = _x select 3;
_minDamage = _x select 4;
if (_damage >= _minDamage) then {
if ("All" in _selections || _selectionName in _selections) then {
@ -51,7 +51,6 @@ _allPossibleInjuries = [];
// No possible wounds available for this damage type or damage amount.
if (_highestPossibleSpot < 0) exitwith {
// It appears we are dealing with an unknown type of damage.
if (count _allInjuriesForDamageType == 0) then {
@ -74,8 +73,8 @@ _woundsCreated = [];
};
}foreach (_injuryTypeInfo select 0);
_unit setvariable [GVAR(openWounds), _openWounds];
_unit setvariable[QGVAR(lastUniqueWoundID), _woundID, true];
_unit setvariable [QGVAR(openWounds), _openWounds];
_unit setvariable [QGVAR(lastUniqueWoundID), _woundID, true];
{
["medical_propagateWound", [_unit, _x]] call EFUNC(common,globalEvent);

View File

@ -25,7 +25,7 @@ if (!local _unit) exitwith {
[[_unit, _force], QUOTE(DFUNC(setDead)), _unit, false] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
};
if (missionName getVariable [QGVAR(enableRevive), false]) exitwith {
if (missionNamespace getVariable [QGVAR(enableRevive), false]) exitwith {
// TODO Implement the revive state
};