mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added bleeding effect
This commit is contained in:
parent
9cef8ea591
commit
e447d5c222
@ -1,3 +1,4 @@
|
||||
PREP(effectBleeding);
|
||||
PREP(effectBloodVolume);
|
||||
PREP(effectIncapacitated);
|
||||
PREP(effectPain);
|
||||
|
BIN
addons/medical_ui/data/blood1.paa
Normal file
BIN
addons/medical_ui/data/blood1.paa
Normal file
Binary file not shown.
BIN
addons/medical_ui/data/blood2.paa
Normal file
BIN
addons/medical_ui/data/blood2.paa
Normal file
Binary file not shown.
74
addons/medical_ui/functions/fnc_effectBleeding.sqf
Normal file
74
addons/medical_ui/functions/fnc_effectBleeding.sqf
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Author: BaerMitUmlaut
|
||||
* Handles the bleeding effect.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Enable effect <BOOL>
|
||||
* 1: Current bloodloss (in l/s) <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
params ["_enable", "_bloodloss"];
|
||||
if (isNull findDisplay 46) exitWith {};
|
||||
|
||||
private _controls = uiNamespace getVariable [QGVAR(bloodControls), [controlNull, controlNull]];
|
||||
_controls params ["_blood1", "_blood2"];
|
||||
|
||||
if (!_enable) exitWith {
|
||||
_blood1 ctrlSetFade 1;
|
||||
_blood2 ctrlSetFade 1;
|
||||
|
||||
_blood1 ctrlCommit 0;
|
||||
_blood2 ctrlCommit 0;
|
||||
};
|
||||
|
||||
// Initialize controls
|
||||
if (isNull _blood1) then {
|
||||
_blood1 = findDisplay 46 ctrlCreate ["RscPicture", -1];
|
||||
_blood2 = findDisplay 46 ctrlCreate ["RscPicture", -1];
|
||||
|
||||
_blood1 ctrlSetText QPATHTOF(data\blood1.paa);
|
||||
_blood2 ctrlSetText QPATHTOF(data\blood2.paa);
|
||||
|
||||
private _pos = [safeZoneXAbs, safeZoneY, safeZoneWAbs, safeZoneH];
|
||||
_blood1 ctrlSetPosition _pos;
|
||||
_blood2 ctrlSetPosition _pos;
|
||||
|
||||
_blood1 ctrlSetFade 1;
|
||||
_blood2 ctrlSetFade 1;
|
||||
|
||||
_blood1 ctrlCommit 0;
|
||||
_blood2 ctrlCommit 0;
|
||||
|
||||
uiNamespace setVariable [QGVAR(bloodControls), [_blood1, _blood2]];
|
||||
};
|
||||
|
||||
private _fade = linearConversion [0, 0.002, _bloodloss, 1, 0, true];
|
||||
|
||||
private _switchBloodFadeInfo = missionNamespace getVariable [QGVAR(switchBloodFadeInfo), [0, 0]];
|
||||
_switchBloodFadeInfo params ["_tickCounter", "_lastBloodloss"];
|
||||
|
||||
if (_tickCounter == 2) then {
|
||||
if (ctrlFade _blood1 > ctrlFade _blood2) then {
|
||||
_blood1 ctrlSetFade _fade;
|
||||
_blood2 ctrlSetFade 1;
|
||||
} else {
|
||||
_blood1 ctrlSetFade 1;
|
||||
_blood2 ctrlSetFade _fade;
|
||||
};
|
||||
|
||||
_blood1 ctrlCommit 3;
|
||||
_blood2 ctrlCommit 3;
|
||||
|
||||
GVAR(switchBloodFadeInfo) = [0, _bloodloss];
|
||||
} else {
|
||||
GVAR(switchBloodFadeInfo) = [_tickCounter + 1, _bloodloss];
|
||||
};
|
||||
|
||||
// Speed up fade on sudden changes
|
||||
if (abs (_lastBloodloss - _bloodloss) > 0.001) then {
|
||||
_blood1 ctrlCommit 1;
|
||||
_blood2 ctrlCommit 1;
|
||||
};
|
@ -15,6 +15,7 @@ if (_disableAll) exitWith {
|
||||
[false, 0] call FUNC(effectUnconscious);
|
||||
[false] call FUNC(effectPain);
|
||||
[false] call FUNC(effectBloodVolume);
|
||||
[false] call FUNC(effectBleeding);
|
||||
};
|
||||
|
||||
// - Current state info -------------------------------------------------------
|
||||
@ -34,3 +35,5 @@ private _pain = [ACE_player] call EFUNC(medical,getPainLevel);
|
||||
if (!_unconscious) then {
|
||||
[true, _pain] call FUNC(effectPain);
|
||||
};
|
||||
|
||||
[true, _bleedingStrength] call FUNC(effectBleeding);
|
||||
|
Loading…
Reference in New Issue
Block a user