mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
fix various issues with handleDamage engine component
This commit is contained in:
parent
033c7c7eec
commit
4b9873d304
@ -14,7 +14,6 @@
|
|||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
params ["_unit", "_selectionName", "_damage", "_typeOfProjectile", "_typeOfDamage"];
|
params ["_unit", "_selectionName", "_damage", "_typeOfProjectile", "_typeOfDamage"];
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
#define COMPONENT_BEAUTIFIED Medical Damage
|
#define COMPONENT_BEAUTIFIED Medical Damage
|
||||||
#include "\z\ace\addons\main\script_mod.hpp"
|
#include "\z\ace\addons\main\script_mod.hpp"
|
||||||
|
|
||||||
#define DEBUG_MODE_FULL
|
//#define DEBUG_MODE_FULL
|
||||||
#define DISABLE_COMPILE_CACHE
|
//#define DISABLE_COMPILE_CACHE
|
||||||
#define CBA_DEBUG_SYNCHRONOUS
|
//#define CBA_DEBUG_SYNCHRONOUS
|
||||||
#define ENABLE_PERFORMANCE_COUNTERS
|
#define ENABLE_PERFORMANCE_COUNTERS
|
||||||
|
|
||||||
#ifdef DEBUG_ENABLED_MEDICAL_DAMAGE
|
#ifdef DEBUG_ENABLED_MEDICAL_DAMAGE
|
||||||
|
@ -12,8 +12,6 @@
|
|||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
#define DAMAGE_STRUCTURAL QGVAR(newDamage$#structural)
|
|
||||||
|
|
||||||
params ["_unit", "_selection", "_damage", "_shooter", "_ammo", "_hitPointIndex"];
|
params ["_unit", "_selection", "_damage", "_shooter", "_ammo", "_hitPointIndex"];
|
||||||
//diag_log _this;
|
//diag_log _this;
|
||||||
|
|
||||||
@ -32,50 +30,63 @@ if (_hitPointIndex < 0) then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private _newDamage = _damage - _oldDamage;
|
private _newDamage = _damage - _oldDamage;
|
||||||
_unit setVariable [format [QGVAR(newDamage$%1), _hitPoint], _newDamage];
|
_unit setVariable [format [QGVAR($%1), _hitPoint], _newDamage];
|
||||||
|
|
||||||
// Never kill the unit by the critical hit points of the engine.
|
// Never kill the unit by the critical hit points of the engine.
|
||||||
if (_hitPoint in ["#structural", "hitbody", "hithead"]) then {
|
// Because Arma now uses TOH 'depends' system, every hitpoint can cause this
|
||||||
_damage = _damage min 0.99;
|
_damage = _damage min 0.99;
|
||||||
};
|
|
||||||
|
|
||||||
// These control blood material visuals.
|
// These control blood material visuals.
|
||||||
// If damage is in dummy hitpoints, "hands" and "legs", don't change anything
|
// If damage is in dummy hitpoints, "hands" and "legs", don't change anything
|
||||||
if (_hitPoint in ["hithead", "hitbody", "hithands", "hitlegs"]) exitWith {_oldDamage};
|
if (_hitPoint in ["hithead", "hitbody", "hithands", "hitlegs"]) exitWith {
|
||||||
|
TRACE_2("hd exited (hardcoded)",_hitPoint,_oldDamage);
|
||||||
|
_oldDamage
|
||||||
|
};
|
||||||
|
|
||||||
// Add injury
|
// Add injury
|
||||||
if (_hitPoint isEqualTo "ace_hdbracket") exitWith {
|
if (_hitPoint isEqualTo "ace_hdbracket") exitWith {
|
||||||
|
private _damageStructural = _unit getVariable [QGVAR($#structural), 0];
|
||||||
|
|
||||||
// --- Head
|
// --- Head
|
||||||
private _damageFace = _unit getVariable [QGVAR(newDamage$HitFace), 0];
|
private _damageFace = _unit getVariable [QGVAR($HitFace), 0];
|
||||||
private _damageNeck = _unit getVariable [QGVAR(newDamage$HitNeck), 0];
|
private _damageNeck = _unit getVariable [QGVAR($HitNeck), 0];
|
||||||
private _damageHead = (_unit getVariable [QGVAR(newDamage$HitHead), 0]) max _damageFace max _damageNeck;
|
private _damageHead = (_unit getVariable [QGVAR($HitHead), 0]) max _damageFace max _damageNeck;
|
||||||
|
|
||||||
// --- Body
|
// --- Body
|
||||||
private _damageStructural = _unit getVariable [DAMAGE_STRUCTURAL, 0];
|
private _damagePelvis = _unit getVariable [QGVAR($HitPelvis), 0];
|
||||||
private _damagePelvis = _unit getVariable [QGVAR(newDamage$HitPelvis), 0];
|
private _damageAbdomen = _unit getVariable [QGVAR($HitAbdomen), 0];
|
||||||
private _damageAbdomen = _unit getVariable [QGVAR(newDamage$HitAbdomen), 0];
|
private _damageDiaphragm = _unit getVariable [QGVAR($HitDiaphragm), 0];
|
||||||
private _damageDiaphragm = _unit getVariable [QGVAR(newDamage$HitDiaphragm), 0];
|
private _damageChest = _unit getVariable [QGVAR($HitChest), 0];
|
||||||
private _damageChest = _unit getVariable [QGVAR(newDamage$HitChest), 0];
|
private _damageBody = (_unit getVariable [QGVAR($HitBody), 0]) max _damagePelvis max _damageAbdomen max _damageDiaphragm max _damageChest;
|
||||||
private _damageBody = (_unit getVariable [QGVAR(newDamage$HitBody), 0]) max _damagePelvis max _damageAbdomen max _damageDiaphragm max _damageChest max _damageStructural;
|
|
||||||
|
|
||||||
// --- Arms and Legs
|
// --- Arms and Legs
|
||||||
private _damageLeftArm = _unit getVariable [QGVAR(newDamage$HitLeftArm), 0];
|
private _damageLeftArm = _unit getVariable [QGVAR($HitLeftArm), 0];
|
||||||
private _damageRightArm = _unit getVariable [QGVAR(newDamage$HitRightArm), 0];
|
private _damageRightArm = _unit getVariable [QGVAR($HitRightArm), 0];
|
||||||
private _damageLeftLeg = _unit getVariable [QGVAR(newDamage$HitLeftLeg), 0];
|
private _damageLeftLeg = _unit getVariable [QGVAR($HitLeftLeg), 0];
|
||||||
private _damageRightLeg = _unit getVariable [QGVAR(newDamage$HitRightLeg), 0];
|
private _damageRightLeg = _unit getVariable [QGVAR($HitRightLeg), 0];
|
||||||
|
|
||||||
// Find hit point that received the maxium damage.
|
// Find hit point that received the maxium damage.
|
||||||
|
// second param is a priority. should multiple hitpoints receive the same
|
||||||
|
// amount of damage (e.g. max which is 4), we don't want them to be sorted
|
||||||
|
// alphabetically (which would mean that RightLeg is always chosen)
|
||||||
private _allDamages = [
|
private _allDamages = [
|
||||||
[_damageHead, "Head"],
|
[_damageHead, PRIORITY_HEAD, "Head"],
|
||||||
[_damageBody, "Body"],
|
[_damageBody, PRIORITY_BODY, "Body"],
|
||||||
[_damageLeftArm, "LeftArm"],
|
[_damageLeftArm, PRIORITY_LEFT_ARM, "LeftArm"],
|
||||||
[_damageRightArm, "RightArm"],
|
[_damageRightArm, PRIORITY_RIGHT_ARM, "RightArm"],
|
||||||
[_damageLeftLeg, "LeftLeg"],
|
[_damageLeftLeg, PRIORITY_LEFT_LEG, "LeftLeg"],
|
||||||
[_damageRightLeg, "RightLeg"]
|
[_damageRightLeg, PRIORITY_RIGHT_LEG, "RightLeg"]
|
||||||
];
|
];
|
||||||
|
TRACE_2("incoming",_allDamages,_damageStructural);
|
||||||
|
|
||||||
_allDamages sort false;
|
_allDamages sort false;
|
||||||
(_allDamages select 0) params ["_receivedDamage", "_woundedHitPoint"];
|
(_allDamages select 0) params ["_receivedDamage", "", "_woundedHitPoint"];
|
||||||
|
|
||||||
|
if (_receivedDamage == 0) then {
|
||||||
|
_receivedDamage = _damageStructural;
|
||||||
|
_woundedHitPoint = "Body";
|
||||||
|
};
|
||||||
|
TRACE_2("received",_receivedDamage,_woundedHitPoint);
|
||||||
|
|
||||||
// Check for falling damage.
|
// Check for falling damage.
|
||||||
if (_ammo isEqualTo "") then {
|
if (_ammo isEqualTo "") then {
|
||||||
@ -104,4 +115,5 @@ if (_hitPoint isEqualTo "#structural" && {getOxygenRemaining _unit <= 0.5} && {_
|
|||||||
[QGVAR(woundReceived), [_unit, "Body", _newDamage, _unit, "#drowning"]] call CBA_fnc_localEvent;
|
[QGVAR(woundReceived), [_unit, "Body", _newDamage, _unit, "#drowning"]] call CBA_fnc_localEvent;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
TRACE_2("hd exited",_hitPoint,_damage);
|
||||||
_damage
|
_damage
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
#include "\z\ace\addons\main\script_mod.hpp"
|
#include "\z\ace\addons\main\script_mod.hpp"
|
||||||
|
|
||||||
#define DEBUG_MODE_FULL
|
#define DEBUG_MODE_FULL
|
||||||
// #define DISABLE_COMPILE_CACHE
|
#define DISABLE_COMPILE_CACHE
|
||||||
// #define CBA_DEBUG_SYNCHRONOUS
|
#define CBA_DEBUG_SYNCHRONOUS
|
||||||
// #define ENABLE_PERFORMANCE_COUNTERS
|
//#define ENABLE_PERFORMANCE_COUNTERS
|
||||||
|
|
||||||
#ifdef DEBUG_ENABLED_MEDICAL_ENGINE
|
#ifdef DEBUG_ENABLED_MEDICAL_ENGINE
|
||||||
#define DEBUG_MODE_FULL
|
#define DEBUG_MODE_FULL
|
||||||
@ -17,12 +17,6 @@
|
|||||||
|
|
||||||
#include "\z\ace\addons\main\script_macros.hpp"
|
#include "\z\ace\addons\main\script_macros.hpp"
|
||||||
|
|
||||||
#define DISABLE_VANILLA_SCREAMS
|
|
||||||
#define DISABLE_VANILLA_MOANS
|
|
||||||
#define DISABLE_VANILLA_HEARTBEAT
|
|
||||||
#define DISABLE_VANILLA_BLOOD_TEXTURES
|
|
||||||
#define DISABLE_VANILLA_DAMAGE_EFFECTS
|
|
||||||
|
|
||||||
#include "script_macros_medical.hpp"
|
#include "script_macros_medical.hpp"
|
||||||
|
|
||||||
#define EMPTY_SOUND {"A3\Sounds_F\dummysound.wss",1,1}
|
#define EMPTY_SOUND {"A3\Sounds_F\dummysound.wss",1,1}
|
||||||
@ -35,3 +29,16 @@
|
|||||||
}, {\
|
}, {\
|
||||||
diag_log format ["Preload done for ""%1""",_this];\
|
diag_log format ["Preload done for ""%1""",_this];\
|
||||||
}, class] call CBA_fnc_waitUntilAndExecute
|
}, class] call CBA_fnc_waitUntilAndExecute
|
||||||
|
|
||||||
|
#define DISABLE_VANILLA_SCREAMS
|
||||||
|
#define DISABLE_VANILLA_MOANS
|
||||||
|
#define DISABLE_VANILLA_HEARTBEAT
|
||||||
|
#define DISABLE_VANILLA_BLOOD_TEXTURES
|
||||||
|
#define DISABLE_VANILLA_DAMAGE_EFFECTS
|
||||||
|
|
||||||
|
#define PRIORITY_HEAD 3
|
||||||
|
#define PRIORITY_BODY 4
|
||||||
|
#define PRIORITY_LEFT_ARM (1 + random 1)
|
||||||
|
#define PRIORITY_RIGHT_ARM (1 + random 1)
|
||||||
|
#define PRIORITY_LEFT_LEG (1 + random 1)
|
||||||
|
#define PRIORITY_RIGHT_LEG (1 + random 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user