Merge pull request #3366 from acemod/cbacanuseweapon

replace some ace_common_fnc_X with CBA_fnc_X
This commit is contained in:
commy2 2016-02-22 16:28:57 +01:00
commit dc16136aef
12 changed files with 26 additions and 71 deletions

View File

@ -12,7 +12,6 @@ PREP(blurScreen);
PREP(cachedCall);
PREP(canGetInPosition);
PREP(canInteractWith);
PREP(canUseWeapon);
PREP(changeProjectileDirection);
PREP(checkFiles);
PREP(checkPBOs);
@ -139,7 +138,6 @@ PREP(resetAllDefaults);
PREP(restoreVariablesJIP);
PREP(runAfterSettingsInit);
PREP(sanitizeString);
PREP(selectWeaponMode);
PREP(sendRequest);
PREP(serverLog);
PREP(setAllGear);

View File

@ -9,6 +9,17 @@ ADDON = false;
GVAR(eventsLocation) = createLocation ["ACE_HashLocation", [-10000,-10000,-10000], 0, 0];
GVAR(eventsLocation) setText QGVAR(eventsLocation);
// backwards comp
DFUNC(canUseWeapon) = {
ACE_DEPRECATED("ace_common_fnc_canUseWeapon","3.7.0","CBA_fnc_canUseWeapon");
_this call CBA_fnc_canUseWeapon;
};
DFUNC(selectWeaponMode) = {
ACE_DEPRECATED("ace_common_fnc_selectWeaponMode","3.7.0","CBA_fnc_selectWeapon");
_this call CBA_fnc_selectWeapon;
};
GVAR(syncedEvents) = HASH_CREATE;
GVAR(showHudHash) = [] call FUNC(hashCreate);

View File

@ -1,23 +0,0 @@
/*
* Author: commy2
* Check if the unit can use a Weapon.
* Returns true if the unit is on foot or in a FFV position.
*
* Arguments:
* 0: The Unit <OBJECT>
*
* Return Value:
* Can the Unit use Weapons <BOOL>
*
* Public: Yes
*/
#include "script_component.hpp"
params [["_unit", objNull, [objNull]]];
if (_unit == vehicle _unit) exitWith {true};
private _config = configFile >> "CfgMovesMaleSdr" >> "States" >> animationState _unit;
isClass _config
&& {getNumber (_config >> "canPullTrigger") == 1}

View File

@ -1,31 +0,0 @@
/*
* Author: commy2
* Unit selects given muzzle and weapon mode.
*
* Arguments:
* 0: unit <OBJECT>
* 1: weapon or Muzzle <STRING>
* 2: weapon Mode <STRING>
*
* Return Value:
* Successful? <BOOL>
*
* Example:
* [player, primaryWeapon player, "FullAuto"] call ace_common_fnc_selectWeaponMode
*
* Public: Yes
*/
#include "script_component.hpp"
params ["_unit", "_muzzle", "_mode"];
private _index = 0;
while {
_index < 100 && {currentMuzzle _unit != _muzzle || {currentWeaponMode _unit != _mode}}
} do {
_unit action ["SwitchWeapon", _unit, _unit, _index];
_index = _index + 1;
};
_index < 100 // return

View File

