Merge branch 'medical-rewrite-pain' into medical-rewrite

This commit is contained in:
commy2 2016-10-12 03:19:48 +02:00
commit 41dde51e8e
4 changed files with 34 additions and 10 deletions

View File

@ -27,4 +27,5 @@ PREP(handleUnitVitals);
PREP(handleMedications);
// PREP(handleStateRevive);
PREP(addPain);
PREP(setUnconscious);

View 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];

View File

@ -66,10 +66,7 @@ if (count _woundsCreated > 0) then {
_unit setVariable [QEGVAR(medical,lastUniqueWoundID), _woundID, true];
};
// TODO use medical add pain function instead
private _painLevel = _unit getVariable [QEGVAR(medical,pain), 0];
_unit setVariable [QEGVAR(medical,pain), _painLevel + _painToAdd];
[_unit, _painToAdd] call EFUNC(medical,addPain);
[_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);

View File

@ -135,10 +135,7 @@ if (count _woundsCreated > 0) then {
_unit setVariable [QGVAR(lastUniqueWoundID), _woundID, true];
};
// TODO use medical add pain function instead
private _painLevel = _unit getVariable [QEGVAR(medical,pain), 0];
_unit setVariable [QEGVAR(medical,pain), _painLevel + _painToAdd];
[_unit, _painToAdd] call EFUNC(medical,addPain);
[_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);