Commander Reload and Remove Turret Mags

This commit is contained in:
DESKTOP-UH65DCE\MusTanG 2017-09-23 22:29:45 -05:00
parent 122cb8b96c
commit 19b5a06215
4 changed files with 56 additions and 0 deletions

View File

@ -0,0 +1,39 @@
/*
Author: DirtySanchez - ported from DonkeyPunch eXpoch http://DonkeyPunch.INFO
Contributors:
Licence:
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
Github:
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/vehicles/EPOCH_vehicle_removeCommanderAmmo.sqf
*/
params["_weaponTurret", "_turretPath"];
if(isNil {_weaponTurret})exitWith{diag_log "[EpochDebug] removeCommanderAmmo _weaponTurret was nil"};
if(isNil {_turretPath})exitWith{diag_log "[EpochDebug] removeCommanderAmmo _turretPath was nil"};
private _magAmmo = 0;
private _magsTurret = "";
private _ammoTurret = getArray(configFile >> "CfgWeapons" >> _weaponTurret >> "magazines");
private _magsAllTurrets = magazinesAllTurrets vehicle player;
{
if(_x select 0 in _ammoTurret)then{
_magsTurret = _x select 0;
_magAmmo = _x select 2;
_magsAllTurrets = [];
};
}forEach _magsAllTurrets;
if(_magAmmo isEqualTo 0)exitWith{
private _nameTurret = getText(configFile >> "CfgWeapons" >> _weaponTurret >> "displayName");
[format["The %1 does not have any ammo",_nameTurret],5] call Epoch_message;
};
[format["You have removed 1 can of %1 with %2 rounds",_magsTurret, _magAmmo],5] call Epoch_message;
player addMagazine [_magsTurret,_magAmmo];
vehicle player removeMagazineTurret [_magsTurret,_turretPath];
reload vehicle player;

View File

@ -35,6 +35,7 @@ class CfgActionMenu
dyna_inDriver = "driver vehicle player == player";
dyna_inTurret = "gunner vehicle player == player";
dyna_inCommander = "player isEqualTo commander objectParent player";
dyna_vehicleRoleEmpty = "((assignedVehicleRole player) isEqualTo [])";
dyna_blockTurrets = "['Horn', 'MiniCarHorn', 'SportCarHorn', 'TruckHorn2', 'TruckHorn', 'BikeHorn', 'CarHorn', 'TruckHorn3']";
@ -48,6 +49,7 @@ class CfgActionMenu
dyna_isGunning = "if(dyna_inVehicle && dyna_inTurret && !dyna_inDriver)then{(!isNil {dyna_weaponsTurret})}else{false}";
dyna_isDriving = "if(dyna_inVehicle && dyna_inDriver)then{(!isNil {dyna_driverTurret})}else{false}";
dyna_isCommanding = "if(dyna_inVehicle && dyna_inCommander)then{(!isNil {dyna_weaponsTurret})}else{false}";
};
class self

View File

@ -190,4 +190,18 @@ class veh_driverRemoveAmmo
action = "[dyna_driverTurret select 0, [-1]] call EPOCH_vehicle_removeTurretAmmo";
icon = "x\addons\a3_epoch_code\Data\UI\buttons\RemoveMag.paa";
tooltipcode = "if!(dyna_driverTurretMags isEqualTo [])then{format['Remove Mag of %1',dyna_driverTurretMags select 0]}else{''}";
};
class veh_commanderRearm
{
condition = "if(dyna_isCommanding)then{!((dyna_weaponsTurret select 0) in dyna_blockTurrets)}else{false}";
action = "[dyna_weaponsTurret select 0, dyna_weaponsTurretPath] call EPOCH_vehicle_checkTurretAmmo";
icon = "x\addons\a3_epoch_code\Data\UI\buttons\Rearm.paa";
tooltipcode = "if(!isNil {dyna_weaponsTurret})then{format['Add Mag to %1',getText(configFile >> 'CfgWeapons' >> dyna_weaponsTurret select 0 >> 'displayName')]}else{''}";
};
class veh_commanderRemoveAmmo
{
condition = "dyna_isCommanding && !(dyna_weaponsTurretMags isEqualTo [])";
action = "[dyna_weaponsTurret select 0, dyna_weaponsTurretPath] call EPOCH_vehicle_removeCommanderAmmo";
icon = "x\addons\a3_epoch_code\Data\UI\buttons\RemoveMag.paa";
tooltipcode = "if(!isNil {dyna_weaponsTurret})then{format['Remove Mag from %1',getText(configFile >> 'CfgWeapons' >> dyna_weaponsTurret select 0 >> 'displayName')]}else{''}";
};

View File

@ -159,6 +159,7 @@ class CfgClientFunctions
class client_VehicleMaintananceDo {};
class vehicle_checkTurretAmmo {};
class vehicle_removeTurretAmmo {};
class vehicle_removeCommanderAmmo {};
};
class missions
{