mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge branch 'medical-rewrite-pain' into medical-rewrite
This commit is contained in:
commit
41dde51e8e
@ -27,4 +27,5 @@ PREP(handleUnitVitals);
|
|||||||
PREP(handleMedications);
|
PREP(handleMedications);
|
||||||
// PREP(handleStateRevive);
|
// PREP(handleStateRevive);
|
||||||
|
|
||||||
|
PREP(addPain);
|
||||||
PREP(setUnconscious);
|
PREP(setUnconscious);
|
||||||
|
29
addons/medical/functions/fnc_addPain.sqf
Normal file
29
addons/medical/functions/fnc_addPain.sqf
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Author: commy2
|
||||||
|
* Adds or removes pain to/from unit.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Unit <OBJECT>
|
||||||
|
* 1: Pain to add. Negative to remove <NUMBER>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Nothing
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [player, 0.5] call ace_medical_fnc_addPain
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
params ["_unit", "_painToAdd"];
|
||||||
|
|
||||||
|
private _pain = _unit getVariable [QEGVAR(medical,pain), 0];
|
||||||
|
|
||||||
|
if (_pain > 0) then {
|
||||||
|
_pain = _pain + (_painToAdd min 1) * (1 - _pain);
|
||||||
|
} else {
|
||||||
|
_pain = (_pain + _painToAdd) max 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
_unit setVariable [QEGVAR(medical,pain), _pain];
|
@ -66,10 +66,7 @@ if (count _woundsCreated > 0) then {
|
|||||||
_unit setVariable [QEGVAR(medical,lastUniqueWoundID), _woundID, true];
|
_unit setVariable [QEGVAR(medical,lastUniqueWoundID), _woundID, true];
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO use medical add pain function instead
|
[_unit, _painToAdd] call EFUNC(medical,addPain);
|
||||||
private _painLevel = _unit getVariable [QEGVAR(medical,pain), 0];
|
|
||||||
_unit setVariable [QEGVAR(medical,pain), _painLevel + _painToAdd];
|
|
||||||
|
|
||||||
[_unit, "hit", PAIN_TO_SCREAM(_painToAdd)] call EFUNC(medical_engine,playInjuredSound);
|
[_unit, "hit", PAIN_TO_SCREAM(_painToAdd)] call EFUNC(medical_engine,playInjuredSound);
|
||||||
|
|
||||||
TRACE_6("exit",_unit, _painLevel, _painToAdd, _unit getVariable QEGVAR(medical,pain), _unit getVariable QEGVAR(medical,openWounds),_woundsCreated);
|
TRACE_5("exit",_unit, _painToAdd, _unit getVariable QEGVAR(medical,pain), _unit getVariable QEGVAR(medical,openWounds),_woundsCreated);
|
||||||
|
@ -135,10 +135,7 @@ if (count _woundsCreated > 0) then {
|
|||||||
_unit setVariable [QGVAR(lastUniqueWoundID), _woundID, true];
|
_unit setVariable [QGVAR(lastUniqueWoundID), _woundID, true];
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO use medical add pain function instead
|
[_unit, _painToAdd] call EFUNC(medical,addPain);
|
||||||
private _painLevel = _unit getVariable [QEGVAR(medical,pain), 0];
|
|
||||||
_unit setVariable [QEGVAR(medical,pain), _painLevel + _painToAdd];
|
|
||||||
|
|
||||||
[_unit, "hit", PAIN_TO_SCREAM(_painToAdd)] call EFUNC(medical_engine,playInjuredSound);
|
[_unit, "hit", PAIN_TO_SCREAM(_painToAdd)] call EFUNC(medical_engine,playInjuredSound);
|
||||||
|
|
||||||
TRACE_6("exit",_unit, _painLevel, _painToAdd, _unit getVariable QEGVAR(medical,pain), _unit getVariable QEGVAR(medical,openWounds),_woundsCreated);
|
TRACE_5("exit",_unit, _painToAdd, _unit getVariable QEGVAR(medical,pain), _unit getVariable QEGVAR(medical,openWounds),_woundsCreated);
|
||||||
|
Loading…
Reference in New Issue
Block a user