mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-02-23 16:40:50 +03:00
Auto select main weapon after throwing
Also added to gear unload so player will auto select pistol if picking
one up with flares in their hands.
Vanilla commit:
08449fdfda
This commit is contained in:
@@ -98,5 +98,8 @@ if ((_ammo isKindOf "SmokeShell") or (_ammo isKindOf "GrenadeHandTimedWest") or
|
||||
publicVariable "PVDZ_obj_RoadFlare";
|
||||
[_this] spawn player_throwObject;
|
||||
};
|
||||
|
||||
//Auto select main weapon after throwing
|
||||
call player_selectWeapon;
|
||||
};
|
||||
};
|
||||
22
SQF/dayz_code/compile/player_selectWeapon.sqf
Normal file
22
SQF/dayz_code/compile/player_selectWeapon.sqf
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
Call this function to select primary or pistol (if no primary)
|
||||
when the player's currently selected weapon is a throwable.
|
||||
*/
|
||||
|
||||
private ["_main","_muzzle"];
|
||||
|
||||
if (currentWeapon player == "Throw") then {
|
||||
_main = primaryWeapon player;
|
||||
if (_main == "") then {
|
||||
{
|
||||
if (getNumber (configFile >> "CfgWeapons" >> _x >> "type") == 2) then {_main = _x;};
|
||||
} count (weapons player);
|
||||
};
|
||||
|
||||
_muzzle = getArray (configFile >> "CfgWeapons" >> _main >> "muzzles");
|
||||
if (count _muzzle > 1) then {
|
||||
player selectWeapon (_muzzle select 0);
|
||||
} else {
|
||||
player selectWeapon _main;
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user