GForces - Add forces strength coefficient setting (#7750)

* Move GForce settings to CBA Settings

* Add GForce coefficient setting

* Fix typo

* Restore ACE Settings class and mark as moved to SQF

* Apply translation suggestions from code review

Co-authored-by: mharis001 <34453221+mharis001@users.noreply.github.com>

Co-authored-by: mharis001 <34453221+mharis001@users.noreply.github.com>
This commit is contained in:
Filip Maciejewski 2020-06-13 02:06:03 +02:00 committed by GitHub
parent e7256dad3d
commit 7c93ee9ed3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 36 additions and 5 deletions

View File

@ -1,8 +1,5 @@
class ACE_Settings {
class GVAR(enabledFor) {
displayName = CSTRING(enabledFor_displayName);
typeName = "SCALAR";
value = 1;
values[] = {ECSTRING(Common,Disabled), CSTRING(enabledFor_onlyAircraft), ECSTRING(Common,Enabled)};
movedToSQF = 1;
};
};

View File

@ -6,6 +6,8 @@ PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;
#include "initSettings.sqf"
GVAR(GForces) = [];
GVAR(GForces_Index) = 0;

View File

@ -29,7 +29,7 @@ private _accel = ((_newVel vectorDiff GVAR(oldVel)) vectorMultiply (1 / INTERVAL
// Cap maximum G's to +- 10 to avoid g-effects when the update is low fps.
private _currentGForce = (((_accel vectorDotProduct vectorUp (vehicle ACE_player)) / 9.8) max -10) min 10;
GVAR(GForces) set [GVAR(GForces_Index), _currentGForce];
GVAR(GForces) set [GVAR(GForces_Index), _currentGForce * GVAR(coef)];
GVAR(GForces_Index) = (GVAR(GForces_Index) + 1) % 30; // 30 = round (AVERAGEDURATION / INTERVAL);
GVAR(oldVel) = _newVel;

View File

@ -0,0 +1,20 @@
[
QGVAR(enabledFor),
"LIST",
[LLSTRING(enabledFor_displayName)],
LLSTRING(Category),
[[0, 1, 2], [LELSTRING(Common,Disabled), LLSTRING(enabledFor_onlyAircraft), LELSTRING(Common,Enabled)], 1],
true,
{[QGVAR(enabledFor), _this] call EFUNC(common,cbaSettings_settingChanged)},
true // Needs mission restart
] call CBA_fnc_addSetting;
[
QGVAR(coef),
"SLIDER",
[LLSTRING(Coefficient_DisplayName), LLSTRING(Coefficient_Description)],
LLSTRING(Category),
[0, 1, 1, 0, true],
true
] call CBA_fnc_addSetting;

View File

@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project name="ACE">
<Package name="GForces">
<Key ID="STR_ACE_GForces_Category">
<English>ACE G-Forces</English>
<Polish>ACE Przeciążenia</Polish>
</Key>
<Key ID="STR_ACE_GForces_enabledFor_displayName">
<English>Gforces Effects</English>
<German>Effekte der G-Kräfte</German>
@ -47,5 +51,13 @@
<Czech>Redukce G Force</Czech>
<Spanish>Reducción de fuerzas G</Spanish>
</Key>
<Key ID="STR_ACE_GForces_Coefficient_DisplayName">
<English>G-Force Coefficient</English>
<Polish>Współczynnk przeciążenia</Polish>
</Key>
<Key ID="STR_ACE_GForces_Coefficient_Description">
<English>Controls strength of G-Force affecting players.</English>
<Polish>Wpływa na siłe przeciążeń oddziałujących na graczy</Polish>
</Key>
</Package>
</Project>