This commit is contained in:
Nicolás Badano 2015-01-17 00:59:45 -03:00
parent f594198eae
commit 43b87cda0b
3 changed files with 47 additions and 36 deletions

View File

@ -39,14 +39,14 @@ class CfgVehicles {
class B_Soldier_05_f;
class B_Pilot_F: B_Soldier_05_f {
AGM_GForceCoef = 0.75;
AGM_GForceCoef = 0.55;
};
class I_Soldier_04_F;
class I_pilot_F: I_Soldier_04_F {
AGM_GForceCoef = 0.75;
AGM_GForceCoef = 0.55;
};
class O_helipilot_F;
class O_Pilot_F: O_helipilot_F {
AGM_GForceCoef = 0.75;
AGM_GForceCoef = 0.55;
};
};

View File

@ -27,50 +27,60 @@ GVAR(GForces) set [GVAR(GForces_Index), _currentGForce];
GVAR(GForces_Index) = (GVAR(GForces_Index) + 1) % round (AVERAGEDURATION / INTERVAL);
GVAR(oldVel) = _newVel;
/*
* source: http://en.wikipedia.org/wiki/G-LOC
* untrained persons without gsuit will fall unconscious between 4 and 6G
* pilots in gsuits will sustain up to 9G
* a person is for average 12 seconds unconscious
* after being unconscious, a person is unable to do simple tasks for average 15 seconds
/* Source: https://github.com/KoffeinFlummi/AGM/issues/1774#issuecomment-70341573
*
* _upTolerance converts the effective 9G of a pilot to virtual 5.4G (= 0.8*0.75*9G)
* pilots with gsuit will get unconscious at an _average of 9G
* normal men without gsuit will get unconscious at an _average of 5.4G
* For untrained people without g-suits:
* GLOC: 5G for 6 s
* RedOut: 2.5G for 6 s
*
* For trained jet pilots without g-suits:
* GLOC: 9G for 6 s
* RedOut: 4.5G
*
* For trained jet pilots with g-suits:
* GLOC: 10.5G for 6 s
* RedOut: 4.5G
*
* Effects and camera shake start 30% the limit value, and build gradually
*/
_average = 0;
if (count GVAR(GForces) > 0) then {
_sum = 0;
{
_sum = _sum + _x;
} forEach GVAR(GForces);
_average = _sum / (count GVAR(GForces));
_sum = 0;
{
_sum = _sum + _x;
} forEach GVAR(GForces);
_average = _sum / (count GVAR(GForces));
};
_downTolerance = ACE_player getVariable ["ACE_GForceCoef",
getNumber (configFile >> "CfgVehicles" >> (typeOf ACE_player) >> "ACE_GForceCoef")];
_upTolerance = _downTolerance * getNumber (configFile >> "CfgWeapons" >> (uniform ACE_player) >> "ACE_GForceCoef");
_classCoef = ACE_player getVariable ["ACE_GForceCoef",
getNumber (configFile >> "CfgVehicles" >> (typeOf ACE_player) >> "AGM_GForceCoef")];
_suitCoef = getNumber (configFile >> "CfgWeapons" >> (uniform ACE_player) >> "AGM_GForceCoef");
["GForces", [_average, _upTolerance], {format ["_g _avgG _avgG*_upTol: %1, %2, %3", _currentGForce, _this select 0, (_this select 0) * (_this select 1)]}] call EFUNC(common,log);
_gBlackOut = MAXVIRTUALG / _classCoef + MAXVIRTUALG / _suitCoef - MAXVIRTUALG;
_gRedOut = MINVIRTUALG / _classCoef;
["GForces", [], {format ["_g _gBO _coef: %1, %2, %3", _average, _gBlackOut, 2 * ((1.0 - ((_average - 0.30 * _gBlackOut) / (0.70 * _gBlackOut)) ^ 2) max 0) ]}] call EFUNC(common,log);
// @todo: Sort the interaction with medical
if (((_average * _upTolerance) > MAXVIRTUALG) and {isClass (configFile >> "CfgPatches" >> "ACE_Medical") and {!(ACE_player getVariable ["ACE_isUnconscious", false])}}) then {
[ACE_player, (10 + floor(random 5))] call EFUNC(medical,knockOut);
if ((_average > _gBlackOut) and {isClass (configFile >> "CfgPatches" >> "ACE_Medical") and {!(ACE_player getVariable ["ACE_isUnconscious", false])}}) then {
[ACE_player, (10 + floor(random 5))] call EFUNC(medical,knockOut);
};
if ((abs _average > 2) and !(ACE_player getVariable ["ACE_isUnconscious", false])) then {
if (_average > 0) then {
_strength = 1.2 - (((_average - 2) * _upTolerance) / (MAXVIRTUALG - 2));
GVAR(GForces_CC) ppEffectAdjust [1,1,0,[0,0,0,1],[0,0,0,0],[1,1,1,1],[_strength,_strength,0,0,0,0.1,0.5]];
addCamShake [((abs _average) - 2) / 3, 1, 15];
} else {
_strength = 1.2 - ((((-1 * _average) - 2) * _downTolerance) / (MAXVIRTUALG - 2));
GVAR(GForces_CC) ppEffectAdjust [1,1,0,[1,0.2,0.2,1],[0,0,0,0],[1,1,1,1],[_strength,_strength,0,0,0,0.1,0.5]];
addCamShake [((abs _average) - 2) / 5, 1, 15];
};
} else {
GVAR(GForces_CC) ppEffectAdjust [1,1,0,[0,0,0,1],[0,0,0,0],[1,1,1,1],[10,10,0,0,0,0.1,0.5]];
GVAR(GForces_CC) ppEffectAdjust [1,1,0,[0,0,0,1],[0,0,0,0],[1,1,1,1],[10,10,0,0,0,0.1,0.5]];
if !(ACE_player getVariable ["ACE_isUnconscious", false]) then {
if (_average > 0.30 * _gBlackOut) then {
_strength = ((_average - 0.30 * _gBlackOut) / (0.70 * _gBlackOut)) max 0;
GVAR(GForces_CC) ppEffectAdjust [1,1,0,[0,0,0,1],[0,0,0,0],[1,1,1,1],[2*(1-_strength),2*(1-_strength),0,0,0,0.1,0.5]];
addCamShake [_strength, 1, 15];
} else {
if (_average < -0.30 * _gRedOut) then {
_strength = ((abs _average - 0.30 * _gRedOut) / (0.70 * _gRedOut)) max 0;
GVAR(GForces_CC) ppEffectAdjust [1,1,0,[1,0.2,0.2,1],[0,0,0,0],[1,1,1,1],[2*(1-_strength),2*(1-_strength),0,0,0,0.1,0.5]];
addCamShake [_strength / 1.5, 1, 15];
};
};
};
GVAR(GForces_CC) ppEffectCommit INTERVAL;

View File

@ -13,4 +13,5 @@
#define AVERAGEDURATION 6
#define INTERVAL 0.20
#define MAXVIRTUALG 5.4
#define MAXVIRTUALG 5.0
#define MINVIRTUALG 2.5