Scale grenade torque depending on throw mode (#5845)

This commit is contained in:
commy2 2017-12-03 17:37:13 +01:00 committed by SilentSpike
parent e0ae842ff0
commit 2e9b195021
2 changed files with 12 additions and 0 deletions

View File

@ -49,10 +49,20 @@ if (!(_unit getVariable [QGVAR(primed), false])) then {
_newVelocity = _newVelocity vectorAdd (velocity (vehicle _unit)); _newVelocity = _newVelocity vectorAdd (velocity (vehicle _unit));
}; };
// Calculate torque of thrown grenade
private _config = configFile >> "CfgAmmo" >> typeOf _activeThrowable; private _config = configFile >> "CfgAmmo" >> typeOf _activeThrowable;
private _torqueDir = getArray (_config >> QGVAR(torqueDirection)); private _torqueDir = getArray (_config >> QGVAR(torqueDirection));
_torqueDir = if (_torqueDir isEqualTypeArray [0,0,0]) then { vectorNormalized _torqueDir } else { [0,0,0] }; _torqueDir = if (_torqueDir isEqualTypeArray [0,0,0]) then { vectorNormalized _torqueDir } else { [0,0,0] };
private _torqueMag = getNumber (_config >> QGVAR(torqueMagnitude)); private _torqueMag = getNumber (_config >> QGVAR(torqueMagnitude));
if (_dropMode) then {
_torqueMag = _torqueMag * THROWSTYLE_DROP_TORQUE_COEF;
} else {
if (_throwType == "high") then {
_torqueMag = _torqueMag * THROWSTYLE_HIGH_TORQUE_COEF;
};
};
private _torque = _torqueDir vectorMultiply _torqueMag; private _torque = _torqueDir vectorMultiply _torqueMag;
// Drop if unit dies during throw process // Drop if unit dies during throw process

View File

@ -23,6 +23,8 @@
#define THROWSTYLE_HIGH_DIR [0, 200, 500] #define THROWSTYLE_HIGH_DIR [0, 200, 500]
#define THROWSTYLE_HIGH_VEL_COEF 2 #define THROWSTYLE_HIGH_VEL_COEF 2
#define THROWSTYLE_DROP_VEL 2 #define THROWSTYLE_DROP_VEL 2
#define THROWSTYLE_HIGH_TORQUE_COEF .6
#define THROWSTYLE_DROP_TORQUE_COEF .2
#define THROW_TYPE_DEFAULT "normal" #define THROW_TYPE_DEFAULT "normal"
#define THROW_SPEED_DEFAULT 18 #define THROW_SPEED_DEFAULT 18