mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Overworked the module settings (WIP)
This commit is contained in:
parent
05f14d6242
commit
c532742a5b
@ -1,37 +1,72 @@
|
|||||||
class CfgVehicles {
|
class CfgVehicles {
|
||||||
class Module_F;
|
class Module_F;
|
||||||
class GVAR(Module): Module_F {
|
class GVAR(Module): Module_F {
|
||||||
author = "Ruthberg";
|
|
||||||
category = "ACE";
|
|
||||||
displayName = "Advanced Ballistics";
|
|
||||||
scope = 2;
|
scope = 2;
|
||||||
isGlobal = 1;
|
displayName = "Advanced Ballistics [ACE]";
|
||||||
icon = QUOTE(PATHTOF(UI\Icon_Module_Wind_ca.paa));
|
icon = QUOTE(PATHTOF(UI\Icon_Module_Wind_ca.paa));
|
||||||
|
category = "ACE";
|
||||||
|
function = QUOTE(DFUNC(initModuleSettings));
|
||||||
|
functionPriority = 1;
|
||||||
|
isGlobal = 1;
|
||||||
|
isTriggerActivated = 0;
|
||||||
|
author = "Ruthberg";
|
||||||
class Arguments {
|
class Arguments {
|
||||||
class enabled {
|
class enabled {
|
||||||
displayName = "Advanced Ballistics";
|
displayName = "Advanced Ballistics";
|
||||||
description = "Enable Advanced Ballistics?";
|
description = "Enables advanced ballistics";
|
||||||
|
typeName = "BOOL";
|
||||||
|
defaultValue = 1;
|
||||||
|
};
|
||||||
|
class alwaysSimulateForSnipers {
|
||||||
|
displayName = "Always Enabled For Snipers";
|
||||||
|
description = "Always enables advanced ballistics when high power optics are used";
|
||||||
|
typeName = "BOOL";
|
||||||
|
defaultValue = 1;
|
||||||
|
};
|
||||||
|
class disabledInFullAutoMode {
|
||||||
|
displayName = "Disabled In FullAuto Mode";
|
||||||
|
description = "Disables the advanced ballistics during full auto fire";
|
||||||
typeName = "BOOL";
|
typeName = "BOOL";
|
||||||
defaultValue = 0;
|
defaultValue = 0;
|
||||||
};
|
};
|
||||||
class enableAmmoTemperatureSimulation {
|
class onlyActiveForLocalPlayers {
|
||||||
displayName = "Enable Ammo Temperature";
|
displayName = "Disabled For Non Local Players";
|
||||||
|
description = "Disables the advanced ballistics for bullets coming from other players (enable this if you encounter frame drops during heavy firefights in multiplayer)";
|
||||||
|
typeName = "BOOL";
|
||||||
|
defaultValue = 1;
|
||||||
|
};
|
||||||
|
/* // TODO: We currently do not have firedEHs on vehicles
|
||||||
|
class vehicleGunnerEnabled {
|
||||||
|
displayName = "Enabled For Vehicle Gunners";
|
||||||
|
description = "Enables advanced ballistics for vehicle gunners";
|
||||||
|
typeName = "BOOL";
|
||||||
|
defaultValue = 0;
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
class ammoTemperatureEnabled {
|
||||||
|
displayName = "Enable Ammo Temperature Simulation";
|
||||||
description = "Muzzle velocity varies with ammo temperature";
|
description = "Muzzle velocity varies with ammo temperature";
|
||||||
typeName = "BOOL";
|
typeName = "BOOL";
|
||||||
defaultValue = 1;
|
defaultValue = 1;
|
||||||
};
|
};
|
||||||
class enableBarrelLengthSimulation {
|
class barrelLengthInfluenceEnabled {
|
||||||
displayName = "Enable Barrel Length";
|
displayName = "Enable Barrel Length Simulation";
|
||||||
description = "Muzzle velocity varies with barrel length";
|
description = "Muzzle velocity varies with barrel length";
|
||||||
typeName = "BOOL";
|
typeName = "BOOL";
|
||||||
defaultValue = 1;
|
defaultValue = 1;
|
||||||
};
|
};
|
||||||
class enableBulletTraceEffect {
|
class bulletTraceEnabled {
|
||||||
displayName = "Enable Bullet Trace";
|
displayName = "Enable Bullet Trace Effect";
|
||||||
description = "Enables the bullet trace effect";
|
description = "Enables a bullet trace effect to high caliber bullets (only visible when looking through high power optics)";
|
||||||
typeName = "BOOL";
|
typeName = "BOOL";
|
||||||
defaultValue = 1;
|
defaultValue = 1;
|
||||||
};
|
};
|
||||||
|
class simulationRadius {
|
||||||
|
displayName = "Simulation Radius";
|
||||||
|
description = "Defines the radius (in meters) in which advanced ballistics are applied";
|
||||||
|
typeName = "NUMBER";
|
||||||
|
defaultValue = 3000;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -2,13 +2,16 @@
|
|||||||
|
|
||||||
#include "initKeybinds.sqf"
|
#include "initKeybinds.sqf"
|
||||||
|
|
||||||
// AB is disabled by default
|
GVAR(enabled) = true;
|
||||||
GVAR(enabled) = false;
|
|
||||||
|
|
||||||
//GVAR(VehicleGunnerEnabled) = true; // TODO: We currently do not have firedEHs on vehicles
|
//GVAR(vehicleGunnerEnabled) = true; // TODO: We currently do not have firedEHs on vehicles
|
||||||
GVAR(AmmoTemperatureEnabled) = true;
|
GVAR(ammoTemperatureEnabled) = true;
|
||||||
GVAR(BarrelLengthInfluenceEnabled) = true;
|
GVAR(barrelLengthInfluenceEnabled) = true;
|
||||||
GVAR(BulletTraceEnabled) = true;
|
GVAR(bulletTraceEnabled) = true;
|
||||||
|
GVAR(onlyActiveForLocalPlayers) = false;
|
||||||
|
GVAR(disabledInFullAutoMode) = false;
|
||||||
|
GVAR(alwaysSimulateForSnipers) = true;
|
||||||
|
GVAR(simulationRadius) = 3000;
|
||||||
|
|
||||||
GVAR(bulletDatabase) = [];
|
GVAR(bulletDatabase) = [];
|
||||||
GVAR(bulletDatabaseStartTime) = [];
|
GVAR(bulletDatabaseStartTime) = [];
|
||||||
|
@ -13,5 +13,6 @@ PREP(calculateWindSpeed);
|
|||||||
PREP(displayProtractor);
|
PREP(displayProtractor);
|
||||||
PREP(handleFired);
|
PREP(handleFired);
|
||||||
PREP(initializeTerrainExtension);
|
PREP(initializeTerrainExtension);
|
||||||
|
PREP(initModuleSettings);
|
||||||
|
|
||||||
ADDON = true;
|
ADDON = true;
|
||||||
|
@ -28,20 +28,22 @@ _ammo = _this select 4;
|
|||||||
_magazine = _this select 5;
|
_magazine = _this select 5;
|
||||||
_bullet = _this select 6;
|
_bullet = _this select 6;
|
||||||
|
|
||||||
|
_abort = false;
|
||||||
|
|
||||||
if (!hasInterface) exitWith {};
|
if (!hasInterface) exitWith {};
|
||||||
if (!alive _bullet) exitWith {};
|
if (!alive _bullet) exitWith {};
|
||||||
if (!GVAR(enabled)) exitWith {};
|
if (!GVAR(enabled)) exitWith {};
|
||||||
if (!([_unit] call EFUNC(common,isPlayer))) exitWith {};
|
if (!([_unit] call EFUNC(common,isPlayer))) exitWith {};
|
||||||
if (underwater _unit) exitWith {};
|
if (underwater _unit) exitWith {};
|
||||||
if (!(_ammo isKindOf "BulletBase")) exitWith {};
|
if (!(_ammo isKindOf "BulletBase")) exitWith {};
|
||||||
if (_unit distanceSqr ACE_player > 9000000) exitWith {};
|
if (_unit distanceSqr ACE_player > GVAR(simulationRadius)) exitWith {};
|
||||||
if (GVAR(ONLY_ACTIVE_FOR_LOCAL_PLAYER) && _unit != ACE_player) exitWith {};
|
if (GVAR(onlyActiveForLocalPlayers) && _unit != ACE_player) then { _abort = true; };
|
||||||
//if (!GVAR(VehicleGunnerEnabled) && !(_unit isKindOf "Man")) exitWith {};
|
//if (!GVAR(vehicleGunnerEnabled) && !(_unit isKindOf "Man")) then { _abort = true; }; // TODO: We currently do not have firedEHs on vehicles
|
||||||
if (GVAR(DISABLED_IN_FULL_AUTO_MODE) && getNumber(configFile >> "cfgWeapons" >> _weapon >> _mode >> "autoFire") == 1) exitWith {};
|
if (GVAR(disabledInFullAutoMode) && getNumber(configFile >> "cfgWeapons" >> _weapon >> _mode >> "autoFire") == 1) then { _abort = true; };
|
||||||
|
|
||||||
// Decide whether normal winddeflection is good enough
|
systemChat format["%1, %2, %3", getNumber(configFile >> "cfgWeapons" >> _weapon >> _mode >> "autoFire"), _abort, GVAR(disabledInFullAutoMode)];
|
||||||
_abort = !(local _unit);
|
|
||||||
if (_abort) then {
|
if (_abort && alwaysSimulateForSnipers) then {
|
||||||
// The shooter is non local
|
// The shooter is non local
|
||||||
if (currentWeapon _unit == primaryWeapon _unit && count primaryWeaponItems _unit > 2) then {
|
if (currentWeapon _unit == primaryWeapon _unit && count primaryWeaponItems _unit > 2) then {
|
||||||
_opticsName = (primaryWeaponItems _unit) select 2;
|
_opticsName = (primaryWeaponItems _unit) select 2;
|
||||||
@ -53,6 +55,8 @@ if (_abort) exitWith {
|
|||||||
[_bullet, getNumber(configFile >> "cfgAmmo" >> _ammo >> "airFriction")] call EFUNC(winddeflection,updateTrajectoryPFH);
|
[_bullet, getNumber(configFile >> "cfgAmmo" >> _ammo >> "airFriction")] call EFUNC(winddeflection,updateTrajectoryPFH);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
systemChat "AB";
|
||||||
|
|
||||||
_airFriction = getNumber(configFile >> "cfgAmmo" >> _ammo >> "airFriction");
|
_airFriction = getNumber(configFile >> "cfgAmmo" >> _ammo >> "airFriction");
|
||||||
_muzzleVelocity = getNumber(configFile >> "cfgMagazines" >> _magazine >> "initSpeed");
|
_muzzleVelocity = getNumber(configFile >> "cfgMagazines" >> _magazine >> "initSpeed");
|
||||||
_muzzleVelocityCoef = getNumber(configFile >> "cfgWeapons" >> _weapon >> "initSpeed");
|
_muzzleVelocityCoef = getNumber(configFile >> "cfgWeapons" >> _weapon >> "initSpeed");
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Author: Glowbal, Ruthberg
|
||||||
|
* Module for adjusting the advanced ballistics settings
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: The module logic <LOGIC>
|
||||||
|
* 1: units <ARRAY>
|
||||||
|
* 2: activated <BOOL>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None <NIL>
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
private ["_logic", "_units", "_activated"];
|
||||||
|
_logic = _this select 0;
|
||||||
|
_units = _this select 1;
|
||||||
|
_activated = _this select 2;
|
||||||
|
|
||||||
|
if !(_activated) exitWith {};
|
||||||
|
|
||||||
|
[_logic, QGVAR(enabled), "enabled"] call EFUNC(common,readSettingFromModule);
|
||||||
|
[_logic, QGVAR(ammoTemperatureEnabled), "ammoTemperatureEnabled"] call EFUNC(common,readSettingFromModule);
|
||||||
|
[_logic, QGVAR(barrelLengthInfluenceEnabled), "barrelLengthInfluenceEnabled"] call EFUNC(common,readSettingFromModule);
|
||||||
|
[_logic, QGVAR(bulletTraceEnabled), "bulletTraceEnabled"] call EFUNC(common,readSettingFromModule);
|
||||||
|
[_logic, QGVAR(onlyActiveForLocalPlayers), "onlyActiveForLocalPlayers"] call EFUNC(common,readSettingFromModule);
|
||||||
|
[_logic, QGVAR(disabledInFullAutoMode), "disabledInFullAutoMode"] call EFUNC(common,readSettingFromModule);
|
||||||
|
[_logic, QGVAR(alwaysSimulateForSnipers), "alwaysSimulateForSnipers"] call EFUNC(common,readSettingFromModule);
|
||||||
|
[_logic, QGVAR(simulationRadius), "simulationRadius"] call EFUNC(common,readSettingFromModule);
|
Loading…
Reference in New Issue
Block a user