Code cleanup 1.54

This commit is contained in:
commy2 2016-01-06 22:42:02 +01:00
parent 0bc540305d
commit e56e18bff3
37 changed files with 276 additions and 327 deletions

View File

@ -17,24 +17,17 @@
params ["_target", "_backpack"];
// do cam shake if the target is the player
if ([_target] call EFUNC(common,isPlayer)) then {
if (_target call EFUNC(common,isPlayer)) then {
addCamShake [4, 0.5, 5];
};
// play a zipper sound effect
private ["_sounds", "_position"];
_sounds = [
/*"a3\sounds_f\characters\ingame\AinvPknlMstpSlayWpstDnon_medic.wss",
"a3\sounds_f\characters\ingame\AinvPknlMstpSlayWrflDnon_medic.wss",
"a3\sounds_f\characters\ingame\AinvPpneMstpSlayWpstDnon_medic.wss",
"a3\sounds_f\characters\ingame\AinvPpneMstpSlayWrflDnon_medic.wss"*/
private _sounds = [
QUOTE(PATHTO_R(sounds\zip_in.wav)),
QUOTE(PATHTO_R(sounds\zip_out.wav))
];
_position = AGLToASL (_target modelToWorldVisual (_target selectionPosition "Spine3"));
private _position = AGLToASL (_target modelToWorldVisual (_target selectionPosition "Spine3"));
playSound3D [
_sounds select floor random count _sounds,

View File

@ -12,13 +12,12 @@
*/
#include "script_component.hpp"
params ["_backpack"];
params [["_backpack", objNull, [objNull]]];
if (_backpack isEqualType objNull) then {
_backpack = typeOf _backpack;
};
private "_config";
_config = configFile >> "CfgVehicles" >> _backpack;
private _config = configFile >> "CfgVehicles" >> _backpack;
getText (_config >> "vehicleClass") == "backpacks" && {getNumber (_config >> "maximumLoad") > 0} // return

View File

@ -16,11 +16,10 @@
params ["_unit", "_backpack"];
// exit if the target is not a real backpack, i.e. parachute, static weapon bag etc.
if !([_backpack] call FUNC(isBackpack)) exitWith {false};
if !(_backpack call FUNC(isBackpack)) exitWith {false};
// get the unit that wears the backpack object
private "_target";
_target = objectParent _backpack;
private _target = objectParent _backpack;
if (isNull _target) exitWith {false};

View File

@ -24,15 +24,13 @@
params ["_unit", "_weapon", "", "", "", "", "_projectile"];
TRACE_3("params",_unit,_weapon,_projectile);
if ((!local _unit) || {_weapon != (secondaryWeapon _unit)}) exitWith {};
if (!local _unit || {_weapon != secondaryWeapon _unit}) exitWith {};
private ["_replacementTube", "_items"];
_replacementTube = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_UsedTube");
private _replacementTube = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_UsedTube");
if (_replacementTube == "") exitWith {}; //If no replacement defined just exit
//Save array of items attached to launcher
_items = secondaryWeaponItems _unit;
private _items = secondaryWeaponItems _unit;
//Replace the orginal weapon with the 'usedTube' weapon
_unit addWeapon _replacementTube;
//Makes sure the used tube is still equiped
@ -55,12 +53,10 @@ if !([_unit] call EFUNC(common,isPlayer)) then {
[_idPFH] call CBA_fnc_removePerFrameHandler;
//If (tube is dropped) OR (is dead) OR (is player) just exit
if (((secondaryWeapon _unit) != _tube) || {!alive _unit} || {([_unit] call EFUNC(common,isPlayer))}) exitWith {};
if (secondaryWeapon _unit != _tube || {!alive _unit} || {[_unit] call EFUNC(common,isPlayer)}) exitWith {};
private ["_items", "_container"];
// _items = secondaryWeaponItems _unit;
_container = createVehicle ["GroundWeaponHolder", position _unit, [], 0, "CAN_COLLIDE"];
//private _items = secondaryWeaponItems _unit;
private _container = createVehicle ["GroundWeaponHolder", position _unit, [], 0, "CAN_COLLIDE"];
_container setPosAsl (getPosAsl _unit);
_container addWeaponCargoGlobal [_tube, 1];

View File

@ -20,17 +20,12 @@ TRACE_1("params",_unit);
if (!local _unit) exitWith {};
private ["_launcher", "_config"];
_launcher = secondaryWeapon _unit;
_config = configFile >> "CfgWeapons" >> _launcher;
private _launcher = secondaryWeapon _unit;
private _config = configFile >> "CfgWeapons" >> _launcher;
if (isClass _config && {getText (_config >> "ACE_UsedTube") != ""} && {getNumber (_config >> "ACE_isUsedLauncher") != 1} && {count secondaryWeaponMagazine _unit == 0}) then {
private ["_magazine", "_isLauncherSelected", "_didAdd"];
_magazine = getArray (_config >> "magazines") select 0;
_isLauncherSelected = currentWeapon _unit == _launcher;
private _magazine = getArray (_config >> "magazines") select 0;
private _isLauncherSelected = currentWeapon _unit == _launcher;
_unit removeMagazines _magazine;
@ -38,8 +33,9 @@ if (isClass _config && {getText (_config >> "ACE_UsedTube") != ""} && {getNumber
_unit addBackpack "ACE_FakeBackpack";
_unit removeWeapon _launcher;
_unit addMagazine _magazine;
_didAdd = _magazine in (magazines _unit);
private _didAdd = _magazine in magazines _unit;
_unit addWeapon _launcher;
if (!_didAdd) then {
TRACE_1("Failed To Add Disposable Magazine Normally, doing backup method (no backpack)",_unit);
_unit addSecondaryWeaponItem _magazine;
@ -48,8 +44,9 @@ if (isClass _config && {getText (_config >> "ACE_UsedTube") != ""} && {getNumber
} else {
_unit removeWeapon _launcher;
_unit addMagazine _magazine;
_didAdd = _magazine in (magazines _unit);
private _didAdd = _magazine in magazines _unit;
_unit addWeapon _launcher;
if (!_didAdd) then {
TRACE_2("Failed To Add Disposable Magazine Normally, doing backup method",_unit,(backpack _unit));
_unit addSecondaryWeaponItem _magazine;

View File

@ -24,13 +24,11 @@ _player removeMagazines "ACE_FiredMissileDummy";
if (isNull _display) exitWith {};
private ["_launcher", "_control", "_config"];
_launcher = secondaryWeapon _player;
private _launcher = secondaryWeapon _player;
if (_launcher == "" || {getText (configFile >> "CfgWeapons" >> _launcher >> "ACE_UsedTube") == ""}) then {
_control = _display displayCtrl 627;
_config = configFile >> "RscDisplayInventory" >> "controls" >> "SlotSecondaryMagazine";
private _control = _display displayCtrl 627;
private _config = configFile >> "RscDisplayInventory" >> "controls" >> "SlotSecondaryMagazine";
_control ctrlSetPosition [getNumber (_config >> "x"), getNumber (_config >> "y"), getNumber (_config >> "w"), getNumber (_config >> "h")];
_control ctrlCommit 0;
@ -39,7 +37,7 @@ if (_launcher == "" || {getText (configFile >> "CfgWeapons" >> _launcher >> "ACE
_control ctrlSetPosition [getNumber (_config >> "x"), getNumber (_config >> "y"), getNumber (_config >> "w"), getNumber (_config >> "h")];
_control ctrlCommit 0;
} else {
_control = _display displayCtrl 627;
private _control = _display displayCtrl 627;
_control ctrlSetPosition [0, 0, 0, 0];
_control ctrlCommit 0;

View File

@ -20,8 +20,7 @@
params ["_projectile", "_color", "_intensity", "_timeToLive"];
private "_light";
_light = "#lightpoint" createVehicleLocal position _projectile;
private _light = "#lightpoint" createVehicleLocal position _projectile;
_light setLightColor _color;
_light setLightAmbient _color;

View File

@ -17,14 +17,12 @@
params ["_grenade"];
private ["_affected", "_strength", "_posGrenade", "_eyePos", "_losCount", "_eyeDir", "_dirToUnitVector", "_angleDiff", "_light"];
_affected = _grenade nearEntities ["CAManBase", 20];
private _affected = _grenade nearEntities ["CAManBase", 20];
{
if (local _x && {alive _x}) then {
_strength = 1 - ((_x distance _grenade) min 15) / 15;
private _strength = 1 - ((_x distance _grenade) min 15) / 15;
TRACE_3("FlashBangEffect Start",_x,(_x distance _grenade),_strength);
@ -47,12 +45,12 @@ _affected = _grenade nearEntities ["CAManBase", 20];
} else {
//Do effects for player
// is there line of sight to the grenade?
_posGrenade = getPosASL _grenade;
_eyePos = eyePos ACE_player; //PositionASL
private _posGrenade = getPosASL _grenade;
private _eyePos = eyePos ACE_player; //PositionASL
_posGrenade set [2, (_posGrenade select 2) + 0.2]; // compensate for grenade glitching into ground
//Check for line of sight (check 4 points in case grenade is stuck in an object or underground)
_losCount = {
private _losCount = {
!lineIntersects [_posGrenade vectorAdd _x, _eyePos, _grenade, ACE_player]
} count [[0,0,0], [0,0,0.2], [0.1, 0.1, 0.1], [-0.1, -0.1, 0.1]];
@ -68,9 +66,9 @@ _affected = _grenade nearEntities ["CAManBase", 20];
// account for people looking away by slightly
// reducing the effect for visual effects.
_eyeDir = (positionCameraToWorld [0,0,1] vectorDiff positionCameraToWorld [0,0,0]);
_dirToUnitVector = _eyePos vectorFromTo _posGrenade;
_angleDiff = acos (_eyeDir vectorDotProduct _dirToUnitVector);
private _eyeDir = (positionCameraToWorld [0,0,1] vectorDiff positionCameraToWorld [0,0,0]);
private _dirToUnitVector = _eyePos vectorFromTo _posGrenade;
private _angleDiff = acos (_eyeDir vectorDotProduct _dirToUnitVector);
// from 0-45deg, full effect
if (_angleDiff > 45) then {
@ -85,7 +83,8 @@ _affected = _grenade nearEntities ["CAManBase", 20];
};
// create flash to illuminate environment
_light = "#lightpoint" createVehicleLocal (getPos _grenade);
private _light = "#lightpoint" createVehicleLocal getPos _grenade;
_light setLightBrightness 200;
_light setLightAmbient [1,1,1];
_light setLightColor [1,1,1];

View File

@ -20,7 +20,7 @@ params ["_projectile"];
if (alive _projectile) then {
playSound3D ["A3\Sounds_F\weapons\Explosion\explosion_mine_1.wss", _projectile, false, getPosASL _projectile, 5, 1.2, 400];
private _affected = _projectile nearEntities ["CAManBase", 20];
private _affected = _projectile nearEntities ["CAManBase", 50];
["flashbangExplosion", _affected, [_projectile]] call EFUNC(common,targetEvent);
};

View File

@ -15,9 +15,7 @@
*/
#include "script_component.hpp"
private ["_mode", "_hint"];
_mode = missionNamespace getVariable [QGVAR(currentThrowMode), 0];
private _mode = missionNamespace getVariable [QGVAR(currentThrowMode), 0];
if (_mode == 4) then {
_mode = 0;
@ -30,13 +28,13 @@ if (_mode == 3) then {
_mode = 4;
};
_hint = [
localize LSTRING(NormalThrow),
localize LSTRING(HighThrow),
localize LSTRING(PreciseThrow),
localize LSTRING(RollGrenade),
localize LSTRING(DropGrenade)
] select _mode;
private _hint = localize ([
LSTRING(NormalThrow),
LSTRING(HighThrow),
LSTRING(PreciseThrow),
LSTRING(RollGrenade),
LSTRING(DropGrenade)
] select _mode);
[_hint] call EFUNC(common,displayTextStructured);

View File

@ -30,24 +30,22 @@ if (isNull _projectile) then {
_projectile = nearestObject [_unit, _ammo];
};
private _config = configFile >> "CfgAmmo" >> _ammo;
// handle special grenades
if (local _unit) then {
if (getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(flashbang)) == 1) then {
private "_fuzeTime";
_fuzeTime = getNumber (configFile >> "CfgAmmo" >> _ammo >> "explosionTime");
if (getNumber (_config >> QGVAR(flashbang)) == 1) then {
private _fuzeTime = getNumber (_config >> "explosionTime");
[FUNC(flashbangThrownFuze), [_projectile], _fuzeTime, 0] call EFUNC(common,waitAndExecute);
};
};
if (getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(flare)) == 1) then {
private ["_fuzeTime", "_timeToLive", "_color", "_intensity"];
_fuzeTime = getNumber (configFile >> "CfgAmmo" >> _ammo >> "explosionTime");
_timeToLive = getNumber (configFile >> "CfgAmmo" >> _ammo >> "timeToLive");
_color = getArray (configFile >> "CfgAmmo" >> _ammo >> QGVAR(color));
_intensity = _color select 3;
_color resize 3;
if (getNumber (_config >> QGVAR(flare)) == 1) then {
private _fuzeTime = getNumber (_config >> "explosionTime");
private _timeToLive = getNumber (_config >> "timeToLive");
private _color = getArray (_config >> QGVAR(color));
private _intensity = _color deleteAt 3;
[FUNC(flare), [_projectile, _color, _intensity, _timeToLive], _fuzeTime, 0] call EFUNC(common,waitAndExecute);
};
@ -55,12 +53,10 @@ if (getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(flare)) == 1) then {
// handle throw modes
if (_unit != ACE_player) exitWith {};
private "_mode";
_mode = missionNamespace getVariable [QGVAR(currentThrowMode), 0];
private _mode = missionNamespace getVariable [QGVAR(currentThrowMode), 0];
if (_mode != 0) then {
private "_velocity";
_velocity = velocity _projectile;
private _velocity = velocity _projectile;
switch (_mode) do {
//high throw

View File

@ -3,5 +3,6 @@
ADDON = false;
PREP(fallDown);
PREP(getRandomAnimation);
ADDON = true;

View File

@ -35,8 +35,7 @@ if (!isNil QUOTE(EFUNC(medical,playInjuredSound))) then {
[_unit] call EFUNC(medical,playInjuredSound);
};
private "_vehicle";
_vehicle = vehicle _unit;
private _vehicle = vehicle _unit;
// handle static weapons
if (_vehicle isKindOf "StaticWeapon") exitWith {
@ -53,61 +52,20 @@ if (_vehicle != _unit) exitWith {};
if !([_unit, _vehicle] call EFUNC(common,canInteractWith)) exitWith {};
// handle ladders
if (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> animationState _unit >> "AGM_isLadder") == 1) exitWith {
if (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> animationState _unit >> "ACE_isLadder") == 1) exitWith {
_unit action ["LadderOff", nearestObject [position _unit, "House"]];
};
// only play animation when standing due to lack of animations, sry
if !(stance _unit in ["CROUCH", "STAND"]) exitWith {};
private "_velocity";
_velocity = vectorMagnitude velocity _unit;
private _velocity = vectorMagnitude velocity _unit;
// only fall when moving
if (_velocity < 2) exitWith {};
// get correct animation by weapon
private "_anim";
call {
private "_weapon";
_weapon = currentWeapon _unit;
if (_weapon == "") exitWith {
_anim = "AmovPercMsprSnonWnonDf_AmovPpneMstpSnonWnonDnon"
};
if (_weapon == primaryWeapon _unit) exitWith {
if ([_unit] call EFUNC(common,isPlayer)) then {
private "_isRunning";
_isRunning = _velocity > 4;
_anim = [
["AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon_2", "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon"] select _isRunning,
["AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon_2", "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon"] select _isRunning,
"AmovPercMstpSrasWrflDnon_AadjPpneMstpSrasWrflDleft",
"AmovPercMstpSrasWrflDnon_AadjPpneMstpSrasWrflDright"
] select floor random 4;
} else {
_anim = "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon";
};
};
if (_weapon == handgunWeapon _unit) exitWith {
if ([_unit] call EFUNC(common,isPlayer)) then {
_anim = [
"AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon",
"AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon",
"AmovPercMstpSrasWpstDnon_AadjPpneMstpSrasWpstDleft",
"AmovPercMstpSrasWpstDnon_AadjPpneMstpSrasWpstDright"
] select floor random 4;
} else {
_anim = "AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon";
};
};
_anim = "";
};
private _anim = _unit call FUNC(getRandomAnimation);
// exit if no animation for this weapon exists, i.e. binocular or rocket launcher
if (_anim == "") exitWith {};

View File

@ -0,0 +1,51 @@
/*
* Author: commy2
* Get a random fall animation for the unit.
*
* Arguments:
* 0: unit <OBJECT>
*
* Return Value:
* Fall animation <STRING>
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit"];
private _weapon = currentWeapon _unit;
if (_weapon == "") exitWith {
"AmovPercMsprSnonWnonDf_AmovPpneMstpSnonWnonDnon"
};
if (_weapon == primaryWeapon _unit) exitWith {
if (_unit call EFUNC(common,isPlayer)) then {
private _isRunning = _velocity > 4;
[
["AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon_2", "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon"] select _isRunning,
["AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon_2", "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon"] select _isRunning,
"AmovPercMstpSrasWrflDnon_AadjPpneMstpSrasWrflDleft",
"AmovPercMstpSrasWrflDnon_AadjPpneMstpSrasWrflDright"
] select floor random 4
} else {
"AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon"
};
};
if (_weapon == handgunWeapon _unit) exitWith {
if (_unit call EFUNC(common,isPlayer)) then {
[
"AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon",
"AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon",
"AmovPercMstpSrasWpstDnon_AadjPpneMstpSrasWpstDleft",
"AmovPercMstpSrasWpstDnon_AadjPpneMstpSrasWpstDright"
] select floor random 4
} else {
"AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon"
};
};
""

View File

@ -6,9 +6,8 @@ if (!hasInterface) exitWith {};
["inventoryDisplayLoaded", {
[{
private "_dialog";
_dialog = _this select 0;
disableSerialization;
params ["_dialog"];
if (isNull _dialog) exitWith {
[_this select 1] call CBA_fnc_removePerFrameHandler;

View File

@ -15,33 +15,30 @@
*/
#include "script_component.hpp"
private ["_pos", "_dir"];
params ["_unit"];
PARAMS_1(_unit);
private _pos = getPosASL _unit;
private _dir = getDir _unit;
_pos = getPosASL _unit;
_dir = getDir _unit;
_dir = [sin _dir, cos _dir, 0];
private ["_checkPos0beg", "_checkPos0end", "_checkPos1beg", "_checkPos1end"];
private _checkPos0beg = _pos vectorAdd [0, 0, 0.9];
private _checkPos0end = _checkPos0beg vectorAdd (_dir vectorMultiply 1.3);
_checkPos0beg = _pos vectorAdd [0, 0, 0.9];
_checkPos0end = _checkPos0beg vectorAdd (_dir vectorMultiply 1.3);
private _checkPos1beg = _pos vectorAdd [0, 0, 1.75];
private _checkPos1end = _checkPos1beg vectorAdd (_dir vectorMultiply 1.3);
_checkPos1beg = _pos vectorAdd [0, 0, 1.75];
_checkPos1end = _checkPos1beg vectorAdd (_dir vectorMultiply 1.3);
private _checkPos2beg = _pos vectorAdd [0.3 * (_dir select 1), 0.3 * -(_dir select 0), 2.0];
private _checkPos2end = _checkPos2beg vectorAdd (_dir vectorMultiply 1.3);
_checkPos2beg = _pos vectorAdd [0.3 * (_dir select 1), 0.3 * -(_dir select 0), 2.0];
_checkPos2end = _checkPos2beg vectorAdd (_dir vectorMultiply 1.3);
private _checkPos3beg = _pos vectorAdd [-0.2 * (_dir select 1), -0.2 * -(_dir select 0), 2.0];
private _checkPos3end = _checkPos3beg vectorAdd (_dir vectorMultiply 1.3);
_checkPos3beg = _pos vectorAdd [-0.2 * (_dir select 1), -0.2 * -(_dir select 0), 2.0];
_checkPos3end = _checkPos3beg vectorAdd (_dir vectorMultiply 1.3);
private _checkPos4beg = _pos vectorAdd [0.3 * (_dir select 1), 0.3 * -(_dir select 0), 1.5];
private _checkPos4end = _checkPos4beg vectorAdd (_dir vectorMultiply 1.3);
_checkPos4beg = _pos vectorAdd [0.3 * (_dir select 1), 0.3 * -(_dir select 0), 1.5];
_checkPos4end = _checkPos4beg vectorAdd (_dir vectorMultiply 1.3);
_checkPos5beg = _pos vectorAdd [-0.2 * (_dir select 1), -0.2 * -(_dir select 0), 1.5];
_checkPos5end = _checkPos5beg vectorAdd (_dir vectorMultiply 1.3);
private _checkPos5beg = _pos vectorAdd [-0.2 * (_dir select 1), -0.2 * -(_dir select 0), 1.5];
private _checkPos5end = _checkPos5beg vectorAdd (_dir vectorMultiply 1.3);
/*
drawLine3D [ASLToATL _checkPos0beg, ASLToATL _checkPos0end, [0,1,0,1]];

View File

@ -15,9 +15,7 @@
*/
#include "script_component.hpp"
private "_unit";
_unit = _this select 0;
params ["_unit"];
if !([_unit] call FUNC(canClimb)) exitWith {
[localize LSTRING(CanNotClimb)] call EFUNC(common,displayTextStructured);

View File

@ -15,11 +15,9 @@
*/
#include "script_component.hpp"
private ["_unit", "_weight"];
params ["_unit"];
_unit = _this select 0;
_weight = loadAbs _unit * 0.1;
private _weight = loadAbs _unit * 0.1;
if (GVAR(useImperial)) then {
_weight = format ["%1lb", (round (_weight * 100)) / 100];

View File

@ -16,12 +16,10 @@
*/
#include "script_component.hpp"
private ["_unit", "_anim", "_pos"];
params ["_unit", "_anim"];
_unit = _this select 0;
_anim = _this select 1;
private _pos = _unit modelToWorldVisual (_unit selectionPosition "camera");
_pos = _unit modelToWorldVisual (_unit selectionPosition "camera");
[_unit, "AmovPknlMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);
_pos = _pos vectorDiff (_unit selectionPosition "camera");

View File

@ -1,7 +1,21 @@
// TMR: Small Arms - Recoil initialization and functions
// (C) 2013 Ryan Schultz. See LICENSE.
// Edited prefixes for compatability in AGM_Realism by KoffeinFlummi
// Edited by commy2
/*
* Author: Orginal by Ryan Schultz, edited by KoffeinFlummi, commy2
* Adds camera shake when firing
* From TMR: Small Arms
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Weapon <STRING>
* 3: Muzzle <STRING>
*
* Return Value:
* Nothing
*
* Example:
* [player, (currentWeapon player), (currentMuzzle player)] call ace_recoil_fnc_camShake;
*
* Public: No
*/
#include "script_component.hpp"
#define BASE_POWER 0.40
@ -9,28 +23,22 @@
#define BASE_FREQ 13
#define RECOIL_COEF 40
private ["_unit", "_weapon", "_muzzle"];
_unit = _this select 0;
_weapon = _this select 1;
_muzzle = _this select 2;
params ["_unit", "_weapon", "_muzzle"];
if (toLower _weapon in ["throw", "put"]) exitWith {};
private ["_powerMod", "_timeMod", "_freqMod"];
_powerMod = ([0, -0.1, -0.1, 0, -0.2] select (["STAND", "CROUCH", "PRONE", "UNDEFINED", ""] find stance _unit)) + ([0, -1, 0, -1] select (["INTERNAL", "EXTERNAL", "GUNNER", "GROUP"] find cameraView));
_timeMod = 0;
_freqMod = 0;
private _powerMod = ([0, -0.1, -0.1, 0, -0.2] select (["STAND", "CROUCH", "PRONE", "UNDEFINED", ""] find stance _unit)) + ([0, -1, 0, -1] select (["INTERNAL", "EXTERNAL", "GUNNER", "GROUP"] find cameraView));
// to get camshake read kickback
private ["_config", "_recoil"];
private _recoil = missionNamespace getVariable format [QGVAR(%1-%2), _weapon, _muzzle];
_config = configFile >> "CfgWeapons" >> _weapon;
_recoil = if (_muzzle == _weapon) then {
getText (_config >> "recoil")
if (isNil "_recoil") then {
private _config = configFile >> "CfgWeapons" >> _weapon;
if (_muzzle == _weapon) then {
_recoil = getText (_config >> "recoil")
} else {
getText (_config >> _muzzle >> "recoil")
_recoil = getText (_config >> _muzzle >> "recoil")
};
if (isClass (configFile >> "CfgRecoils" >> _recoil)) then {
@ -42,26 +50,26 @@ if (isClass (configFile >> "CfgRecoils" >> _recoil)) then {
_recoil = [0, 0];
};
TRACE_3("Caching Recoil config",_weapon,_muzzle,_recoil);
// parse numbers
_recoil set [0, call compile format ["%1", _recoil select 0]];
_recoil set [1, call compile format ["%1", _recoil select 1]];
private "_powerCoef";
_powerCoef = RECOIL_COEF * linearConversion [0, 1, random 1, _recoil select 0, _recoil select 1, false];
missionNamespace setVariable [format [QGVAR(%1-%2), _weapon, _muzzle], _recoil];
};
private _powerCoef = RECOIL_COEF * linearConversion [0, 1, random 1, _recoil select 0, _recoil select 1, false];
if (isWeaponRested _unit) then {_powerMod = _powerMod - 0.07};
if (isWeaponDeployed _unit) then {_powerMod = _powerMod - 0.11};
private "_camshake";
_camshake = [
private _camshake = [
_powerCoef * (BASE_POWER + _powerMod) max 0,
BASE_TIME + _timeMod max 0,
BASE_FREQ + _freqMod max 0
BASE_TIME,
BASE_FREQ
];
/*
systemChat str _camshake;
copyToClipboard format ["addCamShake %1;", _camshake];
*/
TRACE_4("addCamShake",_recoil,_powerCoef,_powerMod,_camshake);\
addCamShake _camshake;

View File

@ -7,9 +7,9 @@ if (!hasInterface) exitWith {};
["ACE3 Weapons", QGVAR(checkAmmo), localize LSTRING(checkAmmo),
{
// Conditions: canInteract
if !([ACE_player, (vehicle ACE_player), ["isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)) exitWith {false};
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 EFUNC(common,canUseWeapon) || {(vehicle ACE_player) isKindOf "StaticWeapon"}) exitWith {false};
// Statement
[ACE_player] call FUNC(checkAmmo);
@ -20,26 +20,26 @@ if (!hasInterface) exitWith {};
["setAmmoSync", {
//To propagate the setAmmo change, do it on all clients
PARAMS_3(_unit,_weapon,_ammo);
params ["_unit", "_weapon", "_ammo"];
TRACE_3("setAmmoSync EH",_unit,_weapon,_ammo);
_unit setAmmo [_weapon, _ammo];
}] call EFUNC(common,addEventhandler);
// Listen for attempts to link ammo
["linkedAmmo", {
EXPLODE_3_PVT(_this,_receiver,_giver,_magazine);
params ["_receiver", "_giver", "_magazine"];
private ["_magazineCfg","_magazineType"];
_magazineType = currentMagazine _receiver;
_magazineCfg = configFile >> "CfgMagazines" >> _magazineType;
private _magazineType = currentMagazine _receiver;
private _magazineCfg = configFile >> "CfgMagazines" >> _magazineType;
// Return the magazine if it's the wrong type
if (_magazineType != (_magazine select 0)) exitWith {
["returnedAmmo", [_giver], [_giver,_receiver,_magazine]] call EFUNC(common,targetEvent);
};
private ["_ammoCount","_ammoMissing","_ammoAdded","_ammoRemaining"];
_ammoCount = _receiver ammo currentWeapon _receiver;
_ammoMissing = getNumber (_magazineCfg >> "count") - _ammoCount;
private _ammoCount = _receiver ammo currentWeapon _receiver;
private _ammoMissing = getNumber (_magazineCfg >> "count") - _ammoCount;
// Return the magazine if the belt is full or empty
if ((_ammoCount == 0) || _ammoMissing == 0) exitWith {
@ -47,19 +47,18 @@ if (!hasInterface) exitWith {};
};
// Add the ammo
_ammoAdded = _ammoMissing min (_magazine select 1);
["setAmmoSync", [_receiver, (currentWeapon _receiver), (_ammoCount + _ammoAdded)]] call EFUNC(common,globalEvent);
private _ammoAdded = _ammoMissing min (_magazine select 1);
["setAmmoSync", [_receiver, currentWeapon _receiver, _ammoCount + _ammoAdded]] call EFUNC(common,globalEvent);
if ((_magazine select 1) - _ammoAdded > 0) then {
["returnedAmmo", [_giver], [_giver, _receiver, [_magazineType, (_magazine select 1) - _ammoAdded]]] call EFUNC(common,targetEvent);
};
}] call EFUNC(common,addEventhandler);
// Listen for returned magazines
["returnedAmmo", {
EXPLODE_3_PVT(_this,_receiver,_giver,_magazine);
params ["_receiver", "", "_magazine"];
TRACE_2("returnedAmmo EH",_receiver,_magazine);
_receiver addMagazine _magazine;
}] call EFUNC(common,addEventhandler);

View File

@ -11,26 +11,24 @@
*/
#include "script_component.hpp"
EXPLODE_2_PVT(_this,_player,_target);
params ["_player", "_target"];
if (vehicle _target != _target) exitWith {false};
private ["_magazineCfg","_magazineType"];
_magazineType = currentMagazine _target;
_magazineCfg = configFile >> "CfgMagazines" >> _magazineType;
private _magazineType = currentMagazine _target;
private _magazineCfg = configFile >> "CfgMagazines" >> _magazineType;
if (getNumber (_magazineCfg >> "ACE_isBelt") == 0) exitWith {false};
// Check if the ammo is not empty or full
private "_ammoCount";
_ammoCount = _target ammo currentWeapon _target;
private _ammoCount = _target ammo currentWeapon _target;
// Exit if the belt is full or empty
if ((_ammoCount == 0) || (getNumber (_magazineCfg >> "count") - _ammoCount) == 0) exitWith {false};
if (_ammoCount == 0 || getNumber (_magazineCfg >> "count") - _ammoCount == 0) exitWith {false};
// Check if the player has any of the same magazines
// Calculate max ammo
private "_maxAmmo";
_maxAmmo = 0;
private _maxAmmo = 0;
{
_maxAmmo = _maxAmmo max (_x select 1);

View File

@ -13,10 +13,9 @@
#define COUNT_BARS 12
EXPLODE_1_PVT(_this,_unit);
params ["_unit"];
private ["_target"];
_target = vehicle _unit;
private _target = vehicle _unit;
if (count _this > 1) then {
_target = _this select 1;

View File

@ -14,11 +14,9 @@
EXPLODE_1_PVT(_this,_target);
private ["_weapon","_muzzle","_magazine","_showNumber","_ammo","_maxRounds","_count","_text","_color","_picture","_ammoBarsStructuredText", "_a", "_loadedName", "_string"];
_weapon = currentWeapon _target;
_muzzle = currentMuzzle _target;
_magazine = currentMagazine _target;
private _weapon = currentWeapon _target;
private _muzzle = currentMuzzle _target;
private _magazine = currentMagazine _target;
// currentWeapon returns "" for static weapons before they are shot once
if (_target isKindOf "StaticWeapon") then {
@ -31,8 +29,8 @@ if (_target isKindOf "StaticWeapon") then {
if (_magazine == "") then {
// Try to get magazine using magazinesAmmoFull
private ["_magazines"];
_magazines = magazinesAmmoFull _target;
private _magazines = magazinesAmmoFull _target;
{
if (_x select 2) exitWith {
_magazine = _x select 0;
@ -45,10 +43,10 @@ if (_magazine == "") exitWith {};
if (_weapon == "") exitWith {};
if (!( _muzzle isEqualType "")) then {_muzzle = _weapon};
_showNumber = false;
_ammo = 0;
_maxRounds = 1;
_count = 0;
private _showNumber = false;
private _ammo = 0;
private _maxRounds = 1;
private _count = 0;
// not grenade launcher
if (_muzzle == _weapon) then {
@ -75,16 +73,16 @@ if (_muzzle == _weapon) then {
};
};
_ammoBarsStructuredText = if (_showNumber) then {
private _ammoBarsStructuredText = if (_showNumber) then {
parseText format ["<t align='center' >%1x</t>", _count]
} else {
_color = [((2 * (1 - _ammo / _maxRounds)) min 1), ((2 * _ammo / _maxRounds) min 1), 0];
private _color = [((2 * (1 - _ammo / _maxRounds)) min 1), ((2 * _ammo / _maxRounds) min 1), 0];
_string = "";
private _string = "";
for "_a" from 1 to _count do {
_string = _string + "|";
};
_text = [_string, _color] call EFUNC(common,stringToColoredText);
private _text = [_string, _color] call EFUNC(common,stringToColoredText);
_string = "";
for "_a" from (_count + 1) to (_maxRounds min COUNT_BARS) do {
@ -97,11 +95,11 @@ _ammoBarsStructuredText = if (_showNumber) then {
if (_target isKindOf "StaticWeapon") then {
//Vehicle mags (usualy) don't have pictures, so just show the text above ammo count
_loadedName = getText (configFile >> "CfgMagazines" >> _magazine >> "displaynameshort");
private _loadedName = getText (configFile >> "CfgMagazines" >> _magazine >> "displaynameshort");
_loadedName = parseText format ["<t align='center' >%1</t>", _loadedName];
_text = composeText [_loadedName, linebreak, _ammoBarsStructuredText];
private _text = composeText [_loadedName, linebreak, _ammoBarsStructuredText];
[_text] call EFUNC(common,displayTextStructured);
} else {
_picture = getText (configFile >> "CfgMagazines" >> _magazine >> "picture");
private _picture = getText (configFile >> "CfgMagazines" >> _magazine >> "picture");
[_ammoBarsStructuredText, _picture] call EFUNC(common,displayTextPicture);
};

View File

@ -11,26 +11,24 @@
*/
#include "script_component.hpp"
EXPLODE_2_PVT(_this,_player,_target);
params ["_player", "_target"];
if (vehicle _target != _target) exitWith {false};
private ["_magazineCfg","_magazineType", "_condition", "_onFailure", "_onFinish"];
_magazineType = currentMagazine _target;
_magazineCfg = configFile >> "CfgMagazines" >> _magazineType;
private _magazineType = currentMagazine _target;
private _magazineCfg = configFile >> "CfgMagazines" >> _magazineType;
if (getNumber (_magazineCfg >> "ACE_isBelt") == 0) exitWith {false};
// Check if the ammo is not empty or full
private "_ammoCount";
_ammoCount = _target ammo currentWeapon _target;
private _ammoCount = _target ammo currentWeapon _target;
// Exit if the belt is full or empty
if ((_ammoCount == 0) || (getNumber (_magazineCfg >> "count") - _ammoCount) == 0) exitWith {false};
// Check if the player has any of the same same magazines
// Calculate max ammo it can link
private "_maxAmmo";
_maxAmmo = 0;
private _maxAmmo = 0;
{
_maxAmmo = _maxAmmo max (_x select 1);
@ -38,21 +36,20 @@ _maxAmmo = 0;
if (_maxAmmo == 0) exitWith {};
// Condition to call each frame
_condition = {
EXPLODE_2_PVT((_this select 0),_player,_target);
private _condition = {
(_this select 0) params ["_player", "_target"];
([_player, _target, []] call EFUNC(common,canInteractWith)) && ((_player distance _target) < 3) && ((speed _target) < 1)
};
_onFinish = {
EXPLODE_3_PVT((_this select 0),_player,_target,_magazine);
private _onFinish = {
(_this select 0) params ["_player", "_target", "_magazine"];
// Raise event on remote unit
["linkedAmmo", [_target], [_target, _player, _magazine]] call EFUNC(common,targetEvent);
};
_onFailure = {
private _onFailure = {
EXPLODE_3_PVT((_this select 0),_player,_target,_magazine);
[_player, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation);

View File

@ -16,8 +16,6 @@
*/
#include "script_component.hpp"
private "_maxSpeed";
params ["_driver", "_vehicle"];
if (GVAR(isSpeedLimiter)) exitWith {
@ -30,7 +28,7 @@ if (GVAR(isSpeedLimiter)) exitWith {
playSound "ACE_Sound_Click";
GVAR(isSpeedLimiter) = true;
_maxSpeed = speed _vehicle max 10;
private _maxSpeed = speed _vehicle max 10;
[{
params ["_args", "_idPFH"];
@ -51,8 +49,7 @@ _maxSpeed = speed _vehicle max 10;
[_idPFH] call CBA_fnc_removePerFrameHandler;
};
private "_speed";
_speed = speed _vehicle;
private _speed = speed _vehicle;
if (_speed > _maxSpeed) then {
_vehicle setVelocity ((velocity _vehicle) vectorMultiply ((_maxSpeed / _speed) - 0.00001)); // fix 1.42-hotfix PhysX libraries applying force in previous direction when turning

View File

@ -105,8 +105,7 @@ if (!hasInterface) exitWith {};
if ((currentWeapon ACE_player) != "") then {
[ACE_player] call FUNC(putWeaponAway);
} else {
private ["_weapon"];
_weapon = switch (true) do {
private _weapon = switch (true) do {
case ((primaryWeapon ACE_player) != ""): {primaryWeapon ACE_player};
case ((handgunWeapon ACE_player) != ""): {handgunWeapon ACE_player};
case ((secondaryWeapon ACE_player) != ""): {secondaryWeapon ACE_player};

View File

@ -17,16 +17,14 @@ GVAR(GrenadesAll) = [];
GVAR(GrenadesFrag) = [];
GVAR(GrenadesNonFrag) = [];
private ["_magazines", "_ammo", "_explosive"];
{
_magazines = getArray (configFile >> "CfgWeapons" >> "Throw" >> _x >> "magazines");
private _magazines = getArray (configFile >> "CfgWeapons" >> "Throw" >> _x >> "magazines");
GVAR(GrenadesAll) append _magazines;
{
_ammo = getText (configFile >> "CfgMagazines" >> _x >> "ammo");
_explosive = getNumber (configFile >> "CfgAmmo" >> _ammo >> "explosive");
private _ammo = getText (configFile >> "CfgMagazines" >> _x >> "ammo");
private _explosive = getNumber (configFile >> "CfgAmmo" >> _ammo >> "explosive");
([GVAR(GrenadesFrag), GVAR(GrenadesNonFrag)] select (_explosive == 0)) pushBack _x;
false

View File

@ -20,12 +20,10 @@ if !(GVAR(DisplayText)) exitWith {};
params ["_magazine", "_numberofGrenades"];
private ["_color", "_name", "_text", "_picture"];
private _color = [[1, 0, 0], [1, 1, 1]] select (_numberofGrenades > 0);
private _name = getText (configFile >> "CfgMagazines" >> _magazine >> "displayNameShort");
_color = [[1, 0, 0], [1, 1, 1]] select (_numberofGrenades > 0);
_name = getText (configFile >> "CfgMagazines" >> _magazine >> "displayNameShort");
_text = [format ["%1 x%2", _name, _numberofGrenades], _color] call EFUNC(common,stringToColoredText);
_picture = getText (configFile >> "CfgMagazines" >> _magazine >> "picture");
private _text = [format ["%1 x%2", _name, _numberofGrenades], _color] call EFUNC(common,stringToColoredText);
private _picture = getText (configFile >> "CfgMagazines" >> _magazine >> "picture");
["displayTextPicture", [_text, _picture]] call EFUNC(common,localEvent);

View File

@ -17,11 +17,8 @@
params ["_vehicle"];
private ["_turret", "_weapons"];
_turret = [_vehicle] call EFUNC(common,getTurretCommander);
_weapons = _vehicle weaponsTurret _turret;
private _turret = _vehicle call EFUNC(common,getTurretCommander);
private _weapons = _vehicle weaponsTurret _turret;
if (
count _weapons > 1
@ -32,8 +29,8 @@ if (
// avoid infinite loop
if !("SmokeLauncher" in _weapons) exitWith {};
private "_index";
_index = 0;
private _index = 0;
while {
_vehicle currentWeaponTurret _turret != "SmokeLauncher"
} do {
@ -44,8 +41,7 @@ if (
} else {
// fire away!
private "_logic";
_logic = createGroup sideLogic createUnit ["Logic", [0,0,0], [], 0, "NONE"];
private _logic = createGroup sideLogic createUnit ["Logic", [0,0,0], [], 0, "NONE"];
_logic action ["useWeapon", _vehicle, commander _vehicle, 0];

View File

@ -18,14 +18,12 @@
params ["_unit", "_weapon"];
private ["_sound", "_position"];
_sound = getArray (configFile >> "CfgWeapons" >> _weapon >> "changeFiremodeSound");
private _sound = getArray (configFile >> "CfgWeapons" >> _weapon >> "changeFiremodeSound");
if (_sound isEqualTo []) exitWith {};
// get position where to play the sound (position of the weapon)
_position = AGLToASL (_unit modelToWorldVisual (_unit selectionPosition "RightHand"));
private _position = AGLToASL (_unit modelToWorldVisual (_unit selectionPosition "RightHand"));
_sound params ["_filename", ["_volume", 1], ["_soundPitch", 1], ["_distance", 0]];

View File

@ -17,6 +17,6 @@
params ["_unit"];
[_unit] call EFUNC(common,fixLoweredRifleAnimation);
_unit call EFUNC(common,fixLoweredRifleAnimation);
_unit action ["SwitchWeapon", _unit, _unit, 99];

View File

@ -18,10 +18,8 @@
params ["_unit", ["_type", 0]];
private ["_currentGrenade", "_magazines", "_grenades", "_nextGrenadeIndex", "_nextGrenade", "_uniformGrenades", "_vestGrenades", "_backpackGrenades"];
// get currently selected grenade
_currentGrenade = currentThrowable _unit;
private _currentGrenade = currentThrowable _unit;
// get correct array format if no grenade is selected
if (_currentGrenade isEqualTo []) then {
@ -31,9 +29,9 @@ if (_currentGrenade isEqualTo []) then {
_currentGrenade = _currentGrenade select 0;
// get available magazines for that unit
_magazines = magazines _unit;
private _magazines = magazines _unit;
_grenades = [];
private _grenades = [];
{
if (_x in _magazines) then {
@ -46,22 +44,22 @@ _grenades = [];
if (_grenades isEqualTo []) exitWith {false};
// get next grenade muzzle
_nextGrenadeIndex = (_grenades find _currentGrenade) + 1;
private _nextGrenadeIndex = (_grenades find _currentGrenade) + 1;
// roll over if the last grenade was selected
if (_nextGrenadeIndex >= count _grenades) then {
_nextGrenadeIndex = 0;
};
_nextGrenade = _grenades select _nextGrenadeIndex;
private _nextGrenade = _grenades select _nextGrenadeIndex;
// abort if the same grenade would be selected
if (_currentGrenade == _nextGrenade) exitWith {false};
// current best method to select a grenade: remove all grenades except the one you want to select, then add them back
_uniformGrenades = [uniformItems _unit, {_x in GVAR(GrenadesAll) && {_x != _nextGrenade}}] call EFUNC(common,filter);
_vestGrenades = [vestItems _unit, {_x in GVAR(GrenadesAll) && {_x != _nextGrenade}}] call EFUNC(common,filter);
_backpackGrenades = [backpackItems _unit, {_x in GVAR(GrenadesAll) && {_x != _nextGrenade}}] call EFUNC(common,filter);
private _uniformGrenades = [uniformItems _unit, {_x in GVAR(GrenadesAll) && {_x != _nextGrenade}}] call EFUNC(common,filter);
private _vestGrenades = [vestItems _unit, {_x in GVAR(GrenadesAll) && {_x != _nextGrenade}}] call EFUNC(common,filter);
private _backpackGrenades = [backpackItems _unit, {_x in GVAR(GrenadesAll) && {_x != _nextGrenade}}] call EFUNC(common,filter);
// remove all grenades except those we are switching to --> this breaks the selector
{_unit removeItemFromUniform _x; false} count _uniformGrenades;

View File

@ -29,20 +29,18 @@ if (_weapon in (_unit getVariable [QEGVAR(safemode,safedWeapons), []])) exitWith
[_unit, _weapon, _weapon] call EFUNC(safemode,unlockSafety);
};
private ["_muzzles", "_modes"];
private _muzzles = [_weapon] call EFUNC(common,getWeaponMuzzles);
private _modes = [_weapon] call EFUNC(common,getWeaponModes);
_muzzles = [_weapon] call EFUNC(common,getWeaponMuzzles);
_modes = [_weapon] call EFUNC(common,getWeaponModes);
private _index = (_modes find currentWeaponMode _unit) + 1;
private ["_index", "_muzzle", "_mode"];
_index = (_modes find currentWeaponMode _unit) + 1;
if (_index > count _modes - 1) then {_index = 0};
_muzzle = _muzzles select 0;
_mode = _modes select _index;
private _muzzle = _muzzles select 0;
private _mode = _modes select _index;
_index = 0;
while {
_index < 100 && {currentMuzzle _unit != _muzzle || {currentWeaponMode _unit != _mode}}
} do {

View File

@ -20,8 +20,7 @@ params ["_unit", "_weapon"];
if (_weapon == "") exitWith {};
private "_muzzles";
_muzzles = [_weapon] call EFUNC(common,getWeaponMuzzles);
private _muzzles = _weapon call EFUNC(common,getWeaponMuzzles);
if (currentWeapon _unit != _weapon) exitWith {
if (count _muzzles > 1) then {
@ -35,12 +34,11 @@ if (currentWeapon _unit != _weapon) exitWith {
};
};
private ["_index", "_muzzle"];
private _index = (_muzzles find currentMuzzle _unit) + 1;
_index = (_muzzles find currentMuzzle _unit) + 1;
if (_index > count _muzzles - 1) then {_index = 1};
_muzzle = _muzzles select _index;
private _muzzle = _muzzles select _index;
_index = 0;
while {

View File

@ -19,39 +19,36 @@
params ["_unit", "_vehicle", "_index"];
private "_turret";
_turret = [_unit] call EFUNC(common,getTurretIndex);
private _turret = _unit call EFUNC(common,getTurretIndex);
if (_turret isEqualTo [] && {_unit == driver _vehicle}) then {
private ["_weapons", "_weapon"];
private _weapons = weapons _vehicle;
_weapons = weapons _vehicle;
if (_index > count _weapons - 1) exitWith {};
_weapon = _weapons select _index;
private _weapon = _weapons select _index;
_index = 0;
while {
_index < 100 && {currentWeapon _vehicle != _weapon}
} do {
_unit action ["SwitchWeapon", _vehicle, _unit, _index];
_index = _index + 1;
};
} else {
private ["_weapons", "_weapon"];
private _weapons = _vehicle weaponsTurret _turret;
_weapons = _vehicle weaponsTurret _turret;
if (_index > count _weapons - 1) exitWith {};
_weapon = _weapons select _index;
private _weapon = _weapons select _index;
_index = 0;
while {
_index < 100 && {_vehicle currentWeaponTurret _turret != _weapon}
} do {
_unit action ["SwitchWeapon", _vehicle, _unit, _index];
_index = _index + 1;
};
};

View File

@ -25,8 +25,7 @@ params ["_unit", "_weapon", "", "", "", "_magazine"];
if (_weapon != "Throw") exitWith {};
private "_count";
_count = {_x == _magazine} count magazines _unit;
private _count = {_x == _magazine} count magazines _unit;
[_magazine, _count] call FUNC(displayGrenadeTypeAndNumber);