mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
add addPain function, cap pain
This commit is contained in:
parent
3521bca00b
commit
2ad7c4c4ea
@ -27,4 +27,5 @@ PREP(handleUnitVitals);
|
||||
PREP(handleMedications);
|
||||
// PREP(handleStateRevive);
|
||||
|
||||
PREP(addPain);
|
||||
PREP(setUnconscious);
|
||||
|
28
addons/medical/functions/fnc_addPain.sqf
Normal file
28
addons/medical/functions/fnc_addPain.sqf
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* Adds pain to unit and plays a scream sound.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Argument Name <TYPE>
|
||||
* 0: Argument Name <TYPE>
|
||||
*
|
||||
* Return Value:
|
||||
* Return Name <TYPE>
|
||||
*
|
||||
* Example:
|
||||
* ["example"] call ace_[module]_fnc_[functionName]
|
||||
*
|
||||
* Public: [Yes/No]
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit", "_painToAdd"];
|
||||
|
||||
_painToAdd = _painToAdd min 1;
|
||||
|
||||
private _pain = _unit getVariable [QEGVAR(medical,pain), 0];
|
||||
_pain = _pain + _painToAdd * (1 - _pain);
|
||||
|
||||
_unit setVariable [QEGVAR(medical,pain), _pain];
|
||||
|
||||
[_unit, "hit", PAIN_TO_SCREAM(_painToAdd)] call EFUNC(medical_engine,playInjuredSound);
|
@ -66,10 +66,6 @@ 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);
|
||||
|
@ -135,10 +135,6 @@ 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);
|
||||
|
Loading…
Reference in New Issue
Block a user