Skip to content
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 force walk option to fracture setting #7852

Merged
merged 3 commits into from
Aug 23, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion addons/medical/dev/watchVariable.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion addons/medical/initSettings.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion addons/medical/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -183,6 +183,9 @@
<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>
mharis001 marked this conversation as resolved.
Show resolved Hide resolved
</Key>
<Key ID="STR_ACE_Medical_FractureChance_DisplayName">
<English>Fracture Chance</English>
<French>Chance de fracture</French>
Expand Down
15 changes: 7 additions & 8 deletions addons/medical_engine/functions/fnc_updateDamageEffects.sqf
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -33,12 +32,12 @@ 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);
};
// Block sprint / force walking based on fracture setting and leg splint status
private _hasLegSplint = (_fractures select 4) == -1 || {(_fractures select 5) == -1};
[_unit, "blockSprint", QEGVAR(medical,fracture), _hasLegSplint && {EGVAR(medical,fractures) == 2}] call EFUNC(common,statusEffect_set);
[_unit, "forceWalk", QEGVAR(medical,fracture), _hasLegSplint && {EGVAR(medical,fractures) == 3}] call EFUNC(common,statusEffect_set);

if (EGVAR(medical,fractures) in [2, 3]) then { // the limp with a splint will still cause effects
PabstMirror marked this conversation as resolved.
Show resolved Hide resolved
if ((_fractures select 2) == -1) then { _aimFracture = _aimFracture + 2; };
if ((_fractures select 3) == -1) then { _aimFracture = _aimFracture + 2; };
};
Expand Down
2 changes: 1 addition & 1 deletion addons/medical_gui/functions/fnc_updateBodyImage.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions addons/medical_gui/functions/fnc_updateInjuryList.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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]];
};
};
};
Expand Down