-
Notifications
You must be signed in to change notification settings - Fork 740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Medical - Add Additional Hitpoints to the medical system #10482
base: master
Are you sure you want to change the base?
Changes from 22 commits
a38767b
4f03f3c
2d0f1a9
71daaa7
434f709
9243175
c6effc9
305654d
822019f
97c9fd4
f4f3905
7c78535
2aeda77
0737077
799c794
b6b1225
5b8e144
6fbea5a
fd4c4cd
9961493
1810f08
7270e8d
ac42769
4b119bf
263fbca
ef08054
3c906ce
09db653
2b93099
02e526b
7fdca42
795d8f3
ac7b61e
33f7686
c89b8b3
d5e6286
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,14 +35,26 @@ private _createdWounds = false; | |
private _updateDamageEffects = false; | ||
private _painLevel = 0; | ||
private _criticalDamage = false; | ||
private _bodyPartDamage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]]; | ||
private _bodyPartDamage = GET_BODYPART_DAMAGE(unit); | ||
private _bodyPartVisParams = [_unit, false, false, false, false]; // params array for EFUNC(medical_engine,updateBodyPartVisuals); | ||
|
||
// process wounds separately for each body part hit | ||
{ // forEach _allDamages | ||
_x params ["_damage", "_bodyPart"]; | ||
_bodyPart = toLowerANSI _bodyPart; | ||
|
||
if (_bodyPart == "head") then { | ||
private _isNeck = (random 1) < 0.1; // 15% chance for neck damage | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems arbitrary. Can this not be handled via medical_engine? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, as the hitbox for neck damage is unbelievably small, to the point its impossible to hit |
||
_bodyPart = ["head", "neck"] select (_isNeck); | ||
}; | ||
if (_bodyPart in ["leftarm", "rightarm", "leftleg", "rightleg"]) then { | ||
private _isUpper = (random 1) < 0.5; | ||
switch (_bodyPart) do { | ||
case "leftarm": { _bodyPart = ["leftarm", "upperleftarm"] select (_isUpper);}; | ||
case "rightarm": { _bodyPart = ["rightarm", "upperrightarm"] select (_isUpper);}; | ||
case "leftleg": { _bodyPart = ["leftleg", "upperleftleg"] select (_isUpper);}; | ||
case "rightleg": { _bodyPart = ["rightleg", "upperrightleg"] select (_isUpper); }; | ||
}; | ||
}; | ||
// silently ignore structural damage | ||
if (_bodyPart == "#structural") then {continue}; | ||
|
||
|
@@ -90,7 +102,7 @@ private _bodyPartVisParams = [_unit, false, false, false, false]; // params arra | |
private _woundDamage = _dmgPerWound * _dmgMultiplier * random [0.9, 1, 1.1]; | ||
|
||
_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 | ||
_bodyPartVisParams set [[1,1,1,2,2,2,3,3,3,4,4,4] select _bodyPartNToAdd, true]; // Mark the body part index needs updating | ||
|
||
// Anything above this value is guaranteed worst wound possible | ||
private _worstDamage = 2; | ||
|
@@ -116,7 +128,7 @@ private _bodyPartVisParams = [_unit, false, false, false, false]; // params arra | |
// Create a new injury. Format [0:classComplex, 1:amountOf, 2:bleedingRate, 3:woundDamage] | ||
private _injury = [_classComplex, 1, _bleeding, _woundDamage]; | ||
|
||
if (_bodyPart isEqualTo "head" || {_bodyPart isEqualTo "body" && {_woundDamage > PENETRATION_THRESHOLD}}) then { | ||
if (_bodyPart in ["head", "body", "neck", "head"] && {_woundDamage > PENETRATION_THRESHOLD}) then { | ||
Cplhardcore marked this conversation as resolved.
Show resolved
Hide resolved
|
||
_criticalDamage = true; | ||
}; | ||
if ([_unit, _bodyPartNToAdd, _bodyPartDamage, _woundDamage] call FUNC(determineIfFatal)) then { | ||
|
@@ -134,7 +146,7 @@ private _bodyPartVisParams = [_unit, false, false, false, false]; // params arra | |
case ( | ||
_causeFracture | ||
&& {EGVAR(medical,fractures) > 0} | ||
&& {_bodyPartNToAdd > 1} | ||
&& {_bodyPartNToAdd > 3} | ||
&& {_woundDamage > FRACTURE_DAMAGE_THRESHOLD} | ||
&& {random 1 < (_fractureMultiplier * EGVAR(medical,fractureChance))} | ||
): { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,17 +22,17 @@ | |
params ["_unit", "_updateHead", "_updateBody", "_updateArms", "_updateLegs"]; | ||
TRACE_5("updateBodyPartVisuals",_unit,_updateHead,_updateBody,_updateArms,_updateLegs); | ||
|
||
private _bodyPartDamage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]]; | ||
private _bodyPartDamage = GET_BODYPART_DAMAGE(unit); | ||
|
||
if (_updateHead) then { | ||
[_unit, "head", (_bodyPartDamage select 0) > VISUAL_BODY_DAMAGE_THRESHOLD] call FUNC(damageBodyPart); | ||
[_unit, "head", ((_bodyPartDamage select 0) max (_bodyPartDamage select 1)) > VISUAL_BODY_DAMAGE_THRESHOLD] call FUNC(damageBodyPart); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will break KAM FYI. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh i am aware, ill have to do my own refactor of KAM with these changes if they do get merged |
||
}; | ||
if (_updateBody) then { | ||
[_unit, "body", (_bodyPartDamage select 1) > VISUAL_BODY_DAMAGE_THRESHOLD] call FUNC(damageBodyPart); | ||
[_unit, "body", ((_bodyPartDamage select 2) max (_bodyPartDamage select 3)) > VISUAL_BODY_DAMAGE_THRESHOLD] call FUNC(damageBodyPart); | ||
}; | ||
if (_updateArms) then { | ||
[_unit, "arms", ((_bodyPartDamage select 2) max (_bodyPartDamage select 3)) > VISUAL_BODY_DAMAGE_THRESHOLD] call FUNC(damageBodyPart); | ||
[_unit, "arms", (((_bodyPartDamage select 4) max (_bodyPartDamage select 5)) max ((_bodyPartDamage select 6) max (_bodyPartDamage select 7))) > 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); | ||
[_unit, "legs", (((_bodyPartDamage select 8) max (_bodyPartDamage select 9)) max ((_bodyPartDamage select 10) max (_bodyPartDamage select 11))) > VISUAL_BODY_DAMAGE_THRESHOLD] call FUNC(damageBodyPart); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function needs handling of previous format of bodyPartDamage array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For BWC? or is there something else I am oblivious to