mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
e2ac18a05d
* advanced_ballistics * advanced_fatigue * advanced_throwing * ai * aircraft * arsenal * atragmx * attach * backpacks * ballistics * captives * cargo * chemlights * common * concertina_wire * cookoff * dagr * disarming * disposable * dogtags * dragging * explosives * fastroping * fcs * finger * frag * gestures * gforces * goggles * grenades * gunbag * hearing * hitreactions * huntir * interact_menu * interaction * inventory * kestrel4500 * laser * laserpointer * logistics_uavbattery * logistics_wirecutter * magazinerepack * map * map_gestures * maptools * markers * medical * medical_ai * medical_blood * medical_menu * microdagr * minedetector * missileguidance * missionmodules * mk6mortar * modules * movement * nametags * nightvision * nlaw * optics * optionsmenu * overheating * overpressure * parachute * pylons * quickmount * rangecard * rearm * recoil * refuel * reload * reloadlaunchers * repair * respawn * safemode * sandbag * scopes * slideshow * spectator * spottingscope * switchunits * tacticalladder * tagging * trenches * tripod * ui * vector * vehiclelock * vehicles * viewdistance * weaponselect * weather * winddeflection * yardage450 * zeus * arsenal defines.hpp * optionals * DEBUG_MODE_FULL 1 * DEBUG_MODE_FULL 2 * Manual fixes * Add SQF Validator check for #include after block comment * explosives fnc_openTimerUI * fix uniqueItems
68 lines
2.4 KiB
Plaintext
68 lines
2.4 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: Glowbal
|
|
* Handling of the open wounds & injuries upon the handleDamage eventhandler.
|
|
*
|
|
* Arguments:
|
|
* 0: Unit That Was Hit <OBJECT>
|
|
* 1: Name Of Hit Selection <STRING>
|
|
* 2: Amount Of Damage <NUMBER>
|
|
* 3: Shooter or source of the damage <OBJECT>
|
|
* 4: Type of the damage done <STRING>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [bob, "leg", 2, kevin, "shot"] call ACE_medical_fnc_handleDamage_wounds
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params ["_unit", "_selectionName", "_damage", "_typeOfProjectile", "_typeOfDamage"];
|
|
TRACE_6("ACE_DEBUG: HandleDamage Called",_unit, _selectionName, _damage, _shooter, _typeOfProjectile,_typeOfDamage);
|
|
|
|
if (_typeOfDamage == "") then {_typeOfDamage = "unknown";};
|
|
|
|
// Administration for open wounds and ids
|
|
private _openWounds = _unit getVariable[QGVAR(openWounds), []];
|
|
private _woundID = _unit getVariable[QGVAR(lastUniqueWoundID), 1];
|
|
|
|
private _extensionOutput = "ace_medical" callExtension format ["HandleDamageWounds,%1,%2,%3,%4", _selectionName, _damage, _typeOfDamage, _woundID];
|
|
|
|
private _painToAdd = 0;
|
|
private _woundsCreated = [];
|
|
|
|
call compile _extensionOutput;
|
|
{
|
|
_x params ["", "_toAddClassID", "_bodyPartNToAdd"];
|
|
_foundIndex = -1;
|
|
{
|
|
_x params ["", "_compareId", "_comparyBodyPartN"];
|
|
// Check if we have an id of the given class on the given bodypart already
|
|
if (_compareId == _toAddClassID && {_comparyBodyPartN == _bodyPartNToAdd}) exitWith {
|
|
_foundIndex = _forEachIndex;
|
|
};
|
|
} forEach _openWounds;
|
|
|
|
if (_foundIndex < 0) then {
|
|
// Since it is a new injury, we will have to add it to the open wounds array to store it
|
|
_openWounds pushBack _x;
|
|
} else {
|
|
// We already have one of these, so we are just going to increase the number that we have of it with a new one.
|
|
private _injury = _openWounds select _foundIndex;
|
|
_injury set [3, (_injury select 3) + 1];
|
|
};
|
|
} forEach _woundsCreated;
|
|
|
|
_unit setVariable [QGVAR(openWounds), _openWounds, true];
|
|
|
|
// Only update if new wounds have been created
|
|
if (count _woundsCreated > 0) then {
|
|
_unit setVariable [QGVAR(lastUniqueWoundID), _woundID, true];
|
|
};
|
|
|
|
private _painLevel = _unit getVariable [QGVAR(pain), 0];
|
|
_unit setVariable [QGVAR(pain), _painLevel + _painToAdd];
|
|
TRACE_6("ACE_DEBUG: HandleDamage_WoundsOLD",_unit, _painLevel, _painToAdd, _unit getVariable QGVAR(pain), _unit getVariable QGVAR(openWounds),_woundsCreated);
|