Skip to content
This repository has been archived by the owner on Apr 12, 2023. It is now read-only.

Commit

Permalink
REWRITE Effects due false IV treatment
Browse files Browse the repository at this point in the history
  • Loading branch information
Katalam committed Feb 10, 2019
1 parent adc688b commit 733a551
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 33 deletions.
39 changes: 39 additions & 0 deletions addons/kat_acecirculation/functions/fn_events.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,42 @@

["treatmentIVfalse", {_this call kat_aceCirculation_fnc_treatmentAdvanced_IV}] call CBA_fnc_addEventHandler;
["IVreset", {_this call kat_aceCirculation_fnc_removeEffect_IV}] call CBA_fnc_addEventHandler;

if (hasInterface) then {
private _fnc_createEffect = {
params ["_type", "_layer", "_default"];

private _effect = ppEffectCreate [_type, _layer];
_effect ppEffectEnable true;
_effect ppEffectForceInNVG true;
_effect ppEffectAdjust _default;
_effect ppEffectCommit 0;

_effect
};

kat_aceCirculation_effect_IV = [
"chromAberration",
4207,
[0, 0, false]
] call _fnc_createEffect;


[{
private _counts = ACE_PLAYER getVariable ["kat_aceCirculation_IV_counts", 0];
if (_counts > 0) then {
private _ppEffect = (0.01 * _counts);
kat_aceCirculation_effect_IV ppEffectEnable true;
kat_aceCirculation_effect_IV ppEffectAdjust [_ppEffect, _ppEffect, false];
kat_aceCirculation_effect_IV ppEffectCommit 0.01;
} else {
kat_aceCirculation_effect_IV ppEffectEnable true;
kat_aceCirculation_effect_IV ppEffectAdjust [0, 0, false];
kat_aceCirculation_effect_IV ppEffectCommit 0.01;
};

if (!(isNull curatorCamera) or !(alive ACE_player)) exitWith {
kat_aceCirculation_effect_IV ppEffectEnable false;
};
}, 0.5, []] call CBA_fnc_addPerFrameHandler;
};
12 changes: 8 additions & 4 deletions addons/kat_acecirculation/functions/fn_handleTreatment.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@
* Public: No
*/

params ["_caller", "_target", "_selectionName", "_className", "_items"];

params ["_player", "_target", "_selectionName", "_className", "_items"];
//[abc,abcd,"hand_r","BloodIV_A",["KAT_bloodIV_A"]]
private _return = false;
[_caller, _target, _selectionName, _className, _items] call ace_medical_fnc_treatmentIV;

[_player, _target, _selectionName, _className, _items] call ace_medical_fnc_treatmentIV;

if ([_target, _className] call kat_aceCirculation_fnc_compatible) exitWith {};
[_target, _className] call kat_aceCirculation_fnc_treatmentAdvanced_IV;

[_className, _target] call kat_aceCirculation_fnc_treatmentAdvanced_IV;

_return = true;
_return;
8 changes: 0 additions & 8 deletions addons/kat_acecirculation/functions/fn_removeEffect_IV.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,4 @@

params ["_unit"];

if !(local _unit) exitWith {["IVreset", [_unit], _unit] call CBA_fnc_targetEvent};

private _effect = ppEffectCreate ["chromAberration", 5000];
_effect ppEffectEnable true;
_effect ppEffectForceInNVG true;
_effect ppEffectAdjust [0, 0, false];
_effect ppEffectCommit 0.01;

_unit setVariable ["kat_aceCirculation_IV_counts", 0, true];
26 changes: 5 additions & 21 deletions addons/kat_acecirculation/functions/fn_treatmentAdvanced_IV.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,18 @@
* 0: Successful <BOOLEAN>
*
* Example:
* [cursorTarget, 'Blood_IV_A'] call kat_aceCirculation_fnc_treatmentAdvanced_IV
* ['Blood_IV_A', cursorTarget] call kat_aceCirculation_fnc_treatmentAdvanced_IV
*
* Public: No
*/

params ["_unit", "_className"];

if !(local _unit) exitWith {["treatmentIVfalse", [_unit, _className], _unit] call CBA_fnc_targetEvent};
private _return = false;

private _counts = _unit getVariable ["kat_aceCirculation_IV_counts", 0];
if (_counts isEqualTo 0) then {_counts = 1};
private _ppEffect = (0.01 * _counts);

private _effect = ppEffectCreate ["chromAberration", 5000];
_effect ppEffectEnable true;
_effect ppEffectForceInNVG true;
_effect ppEffectAdjust [_ppEffect, _ppEffect, false];
_effect ppEffectCommit 0.01;
params ["_className", "_target"];

//unit, adjustment, time
private _volume = getNumber (configFile >> "ACE_Medical_Advanced" >> "Treatment" >> "IV" >> _className >> "volume");
private _hradjust = _volume / 25;
[_unit, _hradjust, 60] call ace_medical_fnc_addHeartRateAdjustment;
[_target, _hradjust, 60] call ace_medical_fnc_addHeartRateAdjustment;

//todo tod?
private _a = (_unit getVariable ["kat_aceCirculation_IV_counts", 0]) + 1;
_unit setVariable ["kat_aceCirculation_IV_counts", _a, true];

_return = true;
_return;
private _a = (_target getVariable ["kat_aceCirculation_IV_counts", 0]) + 1;
_target setVariable ["kat_aceCirculation_IV_counts", _a, true];
Binary file added kat.bikey
Binary file not shown.

0 comments on commit 733a551

Please sign in to comment.