mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
commit
f0642950e3
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
class Extended_PreInit_EventHandlers {
|
class Extended_PreInit_EventHandlers {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
||||||
@ -6,7 +7,7 @@ class Extended_PreInit_EventHandlers {
|
|||||||
|
|
||||||
class Extended_PostInit_EventHandlers {
|
class Extended_PostInit_EventHandlers {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
clientInit = QUOTE(call COMPILE_FILE(XEH_clientInit));
|
init = QUOTE(call COMPILE_FILE(XEH_postInit));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ class CfgVehicles {
|
|||||||
class ACE_SelfActions {
|
class ACE_SelfActions {
|
||||||
class ResetFCS {
|
class ResetFCS {
|
||||||
displayName = CSTRING(ResetFCS);
|
displayName = CSTRING(ResetFCS);
|
||||||
condition = QUOTE(call FUNC(canResetFCS));
|
condition = QUOTE(_player call FUNC(canResetFCS));
|
||||||
statement = QUOTE([ARR_2(vehicle _player,[_player] call DEFUNC(common,getTurretIndex))] call DFUNC(reset););
|
statement = QUOTE([ARR_2(vehicle _player,[_player] call DEFUNC(common,getTurretIndex))] call DFUNC(reset););
|
||||||
showDisabled = 0;
|
showDisabled = 0;
|
||||||
priority = 1;
|
priority = 1;
|
||||||
@ -39,7 +39,7 @@ class CfgVehicles {
|
|||||||
class ACE_SelfActions {
|
class ACE_SelfActions {
|
||||||
class ResetFCS {
|
class ResetFCS {
|
||||||
displayName = CSTRING(ResetFCS);
|
displayName = CSTRING(ResetFCS);
|
||||||
condition = QUOTE(call FUNC(canResetFCS));
|
condition = QUOTE(_player call FUNC(canResetFCS));
|
||||||
statement = QUOTE([ARR_2(vehicle _player,[_player] call DEFUNC(common,getTurretIndex))] call DFUNC(reset););
|
statement = QUOTE([ARR_2(vehicle _player,[_player] call DEFUNC(common,getTurretIndex))] call DFUNC(reset););
|
||||||
showDisabled = 0;
|
showDisabled = 0;
|
||||||
priority = 1;
|
priority = 1;
|
||||||
@ -321,9 +321,13 @@ class CfgVehicles {
|
|||||||
discreteDistance[] = {};
|
discreteDistance[] = {};
|
||||||
discreteDistanceInitIndex = 0;
|
discreteDistanceInitIndex = 0;
|
||||||
|
|
||||||
/*class Turrets: Turrets {
|
class Turrets: Turrets {
|
||||||
class CommanderOptics: CommanderOptics {};
|
class CommanderOptics: CommanderOptics {
|
||||||
};*/
|
GVAR(Enabled) = 1;
|
||||||
|
discreteDistance[] = {};
|
||||||
|
discreteDistanceInitIndex = 0;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -346,9 +350,13 @@ class CfgVehicles {
|
|||||||
discreteDistance[] = {};
|
discreteDistance[] = {};
|
||||||
discreteDistanceInitIndex = 0;
|
discreteDistanceInitIndex = 0;
|
||||||
|
|
||||||
/*class Turrets: Turrets {
|
class Turrets: Turrets {
|
||||||
class CommanderOptics: CommanderOptics {};
|
class CommanderOptics: CommanderOptics {
|
||||||
};*/
|
GVAR(Enabled) = 1;
|
||||||
|
discreteDistance[] = {};
|
||||||
|
discreteDistanceInitIndex = 0;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -362,6 +370,8 @@ class CfgVehicles {
|
|||||||
class Turrets: Turrets {
|
class Turrets: Turrets {
|
||||||
class CommanderOptics: CommanderOptics {
|
class CommanderOptics: CommanderOptics {
|
||||||
GVAR(Enabled) = 1;
|
GVAR(Enabled) = 1;
|
||||||
|
discreteDistance[] = {};
|
||||||
|
discreteDistanceInitIndex = 0;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -16,4 +16,4 @@ if (!hasInterface) exitWith {};
|
|||||||
}] call EFUNC(common,addEventHandler);
|
}] call EFUNC(common,addEventHandler);
|
||||||
|
|
||||||
// Register event for global updates
|
// Register event for global updates
|
||||||
[QGVAR(forceUpdate), FUNC(onForceUpdate)] call EFUNC(common,addEventHandler);
|
[QGVAR(forceUpdate), {ACE_player call FUNC(onForceUpdate)}] call EFUNC(common,addEventHandler);
|
@ -14,6 +14,7 @@ PREP(onForceUpdate);
|
|||||||
PREP(keyDown);
|
PREP(keyDown);
|
||||||
PREP(keyUp);
|
PREP(keyUp);
|
||||||
PREP(reset);
|
PREP(reset);
|
||||||
|
PREP(updateRangeHUD);
|
||||||
PREP(vehicleInit);
|
PREP(vehicleInit);
|
||||||
|
|
||||||
ADDON = true;
|
ADDON = true;
|
||||||
|
@ -1,29 +1,27 @@
|
|||||||
/*
|
/*
|
||||||
* Author: KoffeinFlummi
|
* Author: KoffeinFlummi
|
||||||
*
|
|
||||||
* Adjusts the currently zeroed distance.
|
* Adjusts the currently zeroed distance.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: The vehicle in question
|
* 0: The vehicle in question <OBJECT>
|
||||||
* 1: The amount to add to the distance (can be negative)
|
* 1: The Turrets that the Vehicle has <ARRAY>
|
||||||
|
* 2: The amount to add to the distance (can be negative) <NUMMBER>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_vehicle", "_turret", "_delta", "_turretConfig", "_min", "_max", "_distance"];
|
params ["_vehicle", "_turret", "_delta"];
|
||||||
|
|
||||||
_vehicle = _this select 0;
|
private _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call EFUNC(common,getTurretConfigPath);
|
||||||
_turret = _this select 1;
|
|
||||||
_delta = _this select 2;
|
|
||||||
|
|
||||||
_turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call EFUNC(common,getTurretConfigPath);
|
private _min = getNumber (_turretConfig >> QGVAR(MinDistance));
|
||||||
|
private _max = getNumber (_turretConfig >> QGVAR(MaxDistance));
|
||||||
|
|
||||||
_min = getNumber (_turretConfig >> QGVAR(MinDistance));
|
private _distance = _vehicle getVariable [format ["%1_%2", QGVAR(Distance), _turret], _min];
|
||||||
_max = getNumber (_turretConfig >> QGVAR(MaxDistance));
|
|
||||||
_distance = _vehicle getVariable [format ["%1_%2", QGVAR(Distance), _turret], _min];
|
|
||||||
|
|
||||||
_distance = _distance + _delta;
|
_distance = _distance + _delta;
|
||||||
_distance = _distance min _max;
|
_distance = _distance min _max;
|
||||||
|
@ -1,15 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* Author: KoffeinFlummi
|
* Author: KoffeinFlummi
|
||||||
*
|
|
||||||
* Called from config. Can player reset FCS?
|
* Called from config. Can player reset FCS?
|
||||||
*
|
*
|
||||||
* Argument:
|
* Argument:
|
||||||
* Nothing
|
* Nothing
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return Value:
|
||||||
* Boolean (Bool)
|
* Boolean <BOOL>
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
count ((vehicle ACE_player) getVariable [format ["%1_%2", QGVAR(Magazines), [ACE_player] call EFUNC(common,getTurretIndex)], []]) > 1
|
params ["_unit"];
|
||||||
|
|
||||||
|
count ((vehicle _unit) getVariable [format ["%1_%2", QGVAR(Magazines), [_unit] call EFUNC(common,getTurretIndex)], []]) > 1 // return
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
*
|
|
||||||
* Called from config. Returns true if the player is a gunner and the players current vehicle has a FCS.
|
* Called from config. Returns true if the player is a gunner and the players current vehicle has a FCS.
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* Nothing
|
* None
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return Value:
|
||||||
* Boolean (Bool)
|
* Boolean <BOOL>
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
getNumber ([configFile >> "CfgVehicles" >> typeOf vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex)] call EFUNC(common,getTurretConfigPath) >> QGVAR(Enabled)) == 1
|
getNumber ([configFile >> "CfgVehicles" >> typeOf vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex)] call EFUNC(common,getTurretConfigPath) >> QGVAR(Enabled)) == 1
|
||||||
&& {cameraView == "GUNNER"}
|
&& {cameraView == "GUNNER"} // return
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
*
|
|
||||||
* Returns true if the laser distance measurement can be read from the engine.
|
* Returns true if the laser distance measurement can be read from the engine.
|
||||||
*
|
*
|
||||||
* Argument:
|
* Arguments:
|
||||||
* Nothing
|
* None
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return Value:
|
||||||
* Boolean (Bool)
|
* Boolean <BOOL>
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
!isNull ((uiNamespace getVariable ["ACE_dlgRangefinder", displayNull]) displayCtrl 1713151)
|
!isNull ((uiNamespace getVariable ["ACE_dlgRangefinder", displayNull]) displayCtrl 1713151)
|
||||||
&& {cameraView == "GUNNER"}
|
&& {cameraView == "GUNNER"} // return
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Author: KoffeinFlummi
|
* Author: KoffeinFlummi
|
||||||
*
|
|
||||||
* Adjusts the direction of a shell.
|
* Adjusts the direction of a shell.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
@ -8,58 +7,48 @@
|
|||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_vehicle", "_weapon", "_ammo", "_magazine", "_projectile", "_sumVelocity"];
|
params ["_vehicle", "_weapon", "", "", "_ammo", "_magazine", "_projectile"];
|
||||||
|
|
||||||
_vehicle = _this select 0;
|
private _gunner = [_vehicle, _weapon] call EFUNC(common,getGunner);
|
||||||
_weapon = _this select 1;
|
private _turret = _gunner call EFUNC(common,getTurretIndex);
|
||||||
_ammo = _this select 4;
|
|
||||||
_magazine = _this select 5;
|
|
||||||
_projectile = _this select 6;
|
|
||||||
|
|
||||||
private ["_gunner", "_turret"];
|
|
||||||
|
|
||||||
_gunner = [_vehicle, _weapon] call EFUNC(common,getGunner);
|
|
||||||
_turret = [_gunner] call EFUNC(common,getTurretIndex);
|
|
||||||
|
|
||||||
// Exit if the unit isn't a player
|
// Exit if the unit isn't a player
|
||||||
if !([_gunner] call EFUNC(common,isPlayer)) exitWith {};
|
if !([_gunner] call EFUNC(common,isPlayer)) exitWith {};
|
||||||
|
|
||||||
private ["_FCSMagazines", "_FCSElevation", "_offset"];
|
private _FCSMagazines = _vehicle getVariable [format ["%1_%2", QGVAR(Magazines), _turret], []];
|
||||||
|
private _FCSElevation = _vehicle getVariable format ["%1_%2", QGVAR(Elevation), _turret];
|
||||||
_FCSMagazines = _vehicle getVariable [(format ["%1_%2", QGVAR(Magazines), _turret]), []];
|
|
||||||
_FCSElevation = _vehicle getVariable format ["%1_%2", QGVAR(Elevation), _turret];
|
|
||||||
|
|
||||||
if !(_magazine in _FCSMagazines) exitWith {};
|
if !(_magazine in _FCSMagazines) exitWith {};
|
||||||
|
|
||||||
// GET ELEVATION OFFSET OF CURRENT MAGAZINE
|
// GET ELEVATION OFFSET OF CURRENT MAGAZINE
|
||||||
_offset = 0;
|
private _offset = 0;
|
||||||
|
|
||||||
{
|
{
|
||||||
if (_x == _magazine) exitWith {
|
if (_x == _magazine) exitWith {
|
||||||
_offset = _FCSElevation select _forEachIndex;
|
_offset = _FCSElevation select _forEachIndex;
|
||||||
};
|
};
|
||||||
} forEach _FCSMagazines;
|
} forEach _FCSMagazines;
|
||||||
|
|
||||||
|
|
||||||
[_projectile, (_vehicle getVariable format ["%1_%2", QGVAR(Azimuth), _turret]), _offset, 0] call EFUNC(common,changeProjectileDirection);
|
[_projectile, (_vehicle getVariable format ["%1_%2", QGVAR(Azimuth), _turret]), _offset, 0] call EFUNC(common,changeProjectileDirection);
|
||||||
|
|
||||||
// Remove the platform velocity
|
// Remove the platform velocity
|
||||||
if( (vectorMagnitude velocity _vehicle) > 2) then {
|
if (vectorMagnitude velocity _vehicle > 2) then {
|
||||||
_sumVelocity = (velocity _projectile) vectorDiff (velocity _vehicle);
|
private _sumVelocity = (velocity _projectile) vectorDiff (velocity _vehicle);
|
||||||
|
|
||||||
_projectile setVelocity _sumVelocity;
|
_projectile setVelocity _sumVelocity;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Air burst missile
|
// Air burst missile
|
||||||
|
|
||||||
// handle locally only
|
// handle locally only
|
||||||
if (!local _gunner) exitWith {};
|
if (!local _gunner) exitWith {};
|
||||||
|
|
||||||
if (getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(Airburst)) == 1) then {
|
if (getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(Airburst)) == 1) then {
|
||||||
private "_zeroing";
|
private _zeroing = _vehicle getVariable [format ["%1_%2", QGVAR(Distance), _turret], currentZeroing _vehicle];
|
||||||
_zeroing = _vehicle getVariable [format ["%1_%2", QGVAR(Distance), _turret], currentZeroing _vehicle];
|
|
||||||
|
|
||||||
if (_zeroing < 50) exitWith {};
|
if (_zeroing < 50) exitWith {};
|
||||||
if (_zeroing > 1500) exitWith {};
|
if (_zeroing > 1500) exitWith {};
|
||||||
|
@ -1,91 +1,82 @@
|
|||||||
/*
|
/*
|
||||||
* Author: KoffeinFlummi
|
* Author: KoffeinFlummi
|
||||||
*
|
|
||||||
* Calculates the angle offset necessary to hit the current target.
|
* Calculates the angle offset necessary to hit the current target.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: distance to target in meters
|
* 0: distance to target in meters <NUMBER>
|
||||||
* 1: current angle of the turret
|
* 1: current angle of the turret <NUMBER>
|
||||||
* 2: maximum elevation of the turret
|
* 2: maximum elevation of the turret <NUMBER>
|
||||||
* 3: initSpeed of the projectile
|
* 3: initSpeed of the projectile <NUMBER>
|
||||||
* 4: airFriction of the projectile
|
* 4: airFriction of the projectile <NUMBER>
|
||||||
* 5: maximum timeToLive of the projectile
|
* 5: maximum timeToLive of the projectile <NUMBER>
|
||||||
* 6: simulationStep of the projectile
|
* 6: simulationStep of the projectile <NUMBER>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* offset from the current angle necessary to hit the target
|
* offset from the current angle necessary to hit the target <NUMBER>
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
#define PRECISION 0.1
|
#define PRECISION 0.1
|
||||||
|
|
||||||
private ["_distance", "_angleTarget", "_maxElev", "_initSpeed", "_airFriction", "_timeToLive", "_simulationStep", "_angle1", "_angle2", "_it2", "_f1", "_f2", "_temp", "_it1", "_angle"];
|
params ["_distance", "_angleTarget", "_maxElev", "_initSpeed", "_airFriction", "_timeToLive", "_simulationStep"];
|
||||||
|
|
||||||
_distance = _this select 0;
|
|
||||||
_angleTarget = _this select 1;
|
|
||||||
_maxElev = _this select 2;
|
|
||||||
_initSpeed = _this select 3;
|
|
||||||
_airFriction = _this select 4;
|
|
||||||
_timeToLive = _this select 5;
|
|
||||||
_simulationStep = _this select 6;
|
|
||||||
|
|
||||||
if (_simulationStep == 0) exitWith {_angleTarget};
|
if (_simulationStep == 0) exitWith {_angleTarget};
|
||||||
|
|
||||||
FUNC(traceBullet) = {
|
private _fnc_traceBullet = {
|
||||||
private ["_distance", "_angleTarget", "_maxElev", "_initSpeed", "_airFriction", "_timeToLive", "_simulationStep", "_angle", "_posTargetX", "_posTargetY", "_posX", "_posY", "_velocityX", "_velocityY", "_velocityMagnitude", "_i"];
|
params ["_distance", "_angleTarget", "_maxElev", "_initSpeed", "_airFriction", "_timeToLive", "_simulationStep", "_angle"];
|
||||||
|
|
||||||
_distance = _this select 0;
|
|
||||||
_angleTarget = _this select 1;
|
|
||||||
_maxElev = _this select 2;
|
|
||||||
_initSpeed = _this select 3;
|
|
||||||
_airFriction = _this select 4;
|
|
||||||
_timeToLive = _this select 5;
|
|
||||||
_simulationStep = _this select 6;
|
|
||||||
_angle = _this select 7;
|
|
||||||
|
|
||||||
_angle = _angle - _angleTarget;
|
_angle = _angle - _angleTarget;
|
||||||
_angleTarget = 0;
|
_angleTarget = 0;
|
||||||
|
|
||||||
_posTargetX = (cos _angleTarget) * _distance;
|
private _posTargetX = (cos _angleTarget) * _distance;
|
||||||
_posTargetY = (sin _angleTarget) * _distance;
|
private _posTargetY = (sin _angleTarget) * _distance;
|
||||||
|
|
||||||
_posX = 0;
|
private _posX = 0;
|
||||||
_posY = 0;
|
private _posY = 0;
|
||||||
|
|
||||||
_velocityX = (cos _angle) * _initSpeed;
|
private _velocityX = (cos _angle) * _initSpeed;
|
||||||
_velocityY = (sin _angle) * _initSpeed;
|
private _velocityY = (sin _angle) * _initSpeed;
|
||||||
|
|
||||||
// trace the path of the bullet
|
// trace the path of the bullet
|
||||||
for "_i" from 1 to ((floor (_timeToLive / _simulationStep)) + 1) do {
|
for "_i" from 1 to ((floor (_timeToLive / _simulationStep)) + 1) do {
|
||||||
_velocityMagnitude = sqrt (_velocityX^2 + _velocityY^2);
|
private _velocityMagnitude = sqrt (_velocityX^2 + _velocityY^2);
|
||||||
|
|
||||||
_velocityX = _velocityX + _simulationStep * (_velocityX * _velocityMagnitude * _airFriction);
|
_velocityX = _velocityX + _simulationStep * (_velocityX * _velocityMagnitude * _airFriction);
|
||||||
_velocityY = _velocityY + _simulationStep * (_velocityY * _velocityMagnitude * _airFriction - 9.81);
|
_velocityY = _velocityY + _simulationStep * (_velocityY * _velocityMagnitude * _airFriction - 9.81);
|
||||||
|
|
||||||
_posX = _posX + _velocityX * _simulationStep;
|
_posX = _posX + _velocityX * _simulationStep;
|
||||||
_posY = _posY + _velocityY * _simulationStep;
|
_posY = _posY + _velocityY * _simulationStep;
|
||||||
|
|
||||||
if (_posX >= _posTargetX) exitWith {}; // bullet passed the target
|
if (_posX >= _posTargetX) exitWith {}; // bullet passed the target
|
||||||
};
|
};
|
||||||
|
|
||||||
_posY - _posTargetY
|
_posY - _posTargetY
|
||||||
};
|
};
|
||||||
|
|
||||||
if ((_this + [_maxElev]) call FUNC(traceBullet) < 0) exitWith {_maxElev - _angleTarget};
|
private _data = [_distance, _angleTarget, _maxElev, _initSpeed, _airFriction, _timeToLive, _simulationStep, _maxElev];
|
||||||
|
|
||||||
|
if (_data call _fnc_traceBullet < 0) exitWith {_maxElev - _angleTarget};
|
||||||
|
|
||||||
// Newton Method / Secand Method
|
// Newton Method / Secand Method
|
||||||
_angle1 = _angleTarget;
|
private _angle1 = _angleTarget;
|
||||||
_angle2 = _maxElev;
|
private _angle2 = _maxElev;
|
||||||
_it2 = 0;
|
private _it2 = 0;
|
||||||
_f1 = (_this + [_angle1]) call FUNC(traceBullet);
|
|
||||||
|
_data set [7, _maxElev];
|
||||||
|
private _f1 = _data call _fnc_traceBullet;
|
||||||
|
|
||||||
|
if (abs _f1 <= PRECISION) exitWith {0};
|
||||||
|
|
||||||
|
while {abs _f1 > PRECISION} do {
|
||||||
|
_data set [7, _angle2];
|
||||||
|
private _f2 = _data call _fnc_traceBullet;
|
||||||
|
|
||||||
if ((abs _f1) <= PRECISION) exitWith {0};
|
|
||||||
while {(abs _f1) > PRECISION} do {
|
|
||||||
_f2 = (_this + [_angle2]) call FUNC(traceBullet);
|
|
||||||
_temp = _angle2-_f2*(_angle2-_angle1)/(_f2-_f1);
|
|
||||||
_angle1 = _angle2;
|
_angle1 = _angle2;
|
||||||
_angle2 = _temp;
|
_angle2 = _angle2 - _f2 * (_angle2 - _angle1) / (_f2 - _f1);
|
||||||
_f1 = _f2;
|
|
||||||
_it2 = _it2+1;
|
|
||||||
};
|
|
||||||
//player globalChat format ["it1: %1 | _angle1: %2 | it2: %3 | _angle2: %4",_it1, _angle-_angleTarget, _it2, _angle2-_angleTarget];
|
|
||||||
|
|
||||||
_angle=_angle2;
|
_f1 = _f2;
|
||||||
_angle - _angleTarget
|
_it2 = _it2 + 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
_angle2 - _angleTarget
|
||||||
|
@ -1,23 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
*
|
* Read laser distance measurement from engine.
|
||||||
* Read laser distance measurement from engine and update compatible info elements.
|
|
||||||
*
|
*
|
||||||
* Argument:
|
* Argument:
|
||||||
* Nothing
|
* None
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* Measured distance (Number)
|
* Measured distance <NUMBER>
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_dlgRangefinder", "_range"];
|
|
||||||
|
|
||||||
disableSerialization;
|
disableSerialization;
|
||||||
_dlgRangefinder = uiNamespace getVariable ["ACE_dlgRangefinder", displayNull];
|
private _dlgRangefinder = uiNamespace getVariable ["ACE_dlgRangefinder", displayNull];
|
||||||
|
|
||||||
_range = ctrlText (_dlgRangefinder displayCtrl 151);
|
parseNumber ctrlText (_dlgRangefinder displayCtrl 151);
|
||||||
(_dlgRangefinder displayCtrl 1713151) ctrlSetText _range;
|
|
||||||
|
|
||||||
parseNumber _range
|
|
||||||
|
@ -1,21 +1,32 @@
|
|||||||
// by commy2
|
/*
|
||||||
|
* Author: commy2
|
||||||
|
* Handle Air burst ammunition. Called from per frame handler.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* -
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_vehicle", "_projectile", "_zeroing", "_position", "_subMunition"];
|
(_this select 0) params ["_vehicle", "_projectile", "_zeroing"];
|
||||||
|
|
||||||
_vehicle = _this select 0 select 0;
|
|
||||||
_projectile = _this select 0 select 1;
|
|
||||||
_zeroing = _this select 0 select 2;
|
|
||||||
|
|
||||||
|
// remove pfh if the projectile died before arriving
|
||||||
if (isNull _projectile || {!alive _projectile}) exitWith {
|
if (isNull _projectile || {!alive _projectile}) exitWith {
|
||||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// wait if not there
|
||||||
if (_projectile distance _vehicle < _zeroing) exitWith {};
|
if (_projectile distance _vehicle < _zeroing) exitWith {};
|
||||||
|
|
||||||
_position = getPosATL _projectile;
|
// explode
|
||||||
|
private _position = getPosATL _projectile;
|
||||||
|
|
||||||
|
private _subMunition = createVehicle ["ACE_B_35mm_ABM_Helper", _position, [], 0, "FLY"];
|
||||||
|
|
||||||
_subMunition = createVehicle ["ACE_B_35mm_ABM_Helper", _position, [], 0, "FLY"];
|
|
||||||
_subMunition setPosATL _position;
|
_subMunition setPosATL _position;
|
||||||
_subMunition setVelocity [0, 0, -10];
|
_subMunition setVelocity [0, 0, -10];
|
||||||
|
|
||||||
|
@ -1,23 +1,22 @@
|
|||||||
/*
|
/*
|
||||||
* Author: KoffeinFlummi
|
* Author: KoffeinFlummi
|
||||||
*
|
|
||||||
* Starts watching the target for sideways correction.
|
* Starts watching the target for sideways correction.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Vehicle
|
* 0: Vehicle <OBJECT>
|
||||||
|
* 1: Turret <ARRAY>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* none
|
* None
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_vehicle", "_turret", "_distance", "_weaponDirection"];
|
params ["_vehicle", "_turret"];
|
||||||
|
|
||||||
_vehicle = _this select 0;
|
private _distance = call FUNC(getRange);
|
||||||
_turret = _this select 1;
|
call (updateRangeHUD);
|
||||||
|
|
||||||
_distance = call FUNC(getRange);
|
|
||||||
|
|
||||||
if !(!GVAR(enabled) && FUNC(canUseFCS)) exitWith {};
|
if !(!GVAR(enabled) && FUNC(canUseFCS)) exitWith {};
|
||||||
|
|
||||||
@ -28,7 +27,7 @@ if (_distance == 0) then {
|
|||||||
_distance = [5, 5000, 0] call EFUNC(common,getTargetDistance); // maximum distance: 5000m, 5m precision
|
_distance = [5, 5000, 0] call EFUNC(common,getTargetDistance); // maximum distance: 5000m, 5m precision
|
||||||
};
|
};
|
||||||
|
|
||||||
_weaponDirection = _vehicle weaponDirection (_vehicle currentWeaponTurret _turret); // @todo doesn't work for sub turrets
|
private _weaponDirection = _vehicle weaponDirection (_vehicle currentWeaponTurret _turret); // @todo doesn't work for sub turrets
|
||||||
|
|
||||||
if (_turret isEqualTo ([_vehicle] call EFUNC(common,getTurretCommander))) then {
|
if (_turret isEqualTo ([_vehicle] call EFUNC(common,getTurretCommander))) then {
|
||||||
_weaponDirection = eyeDirection _vehicle;
|
_weaponDirection = eyeDirection _vehicle;
|
||||||
@ -38,8 +37,4 @@ if (_weaponDirection isEqualTo [0,0,0]) then { // dummy value for non main turr
|
|||||||
_weaponDirection = [1,0,0];
|
_weaponDirection = [1,0,0];
|
||||||
};
|
};
|
||||||
|
|
||||||
GVAR(Position) = [
|
GVAR(Position) = (getPosASL _vehicle) vectorAdd (_weaponDirection vectorMultiply _distance);
|
||||||
(getPos _vehicle select 0) + _distance * (_weaponDirection select 0),
|
|
||||||
(getPos _vehicle select 1) + _distance * (_weaponDirection select 1),
|
|
||||||
(getPos _vehicle select 2) + _distance * (_weaponDirection select 2)
|
|
||||||
];
|
|
||||||
|
@ -1,40 +1,38 @@
|
|||||||
/*
|
/*
|
||||||
* Author: KoffeinFlummi
|
* Author: KoffeinFlummi
|
||||||
*
|
|
||||||
* Calculates the offsets for all weapons needed to hit the current target.
|
* Calculates the offsets for all weapons needed to hit the current target.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: The vehicle
|
* 0: Vehicle <OBJECT>
|
||||||
|
* 1: Turret <ARRAY>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* none
|
* None
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_vehicle", "_turret", "_turretConfig", "_distance", "_weapons", "_magazines", "_showHint", "_playSound", "_i"];
|
params ["_vehicle", "_turret", "_distance", ["_showHint", false], ["_playSound", true]];
|
||||||
|
|
||||||
_vehicle = _this select 0;
|
private _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call EFUNC(common,getTurretConfigPath);
|
||||||
_turret = _this select 1;
|
|
||||||
|
|
||||||
_turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call EFUNC(common,getTurretConfigPath);
|
call (updateRangeHUD);
|
||||||
|
|
||||||
_distance = call FUNC(getRange);
|
if (isNil "_distance") then {
|
||||||
|
_distance = call FUNC(getRange);
|
||||||
|
|
||||||
_weapons = _vehicle weaponsTurret _turret;
|
if (_distance == 0) then {
|
||||||
_magazines = _vehicle magazinesTurret _turret;
|
|
||||||
|
|
||||||
if (_distance == 0) then {
|
|
||||||
_distance = [
|
_distance = [
|
||||||
getNumber (_turretConfig >> QGVAR(DistanceInterval)),
|
getNumber (_turretConfig >> QGVAR(DistanceInterval)),
|
||||||
getNumber (_turretConfig >> QGVAR(MaxDistance)),
|
getNumber (_turretConfig >> QGVAR(MaxDistance)),
|
||||||
getNumber (_turretConfig >> QGVAR(MinDistance))
|
getNumber (_turretConfig >> QGVAR(MinDistance))
|
||||||
] call EFUNC(common,getTargetDistance); // maximum distance: 5000m, 5m precision
|
] call EFUNC(common,getTargetDistance); // maximum distance: 5000m, 5m precision
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
private ["_weapon", "_weaponDirection", "_angleTarget"];
|
private _weapon = _vehicle currentWeaponTurret _turret;
|
||||||
_weapon = _vehicle currentWeaponTurret _turret;
|
private _weaponDirection = _vehicle weaponDirection _weapon; // @todo doesn't work for sub turrets
|
||||||
_weaponDirection = _vehicle weaponDirection _weapon; // @todo doesn't work for sub turrets
|
|
||||||
|
|
||||||
if (_turret isEqualTo ([_vehicle] call EFUNC(common,getTurretCommander))) then {
|
if (_turret isEqualTo ([_vehicle] call EFUNC(common,getTurretCommander))) then {
|
||||||
_weaponDirection = eyeDirection _vehicle;
|
_weaponDirection = eyeDirection _vehicle;
|
||||||
@ -44,176 +42,139 @@ if (_weaponDirection isEqualTo [0,0,0]) then { // dummy value for non main turr
|
|||||||
_weaponDirection = [1,0,0];
|
_weaponDirection = [1,0,0];
|
||||||
};
|
};
|
||||||
|
|
||||||
_angleTarget = asin (_weaponDirection select 2);
|
private _angleTarget = asin (_weaponDirection select 2);
|
||||||
|
|
||||||
if (count _this > 2) then {
|
|
||||||
if((_this select 2) > -1) then {
|
|
||||||
_distance = _this select 2;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!(isNil QGVAR(backgroundCalculation)) and {!(scriptDone GVAR(backgroundCalculation))}) then {
|
|
||||||
terminate GVAR(backgroundCalculation);
|
|
||||||
};
|
|
||||||
|
|
||||||
private ["_movingAzimuth", "_posTarget", "_velocityTarget"];
|
|
||||||
|
|
||||||
// MOVING TARGETS
|
// MOVING TARGETS
|
||||||
_movingAzimuth = 0;
|
private _movingAzimuth = 0;
|
||||||
if (ACE_time - GVAR(time) > 1 and GVAR(time) != -1 and count _this < 3) then {
|
|
||||||
// calculate speed of target
|
|
||||||
_posTarget = [
|
|
||||||
(getPos _vehicle select 0) + _distance * (_weaponDirection select 0),
|
|
||||||
(getPos _vehicle select 1) + _distance * (_weaponDirection select 1),
|
|
||||||
(getPos _vehicle select 2) + _distance * (_weaponDirection select 2)
|
|
||||||
];
|
|
||||||
_velocityTarget = [
|
|
||||||
((_posTarget select 0) - (GVAR(position) select 0)) / (ACE_time - GVAR(time)),
|
|
||||||
((_posTarget select 1) - (GVAR(position) select 1)) / (ACE_time - GVAR(time)),
|
|
||||||
((_posTarget select 2) - (GVAR(position) select 2)) / (ACE_time - GVAR(time))
|
|
||||||
];
|
|
||||||
|
|
||||||
private ["_magazineType", "_ammoType", "_initSpeed", "_airFriction", "_timeToLive", "_simulationStep", "_initSpeedCoef", "_velocityMagnitude"];
|
if (ACE_time - GVAR(time) > 1 && GVAR(time) != -1 && isNil {_this select 2}) then {
|
||||||
|
// calculate speed of target
|
||||||
|
private _posTarget = (getPosASL _vehicle) vectorAdd (_weaponDirection vectorMultiply _distance);
|
||||||
|
private _velocityTarget = (_posTarget vectorDiff GVAR(position)) vectorMultiply (1 / (ACE_time - GVAR(time)));
|
||||||
|
|
||||||
// estimate time to target
|
// estimate time to target
|
||||||
_magazineType = _vehicle currentMagazineTurret _turret;
|
private _magazine = _vehicle currentMagazineTurret _turret;
|
||||||
_ammoType = getText (configFile >> "CfgMagazines" >> _magazineType >> "ammo");
|
private _ammo = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo");
|
||||||
_initSpeed = getNumber (configFile >> "CfgMagazines" >> _magazineType >> "initSpeed");
|
private _initSpeed = getNumber (configFile >> "CfgMagazines" >> _magazine >> "initSpeed");
|
||||||
_airFriction = getNumber (configFile >> "CfgAmmo" >> _ammoType >> "airFriction");
|
private _airFriction = getNumber (configFile >> "CfgAmmo" >> _ammo >> "airFriction");
|
||||||
_timeToLive = getNumber (configFile >> "CfgAmmo" >> _ammoType >> "timeToLive");
|
private _timeToLive = getNumber (configFile >> "CfgAmmo" >> _ammo >> "timeToLive");
|
||||||
_simulationStep = getNumber (configFile >> "CfgAmmo" >> _ammoType >> "simulationStep");
|
private _simulationStep = getNumber (configFile >> "CfgAmmo" >> _ammo >> "simulationStep");
|
||||||
|
private _initSpeedCoef = getNumber (configFile >> "CfgWeapons" >> _weapon >> "initSpeed");
|
||||||
|
|
||||||
_initSpeedCoef = getNumber(configFile >> "CfgWeapons" >> _weapon >> "initSpeed");
|
|
||||||
if (_initSpeedCoef < 0) then {
|
if (_initSpeedCoef < 0) then {
|
||||||
_initSpeed = _initSpeed * -_initSpeedCoef;
|
_initSpeed = _initSpeed * - _initSpeedCoef;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_initSpeedCoef > 0) then {
|
if (_initSpeedCoef > 0) then {
|
||||||
_initSpeed = _initSpeedCoef;
|
_initSpeed = _initSpeedCoef;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_simulationStep != 0) then {
|
if (_simulationStep != 0) then {
|
||||||
private ["_posX", "_velocityX", "_velocityY", "_timeToTarget"];
|
private _posX = 0;
|
||||||
|
private _velocityX = _initSpeed;
|
||||||
|
private _velocityY = 0;
|
||||||
|
private _timeToTarget = 0;
|
||||||
|
|
||||||
_posX = 0;
|
for "_i" from 1 to (floor (_timeToLive / _simulationStep) + 1) do {
|
||||||
_velocityX = _initSpeed;
|
|
||||||
_velocityY = 0;
|
|
||||||
_timeToTarget = 0;
|
|
||||||
|
|
||||||
for "_i" from 1 to ((floor (_timeToLive / _simulationStep)) + 1) do {
|
|
||||||
_posX = _posX + _velocityX * _simulationStep;
|
_posX = _posX + _velocityX * _simulationStep;
|
||||||
|
|
||||||
if (_posX >= _distance) exitWith { // bullet passed the target
|
if (_posX >= _distance) exitWith { // bullet passed the target
|
||||||
_timeToTarget = _i * _simulationStep;
|
_timeToTarget = _i * _simulationStep;
|
||||||
};
|
};
|
||||||
_velocityMagnitude = sqrt (_velocityX^2 + _velocityY^2);
|
|
||||||
|
private _velocityMagnitude = sqrt (_velocityX ^ 2 + _velocityY ^ 2);
|
||||||
|
|
||||||
_velocityX = _velocityX + _velocityX * _velocityMagnitude * _airFriction * _simulationStep;
|
_velocityX = _velocityX + _velocityX * _velocityMagnitude * _airFriction * _simulationStep;
|
||||||
_velocityY = _velocityY + _velocityY * _velocityMagnitude * _airFriction * _simulationStep - 9.81 * _simulationStep;
|
_velocityY = _velocityY + _velocityY * _velocityMagnitude * _airFriction * _simulationStep - 9.81 * _simulationStep;
|
||||||
};
|
};
|
||||||
|
|
||||||
private ["_posArrival", "_dirArrival"];
|
|
||||||
|
|
||||||
// calculate offsets
|
// calculate offsets
|
||||||
_posArrival = [
|
private _posArrival = _posTarget vectorAdd (_velocityTarget vectorMultiply _timeToTarget);
|
||||||
(_posTarget select 0) + (_velocityTarget select 0) * _timeToTarget,
|
private _dirArrival = (_posArrival vectorDiff getPosASL _vehicle) vectorMultiply (1 / (_posArrival vectorDistance getPosASL _vehicle));
|
||||||
(_posTarget select 1) + (_velocityTarget select 1) * _timeToTarget,
|
|
||||||
(_posTarget select 2) + (_velocityTarget select 2) * _timeToTarget
|
|
||||||
];
|
|
||||||
|
|
||||||
_dirArrival = [
|
|
||||||
((_posArrival select 0) - (getPos _vehicle select 0)) / (_posArrival distance (getPos _vehicle)),
|
|
||||||
((_posArrival select 1) - (getPos _vehicle select 1)) / (_posArrival distance (getPos _vehicle)),
|
|
||||||
((_posArrival select 2) - (getPos _vehicle select 2)) / (_posArrival distance (getPos _vehicle))
|
|
||||||
];
|
|
||||||
|
|
||||||
_movingAzimuth = ((_dirArrival select 0) atan2 (_dirArrival select 1)) - ((_weaponDirection select 0) atan2 (_weaponDirection select 1));
|
_movingAzimuth = ((_dirArrival select 0) atan2 (_dirArrival select 1)) - ((_weaponDirection select 0) atan2 (_weaponDirection select 1));
|
||||||
_angleTarget = asin (_dirArrival select 2);
|
_angleTarget = asin (_dirArrival select 2);
|
||||||
_distance = floor (_posArrival distance (getPos _vehicle));
|
_distance = floor (_posArrival distance (getPosASL _vehicle));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
GVAR(enabled) = false;
|
GVAR(enabled) = false;
|
||||||
GVAR(time) = -1;
|
GVAR(time) = -1;
|
||||||
|
|
||||||
private ["_viewDiff", "_FCSAzimuth", "_FCSMagazines", "_FCSElevation"];
|
|
||||||
|
|
||||||
// CALCULATE AZIMUTH CORRECTION
|
// CALCULATE AZIMUTH CORRECTION
|
||||||
_viewDiff = _vehicle getVariable format ["%1_%2", QGVAR(ViewDiff), _turret];
|
private _viewDiff = _vehicle getVariable format ["%1_%2", QGVAR(ViewDiff), _turret];
|
||||||
_FCSAzimuth = _movingAzimuth;
|
private _FCSAzimuth = _movingAzimuth;
|
||||||
|
|
||||||
if (_viewDiff != 0) then {
|
if (_viewDiff != 0) then {
|
||||||
_FCSAzimuth = (atan (_distance / _viewDiff) - (abs _viewDiff / _viewDiff) * 90) + _movingAzimuth;
|
_FCSAzimuth = (atan (_distance / _viewDiff) - (abs _viewDiff / _viewDiff) * 90) + _movingAzimuth;
|
||||||
};
|
};
|
||||||
|
|
||||||
// CALCULATE OFFSET
|
// CALCULATE OFFSET
|
||||||
_FCSMagazines = [];
|
private _FCSMagazines = [];
|
||||||
_FCSElevation = [];
|
private _FCSElevation = [];
|
||||||
|
|
||||||
{
|
{
|
||||||
private ["_magazine", "_ammoType"];
|
private _magazine = _x;
|
||||||
_magazine = _x;
|
private _ammo = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo");
|
||||||
_ammoType = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo");
|
|
||||||
|
|
||||||
if !(getText (configFile >> "CfgAmmo" >> _ammoType >> "simulation") == "shotMissile") then {
|
if !(getText (configFile >> "CfgAmmo" >> _ammo >> "simulation") == "shotMissile") then {
|
||||||
private ["_maxElev", "_initSpeed", "_airFriction", "_offset"];
|
private _maxElev = getNumber (_turretConfig >> "maxElev");
|
||||||
|
private _initSpeed = getNumber (configFile >> "CfgMagazines" >> _magazine >> "initSpeed");
|
||||||
_maxElev = getNumber (_turretConfig >> "maxElev");
|
private _airFriction = getNumber (configFile >> "CfgAmmo" >> _ammo >> "airFriction");
|
||||||
_initSpeed = getNumber (configFile >> "CfgMagazines" >> _magazine >> "initSpeed");
|
|
||||||
_airFriction = getNumber (configFile >> "CfgAmmo" >> _ammoType >> "airFriction");
|
|
||||||
|
|
||||||
{
|
{
|
||||||
private ["_weapon", "_muzzles", "_weaponMagazines", "_muzzleMagazines"];
|
private ["_weapon", "_muzzles", "_weaponMagazines", "_muzzleMagazines"];
|
||||||
_weapon = _x;
|
_weapon = _x;
|
||||||
_muzzles = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles");
|
_muzzles = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles");
|
||||||
_weaponMagazines = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines");
|
_weaponMagazines = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines");
|
||||||
|
|
||||||
{
|
{
|
||||||
if (_x != "this") then {
|
if (_x != "this") then {
|
||||||
_muzzleMagazines = getArray (configFile >> "CfgWeapons" >> _weapon >> _x >> "magazines");
|
_muzzleMagazines = getArray (configFile >> "CfgWeapons" >> _weapon >> _x >> "magazines");
|
||||||
_weaponMagazines append _muzzleMagazines;
|
_weaponMagazines append _muzzleMagazines;
|
||||||
};
|
};
|
||||||
} forEach _muzzles;
|
false
|
||||||
|
} count _muzzles;
|
||||||
|
|
||||||
if (_magazine in _weaponMagazines) exitWith {
|
if (_magazine in _weaponMagazines) exitWith {
|
||||||
_initSpeedCoef = getNumber(configFile >> "CfgWeapons" >> _weapon >> "initSpeed");
|
_initSpeedCoef = getNumber(configFile >> "CfgWeapons" >> _weapon >> "initSpeed");
|
||||||
|
|
||||||
if (_initSpeedCoef < 0) then {
|
if (_initSpeedCoef < 0) then {
|
||||||
_initSpeed = _initSpeed * -_initSpeedCoef;
|
_initSpeed = _initSpeed * -_initSpeedCoef;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_initSpeedCoef > 0) then {
|
if (_initSpeedCoef > 0) then {
|
||||||
_initSpeed = _initSpeedCoef;
|
_initSpeed = _initSpeedCoef;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} forEach _weapons;
|
false
|
||||||
|
} count (_vehicle weaponsTurret _turret);
|
||||||
|
|
||||||
_offset = "ace_fcs" callExtension format ["%1,%2,%3,%4", _initSpeed, _airFriction, _angleTarget, _distance];
|
private _offset = "ace_fcs" callExtension format ["%1,%2,%3,%4", _initSpeed, _airFriction, _angleTarget, _distance];
|
||||||
_offset = parseNumber _offset;
|
_offset = parseNumber _offset;
|
||||||
|
|
||||||
_FCSMagazines = _FCSMagazines + [_magazine];
|
_FCSMagazines pushBack _magazine;
|
||||||
_FCSElevation = _FCSElevation + [_offset];
|
_FCSElevation pushBack _offset;
|
||||||
};
|
};
|
||||||
} forEach _magazines;
|
false
|
||||||
|
} count (_vehicle magazinesTurret _turret);
|
||||||
|
|
||||||
[_vehicle, format ["%1_%2", QGVAR(Distance), _turret], _distance] call EFUNC(common,setVariablePublic);
|
[_vehicle, format ["%1_%2", QGVAR(Distance), _turret], _distance] call EFUNC(common,setVariablePublic);
|
||||||
[_vehicle, format ["%1_%2", QGVAR(Magazines), _turret], _FCSMagazines] call EFUNC(common,setVariablePublic);
|
[_vehicle, format ["%1_%2", QGVAR(Magazines), _turret], _FCSMagazines] call EFUNC(common,setVariablePublic);
|
||||||
[_vehicle, format ["%1_%2", QGVAR(Elevation), _turret], _FCSElevation] call EFUNC(common,setVariablePublic);
|
[_vehicle, format ["%1_%2", QGVAR(Elevation), _turret], _FCSElevation] call EFUNC(common,setVariablePublic);
|
||||||
[_vehicle, format ["%1_%2", QGVAR(Azimuth), _turret], _FCSAzimuth] call EFUNC(common,setVariablePublic);
|
[_vehicle, format ["%1_%2", QGVAR(Azimuth), _turret], _FCSAzimuth] call EFUNC(common,setVariablePublic);
|
||||||
|
|
||||||
_showHint = false;
|
if (_playSound) then {
|
||||||
if( (count _this) > 3) then {
|
|
||||||
_showHint = _this select 3;
|
|
||||||
};
|
|
||||||
|
|
||||||
_playSound = true;
|
|
||||||
if( (count _this) > 3) then {
|
|
||||||
_playSound = _this select 4;
|
|
||||||
};
|
|
||||||
|
|
||||||
if(_playSound) then {
|
|
||||||
playSound "ACE_Sound_Click";
|
playSound "ACE_Sound_Click";
|
||||||
};
|
};
|
||||||
|
|
||||||
if(_showHint) then {
|
if (_showHint) then {
|
||||||
[format ["%1: %2", localize LSTRING(ZeroedTo), _distance]] call EFUNC(common,displayTextStructured);
|
[format ["%1: %2", localize LSTRING(ZeroedTo), _distance]] call EFUNC(common,displayTextStructured);
|
||||||
};
|
};
|
||||||
|
|
||||||
//Update the hud's distance display to the new value or "----" if out of range
|
//Update the hud's distance display to the new value or "----" if out of range
|
||||||
//(10m fudge because of EFUNC(common,getTargetDistance))
|
//(10m fudge because of EFUNC(common,getTargetDistance))
|
||||||
if ((_distance + 10) >= (getNumber (_turretConfig >> QGVAR(MaxDistance)))) then {
|
if (_distance + 10 >= getNumber (_turretConfig >> QGVAR(MaxDistance))) then {
|
||||||
((uiNamespace getVariable ["ACE_dlgRangefinder", displayNull]) displayCtrl 1713151) ctrlSetText "----";
|
((uiNamespace getVariable ["ACE_dlgRangefinder", displayNull]) displayCtrl 1713151) ctrlSetText "----";
|
||||||
} else {
|
} else {
|
||||||
((uiNamespace getVariable ["ACE_dlgRangefinder", displayNull]) displayCtrl 1713151) ctrlSetText ([_distance, 4, 0] call CBA_fnc_formatNumber);
|
((uiNamespace getVariable ["ACE_dlgRangefinder", displayNull]) displayCtrl 1713151) ctrlSetText ([_distance, 4, 0] call CBA_fnc_formatNumber);
|
||||||
|
@ -1,7 +1,13 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
if !([ACE_player, vehicle ACE_player, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
params ["_unit"];
|
||||||
|
|
||||||
|
private _vehicle = vehicle _unit;
|
||||||
|
|
||||||
|
if !([_unit, _vehicle, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||||
if !((!GVAR(enabled) && FUNC(canUseFCS)) || FUNC(canUseRangefinder)) exitWith {false};
|
if !((!GVAR(enabled) && FUNC(canUseFCS)) || FUNC(canUseRangefinder)) exitWith {false};
|
||||||
|
|
||||||
[vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex), -1, false] call FUNC(keyDown);
|
private _turret = _unit call EFUNC(common,getTurretIndex);
|
||||||
[vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex), -1, false, false] call FUNC(keyUp);
|
|
||||||
|
[_vehicle, _turret, -1, false] call FUNC(keyDown);
|
||||||
|
[_vehicle, _turret, -1, false, false] call FUNC(keyUp);
|
||||||
|
@ -1,21 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* Author: KoffeinFlummi
|
* Author: KoffeinFlummi
|
||||||
*
|
|
||||||
* Resets the FCS to default.
|
* Resets the FCS to default.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Vehicle
|
* 0: Vehicle <OBJECT>
|
||||||
|
* 1: Turret <ARRAY>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* none
|
* none
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_vehicle", "_turret"];
|
params ["_vehicle", "_turret"];
|
||||||
|
|
||||||
_vehicle = _this select 0;
|
|
||||||
_turret = _this select 1;
|
|
||||||
|
|
||||||
[_vehicle, format ["%1_%2", QGVAR(Distance), _turret], 0] call EFUNC(common,setVariablePublic);
|
[_vehicle, format ["%1_%2", QGVAR(Distance), _turret], 0] call EFUNC(common,setVariablePublic);
|
||||||
[_vehicle, format ["%1_%2", QGVAR(Magazines), _turret], []] call EFUNC(common,setVariablePublic);
|
[_vehicle, format ["%1_%2", QGVAR(Magazines), _turret], []] call EFUNC(common,setVariablePublic);
|
||||||
|
18
addons/fcs/functions/fnc_updateRangeHUD.sqf
Normal file
18
addons/fcs/functions/fnc_updateRangeHUD.sqf
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* Author: commy2
|
||||||
|
* Update compatible info elements.
|
||||||
|
*
|
||||||
|
* Argument:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Return value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
disableSerialization;
|
||||||
|
private _dlgRangefinder = uiNamespace getVariable ["ACE_dlgRangefinder", displayNull];
|
||||||
|
|
||||||
|
(_dlgRangefinder displayCtrl 1713151) ctrlSetText ctrlText (_dlgRangefinder displayCtrl 151);
|
@ -1,6 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Author: KoffeinFlummi, commy2
|
* Author: KoffeinFlummi, commy2
|
||||||
*
|
|
||||||
* Checks if a vehicle is equipped with an FCS and if so, adds the fired event handler. Execute on server.
|
* Checks if a vehicle is equipped with an FCS and if so, adds the fired event handler. Execute on server.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
@ -8,17 +7,15 @@
|
|||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* none
|
* none
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private "_vehicle";
|
params ["_vehicle"];
|
||||||
|
|
||||||
_vehicle = _this select 0;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
private "_turretConfig";
|
private _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _x] call EFUNC(common,getTurretConfigPath);
|
||||||
_turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _x] call EFUNC(common,getTurretConfigPath);
|
|
||||||
|
|
||||||
if (getNumber (_turretConfig >> QGVAR(Enabled)) == 1) then {
|
if (getNumber (_turretConfig >> QGVAR(Enabled)) == 1) then {
|
||||||
_vehicle setVariable [format ["%1_%2", QGVAR(Distance), _x], 0, true];
|
_vehicle setVariable [format ["%1_%2", QGVAR(Distance), _x], 0, true];
|
||||||
@ -42,4 +39,5 @@ _vehicle = _this select 0;
|
|||||||
_vehicle setVariable [format ["%1_%2", QGVAR(ViewDiff), _x], 0, true];
|
_vehicle setVariable [format ["%1_%2", QGVAR(ViewDiff), _x], 0, true];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} forEach allTurrets _vehicle;
|
false
|
||||||
|
} count allTurrets _vehicle;
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
[vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex)] call FUNC(keyUp);
|
[vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex)] call FUNC(keyUp);
|
||||||
false
|
false
|
||||||
},
|
},
|
||||||
[15, [false, false, false]], false] call cba_fnc_addKeybind; //Tab Key
|
[15, [false, false, false]], false] call CBA_fnc_addKeybind; //Tab Key
|
||||||
|
|
||||||
["ACE3 Vehicles", QGVAR(adjustRangeUp), localize LSTRING(AdjustRangeUp),
|
["ACE3 Vehicles", QGVAR(adjustRangeUp), localize LSTRING(AdjustRangeUp),
|
||||||
{
|
{
|
||||||
@ -42,7 +42,7 @@
|
|||||||
true
|
true
|
||||||
},
|
},
|
||||||
{false},
|
{false},
|
||||||
[201, [false, false, false]], false] call cba_fnc_addKeybind; //PageUp Key
|
[201, [false, false, false]], false] call CBA_fnc_addKeybind; //PageUp Key
|
||||||
|
|
||||||
["ACE3 Vehicles", QGVAR(adjustRangDown), localize LSTRING(AdjustRangeDown),
|
["ACE3 Vehicles", QGVAR(adjustRangDown), localize LSTRING(AdjustRangeDown),
|
||||||
{
|
{
|
||||||
@ -56,4 +56,4 @@
|
|||||||
true
|
true
|
||||||
},
|
},
|
||||||
{false},
|
{false},
|
||||||
[209, [false, false, false]], false] call cba_fnc_addKeybind; //PageDown Key
|
[209, [false, false, false]], false] call CBA_fnc_addKeybind; //PageDown Key
|
||||||
|
Loading…
x
Reference in New Issue
Block a user