diff --git a/addons/fire/XEH_postInit.sqf b/addons/fire/XEH_postInit.sqf index bfcecf80bf..ed808d6946 100644 --- a/addons/fire/XEH_postInit.sqf +++ b/addons/fire/XEH_postInit.sqf @@ -60,7 +60,7 @@ if (!isServer) exitWith {}; private _hashedKey = hashValue _key; if (isNil "_hashedKey") exitWith { - ERROR_2("Unsupported key type used: %1 - %2 - %3",_key,typeName _key); + ERROR_2("Unsupported key type used: %1 - %2",_key,typeName _key); }; // To avoid issues, remove existing entries first before overwriting @@ -77,7 +77,7 @@ if (!isServer) exitWith {}; private _hashedKey = hashValue _key; if (isNil "_hashedKey") exitWith { - ERROR_2("Unsupported key type used: %1 - %2 - %3",_key,typeName _key); + ERROR_2("Unsupported key type used: %1 - %2",_key,typeName _key); }; (GVAR(fireSources) deleteAt _hashedKey) params [["_fireLogic", objNull]]; diff --git a/addons/fire/functions/fnc_burnReaction.sqf b/addons/fire/functions/fnc_burnReaction.sqf index 3138a31cc2..5a9b75d48c 100644 --- a/addons/fire/functions/fnc_burnReaction.sqf +++ b/addons/fire/functions/fnc_burnReaction.sqf @@ -16,8 +16,9 @@ params ["_unit"]; if ( GVAR(dropWeapon) > 0 && - {isNull objectParent _unit && {(currentWeapon _unit) != ""}} && - {!isPlayer _unit || GVAR(dropWeapon) >= 2} + {isNull objectParent _unit} && + {(currentWeapon _unit) != ""} && + {!isPlayer _unit || GVAR(dropWeapon) == 2} ) then { _unit call EFUNC(common,throwWeapon); }; diff --git a/addons/fire/functions/fnc_burnSimulation.sqf b/addons/fire/functions/fnc_burnSimulation.sqf index e48fa38ec4..ff64c3ffb2 100644 --- a/addons/fire/functions/fnc_burnSimulation.sqf +++ b/addons/fire/functions/fnc_burnSimulation.sqf @@ -67,8 +67,8 @@ params ["_unit", "_instigator"]; _distancePercent = 1 - ((_unit distance _x) / BURN_PROPAGATE_DISTANCE); _adjustedIntensity = _intensity * _distancePercent; - // Don't burn if intensity is too low - if (BURN_MIN_INTENSITY > _adjustedIntensity) then { + // Don't burn if intensity is too low or already burning with higher intensity + if (BURN_MIN_INTENSITY > _adjustedIntensity || {(_x getVariable [QGVAR(intensity), 0]) > _adjustedIntensity}) then { continue; }; @@ -138,16 +138,20 @@ params ["_unit", "_instigator"]; _unit call FUNC(burnReaction); }; - // Common burn areas are the hands and face https://www.ncbi.nlm.nih.gov/pubmed/16899341/ - private _woundSelection = ["Head", "Body", "LeftArm", "RightArm", "LeftLeg", "RightLeg"] selectRandomWeighted [0.77, 0.5, 0.8, 0.8, 0.3, 0.3]; - - if (GET_PAIN_PERCEIVED(_unit) < (PAIN_UNCONSCIOUS + random 0.2)) then { - // Keep pain around unconciousness limit to allow for more fun interactions - [_unit, _intensity / BURN_MAX_INTENSITY, _woundSelection, "burn", _instigator] call EFUNC(medical,addDamageToUnit); - } else { - [_unit, 0.15, _woundSelection, "burn", _instigator] call EFUNC(medical,addDamageToUnit); + if (!isNull _instigator) then { + _unit setVariable [QEGVAR(medical,lastDamageSource), _instigator]; + _unit setVariable [QEGVAR(medical,lastInstigator), _instigator]; }; + // Common burn areas are the hands and face https://www.ncbi.nlm.nih.gov/pubmed/16899341/ + private _bodyPart = ["Head", "Body", "LeftArm", "RightArm", "LeftLeg", "RightLeg"] selectRandomWeighted [0.77, 0.5, 0.8, 0.8, 0.3, 0.3]; + + // Keep pain around unconciousness limit to allow for more fun interactions + private _damageToAdd = [0.15, _intensity / BURN_MAX_INTENSITY] select (!alive _unit || {GET_PAIN_PERCEIVED(_unit) < (PAIN_UNCONSCIOUS + random 0.2)}); + + // Use event directly, as ace_medical_fnc_addDamageToUnit requires unit to be alive + [QEGVAR(medical,woundReceived), [_unit, [[_damageToAdd, _bodyPart, _damageToAdd]], _instigator, "burn"]] call CBA_fnc_localEvent; + _unit setVariable [QGVAR(intensity), _intensity, true]; // globally sync intensity across all clients to make sure simulation is deterministic }; }, BURN_PROPAGATE_UPDATE, [_unit, _instigator]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/fire/functions/fnc_fireManagerPFH.sqf b/addons/fire/functions/fnc_fireManagerPFH.sqf index eb59faef72..540caa7de7 100644 --- a/addons/fire/functions/fnc_fireManagerPFH.sqf +++ b/addons/fire/functions/fnc_fireManagerPFH.sqf @@ -1,6 +1,6 @@ #include "..\script_component.hpp" /* - * Author: tcvm + * Author: tcvm, johnb43 * Handles various objects on fire and determines if units close to objects deserve to get burned. * * Arguments: diff --git a/addons/fire/functions/fnc_medical_success.sqf b/addons/fire/functions/fnc_medical_success.sqf index a84aab5644..ed4b8cb326 100644 --- a/addons/fire/functions/fnc_medical_success.sqf +++ b/addons/fire/functions/fnc_medical_success.sqf @@ -2,6 +2,7 @@ /* * Author: tcvm * Decreases burning intensity on successful medical action. + * The medical action is looped until the user stops the interaction or the unit is no longer burning. * * Arguments: * 0: Medic @@ -25,15 +26,16 @@ _intensity = _intensity * INTENSITY_DECREASE_MULT_PAT_DOWN; _patient setVariable [QGVAR(intensity), _intensity, true]; -if (_intensity > BURN_MIN_INTENSITY) then { - TRACE_1("patient still burning, looping",_this); +// If the unit is still burning, loop the medical action +if !(_patient call FUNC(isBurning)) exitWith {}; - if (EGVAR(medical_gui,pendingReopen)) then { - TRACE_1("temporarily blocking medical menu reopen",_this); +TRACE_1("patient still burning, looping",_this); - EGVAR(medical_gui,pendingReopen) = false; - [{EGVAR(medical_gui,pendingReopen) = true}] call CBA_fnc_execNextFrame; - }; +if (EGVAR(medical_gui,pendingReopen)) then { + TRACE_1("temporarily blocking medical menu reopen",_this); - [_medic, _patient, _bodyPart, _classname] call EFUNC(medical_treatment,treatment); + EGVAR(medical_gui,pendingReopen) = false; + [{EGVAR(medical_gui,pendingReopen) = true}] call CBA_fnc_execNextFrame; }; + +[_medic, _patient, _bodyPart, _classname] call EFUNC(medical_treatment,treatment);