Merge pull request #66 from KoffeinFlummi/cbaKeyBinds

Cba key binds for various modules
This commit is contained in:
Nicolás Badano 2015-01-18 18:46:43 -03:00
commit 6731a8e1d6
24 changed files with 261 additions and 129 deletions

View File

@ -12,5 +12,5 @@
#include "script_component.hpp"
_player == gunner _vehicle
&& (count (_vehicle getVariable [QGVAR(Magazines), []]) > 1)
ACE_player == gunner vehicle ACE_player
&& (count ((vehicle ACE_player) getVariable [QGVAR(Magazines), []]) > 1)

View File

@ -12,6 +12,6 @@
#include "script_component.hpp"
_player == gunner _vehicle
&& {getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(Enabled)) == 1}
ACE_player == gunner vehicle ACE_player
&& {getNumber (configFile >> "CfgVehicles" >> typeOf (vehicle ACE_player) >> QGVAR(Enabled)) == 1}
&& {cameraView == "GUNNER"}

View File

@ -4,6 +4,12 @@ class Extended_PreInit_EventHandlers {
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE( call COMPILE_FILE(XEH_postInit) );
};
};
class Extended_FiredBIS_EventHandlers {
class CAManBase {
class GVAR(Overheat) {

View File

@ -0,0 +1,25 @@
// by CAA-Picard
#include "script_component.hpp"
if !(hasInterface) exitWith {};
// Add keybinds
["ACE3",
localize "STR_ACE_Overheating_UnjamWeapon",
{
// Conditions: canInteract
_exceptions = [];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
// Conditions: specific
if !([ACE_player] call EFUNC(common,canUseWeapon) &&
{currentWeapon ACE_player in (ACE_player getVariable [QGVAR(jammedWeapons), []])}
) exitWith {false};
// Statement
[ACE_player, currentMuzzle ACE_player, false] call FUNC(clearJam);
true
},
[19, [true, false, false]],
false,
"keydown"
] call cba_fnc_registerKeybind;

View File

@ -14,18 +14,6 @@ class CfgPatches {
#include "CfgEventHandlers.hpp"
class ACE_Default_Keys {
class clearJam {
displayName = "$STR_ACE_Overheating_UnjamWeapon";
condition = QUOTE( [_player] call EFUNC(common,canUseWeapon) && {currentWeapon _player in (_player getVariable [ARR_2(QUOTE(QGVAR(jammedWeapons)), [])])} );
statement = QUOTE( [ARR_3(_player, currentMuzzle _player, false)] call FUNC(clearJam); );
key = 19;
shift = 1;
control = 0;
alt = 0;
};
};
#include "CfgSounds.hpp"
#include "CfgVehicles.hpp"

View File

@ -5,6 +5,12 @@ class Extended_PreInit_EventHandlers {
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE( call COMPILE_FILE(XEH_postInit) );
};
};
class Extended_Take_EventHandlers {
class CAManBase {
class ACE_AmmoIndicatorReload {

View File

@ -0,0 +1,24 @@
// by CAA-Picard
#include "script_component.hpp"
if !(hasInterface) exitWith {};
// Add keybinds
["ACE3",
localize "STR_ACE_Reload_checkAmmo",
{
// Conditions: canInteract
_exceptions = [];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
// Conditions: specific
if !([ACE_player] call EFUNC(common,canUseWeapon) ||
{(vehicle ACE_player) isKindOf 'StaticWeapon'}) exitWith {false};
// Statement
[ACE_player, vehicle ACE_player, false] call FUNC(checkAmmo);
true
},
[19, [false, true, false]],
false,
"keydown"
] call cba_fnc_registerKeybind;

View File

@ -13,18 +13,7 @@ class CfgPatches {
};
#include "CfgEventHandlers.hpp"
#include "CfgActions.hpp"
class ACE_Default_Keys {
class checkAmmo {
displayName = "$STR_ACE_Reload_checkAmmo";
condition = QUOTE([_player] call EFUNC(common,canUseWeapon) || {_vehicle isKindOf 'StaticWeapon'});
statement = QUOTE([ARR_3(_player, _vehicle, false)] call FUNC(checkAmmo););
key = 19;
shift = 0;
control = 1;
alt = 0;
};
};
#include "RscInGameUI.hpp"

View File

@ -4,3 +4,9 @@ class Extended_PreInit_EventHandlers {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE( call COMPILE_FILE(XEH_postInit) );
};
};

View File

@ -0,0 +1,26 @@
// by CAA-Picard
#include "script_component.hpp"
if !(hasInterface) exitWith {};
// Add keybinds
["ACE3",
localize "STR_ACE_Resting_RestWeapon",
{
// Conditions: canInteract
_exceptions = [];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
// Conditions: specific
if !([ACE_player] call EFUNC(common,canUseWeapon) &&
{inputAction 'reloadMagazine' == 0} &&
{!weaponLowered ACE_player} &&
{speed ACE_player < 1}) exitWith {false};
// Statement
[ACE_player, vehicle ACE_player, currentWeapon ACE_player] call FUNC(restWeapon);
true
},
[15, [false, false, false]],
false,
"keydown"
] call cba_fnc_registerKeybind;

View File

@ -14,18 +14,6 @@ class CfgPatches {
#include "CfgEventHandlers.hpp"
class ACE_Default_Keys {
class restWeapon {
displayName = "$STR_ACE_Resting_RestWeapon";
condition = QUOTE([_player] call EFUNC(common,canUseWeapon) && {inputAction 'reloadMagazine' == 0} && {!weaponLowered _player} && {speed _player < 1});
statement = QUOTE([ARR_3(_player, _vehicle, currentWeapon _player)] call FUNC(restWeapon));
key = 15;
shift = 0;
control = 0;
alt = 0;
};
};
#include "CfgWeapons.hpp"
#include "CfgMoves.hpp"

View File

@ -1,5 +1,25 @@
// by commy2
// by CAA-Picard
#include "script_component.hpp"
//["Soldier", {_player = ACE_player; if (currentWeapon _player in (_player getVariable [QGVAR(safedWeapons), []])) then {[false] call FUNC(setSafeModeVisual)}] call EFUNC(common,addInfoDisplayEventHandler);
//@todo addEventHandler infoDisplayChanged with select 1 == "Soldier"
// Add keybinds
["ACE3",
localize "STR_ACE_SafeMode_SafeMode",
{
// Conditions: canInteract
_exceptions = [QEGVAR(interaction,isNotEscorting)];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
// Conditions: specific
if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false};
// Statement
[ACE_player, currentWeapon ACE_player, currentMuzzle ACE_player] call FUNC(lockSafety);
true
},
[41, [false, true, false]],
false,
"keydown"
] call cba_fnc_registerKeybind;

View File

@ -13,16 +13,3 @@ class CfgPatches {
};
#include "CfgEventHandlers.hpp"
class ACE_Default_Keys {
class safeWeapon {
displayName = "$STR_ACE_SafeMode_SafeMode";
condition = QUOTE([_player] call EFUNC(common,canUseWeapon));
statement = QUOTE([ARR_3(_player, currentWeapon _player, currentMuzzle _player)] call FUNC(lockSafety));
exceptions[] = {"ACE_interaction_isNotEscorting"};
key = 41;
shift = 0;
control = 1;
alt = 0;
};
};

View File

@ -1,10 +1,10 @@
class RscTitles {
class ACE_Scope_Zeroing {
class ACE_Scopes_Zeroing {
idd = -1;
movingEnable = 0;
enableSimulation = 1;
enableDisplay = 1;
onLoad = QUOTE(_this spawn compile preprocessFileLineNumbers 'z\ace\scopes\scripts\zeroingOnLoad.sqf'; uiNamespace setVariable [ARR_2('ACE_Scopes_Debug', _this)];);
onLoad = QUOTE(_this spawn compile preprocessFileLineNumbers QUOTE(QUOTE(PATHTOF(scripts\zeroingOnLoad.sqf))); uiNamespace setVariable [ARR_2('ACE_Scopes_Debug', _this)];);
duration = 1e+011;
fadein = 0;
fadeout = 0;

View File

@ -1,42 +1,115 @@
/*
* Author: KoffeinFlummi
* Author: KoffeinFlummi and CAA-Picard
*
* Initializes vars needed for scope adjustment and watches for scope changes.
* Watches for scope changes.
* Defines key bindings
*
* Arguments:
* None
*
* Return Value:
* None
*/
#include "script_component.hpp"
GVAR(fadeScript) = scriptNull;
if !(hasInterface) exitWith {};
// show overlay after changing weapon/optic
0 spawn {
_layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer;
while {True} do {
waitUntil {[ACE_player, 0,0] call FUNC(canAdjustScope)};
_layer cutRsc [QGVAR(Zeroing), "PLAIN", 0, false];
sleep 3;
_layer cutFadeOut 2;
_layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer;
while {True} do {
waitUntil {[ACE_player, 0,0] call FUNC(canAdjustScope)};
_layer cutRsc [QGVAR(Zeroing), "PLAIN", 0, false];
sleep 3;
_layer cutFadeOut 2;
_weapon = currentWeapon ACE_player;
_optics = [ACE_player] call FUNC(getOptics);
waitUntil {sleep 0.05; !(_optics isEqualTo ([ACE_player] call FUNC(getOptics))) or (currentWeapon ACE_player != _weapon)};
};
_weapon = currentWeapon ACE_player;
_optics = [ACE_player] call FUNC(getOptics);
waitUntil {sleep 0.05; !(_optics isEqualTo ([ACE_player] call FUNC(getOptics))) or (currentWeapon ACE_player != _weapon)};
};
};
// instantly hide when scoping in
0 spawn {
_layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer;
while {True} do {
_layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer;
while {True} do {
waitUntil {sleep 0.05; cameraView == "GUNNER"};
if !(isNull GVAR(fadeScript)) then {
terminate GVAR(fadeScript);
terminate GVAR(fadeScript);
};
_layer cutText ["", "PLAIN", 0];
};
_layer cutText ["", "PLAIN", 0];
};
};
// Add keybinds
["ACE3",
localize "STR_ACE_Scopes_AdjustUp",
{
// Conditions: canInteract
_exceptions = [];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
// Conditions: specific
[ACE_player] call FUNC(inventoryCheck);
if !([ACE_player, 0, 0.1] call FUNC(canAdjustScope)) exitWith {false};
// Statement
[ACE_player, 0, 0.1] call FUNC(adjustScope);
true
},
[201, [false, false, false]],
false,
"keydown"
] call cba_fnc_registerKeybind;
["ACE3",
localize "STR_ACE_Scopes_AdjustDown",
{
// Conditions: canInteract
_exceptions = [];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
// Conditions: specific
[ACE_player] call FUNC(inventoryCheck);
if !([ACE_player, 0, -0.1] call FUNC(canAdjustScope)) exitWith {false};
// Statement
[ACE_player, 0, -0.1] call FUNC(adjustScope);
true
},
[209, [false, false, false]],
false,
"keydown"
] call cba_fnc_registerKeybind;
["ACE3",
localize "STR_ACE_Scopes_AdjustLeft",
{
// Conditions: canInteract
_exceptions = [];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
// Conditions: specific
[ACE_player] call FUNC(inventoryCheck);
if !([ACE_player, -0.1, 0] call FUNC(canAdjustScope)) exitWith {false};
// Statement
[ACE_player, -0.1, 0] call FUNC(adjustScope);
true
},
[209, [false, true, false]],
false,
"keydown"
] call cba_fnc_registerKeybind;
["ACE3",
localize "STR_ACE_Scopes_AdjustRight",
{
// Conditions: canInteract
_exceptions = [];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
// Conditions: specific
[ACE_player] call FUNC(inventoryCheck);
if !([ACE_player, 0.1, 0] call FUNC(canAdjustScope)) exitWith {false};
// Statement
[ACE_player, 0.1, 0] call FUNC(adjustScope);
true
},
[201, [false, true, false]],
false,
"keydown"
] call cba_fnc_registerKeybind;

View File

@ -6,3 +6,5 @@ PREP(firedEH);
PREP(getOptics);
PREP(hideZeroing);
PREP(inventoryCheck);
GVAR(fadeScript) = scriptNull;

View File

@ -13,39 +13,9 @@ class CfgPatches {
};
#include "CfgEventHandlers.hpp"
#include "CfgSounds.hpp"
#include "CfgWeapons.hpp"
class ACE_Default_Keys {
class adjustScopeUp {
displayName = "$STR_ACE_Scopes_AdjustUp";
condition = QUOTE([_player] call FUNC(inventoryCheck); [ARR_3(_player, 0, 0.1)] call FUNC(canAdjustScope););
statement = QUOTE([ARR_3(_player, 0, 0.1)] call FUNC(adjustScope););
allowHolding = 1;
key = 201;
shift = 0;
control = 0;
alt = 0;
};
class adjustScopeDown: adjustScopeUp {
displayName = "$STR_ACE_Scopes_AdjustDown";
condition = QUOTE([_player] call FUNC(inventoryCheck); [ARR_3(_player, 0, -0.1)] call FUNC(canAdjustScope););
statement = QUOTE([ARR_3(_player, 0, -0.1)] call FUNC(adjustScope););
key = 209;
};
class adjustScopeLeft: adjustScopeUp {
displayName = "$STR_ACE_Scopes_AdjustLeft";
condition = QUOTE([_player] call FUNC(inventoryCheck); [ARR_3(_player, -0.1, 0)] call FUNC(canAdjustScope););
statement = QUOTE([ARR_3(_player, -0.1, 0)] call FUNC(adjustScope););
key = 209;
control = 1;
};
class adjustScopeRight: adjustScopeLeft {
displayName = "$STR_ACE_Scopes_AdjustRight";
condition = QUOTE([_player] call FUNC(inventoryCheck); [ARR_3(_player, 0.1, 0)] call FUNC(canAdjustScope););
statement = QUOTE([ARR_3(_player, 0.1, 0)] call FUNC(adjustScope););
key = 201;
};
};
#include "RscTitles.hpp"

View File

@ -29,7 +29,7 @@ if (isNil QGVAR(Adjustment)) then {
GVAR(Adjustment) = [[0,0], [0,0], [0,0]];
};
if (isNil "AGM_Scopes_Optics") then {
if (isNil QGVAR(Optics)) then {
GVAR(Optics) = ["", "", ""];
};

View File

@ -0,0 +1 @@
#include "\z\ace\addons\scopes\script_component.hpp"

View File

@ -1,7 +1,9 @@
#include "script_component.hpp"
disableSerialization;
_display = _this select 0;
uiNamespace setVariable ["ACE_Scopes_ZeroingDisplay", _display];
uiNamespace setVariable [QGVAR(ZeroingDisplay, _display];
_vertical = _display displayCtrl 925002;
_horizontal = _display displayCtrl 925003;
@ -11,8 +13,8 @@ _weapons = [
handgunWeapon player
];
if ((currentWeapon player) in _weapons) then {
_zeroing = ACE_Scopes_Adjustment select (_weapons find (currentWeapon player));
if ((currentWeapon ACE_player) in _weapons) then {
_zeroing = GVAR(Adjustment) select (_weapons find (currentWeapon ACE_player));
_horizontal ctrlSetText (str (_zeroing select 0));
_vertical ctrlSetText (str (_zeroing select 1));
};

View File

@ -5,6 +5,12 @@ class Extended_PreInit_EventHandlers {
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_postInit));
};
};
class Extended_Engine_EventHandlers {
class Car {
class ACE_EngineStartDelay {

View File

@ -0,0 +1,25 @@
// by CAA-Picard
#include "script_component.hpp"
if !(hasInterface) exitWith {};
// Add keybinds
["ACE3",
localize "STR_ACE_SpeedLimiter",
{
// Conditions: canInteract
_exceptions = [];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
// Conditions: specific
if !(ACE_player == driver vehicle ACE_player &&
{vehicle ACE_player isKindOf 'Car' ||
{vehicle ACE_player isKindOf 'Tank'}}) exitWith {false};
// Statement
[ACE_player, vehicle ACE_player] call FUNC(speedLimiter);
true
},
[211, [false, false, false]],
false,
"keydown"
] call cba_fnc_registerKeybind;

View File

@ -16,15 +16,3 @@ class CfgPatches {
#include "CfgAmmo.hpp"
#include "CfgVehicles.hpp"
#include "CfgWeapons.hpp"
class ACE_Default_Keys {
class speedLimiter {
displayName = "$STR_ACE_SpeedLimiter";
condition = QUOTE(_player == driver _vehicle && {_vehicle isKindOf 'Car' || {_vehicle isKindOf 'Tank'}});
statement = QUOTE([ARR_2(_player, _vehicle)] call FUNC(speedLimiter));
key = 211;
shift = 0;
control = 0;
alt = 0;
};
};