Merge pull request #1563 from acemod/medicalCleanup

Cleanup
This commit is contained in:
Glowbal 2015-06-11 10:25:28 +02:00
commit b6ed944123
3 changed files with 32 additions and 55 deletions

View File

@ -13,22 +13,23 @@
#include "script_component.hpp"
private ["_typeOfProjectile","_typeOfInjury"];
_typeOfProjectile = _this select 0;
_typeOfInjury = switch (true) do {
case (_typeOfProjectile iskindof "BulletBase"): {"Bullet"};
case (_typeOfProjectile iskindof "GrenadeCore"): {"Grenade"};
case (_typeOfProjectile iskindof "TimeBombCore"): {"Explosive"};
case (_typeOfProjectile iskindof "MineCore"): {"Explosive"};
case (_typeOfProjectile iskindof "FuelExplosion"): {"Explosive"};
case (_typeOfProjectile iskindof "ShellBase"): {"Shell"};
case (_typeOfProjectile iskindof "RocketBase"): {"Explosive"};
case (_typeOfProjectile iskindof "MissileBase"): {"Explosive"};
case (_typeOfProjectile iskindof "LaserBombCore"): {"Explosive"};
case (_typeOfProjectile iskindof "BombCore"): {"Explosive"};
case (_typeOfProjectile iskindof "Grenade"): {"Grenade"};
case (_typeOfProjectile == "VehicleCrash"): {"VehicleCrash"};
default {_typeOfProjectile};
PARAMS_1(_typeOfProjectile);
private ["_typeOfDamage"];
_typeOfDamage = switch (true) do {
case (_typeOfProjectile isKindOf "BulletBase"): {"bullet"};
case (_typeOfProjectile isKindOf "GrenadeCore"): {"grenade"};
case (_typeOfProjectile isKindOf "TimeBombCore"): {"explosive"};
case (_typeOfProjectile isKindOf "MineCore"): {"explosive"};
case (_typeOfProjectile isKindOf "FuelExplosion"): {"explosive"};
case (_typeOfProjectile isKindOf "ShellBase"): {"shell"};
case (_typeOfProjectile isKindOf "RocketBase"): {"explosive"};
case (_typeOfProjectile isKindOf "MissileBase"): {"explosive"};
case (_typeOfProjectile isKindOf "LaserBombCore"): {"explosive"};
case (_typeOfProjectile isKindOf "BombCore"): {"explosive"};
case (_typeOfProjectile isKindOf "Grenade"): {"grenade"};
default {toLower _typeOfProjectile};
};
// TODO replace the capitalization on the switch results instead..
toLower _typeOfInjury;
_typeOfDamage

View File

@ -12,7 +12,7 @@
* 6: Type of Damage <STRING>
*
* Return Value:
* Damage To Be Inflicted <NUMBER>
* Nothing
*
* Public: No
*/
@ -28,10 +28,7 @@ _typeOfProjectile = _this select 4;
_newDamage = _this select 5;
// Most likely taking exessive fire damage. Lets exit.
if (isNull _sourceOfDamage && {_typeOfProjectile == ""} && {vehicle _unit == _unit} && {(_selectionName == "head" || isBurning _unit)}) exitwith {
0
};
_typeOfDamage = [_typeOfProjectile] call FUNC(getTypeOfDamage);
if (isNull _sourceOfDamage && {_typeOfProjectile == ""} && {vehicle _unit == _unit} && {(_selectionName == "head" || isBurning _unit)}) exitwith {};
_part = [_selectionName] call FUNC(selectionNameToNumber);
if (_part < 0) exitwith {};
@ -44,6 +41,7 @@ _unit setvariable [QGVAR(bodyPartStatus), _damageBodyParts, true];
[_unit] call FUNC(handleDamage_advancedSetDamage);
_typeOfDamage = [_typeOfProjectile] call FUNC(getTypeOfDamage);
[_unit, _selectionName, _newDamage, _typeOfProjectile, _typeOfDamage] call FUNC(handleDamage_wounds);
// TODO Disabled until implemented fully
@ -63,5 +61,3 @@ if (alive _unit && {!(_unit getvariable ["ACE_isUnconscious", false])}) then {
[_unit] call FUNC(setUnconscious);
};
};
_amountOfDamage;

View File

@ -13,42 +13,22 @@
#include "script_component.hpp"
private ["_unit", "_bodyStatus", "_headDamage", "_torsoDamage", "_handsDamage", "_legsDamage"];
_unit = _this select 0;
PARAMS_1(_unit);
if (!local _unit) exitwith {};
_bodyStatus = _unit getvariable [QGVAR(bodyPartStatus),[0,0,0,0,0,0]];
private ["_bodyStatus", "_headDamage", "_torsoDamage", "_handsDamage", "_legsDamage"];
// ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"]
_headDamage = _bodyStatus select 0;
if (_headDamage > 0.95) then {
_unit setHitPointDamage ["hitHead", 0.95];
} else {
_unit setHitPointDamage ["hitHead", _headDamage];
};
_bodyStatus = _unit getVariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]];
_torsoDamage = _bodyStatus select 1;
if (_torsoDamage > 0.95) then {
_unit setHitPointDamage ["hitBody", 0.95];
} else {
_unit setHitPointDamage ["hitBody", _torsoDamage];
};
EXPLODE_6_PVT(_bodyStatus,_headDamage,_torsoDamage,_handsDamageR,_handsDamageL,_legsDamageR,_legsDamageL);
_unit setHitPointDamage ["hitHead", _headDamage min 0.95];
_unit setHitPointDamage ["hitBody", _torsoDamage min 0.95];
_unit setHitPointDamage ["hitHands", (_handsDamageR + _handsDamageL) min 0.95];
_unit setHitPointDamage ["hitLegs", (_legsDamageR + _legsDamageL) min 0.95];
_handsDamage = (_bodyStatus select 2) + (_bodyStatus select 3);
if (_handsDamage > 0.95) then {
_unit setHitPointDamage ["hitHands", 0.95];
} else {
_unit setHitPointDamage ["hitHands", _handsDamage];
};
_legsDamage = (_bodyStatus select 4) + (_bodyStatus select 5);
if (_legsDamage > 0.95) then {
_unit setHitPointDamage ["hitLegs", 0.95];
} else {
_unit setHitPointDamage ["hitLegs", _legsDamage];
};
if ({_x > 0} count _bodyStatus == 0) then {
if (_bodyStatus isEqualTo [0,0,0,0,0,0]) then {
_unit setDamage 0;
};