@ -15,7 +15,7 @@ GVAR(flashbangPPEffectCC) ppEffectForceInNVG true;
// Conditions: canInteract
if !([ACE_player, objNull, ["isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
if (!([ACE_player] call EFUNC(common,canUseWeapon))) exitWith {false};
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
// Statement
[] call FUNC(nextMode);

View File

@ -5,7 +5,7 @@
// Conditions: canInteract
if !([ACE_player, objNull, ["isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false};
if !([ACE_player] call CBA_fnc_canUseWeapon) exitWith {false};
[ACE_player, currentWeapon ACE_player] call FUNC(switchLaserLightMode);
true

View File

@ -23,7 +23,7 @@ GVAR(cacheSilencerData) = call CBA_fnc_createNamespace;
// Conditions: canInteract
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
if !([ACE_player] call EFUNC(common,canUseWeapon) &&
if !([ACE_player] call CBA_fnc_canUseWeapon &&
{currentWeapon ACE_player in (ACE_player getVariable [QGVAR(jammedWeapons), []])}
) exitWith {false};

View File

@ -46,7 +46,7 @@ GVAR(knowAboutJam) = false;
if (_unit getVariable [QGVAR(JammingActionID), -1] == -1) then {
private _condition = {
[_this select 1] call EFUNC(common,canUseWeapon)
[_this select 1] call CBA_fnc_canUseWeapon
&& {currentMuzzle (_this select 1) in ((_this select 1) getVariable [QGVAR(jammedWeapons), []])}
&& {!(currentMuzzle (_this select 1) in ((_this select 1) getVariable [QEGVAR(safemode,safedWeapons), []]))}
};

View File

@ -9,7 +9,7 @@ if (!hasInterface) exitWith {};
// Conditions: canInteract
if !([ACE_player, vehicle ACE_player, ["isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
if !(ACE_player call EFUNC(common,canUseWeapon) || {(vehicle ACE_player) isKindOf "StaticWeapon"}) exitWith {false};
if !(ACE_player call CBA_fnc_canUseWeapon || {(vehicle ACE_player) isKindOf "StaticWeapon"}) exitWith {false};
// Statement
[ACE_player] call FUNC(checkAmmo);

View File

@ -13,7 +13,7 @@ if (!hasInterface) exitWith {};
// Conditions: canInteract
if !([ACE_player, objNull, ["isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
if !([ACE_player] call EFUNC(common,canUseWeapon) && {currentWeapon ACE_player != binocular ACE_player}) exitWith {false};
if !([ACE_player] call CBA_fnc_canUseWeapon && {currentWeapon ACE_player != binocular ACE_player}) exitWith {false};
// Statement
[ACE_player, currentWeapon ACE_player, currentMuzzle ACE_player] call FUNC(lockSafety);

View File

@ -38,7 +38,7 @@ if (_unit getVariable [QGVAR(actionID), -1] == -1) then {
_unit setVariable [QGVAR(actionID), [
_unit, "DefaultAction", {
if (
[_this select 1] call EFUNC(common,canUseWeapon)
[_this select 1] call CBA_fnc_canUseWeapon
&& {
if (currentMuzzle (_this select 1) in ((_this select 1) getVariable [QGVAR(safedWeapons), []])) then {
if (inputAction "nextWeapon" > 0) exitWith {

View File

@ -8,7 +8,7 @@ if (!hasInterface) exitWith {};
// Conditions: canInteract
if !([ACE_player, ACE_player, ["isNotInside", "isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false};
if !([ACE_player] call CBA_fnc_canUseWeapon) exitWith {false};
// Statement
[ACE_player, handgunWeapon ACE_player] call FUNC(selectWeaponMode);
@ -21,7 +21,7 @@ if (!hasInterface) exitWith {};
// Conditions: canInteract
if !([ACE_player, ACE_player, ["isNotInside", "isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false};
if !([ACE_player] call CBA_fnc_canUseWeapon) exitWith {false};
// Statement
[ACE_player, primaryWeapon ACE_player] call FUNC(selectWeaponMode);
@ -34,7 +34,7 @@ if (!hasInterface) exitWith {};
// Conditions: canInteract
if !([ACE_player, ACE_player, ["isNotInside", "isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false};
if !([ACE_player] call CBA_fnc_canUseWeapon) exitWith {false};
// Statement
[ACE_player, primaryWeapon ACE_player] call FUNC(selectWeaponMuzzle);
@ -47,7 +47,7 @@ if (!hasInterface) exitWith {};
// Conditions: canInteract
if !([ACE_player, ACE_player, ["isNotInside", "isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false};
if !([ACE_player] call CBA_fnc_canUseWeapon) exitWith {false};
// Statement
[ACE_player, secondaryWeapon ACE_player] call FUNC(selectWeaponMode);
@ -60,7 +60,7 @@ if (!hasInterface) exitWith {};
// Conditions: canInteract
if !([ACE_player, ACE_player, ["isNotInside", "isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false};
if !([ACE_player] call CBA_fnc_canUseWeapon) exitWith {false};
// Statement
[ACE_player, binocular ACE_player] call FUNC(selectWeaponMode);
@ -73,7 +73,7 @@ if (!hasInterface) exitWith {};
// Conditions: canInteract
if !([ACE_player, ACE_player, ["isNotInside", "isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false};
if !([ACE_player] call CBA_fnc_canUseWeapon) exitWith {false};
// Statement
[ACE_player, 1] call FUNC(selectNextGrenade);
@ -86,7 +86,7 @@ if (!hasInterface) exitWith {};
// Conditions: canInteract
if !([ACE_player, ACE_player, ["isNotInside", "isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false};
if !([ACE_player] call CBA_fnc_canUseWeapon) exitWith {false};
// Statement
[ACE_player, 2] call FUNC(selectNextGrenade);
@ -99,7 +99,7 @@ if (!hasInterface) exitWith {};
// Conditions: canInteract
if !([ACE_player, ACE_player, ["isNotInside", "isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
if !([ACE_player] call EFUNC(common,canUseWeapon)) exitWith {false};
if !([ACE_player] call CBA_fnc_canUseWeapon) exitWith {false};
// Statement
if ((currentWeapon ACE_player) != "") then {