Medical - Add force walk option to fracture setting (#7852)

* Medical - Add force walk option to fracture setting

* Add French translation

Co-authored-by: Elgin675 <elgin675@hotmail.com>

* Reduce calls to statusEffect_set (#7865)

* Reduce calls to statusEffect_set

* statusEffect_addType fracture to forcewalk

Co-authored-by: Elgin675 <elgin675@hotmail.com>
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
This commit is contained in:
mharis001 2020-08-22 20:37:15 -04:00 committed by GitHub
parent dd2babb833
commit 0f08a18f89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 14 deletions

View File

@ -19,7 +19,7 @@
//Status Effect EHs:
[QGVAR(setStatusEffect), {_this call FUNC(statusEffect_set)}] call CBA_fnc_addEventHandler;
["forceWalk", false, ["ace_advanced_fatigue", "ACE_SwitchUnits", "ACE_Attach", "ACE_dragging", "ACE_Explosives", "ACE_Ladder", "ACE_Sandbag", "ACE_refuel", "ACE_rearm", "ACE_Trenches"]] call FUNC(statusEffect_addType);
["forceWalk", false, ["ace_advanced_fatigue", "ACE_SwitchUnits", "ACE_Attach", "ACE_dragging", "ACE_Explosives", "ACE_Ladder", "ACE_Sandbag", "ACE_refuel", "ACE_rearm", "ACE_Trenches", "ace_medical_fracture"]] call FUNC(statusEffect_addType);
["blockSprint", false, ["ace_advanced_fatigue", "ace_medical_fracture"]] call FUNC(statusEffect_addType);
["setCaptive", true, [QEGVAR(captives,Handcuffed), QEGVAR(captives,Surrendered)]] call FUNC(statusEffect_addType);
["blockDamage", false, ["fixCollision", "ACE_cargo"]] call FUNC(statusEffect_addType);

View File

@ -69,7 +69,8 @@ GVAR(dev_watchVariableRunning) = true;
private _fractures = GET_FRACTURES(_unit);
private _canSprint = if (isSprintAllowed _unit) then {""} else {"[<t color ='#FFCC22'>Sprint Blocked</t>]"};
_return pushBack format ["Fractures: %1 %2", _fractures, _canSprint];
private _forceWalk = if (isForcedWalk _unit) then {"[<t color ='#FF9922'>Forced Walking</t>]"} else {""};
_return pushBack format ["Fractures: %1 %2%3", _fractures, _canSprint, _forceWalk];
// Tourniquets:

View File

@ -14,7 +14,7 @@
"LIST",
[LSTRING(Fractures_DisplayName), LSTRING(Fractures_Description)],
LSTRING(Category),
[[0, 1, 2], [ELSTRING(common,Disabled), LSTRING(Fractures_SplintHealsFully), LSTRING(Fractures_SplintHasEffects)], 1],
[[0, 1, 2, 3], [ELSTRING(common,Disabled), LSTRING(Fractures_SplintHealsFully), LSTRING(Fractures_SplintHealsNoSprint), LSTRING(Fractures_SplintHealsNoJog)], 1],
true,
{},
true

View File

@ -169,7 +169,7 @@
<Spanish>Férulas sanan completamente las fracturas</Spanish>
<German>Schienen heilen Knochenbrüche vollständig</German>
</Key>
<Key ID="STR_ACE_Medical_Fractures_SplintHasEffects">
<Key ID="STR_ACE_Medical_Fractures_SplintHealsNoSprint">
<English>Splints Heal, but Cannot Sprint</English>
<Russian>Шины вылечивают, но не дают бегать</Russian>
<Japanese>添え木で治癒可能、走れないように</Japanese>
@ -183,6 +183,10 @@
<Spanish>Las férulas sanan, pero no pueden correr</Spanish>
<German>Schienen heilen, aber ermöglichen kein Sprinten</German>
</Key>
<Key ID="STR_ACE_Medical_Fractures_SplintHealsNoJog">
<English>Splints Heal, but Cannot Jog</English>
<French>Les attelles guérissent les fractures, mais empêchent de courir</French>
</Key>
<Key ID="STR_ACE_Medical_FractureChance_DisplayName">
<English>Fracture Chance</English>
<French>Chance de fracture</French>

View File

@ -1,11 +1,10 @@
#include "script_component.hpp"
/*
* Author: commy2, PabstMirror
* Updates damage effects for limping and fractures
* Updates damage effects for limping and fractures.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Limping (optional, default: true) <BOOLEAN>
*
* Return Value:
* None
@ -33,12 +32,15 @@ if (EGVAR(medical,fractures) > 0) then {
if ((_fractures select 2) == 1) then { _aimFracture = _aimFracture + 4; };
if ((_fractures select 3) == 1) then { _aimFracture = _aimFracture + 4; };
if (EGVAR(medical,fractures) == 2) then { // the limp with a splint will still cause effects
private _isSprintBlocked = ((_fractures select 4) == -1) || {(_fractures select 5) == -1}; // block sprinting if we have a leg splint on
if (_isSprintBlocked || {!isSprintAllowed _unit}) then { // only update status effect if we need to
TRACE_1("updating status effect",_isSprintBlocked);
[_unit, "blockSprint", QEGVAR(medical,fracture), _isSprintBlocked] call EFUNC(common,statusEffect_set);
if (EGVAR(medical,fractures) in [2, 3]) then { // the limp with a splint will still cause effects
// Block sprint / force walking based on fracture setting and leg splint status
private _hasLegSplint = (_fractures select 4) == -1 || {(_fractures select 5) == -1};
if (EGVAR(medical,fractures) == 2) then {
[_unit, "blockSprint", QEGVAR(medical,fracture), _hasLegSplint] call EFUNC(common,statusEffect_set);
} else {
[_unit, "forceWalk", QEGVAR(medical,fracture), _hasLegSplint] call EFUNC(common,statusEffect_set);
};
if ((_fractures select 2) == -1) then { _aimFracture = _aimFracture + 2; };
if ((_fractures select 3) == -1) then { _aimFracture = _aimFracture + 2; };
};

View File

@ -51,7 +51,7 @@ private _bodyPartBloodLoss = [0, 0, 0, 0, 0, 0];
_ctrlBone ctrlSetTextColor [1, 0, 0, 1];
};
case -1: {
if (EGVAR(medical,fractures) == 2) then {
if (EGVAR(medical,fractures) in [2, 3]) then {
_ctrlBone ctrlShow true;
_ctrlBone ctrlSetTextColor [0, 0, 1, 1];
} else {

View File

@ -65,8 +65,8 @@ switch (GET_FRACTURES(_target) select _selectionN) do {
_entries pushBack [localize LSTRING(Status_Fractured), [1, 0, 0, 1]];
};
case -1: {
if (EGVAR(medical,fractures) == 2) then { // Ignore if the splint has no effect
_entries pushBack [localize LSTRING(Status_SplintApplied), [1, 1, 1, 1]];
if (EGVAR(medical,fractures) in [2, 3]) then { // Ignore if the splint has no effect
_entries pushBack [localize LSTRING(Status_SplintApplied), [0.2, 0.2, 1, 1]];
};
};
};