-
Notifications
You must be signed in to change notification settings - Fork 749
Advanced Fatigue - Various improvements #5723
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
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
70c8ab1
Advanced Fatique - Various improvements
ulteq ea29171
Remove regular cloth weight from the carried load calculation.
ulteq 82000ce
Split 'wattsPerATP' calculation into two
ulteq 00305eb
Oxygen tweak
ulteq 18661eb
Experimental movement speed limiter
ulteq File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| /* | ||
| * Author: BaerMitUmlaut, Ruthberg | ||
| * Calculates the current maximum movement speed for a unit. | ||
| * Calculation is done according to the Pandolf/Wojtowicz formulas. | ||
| * | ||
| * Arguments: | ||
| * 0: Unit <OBJECT> | ||
| * 1: Power <NUMBER> | ||
| * 2: Forward Angle <NUMBER> | ||
| * 3: Side Angle <NUMBER> | ||
| * | ||
| * Return Value: | ||
| * Speed <NUMBER> | ||
| * | ||
| * Example: | ||
| * [player, 840, 0, 0] call ace_advanced_fatigue_fnc_getMaximumSpeed | ||
| * | ||
| * Public: No | ||
| */ | ||
| #include "script_component.hpp" | ||
| params ["_unit", "_power", "_fwdAngle", "_sideAngle"]; | ||
|
|
||
| private _gearMass = 0 max (((_unit getVariable [QEGVAR(movement,totalLoad), loadAbs _unit]) / 22.046 - 3.5) * GVAR(loadFactor)); | ||
| private _terrainGradient = abs(_fwdAngle); | ||
| private _terrainFactor = 1; | ||
|
|
||
| private _duty = GVAR(animDuty); | ||
| { | ||
| if (_x isEqualType 0) then { | ||
| _duty = _duty * _x; | ||
| } else { | ||
| _duty = _duty * (_unit call _x); | ||
| }; | ||
| } forEach (GVAR(dutyList) select 1); | ||
|
|
||
| if (!GVAR(isSwimming)) then { | ||
| if (_fwdAngle < 0) then { | ||
| _terrainGradient = 0.15 * _terrainGradient; | ||
| }; | ||
| if ((getPosATL _unit) select 2 < 0.01) then { | ||
| private _sideGradient = abs(_sideAngle / 45) min 1; | ||
| _terrainFactor = 1 + _sideGradient ^ 4; | ||
| }; | ||
| }; | ||
|
|
||
| private _fnc_getRunningSpeed = { | ||
| params ["_power", "_gearMass", "_terrainFactor", "_terrainGradient", "_duty"]; | ||
| private _p = _power / 0.23; | ||
| _p = _p - 2.10 * SIM_BODYMASS; | ||
| _p = _p - 4 * (SIM_BODYMASS + _gearMass) * (_gearMass / SIM_BODYMASS) ^ 2; | ||
| _p = _p / (_terrainFactor * (SIM_BODYMASS + _gearMass)); | ||
| (1 / 30 * (-11 * _terrainGradient + sqrt(121 * (_terrainGradient ^ 2) + 1000 * _p))) | ||
| }; | ||
|
|
||
| private _fnc_getWalkingSpeed = { | ||
| params ["_power", "_gearMass", "_terrainFactor", "_terrainGradient", "_duty"]; | ||
| private _p = _power / 0.23; | ||
| _p = _p - 1.05 * SIM_BODYMASS; | ||
| _p = _p - 2 * (SIM_BODYMASS + _gearMass) * (_gearMass / SIM_BODYMASS) ^ 2; | ||
| _p = _p / (_terrainFactor * (SIM_BODYMASS + _gearMass)); | ||
| (1 / 115 * (-33 * _terrainGradient + sqrt(1089 * (_terrainGradient ^ 2) + 11500 * _p))) | ||
| }; | ||
|
|
||
| /* | ||
| private _fnc_getRunningSpeed = { | ||
| params ["_power", "_gearMass", "_terrainFactor", "_terrainGradient", "_duty"]; | ||
| private _numerator = 3.6 * - (_power / (0.23 * _duty)); | ||
| _numerator = _numerator - 2.1 * SIM_BODYMASS; | ||
| _numerator = _numerator - 4 * (_gearMass + SIM_BODYMASS) * (_gearMass / SIM_BODYMASS) ^ 2; | ||
| private _denominator = _terrainFactor * (_gearMass + SIM_BODYMASS); | ||
| private _radicand = ((0.66 * _terrainGradient) ^ 2) - _numerator / _denominator; | ||
| private _v = -0.66 * _terrainGradient + sqrt(_radicand); | ||
| _v / 1.8 | ||
| }; | ||
|
|
||
| private _fnc_getWalkingSpeed = { | ||
| params ["_power", "_gearMass", "_terrainFactor", "_terrainGradient", "_duty"]; | ||
| private _numerator = 4.6 * - (_power / (0.23 * _duty)); | ||
| _numerator = _numerator - 1.05 * SIM_BODYMASS; | ||
| _numerator = _numerator - 2 * (_gearMass + SIM_BODYMASS) * (_gearMass / SIM_BODYMASS) ^ 2; | ||
| private _denominator = _terrainFactor * (_gearMass + SIM_BODYMASS); | ||
| private _radicand = ((0.66 * _terrainGradient) ^ 2) - _numerator / _denominator; | ||
| private _v = -0.66 * _terrainGradient + sqrt(_radicand); | ||
| _v / 2.3 | ||
| }; | ||
| */ | ||
|
|
||
| private _speed = [_power, _gearMass, _terrainFactor, _terrainGradient, _duty] call _fnc_getRunningSpeed; | ||
| if (_speed < 2) then { | ||
| _speed = [_power, _gearMass, _terrainFactor, _terrainGradient, _duty] call _fnc_getWalkingSpeed; | ||
| }; | ||
|
|
||
| _speed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
could this be a separate function?
so one could run this without having a debug build?
Uh oh!
There was an error while loading. Please reload this page.
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.
I guess we can do that.
But the other debug info (shown via
systemChatandhintSilent) is more helpful.Should we try to move all of the debug output into a function?