mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
356a8f640a
Conflicts: addons/medical/functions/fnc_actionCheckBloodPressure.sqf addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf addons/medical/functions/fnc_actionCheckPulse.sqf addons/medical/functions/fnc_actionCheckPulseLocal.sqf addons/medical/functions/fnc_actionDiagnose.sqf addons/medical/functions/fnc_actionRemoveTourniquet.sqf addons/medical/functions/fnc_addHeartRateAdjustment.sqf addons/medical/functions/fnc_addToInjuredCollection.sqf addons/medical/functions/fnc_addUnconsciousCondition.sqf addons/medical/functions/fnc_addVitalLoop.sqf addons/medical/functions/fnc_canTreat.sqf addons/medical/functions/fnc_copyDeadBody.sqf addons/medical/functions/fnc_createLitter.sqf addons/medical/functions/fnc_determineIfFatal.sqf addons/medical/functions/fnc_getBloodLoss.sqf addons/medical/functions/fnc_getBloodPressure.sqf addons/medical/functions/fnc_getBloodVolumeChange.sqf addons/medical/functions/fnc_getCardiacOutput.sqf addons/medical/functions/fnc_getHeartRateChange.sqf addons/medical/functions/fnc_getTriageStatus.sqf addons/medical/functions/fnc_getUnconsciousCondition.sqf addons/medical/functions/fnc_handleBandageOpening.sqf addons/medical/functions/fnc_handleCollisionDamage.sqf addons/medical/functions/fnc_handleDamage.sqf addons/medical/functions/fnc_handleDamage_advanced.sqf addons/medical/functions/fnc_handleDamage_advancedSetDamage.sqf addons/medical/functions/fnc_handleDamage_airway.sqf addons/medical/functions/fnc_handleDamage_caching.sqf addons/medical/functions/fnc_handleDamage_fractures.sqf addons/medical/functions/fnc_handleDamage_internalInjuries.sqf addons/medical/functions/fnc_handleDamage_wounds.sqf addons/medical/functions/fnc_handleDamage_woundsOld.sqf addons/medical/functions/fnc_hasMedicalEnabled.sqf addons/medical/functions/fnc_hasTourniquetAppliedTo.sqf addons/medical/functions/fnc_isInStableCondition.sqf addons/medical/functions/fnc_isMedicalVehicle.sqf addons/medical/functions/fnc_itemCheck.sqf addons/medical/functions/fnc_medicationEffectLoop.sqf addons/medical/functions/fnc_modifyMedicalAction.sqf addons/medical/functions/fnc_moduleAdvancedMedicalSettings.sqf addons/medical/functions/fnc_moduleAssignMedicalFacility.sqf addons/medical/functions/fnc_moduleBasicMedicalSettings.sqf addons/medical/functions/fnc_moduleReviveSettings.sqf addons/medical/functions/fnc_parseConfigForInjuries.sqf addons/medical/functions/fnc_playInjuredSound.sqf addons/medical/functions/fnc_reviveStateLoop.sqf addons/medical/functions/fnc_selectionNameToNumber.sqf addons/medical/functions/fnc_setDead.sqf addons/medical/functions/fnc_setHitPointDamage.sqf addons/medical/functions/fnc_setStructuralDamage.sqf addons/medical/functions/fnc_setUnconscious.sqf addons/medical/functions/fnc_showBloodEffect.sqf addons/medical/functions/fnc_treatment.sqf addons/medical/functions/fnc_treatmentAdvanced_CPR.sqf addons/medical/functions/fnc_treatmentAdvanced_CPRLocal.sqf addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf addons/medical/functions/fnc_treatmentAdvanced_fullHeal.sqf addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf addons/medical/functions/fnc_treatmentAdvanced_medication.sqf addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf addons/medical/functions/fnc_treatmentBasic_bloodbagLocal.sqf addons/medical/functions/fnc_treatmentBasic_epipen.sqf addons/medical/functions/fnc_treatmentBasic_morphine.sqf addons/medical/functions/fnc_treatmentBasic_morphineLocal.sqf addons/medical/functions/fnc_treatmentIV.sqf addons/medical/functions/fnc_treatmentIVLocal.sqf addons/medical/functions/fnc_treatmentTourniquet.sqf addons/medical/functions/fnc_treatmentTourniquetLocal.sqf addons/medical/functions/fnc_treatment_failure.sqf addons/medical/functions/fnc_treatment_success.sqf addons/medical/functions/fnc_unconsciousPFH.sqf addons/medical/functions/fnc_useItem.sqf addons/medical/functions/fnc_vitalLoop.sqf addons/medical_blood/functions/fnc_hit.sqf addons/medical_treatment/functions/fnc_hasItem.sqf addons/medical_treatment/functions/fnc_useItems.sqf
99 lines
3.3 KiB
Plaintext
99 lines
3.3 KiB
Plaintext
/*
|
|
* Author: KoffeinFlummi and esteldunedain
|
|
* Calculates average g-forces and triggers g-effects
|
|
*
|
|
* Arguments:
|
|
* 0: Arguments <ARRAY>
|
|
* 1: pfh_id <NUMBER>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [[args], 5] call ace_gforces_fnc_pfhUpdateGForces
|
|
*
|
|
* Public: No
|
|
*/
|
|
#include "script_component.hpp"
|
|
|
|
// Update the g-forces at constant mission time intervals (taking accTime into account)
|
|
if ((CBA_missionTime - GVAR(lastUpdateTime)) < INTERVAL) exitWith {};
|
|
GVAR(lastUpdateTime) = CBA_missionTime;
|
|
|
|
if (GVAR(playerIsVirtual) || {!alive ACE_player}) exitWith {};
|
|
|
|
BEGIN_COUNTER(everyInterval);
|
|
|
|
private _newVel = velocity (vehicle ACE_player);
|
|
private _accel = ((_newVel vectorDiff GVAR(oldVel)) vectorMultiply (1 / INTERVAL)) vectorAdd [0, 0, 9.8];
|
|
// 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_Index) = (GVAR(GForces_Index) + 1) % 30; // 30 = round (AVERAGEDURATION / INTERVAL);
|
|
GVAR(oldVel) = _newVel;
|
|
|
|
/* Source: https://github.com/KoffeinFlummi/AGM/issues/1774#issuecomment-70341573
|
|
*
|
|
* 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
|
|
*/
|
|
|
|
private _average = 0;
|
|
private _count = {
|
|
_average = _average + _x;
|
|
true
|
|
} count GVAR(GForces);
|
|
|
|
if (_count > 0) then {
|
|
_average = _average / _count;
|
|
};
|
|
|
|
private _classCoef = (ACE_player getVariable ["ACE_GForceCoef",
|
|
getNumber (configFile >> "CfgVehicles" >> (typeOf ACE_player) >> "ACE_GForceCoef")]) max 0.001;
|
|
private _suitCoef = if ((uniform ACE_player) != "") then {
|
|
(getNumber (configFile >> "CfgWeapons" >> (uniform ACE_player) >> "ACE_GForceCoef")) max 0.001
|
|
} else {
|
|
1
|
|
};
|
|
|
|
private _gBlackOut = MAXVIRTUALG / _classCoef + MAXVIRTUALG / _suitCoef - MAXVIRTUALG;
|
|
|
|
// Unconsciousness
|
|
if ((_average > _gBlackOut) and {isClass (configFile >> "CfgPatches" >> "ACE_Medical") and {!(ACE_player getVariable ["ACE_isUnconscious", false])}}) then {
|
|
[ACE_player, true, (10 + floor(random 5)), true] call EFUNC(medical,setUnconscious);
|
|
};
|
|
|
|
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 {
|
|
private _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 {
|
|
private _gRedOut = MINVIRTUALG / _classCoef;
|
|
|
|
if (_average < -0.30 * _gRedOut) then {
|
|
private _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;
|
|
|
|
END_COUNTER(everyInterval);
|