ACE3/addons/medical_feedback/functions/fnc_effectPain.sqf

47 lines
1.5 KiB
Plaintext
Raw Normal View History

#include "script_component.hpp"
2016-12-01 19:54:03 +00:00
/*
* Author: BaerMitUmlaut
* Triggers the pain effect (single flash).
*
* Arguments:
* 0: Enable <BOOL>
* 1: Intensity <NUMBER>
*
* Return Value:
* None
*/
2016-12-01 19:54:03 +00:00
params ["_enable", "_intensity"];
if (!_enable || {_intensity == 0}) exitWith {
2016-12-01 19:54:03 +00:00
GVAR(ppPain) ppEffectEnable false;
};
GVAR(ppPain) ppEffectEnable true;
// Trigger effect every 2s
private _showNextTick = missionNamespace getVariable [QGVAR(showPainNextTick), true];
GVAR(showPainNextTick) = !_showNextTick;
if (_showNextTick) exitWith {};
2016-12-01 19:54:03 +00:00
private _initialAdjust = [];
private _delayedAdjust = [];
if (GVAR(painEffectType) == 0) then {
_intensity = linearConversion [0, 1, _intensity, 0, 0.6, true];
_initialAdjust = [1, 1, 0, [1, 1, 1, _intensity], [1, 1, 1, 1], [0.33, 0.33, 0.33, 0], [0.59, 0.64, 0, 0, 0, 0, 4]];
_delayedAdjust = [1, 1, 0, [1, 1, 1, 0], [1, 1, 1, 1], [0.33, 0.33, 0.33, 0], [0.59, 0.64, 0, 0, 0, 0, 4]];
} else {
_intensity = linearConversion [0, 1, _intensity, 0, 0.008, true];
_initialAdjust = [_intensity, _intensity, 0.3, 0.39];
_delayedAdjust = [ 0, 0, 0.3, 0.39];
};
GVAR(ppPain) ppEffectAdjust _initialAdjust;
GVAR(ppPain) ppEffectCommit FX_PAIN_FADE_IN;
2016-12-01 19:54:03 +00:00
[{
params ["_adjust", "_painEffectType"];
if (GVAR(painEffectType) != _painEffectType) exitWith {TRACE_1("Effect type changed",_this);};
GVAR(ppPain) ppEffectAdjust _adjust;
GVAR(ppPain) ppEffectCommit FX_PAIN_FADE_OUT;
}, [_delayedAdjust, GVAR(painEffectType)], FX_PAIN_FADE_IN] call CBA_fnc_waitAndExecute;