mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
handle blood visuals
This commit is contained in:
parent
b698a88dc1
commit
4bc1c1db56
@ -14,6 +14,10 @@
|
||||
|
||||
params ["_unit"];
|
||||
|
||||
if (damage _unit > 0) then {
|
||||
_unit setDamage 0;
|
||||
};
|
||||
|
||||
_unit setVariable [QGVAR(pain), 0, true];
|
||||
_unit setVariable [QGVAR(bloodVolume), 100, true];
|
||||
_unit setVariable ["ACE_isUnconscious", false, true]; // TODO this is done based on state
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit That Was Hit <OBJECT>
|
||||
* 1: Name Of Hit Selection <STRING>
|
||||
* 1: Name Of Body Part <STRING>
|
||||
* 2: Amount Of Damage <NUMBER>
|
||||
* 3: Shooter or source of the damage <OBJECT>
|
||||
* 4: Type of the damage done <STRING>
|
||||
@ -59,6 +59,8 @@ call compile _extensionOutput;
|
||||
|
||||
_unit setVariable [QEGVAR(medical,openWounds), _openWounds, true];
|
||||
|
||||
[_unit, _bodyPart] call EFUNC(medical_engine,updateBodyPartVisuals);
|
||||
|
||||
// Only update if new wounds have been created
|
||||
if (count _woundsCreated > 0) then {
|
||||
_unit setVariable [QEGVAR(medical,lastUniqueWoundID), _woundID, true];
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit That Was Hit <OBJECT>
|
||||
* 1: Name Of Hit Selection <STRING>
|
||||
* 1: Name Of Body Part <STRING>
|
||||
* 2: Amount Of Damage <NUMBER>
|
||||
* 3: Shooter or source of the damage <OBJECT>
|
||||
* 4: Type of the damage done <STRING>
|
||||
@ -128,6 +128,8 @@ private _woundsCreated = [];
|
||||
|
||||
_unit setVariable [QEGVAR(medical,openWounds), _openWounds, true];
|
||||
|
||||
[_unit, _bodyPart] call EFUNC(medical_engine,updateBodyPartVisuals);
|
||||
|
||||
// Only update if new wounds have been created
|
||||
if (count _woundsCreated > 0) then {
|
||||
_unit setVariable [QGVAR(lastUniqueWoundID), _woundID, true];
|
||||
|
@ -2,6 +2,7 @@
|
||||
PREP(handleDamage);
|
||||
PREP(playInjuredSound);
|
||||
PREP(damageBodyPart);
|
||||
PREP(updateBodyPartVisuals);
|
||||
PREP(setLimping);
|
||||
PREP(setStructuralDamage);
|
||||
PREP(setUnconsciousAnim);
|
||||
|
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* Damages a body part of a local unit. Does not kill the unit.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Body part, can be "Head", "Body", "LeftArm", "RightArm", "LeftLeg", "RightLeg" or "All" <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [player, "HEAD"] call ace_medical_engine_fnc_updateBodyPartVisuals
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_unit", objNull, [objNull]], ["_bodyPart", "", [""]]];
|
||||
|
||||
if (!local _unit) exitWith {
|
||||
ERROR("Unit not local or null");
|
||||
};
|
||||
|
||||
if (_bodyPart == "All") exitWith {
|
||||
[_unit, "Head"] call FUNC(updateBodyPartVisuals);
|
||||
[_unit, "Body"] call FUNC(updateBodyPartVisuals);
|
||||
[_unit, "LeftArm"] call FUNC(updateBodyPartVisuals);
|
||||
[_unit, "RightArm"] call FUNC(updateBodyPartVisuals);
|
||||
[_unit, "LeftLeg"] call FUNC(updateBodyPartVisuals);
|
||||
[_unit, "RightLeg"] call FUNC(updateBodyPartVisuals);
|
||||
};
|
||||
|
||||
private _affectedBodyParts = [_bodyPart];
|
||||
|
||||
switch (toLower _bodyPart) do {
|
||||
case "leftarm";
|
||||
case "rightarm": {
|
||||
_bodyPart = "Arms";
|
||||
_affectedBodyParts = ["LeftArm", "RightArm"];
|
||||
};
|
||||
|
||||
case "leftleg";
|
||||
case "rightleg": {
|
||||
_bodyPart = "Legs";
|
||||
_affectedBodyParts = ["LeftLeg", "RightLeg"];
|
||||
};
|
||||
};
|
||||
|
||||
private _openWounds = _unit getVariable QEGVAR(medical,openWounds);
|
||||
private _bloodLossOnAffectedBodyParts = 0;
|
||||
|
||||
{
|
||||
private _partIndex = ALL_BODY_PARTS find toLower _x;
|
||||
|
||||
private _bloodLossOnBodyPart = 0;
|
||||
|
||||
{
|
||||
_x params ["", "", "_bodyPartN", "_amountOf", "_percentageOpen"];
|
||||
|
||||
if (_bodyPartN isEqualTo _partIndex) then {
|
||||
_bloodLossOnBodyPart = _bloodLossOnBodyPart + (_amountOf * _percentageOpen);
|
||||
};
|
||||
} forEach _openWounds;
|
||||
|
||||
// report maximum of both legs or arms
|
||||
_bloodLossOnAffectedBodyParts = _bloodLossOnAffectedBodyParts max _bloodLossOnBodyPart;
|
||||
} forEach _affectedBodyParts;
|
||||
|
||||
[_unit, _bodyPart, _bloodLossOnAffectedBodyParts >= 0.15] call FUNC(damageBodyPart);
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The patient <OBJECT>
|
||||
* 1: Treatment classname <STRING>
|
||||
* 1: Treatment class name <STRING>
|
||||
* 2: Body part <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
@ -102,6 +102,8 @@ _openWounds set [_mostEffectiveSpot, _mostEffectiveInjury];
|
||||
|
||||
_target setVariable [QEGVAR(medical,openWounds), _openWounds, true];
|
||||
|
||||
[_target, _bodyPart] call EFUNC(medical_engine,updateBodyPartVisuals);
|
||||
|
||||
// Handle the reopening of bandaged wounds
|
||||
if (_impact > 0 && {EGVAR(medical,level) >= 2} && {EGVAR(medical,enableAdvancedWounds)}) then {
|
||||
[_target, _impact, _partIndex, _mostEffectiveSpot, _mostEffectiveInjury, _bandage] call FUNC(handleBandageOpening);
|
||||
@ -189,7 +191,7 @@ if (EGVAR(medical,healHitPointAfterAdvBandage) || {EGVAR(medical,level) < 2}) th
|
||||
|
||||
_target setVariable [QEGVAR(medical,bodyPartStatus), _bodyStatus, true];
|
||||
|
||||
[_target] call EFUNC(medical_damage,setDamage);
|
||||
//[_target] call EFUNC(medical_damage,setDamage);
|
||||
};
|
||||
|
||||
true
|
||||
|
@ -53,7 +53,7 @@ private _bloodLossOnSelection = 0;
|
||||
private _partNumber = (ALL_BODY_PARTS find toLower _bodyPart) max 0;
|
||||
|
||||
// Add all bleeding from wounds on selection
|
||||
private _openWounds = _target getvariable [QEGVAR(medical,openWounds), []];
|
||||
private _openWounds = _target getVariable [QEGVAR(medical,openWounds), []];
|
||||
{
|
||||
_x params ["", "", "_selectionX", "_amountOf", "_percentageOpen"];
|
||||
if (_selectionX == _partNumber) then {
|
||||
|
Loading…
Reference in New Issue
Block a user