diff --git a/addons/medical/CfgEventHandlers.hpp b/addons/medical/CfgEventHandlers.hpp index 6be2a7b5e8..ab62ee2c0a 100644 --- a/addons/medical/CfgEventHandlers.hpp +++ b/addons/medical/CfgEventHandlers.hpp @@ -21,14 +21,14 @@ class Extended_Killed_Eventhandlers { class Extended_Local_Eventhandlers { class CaManBase { - class ADDON { + class ADDON { Local = QUOTE(_this call FUNC(eh_local)); }; }; }; class Extended_Init_Eventhandlers { class CaManBase { - class ADDON { + class ADDON { init = QUOTE(_this call FUNC(onInitForUnit);); }; }; diff --git a/addons/medical/functions/fnc_getBodyPartNumber.sqf b/addons/medical/functions/fnc_getBodyPartNumber.sqf index 20a514a9ed..6bfc041c80 100644 --- a/addons/medical/functions/fnc_getBodyPartNumber.sqf +++ b/addons/medical/functions/fnc_getBodyPartNumber.sqf @@ -22,7 +22,7 @@ _selectionName = _this select 0; 1 }; case "hands": { - if (random(1)>0.499) then { + if (random(1)>=0.5) then { 2 } else { 3 @@ -35,7 +35,7 @@ _selectionName = _this select 0; 3 }; case "legs": { - if (random(1)>0.499) then { + if (random(1)>=0.5) then { 4 } else { 5 diff --git a/addons/medical/functions/fnc_handleTreatment_Action_AdvancedLocal.sqf b/addons/medical/functions/fnc_handleTreatment_Action_AdvancedLocal.sqf index 85e29aff31..5fe402bd30 100644 --- a/addons/medical/functions/fnc_handleTreatment_Action_AdvancedLocal.sqf +++ b/addons/medical/functions/fnc_handleTreatment_Action_AdvancedLocal.sqf @@ -10,7 +10,7 @@ #include "script_component.hpp" -private ["_unit", "_caller", "_selectionName", "_removeItem", "_prevAnim"]; +private ["_unit", "_caller", "_selectionName", "_removeItem", "_prevAnim", "_value"]; _caller = _this select 0; _target = _this select 1; _selectionName = _this select 2; @@ -38,12 +38,7 @@ if (count _attributes > 1) then { _value = _value + (_attributes select 1); [_target,(_attributes select 0),_value] call EFUNC(common,setDefinedVariable); - _patient = "patient"; - if (_target == _caller) then { - _patient = "himself"; - }; - // TODO localization [_target,"treatment",format["%1 has given %4 a %2(%3ml)",[_caller] call cse_fnc_getName,_attributes select 2,_attributes select 1,_target]] call FUNC(addActivityToLog); [_target,_removeItem] call FUNC(addToTriageList); -}; \ No newline at end of file +}; diff --git a/addons/medical/functions/fnc_setDamageBodyPart.sqf b/addons/medical/functions/fnc_setDamageBodyPart.sqf index 523b49d332..828bd93c7e 100644 --- a/addons/medical/functions/fnc_setDamageBodyPart.sqf +++ b/addons/medical/functions/fnc_setDamageBodyPart.sqf @@ -1,25 +1,53 @@ +/** + * fnc_setDamageBodyPart.sqf + * @Descr: N/A + * @Author: Glowbal + * + * @Arguments: [] + * @Return: + * @PublicAPI: false + */ + #include "script_component.hpp" -private ["_unit", "_bodyPart", "_amountOfDamage"]; +private ["_unit", "_bodyStatus", "_headDamage", "_torsoDamage", "_handsDamage", "_legsDamage"]; _unit = _this select 0; -_bodyPart = _this select 1; -_amountOfDamage = _this select 2; -if (alive _unit) then { - _hitPointName = switch (_bodyPart) do { - case 0: {"hitHead"}; - case 1: {"hitBody"}; - case 2: {"hitHands"}; - case 3: {"hitHands"}; - case 4: {"hitLegs"}; - case 5: {"hitLegs"}; - default {"hitLegs"}; - }; - if (_amountOfDamage < 0.95) then { - _unit setHitPointDamage [_hitPointName, _amountOfDamage]; - _unit setHit [_selectionName, _amountOfDamage]; - } else { - _unit setHitPointDamage [_hitPointName, 0.95]; - _unit setHit [_selectionName, 0.95]; - }; -}; \ No newline at end of file +if (!local _unit) exitwith { + // execute only local +}; + +_bodyStatus = [_unit,QGVAR(bodyPartStatus),[0,0,0,0,0,0]] call EFUNC(common,getDefinedVariable); +// ["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]; +}; + +_torsoDamage = _bodyStatus select 1; +if (_torsoDamage > 0.95) then { + _unit setHitPointDamage ["hitBody", 0.95]; +} else { + _unit setHitPointDamage ["hitBody", _torsoDamage]; +}; + + +_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 { + _unit setDamage 0; +};