mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Fix updating body part visuals (#5141)
This commit is contained in:
parent
f715edabc9
commit
382028e662
@ -41,10 +41,12 @@ private _woundDamage = _damage / ((count _woundsCreated) max 1); // If the damag
|
|||||||
private _painLevel = 0;
|
private _painLevel = 0;
|
||||||
private _critialDamage = false;
|
private _critialDamage = false;
|
||||||
private _bodyPartDamage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]];
|
private _bodyPartDamage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]];
|
||||||
|
private _bodyPartVisParams = [_unit, false, false, false, false]; // params array for EFUNC(medical_engine,updateBodyPartVisuals);
|
||||||
{
|
{
|
||||||
_x params ["", "_woundClassIDToAdd", "_bodyPartNToAdd", "", "_bleeding"];
|
_x params ["", "_woundClassIDToAdd", "_bodyPartNToAdd", "", "_bleeding"];
|
||||||
|
|
||||||
_bodyPartDamage set [_bodyPartNToAdd, (_bodyPartDamage select _bodyPartNToAdd) + _woundDamage];
|
_bodyPartDamage set [_bodyPartNToAdd, (_bodyPartDamage select _bodyPartNToAdd) + _woundDamage];
|
||||||
|
_bodyPartVisParams set [[1,2,3,3,4,4] select _bodyPartNToAdd, true]; // Mark the body part index needs updating
|
||||||
|
|
||||||
// The higher the nastiness likelihood the higher the change to get a painful and bloody wound
|
// The higher the nastiness likelihood the higher the change to get a painful and bloody wound
|
||||||
private _nastinessLikelihood = linearConversion [0, 20, _woundDamage, 0.5, 30, true];
|
private _nastinessLikelihood = linearConversion [0, 20, _woundDamage, 0.5, 30, true];
|
||||||
@ -107,7 +109,8 @@ private _bodyPartDamage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,
|
|||||||
_unit setVariable [QEGVAR(medical,openWounds), _openWounds, true];
|
_unit setVariable [QEGVAR(medical,openWounds), _openWounds, true];
|
||||||
_unit setVariable [QEGVAR(medical,bodyPartDamage), _bodyPartDamage, true];
|
_unit setVariable [QEGVAR(medical,bodyPartDamage), _bodyPartDamage, true];
|
||||||
|
|
||||||
[_unit, _bodyPart] call EFUNC(medical_engine,updateBodyPartVisuals);
|
_bodyPartVisParams call EFUNC(medical_engine,updateBodyPartVisuals);
|
||||||
|
|
||||||
[_unit, _painLevel] call EFUNC(medical,adjustPainLevel);
|
[_unit, _painLevel] call EFUNC(medical,adjustPainLevel);
|
||||||
[_unit, "hit", PAIN_TO_SCREAM(_painLevel)] call EFUNC(medical_engine,playInjuredSound);
|
[_unit, "hit", PAIN_TO_SCREAM(_painLevel)] call EFUNC(medical_engine,playInjuredSound);
|
||||||
|
|
||||||
|
@ -74,6 +74,7 @@ private _woundID = _unit getVariable [QGVAR(lastUniqueWoundID), 1]; // Unique w
|
|||||||
private _painLevel = 0;
|
private _painLevel = 0;
|
||||||
private _critialDamage = false;
|
private _critialDamage = false;
|
||||||
private _bodyPartDamage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]];
|
private _bodyPartDamage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]];
|
||||||
|
private _bodyPartVisParams = [_unit, false, false, false, false]; // params array for EFUNC(medical_engine,updateBodyPartVisuals);
|
||||||
private _woundsCreated = [];
|
private _woundsCreated = [];
|
||||||
{
|
{
|
||||||
_x params ["_thresholdMinDam", "_thresholdWoundCount"];
|
_x params ["_thresholdMinDam", "_thresholdWoundCount"];
|
||||||
@ -92,6 +93,7 @@ private _woundsCreated = [];
|
|||||||
private _bodyPartNToAdd = [floor random 6, _bodyPartN] select _isSelectionSpecific; // 6 == count ALL_BODY_PARTS
|
private _bodyPartNToAdd = [floor random 6, _bodyPartN] select _isSelectionSpecific; // 6 == count ALL_BODY_PARTS
|
||||||
|
|
||||||
_bodyPartDamage set [_bodyPartNToAdd, (_bodyPartDamage select _bodyPartNToAdd) + _woundDamage];
|
_bodyPartDamage set [_bodyPartNToAdd, (_bodyPartDamage select _bodyPartNToAdd) + _woundDamage];
|
||||||
|
_bodyPartVisParams set [[1,2,3,3,4,4] select _bodyPartNToAdd, true]; // Mark the body part index needs updating
|
||||||
|
|
||||||
// Create a new injury. Format [ID, classID, bodypart, percentage treated, bleeding rate]
|
// Create a new injury. Format [ID, classID, bodypart, percentage treated, bleeding rate]
|
||||||
_injury = [_woundID, _woundClassIDToAdd, _bodyPartNToAdd, 1, _injuryBleedingRate];
|
_injury = [_woundID, _woundClassIDToAdd, _bodyPartNToAdd, 1, _injuryBleedingRate];
|
||||||
@ -165,7 +167,7 @@ private _woundsCreated = [];
|
|||||||
_unit setVariable [QEGVAR(medical,openWounds), _openWounds, true];
|
_unit setVariable [QEGVAR(medical,openWounds), _openWounds, true];
|
||||||
_unit setVariable [QEGVAR(medical,bodyPartDamage), _bodyPartDamage, true];
|
_unit setVariable [QEGVAR(medical,bodyPartDamage), _bodyPartDamage, true];
|
||||||
|
|
||||||
[_unit, _bodyPart] call EFUNC(medical_engine,updateBodyPartVisuals);
|
_bodyPartVisParams call EFUNC(medical_engine,updateBodyPartVisuals);
|
||||||
|
|
||||||
[_unit, _painLevel] call EFUNC(medical,adjustPainLevel);
|
[_unit, _painLevel] call EFUNC(medical,adjustPainLevel);
|
||||||
[_unit, "hit", PAIN_TO_SCREAM(_painLevel)] call EFUNC(medical_engine,playInjuredSound);
|
[_unit, "hit", PAIN_TO_SCREAM(_painLevel)] call EFUNC(medical_engine,playInjuredSound);
|
||||||
|
@ -5,13 +5,13 @@
|
|||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit <OBJECT>
|
* 0: Unit <OBJECT>
|
||||||
* 1: Selection, can be "Head", "Body", "Arms" or "Legs" <STRING>
|
* 1: Selection, can be "Head", "Body", "Arms" or "Legs" <STRING>
|
||||||
* 2: Damage <BOOLEAN>
|
* 2: Damaged <BOOLEAN>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [player, "HEAD"] call ace_medical_engine_fnc_damageBodyPart
|
* [player, "HEAD", true] call ace_medical_engine_fnc_damageBodyPart
|
||||||
*
|
*
|
||||||
* Notes:
|
* Notes:
|
||||||
* Head: Blood visuals @ 0.45
|
* Head: Blood visuals @ 0.45
|
||||||
@ -24,6 +24,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
params ["_unit", "_selection", "_damage"];
|
params ["_unit", "_selection", "_damage"];
|
||||||
|
TRACE_3("damageBodyPart",_unit,_selection,_damage);
|
||||||
|
|
||||||
_damage = [0, DAMAGED_MIN_THRESHOLD] select _damage;
|
_damage = [0, DAMAGED_MIN_THRESHOLD] select _damage;
|
||||||
|
|
||||||
|
@ -4,52 +4,35 @@
|
|||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit <OBJECT>
|
* 0: Unit <OBJECT>
|
||||||
* 1: Body part, can be "Head", "Body", "LeftArm", "RightArm", "LeftLeg", "RightLeg" or "All" <STRING>
|
* 1: Update Head <BOOLEAN>
|
||||||
|
* 2: Update Body <BOOLEAN>
|
||||||
|
* 3: Update Arms <BOOLEAN>
|
||||||
|
* 4: Update Legs <BOOLEAN>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [player, "HEAD"] call ace_medical_engine_fnc_updateBodyPartVisuals
|
* [player, true, true, true, true] call ace_medical_engine_fnc_updateBodyPartVisuals
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
params ["_unit", "_bodyPart"];
|
params ["_unit", "_updateHead", "_updateBody", "_updateArms", "_updateLegs"];
|
||||||
|
TRACE_5("updateBodyPartVisuals",_unit,_updateHead,_updateBody,_updateArms,_updateLegs);
|
||||||
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 _bodyPartDamage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]];
|
private _bodyPartDamage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]];
|
||||||
private _damageOnAffectedBodyParts = 0;
|
|
||||||
{
|
if (_updateHead) then {
|
||||||
private _partIndex = ALL_BODY_PARTS find toLower _x;
|
[_unit, "head", (_bodyPartDamage select 0) > VISUAL_BODY_DAMAGE_THRESHOLD] call FUNC(damageBodyPart);
|
||||||
private _damageOnBodyPart = _bodyPartDamage select _partIndex;
|
};
|
||||||
// report maximum of both legs or arms
|
if (_updateBody) then {
|
||||||
_damageOnAffectedBodyParts = _damageOnAffectedBodyParts max _damageOnBodyPart;
|
[_unit, "body", (_bodyPartDamage select 1) > VISUAL_BODY_DAMAGE_THRESHOLD] call FUNC(damageBodyPart);
|
||||||
} forEach _affectedBodyParts;
|
};
|
||||||
|
if (_updateArms) then {
|
||||||
[_unit, _bodyPart, _damageOnAffectedBodyParts > VISUAL_BODY_DAMAGE_THRESHOLD] call FUNC(damageBodyPart);
|
[_unit, "arms", ((_bodyPartDamage select 2) max (_bodyPartDamage select 3)) > VISUAL_BODY_DAMAGE_THRESHOLD] call FUNC(damageBodyPart);
|
||||||
|
};
|
||||||
|
if (_updateLegs) then {
|
||||||
|
[_unit, "legs", ((_bodyPartDamage select 4) max (_bodyPartDamage select 5)) > VISUAL_BODY_DAMAGE_THRESHOLD] call FUNC(damageBodyPart);
|
||||||
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user