mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Medical - Add ability for unit specific damage threshold (#7455)
This commit is contained in:
parent
f0f90ec866
commit
142fc1e3de
49
addons/medical_damage/CfgEden.hpp
Normal file
49
addons/medical_damage/CfgEden.hpp
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
class Cfg3DEN {
|
||||||
|
class Attributes {
|
||||||
|
class Slider;
|
||||||
|
class GVAR(slider): Slider {
|
||||||
|
attributeLoad = "params [""_ctrlGroup""];\
|
||||||
|
private _slider = _ctrlGroup controlsGroupCtrl 100;\
|
||||||
|
private _edit = _ctrlGroup controlsGroupCtrl 101;\
|
||||||
|
_slider sliderSetPosition _value;\
|
||||||
|
_edit ctrlSetText (if (_value < 0.1) then {localize ""str_disp_default""} else {[_value, 1, 1] call CBA_fnc_formatNumber});";
|
||||||
|
attributeSave = "params [""_ctrlGroup""];\
|
||||||
|
sliderPosition (_ctrlGroup controlsGroupCtrl 100); ";
|
||||||
|
onLoad = "params [""_ctrlGroup""];\
|
||||||
|
private _slider = _ctrlGroup controlsGroupCtrl 100;\
|
||||||
|
private _edit = _ctrlGroup controlsGroupCtrl 101;\
|
||||||
|
_slider sliderSetRange [0, 10];\
|
||||||
|
_slider ctrlAddEventHandler [""SliderPosChanged"", {\
|
||||||
|
params [""_slider""];\
|
||||||
|
private _edit = (ctrlParentControlsGroup _slider) controlsGroupCtrl 101;\
|
||||||
|
private _value = sliderPosition _slider;\
|
||||||
|
_edit ctrlSetText (if (_value < 0.1) then {localize ""str_disp_default""} else {[_value, 1, 1] call CBA_fnc_formatNumber});\
|
||||||
|
}];\
|
||||||
|
_edit ctrlAddEventHandler [""KillFocus"", {\
|
||||||
|
params [""_edit""];\
|
||||||
|
private _slider = (ctrlParentControlsGroup _edit) controlsGroupCtrl 100;\
|
||||||
|
private _value = ((parseNumber ctrlText _edit) min 10) max 0;\
|
||||||
|
_slider sliderSetPosition _value;\
|
||||||
|
_edit ctrlSetText (if (_value < 0.1) then { localize ""str_disp_default"" } else {[_value, 1, 1] call CBA_fnc_formatNumber});\
|
||||||
|
}];";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
class Object {
|
||||||
|
class AttributeCategories {
|
||||||
|
class ace_attributes {
|
||||||
|
class Attributes {
|
||||||
|
class GVAR(threshold) {
|
||||||
|
property = QUOTE(threshold);
|
||||||
|
control = QGVAR(slider);
|
||||||
|
displayName = CSTRING(Eden_threshold_DisplayName);
|
||||||
|
tooltip = CSTRING(Eden_threshold_Description);
|
||||||
|
expression = QUOTE(if (_value >= 0.1) then {_this setVariable [ARR_3(QQEGVAR(medical,damageThreshold),_value,true)]});
|
||||||
|
typeName = "NUMBER";
|
||||||
|
condition = "objectControllable";
|
||||||
|
defaultValue = 0;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
@ -18,6 +18,7 @@ class CfgPatches {
|
|||||||
#include "ACE_Medical_Injuries.hpp"
|
#include "ACE_Medical_Injuries.hpp"
|
||||||
#include "CfgEventHandlers.hpp"
|
#include "CfgEventHandlers.hpp"
|
||||||
#include "CfgAmmo.hpp"
|
#include "CfgAmmo.hpp"
|
||||||
|
#include "CfgEden.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
class ACE_Extensions {
|
class ACE_Extensions {
|
||||||
|
@ -39,7 +39,7 @@ if (EGVAR(medical,fatalDamageSource) in [0, 2]) then {
|
|||||||
};
|
};
|
||||||
if (EGVAR(medical,fatalDamageSource) in [1, 2]) then {
|
if (EGVAR(medical,fatalDamageSource) in [1, 2]) then {
|
||||||
// Sum of trauma to critical areas can be fatal (e.g. many small hits)
|
// Sum of trauma to critical areas can be fatal (e.g. many small hits)
|
||||||
private _damageThreshold = if (isPlayer _unit) then { EGVAR(medical,playerDamageThreshold) } else { EGVAR(medical,AIDamageThreshold) };
|
private _damageThreshold = GET_DAMAGE_THRESHOLD(_unit);
|
||||||
private _headThreshhold = 1.25 * _damageThreshold;
|
private _headThreshhold = 1.25 * _damageThreshold;
|
||||||
private _bodyThreshhold = 1.5 * _damageThreshold;
|
private _bodyThreshhold = 1.5 * _damageThreshold;
|
||||||
|
|
||||||
|
@ -30,10 +30,7 @@ _bodyPartDamage params ["_headDamage", "_bodyDamage", "_leftArmDamage", "_rightA
|
|||||||
};
|
};
|
||||||
} forEach GET_OPEN_WOUNDS(_unit);
|
} forEach GET_OPEN_WOUNDS(_unit);
|
||||||
|
|
||||||
private _damageThreshold = [
|
private _damageThreshold = GET_DAMAGE_THRESHOLD(_unit);
|
||||||
EGVAR(medical,AIDamageThreshold),
|
|
||||||
EGVAR(medical,playerDamageThreshold)
|
|
||||||
] select (isPlayer _unit);
|
|
||||||
|
|
||||||
if ((_headDamage > _damageThreshold / 2) || {_bodyDamage > _damageThreshold} || {(_painLevel >= PAIN_UNCONSCIOUS) && {random 1 < 0.1}}) then {
|
if ((_headDamage > _damageThreshold / 2) || {_bodyDamage > _damageThreshold} || {(_painLevel >= PAIN_UNCONSCIOUS) && {random 1 < 0.1}}) then {
|
||||||
[QEGVAR(medical,CriticalInjury), _unit] call CBA_fnc_localEvent;
|
[QEGVAR(medical,CriticalInjury), _unit] call CBA_fnc_localEvent;
|
||||||
|
@ -631,5 +631,13 @@
|
|||||||
<Turkish>Ikisinden biri</Turkish>
|
<Turkish>Ikisinden biri</Turkish>
|
||||||
<German>Beide</German>
|
<German>Beide</German>
|
||||||
</Key>
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Medical_Damage_Eden_threshold_DisplayName">
|
||||||
|
<English>Unit Damage Threshold</English>
|
||||||
|
<German>Schwelle für Schaden</German>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Medical_Damage_Eden_threshold_Description">
|
||||||
|
<English>Sets the amount of damage a unit can receive before going unconscious. (0 for mission default)</English>
|
||||||
|
<German>Legt die Höhe des Schadens fest, den eine Einheit erhalten kann, bevor diese ohnmächtig wird. (0 für Misionsnormalwert)</German>
|
||||||
|
</Key>
|
||||||
</Package>
|
</Package>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -179,6 +179,7 @@
|
|||||||
#define GET_OPEN_WOUNDS(unit) (unit getVariable [VAR_OPEN_WOUNDS, []])
|
#define GET_OPEN_WOUNDS(unit) (unit getVariable [VAR_OPEN_WOUNDS, []])
|
||||||
#define GET_BANDAGED_WOUNDS(unit) (unit getVariable [VAR_BANDAGED_WOUNDS, []])
|
#define GET_BANDAGED_WOUNDS(unit) (unit getVariable [VAR_BANDAGED_WOUNDS, []])
|
||||||
#define GET_STITCHED_WOUNDS(unit) (unit getVariable [VAR_STITCHED_WOUNDS, []])
|
#define GET_STITCHED_WOUNDS(unit) (unit getVariable [VAR_STITCHED_WOUNDS, []])
|
||||||
|
#define GET_DAMAGE_THRESHOLD(unit) (unit getVariable [QEGVAR(medical,damageThreshold), [EGVAR(medical,AIDamageThreshold),EGVAR(medical,playerDamageThreshold)] select (isPlayer unit)])
|
||||||
|
|
||||||
// The following function calls are defined here just for consistency
|
// The following function calls are defined here just for consistency
|
||||||
#define GET_BLOOD_LOSS(unit) ([unit] call EFUNC(medical_status,getBloodLoss))
|
#define GET_BLOOD_LOSS(unit) ([unit] call EFUNC(medical_status,getBloodLoss))
|
||||||
|
Loading…
Reference in New Issue
Block a user