Fire - Loop "Pat down" action until patient is put out of fire (#9017)

* Adjust burn intensity defines and move to shared

* Loop "Pat down" action until patient is put out of fire

---------

Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
This commit is contained in:
Filip Maciejewski 2023-06-24 04:08:23 +02:00 committed by GitHub
parent 728f556ae4
commit beffc7660c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 6 deletions

View File

@ -23,8 +23,6 @@
#define BURN_PROPOGATE_UPDATE 1
#define BURN_PROPOGATE_DISTANCE 2
#define BURN_PROPOGATE_COUNTER_MAX 5
#define MAX_INTENSITY 10
#define MIN_INTENSITY 1
params ["_unit", "_intensity", ["_instigator", objNull]];
@ -44,7 +42,7 @@ if (_isBurning) exitWith {};
_intensity = 0;
};
_fireParticle setDropInterval (0.01 max linearConversion [MAX_INTENSITY, MIN_INTENSITY, _intensity, 0.03, 0.1, false]);
_fireParticle setDropInterval (0.01 max linearConversion [BURN_MAX_INTENSITY, BURN_MIN_INTENSITY, _intensity, 0.03, 0.1, false]);
_fireParticle setParticleParams [
["\A3\data_f\ParticleEffects\Universal\Universal", 16, 10, 32], // sprite sheet values
"", // animation name
@ -235,7 +233,7 @@ if (_isBurning) exitWith {};
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 / MAX_INTENSITY, _woundSelection, "burn", _instigator] call EFUNC(medical,addDamageToUnit);
[_unit, _intensity / BURN_MAX_INTENSITY, _woundSelection, "burn", _instigator] call EFUNC(medical,addDamageToUnit);
} else {
[_unit, 0.15, _woundSelection, "burn", _instigator] call EFUNC(medical,addDamageToUnit);
};
@ -336,5 +334,5 @@ if (_isBurning) exitWith {};
private _unitAlive = (alive _unit) && { getNumber ((configOf _unit) >> "isPlayableLogic") != 1 };
private _unitIsUnit = { (_unit != vehicle _unit) && { isNull vehicle _unit } };
!_unitAlive || _unitIsUnit || { _intensity <= MIN_INTENSITY } || { !([_unit] call FUNC(isBurning)) }
!_unitAlive || _unitIsUnit || { _intensity <= BURN_MIN_INTENSITY } || { !([_unit] call FUNC(isBurning)) }
}, ["_intensity", "_fireParticle", "_smokeParticle", "_fireLight", "_fireSound", "_lightFlare", "_lastIntensityUpdate", "_lastPropogateUpdate", "_isThisUnitAlive"]] call CBA_fnc_createPerFrameHandlerObject;

View File

@ -16,8 +16,21 @@
* Public: No
*/
params ["_medic", "_patient"];
params ["_medic", "_patient", "_bodyPart", "_classname"];
private _intensity = _patient getVariable [QGVAR(intensity), 0];
_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 (EGVAR(medical_gui,pendingReopen)) then {
LOG("temporarily blocking medical menu reopen");
EGVAR(medical_gui,pendingReopen) = false;
[{EGVAR(medical_gui,pendingReopen) = true}] call CBA_fnc_execNextFrame;
};
[_medic, _patient, _bodyPart, _classname] call EFUNC(medical_treatment,treatment);
};

View File

@ -31,5 +31,9 @@
"amovppnemstpsoptwbindnon_amovppnemevasoptwbindr"\
]
#define BURN_MAX_INTENSITY 10
#define BURN_MIN_INTENSITY 1
#define INTENSITY_DECREASE_MULT_PAT_DOWN 0.8
#define INTENSITY_DECREASE_MULT_ROLLING INTENSITY_DECREASE_MULT_PAT_DOWN