Scopes - Allow Scope Adjust from FFV

This commit is contained in:
PabstMirror 2016-05-19 21:39:15 -05:00
parent 709916c0f3
commit 508b71e7ba
9 changed files with 65 additions and 11 deletions

View File

@ -22,6 +22,7 @@ private _min = getNumber (_turretConfig >> QGVAR(MinDistance));
private _max = getNumber (_turretConfig >> QGVAR(MaxDistance));
private _distance = _vehicle getVariable [format ["%1_%2", QGVAR(Distance), _turret], _min];
TRACE_4("",_distance,_delta,_min,_max);
_distance = _distance + _delta;
_distance = _distance min _max;

View File

@ -15,6 +15,7 @@
*/
#include "script_component.hpp"
params ["_vehicle","_turret","_distance","_angleTarget"];
TRACE_4("params",_vehicle,_turret,_distance,_angleTarget);
private _FCSMagazines = [];
private _FCSElevation = [];

View File

@ -8,9 +8,18 @@
* Return Value:
* Boolean <BOOL>
*
* Example:
* [] call ace_fcs_fnc_canUseFCS
*
* Public: No
*/
#include "script_component.hpp"
getNumber ([configFile >> "CfgVehicles" >> typeOf vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex)] call EFUNC(common,getTurretConfigPath) >> QGVAR(Enabled)) == 1
&& {cameraView == "GUNNER"} // return
&& {cameraView == "GUNNER"}
&& {
private _animationState = animationState ACE_player;
private _moves = configFile >> getText (configFile >> "CfgVehicles" >> (typeof ACE_player) >> "moves");
(getNumber (_moves >> "States" >> _animationState >> "canPullTrigger") == 0)
}

View File

@ -14,6 +14,7 @@
#include "script_component.hpp"
params ["_vehicle", "_turret", "_distance", ["_showHint", false], ["_playSound", true]];
TRACE_5("params",_vehicle,_turret,_distance,_showHint,_playSound);
private _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call EFUNC(common,getTurretConfigPath);

View File

@ -2,6 +2,7 @@
PREP(adjustScope);
PREP(adjustZero);
PREP(applyScopeAdjustment);
PREP(canAdjustScope);
PREP(canAdjustZero);
PREP(firedEH);
PREP(getOptics);

View File

@ -33,8 +33,10 @@ if (!hasInterface) exitWith {};
["ACE3 Scope Adjustment", QGVAR(AdjustUpMinor), localize LSTRING(AdjustUpMinor),
{
// Conditions: canInteract
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
if (!([ACE_player] call FUNC(canAdjustScope))) exitWith {false};
[ACE_player] call FUNC(inventoryCheck);
// Statement
@ -46,8 +48,10 @@ if (!hasInterface) exitWith {};
["ACE3 Scope Adjustment", QGVAR(AdjustDownMinor), localize LSTRING(AdjustDownMinor),
{
// Conditions: canInteract
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
if (!([ACE_player] call FUNC(canAdjustScope))) exitWith {false};
[ACE_player] call FUNC(inventoryCheck);
// Statement
@ -59,8 +63,10 @@ if (!hasInterface) exitWith {};
["ACE3 Scope Adjustment", QGVAR(AdjustLeftMinor), localize LSTRING(AdjustLeftMinor),
{
// Conditions: canInteract
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
if (!([ACE_player] call FUNC(canAdjustScope))) exitWith {false};
[ACE_player] call FUNC(inventoryCheck);
// Statement
@ -72,8 +78,10 @@ if (!hasInterface) exitWith {};
["ACE3 Scope Adjustment", QGVAR(AdjustRightMinor), localize LSTRING(AdjustRightMinor),
{
// Conditions: canInteract
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
if (!([ACE_player] call FUNC(canAdjustScope))) exitWith {false};
[ACE_player] call FUNC(inventoryCheck);
// Statement
@ -85,8 +93,10 @@ if (!hasInterface) exitWith {};
["ACE3 Scope Adjustment", QGVAR(AdjustUpMajor), localize LSTRING(AdjustUpMajor),
{
// Conditions: canInteract
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
if (!([ACE_player] call FUNC(canAdjustScope))) exitWith {false};
[ACE_player] call FUNC(inventoryCheck);
// Statement
@ -98,8 +108,10 @@ if (!hasInterface) exitWith {};
["ACE3 Scope Adjustment", QGVAR(AdjustDownMajor), localize LSTRING(AdjustDownMajor),
{
// Conditions: canInteract
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
if (!([ACE_player] call FUNC(canAdjustScope))) exitWith {false};
[ACE_player] call FUNC(inventoryCheck);
// Statement
@ -111,8 +123,10 @@ if (!hasInterface) exitWith {};
["ACE3 Scope Adjustment", QGVAR(AdjustLeftMajor), localize LSTRING(AdjustLeftMajor),
{
// Conditions: canInteract
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
if (!([ACE_player] call FUNC(canAdjustScope))) exitWith {false};
[ACE_player] call FUNC(inventoryCheck);
// Statement
@ -124,8 +138,10 @@ if (!hasInterface) exitWith {};
["ACE3 Scope Adjustment", QGVAR(AdjustRightMajor), localize LSTRING(AdjustRightMajor),
{
// Conditions: canInteract
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
if (!([ACE_player] call FUNC(canAdjustScope))) exitWith {false};
[ACE_player] call FUNC(inventoryCheck);
// Statement

View File

@ -4,6 +4,4 @@ ADDON = false;
#include "XEH_PREP.hpp"
GVAR(fadeScript) = scriptNull;
ADDON = true;

View File

@ -0,0 +1,26 @@
/*
* Author: PabstMirror
* Tests if player would be in a position to adjust scope
* Mainly for determining edge cases with turned-out / FFV.
*
* Argument:
* 0: Unit <OBJECT>
*
* Return value:
* <BOOL>
*
* Example:
* [player] call ace_scopes_fnc_canAdjustScope
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit"];
if ((vehicle _unit) == _unit) exitWith {true};
private _animationState = animationState _unit;
private _moves = configFile >> getText (configFile >> "CfgVehicles" >> (typeof _unit) >> "moves");
(getNumber (_moves >> "States" >> _animationState >> "canPullTrigger") == 1)

View File

@ -24,6 +24,7 @@ _weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex);
if (_weaponIndex < 0) exitWith {};
_zeroing = _adjustment select _weaponIndex;
TRACE_1("Adjusting With",_zeroing);
if (_zeroing isEqualTo [0, 0, 0]) exitWith {};