From c6bcbe81eb7207f6b712f5e3b0d3cc985bae2603 Mon Sep 17 00:00:00 2001 From: He-Man Date: Thu, 5 Oct 2017 20:59:52 +0200 Subject: [PATCH] Reworked Vehicle Rearm Scrips --- .../EPOCH_vehicle_checkTurretAmmo.sqf | 61 +++++++---- .../EPOCH_vehicle_removeCommanderAmmo.sqf | 48 --------- .../EPOCH_vehicle_removeTurretAmmo.sqf | 47 ++++---- .../CfgActionMenu/CfgActionMenu_core.hpp | 21 +--- .../CfgActionMenu/CfgActionMenu_self.hpp | 100 +++++++----------- .../Configs/CfgClientFunctions.hpp | 1 - 6 files changed, 101 insertions(+), 177 deletions(-) delete mode 100644 Sources/epoch_code/compile/vehicles/EPOCH_vehicle_removeCommanderAmmo.sqf diff --git a/Sources/epoch_code/compile/vehicles/EPOCH_vehicle_checkTurretAmmo.sqf b/Sources/epoch_code/compile/vehicles/EPOCH_vehicle_checkTurretAmmo.sqf index 27aa764d..22f606f7 100644 --- a/Sources/epoch_code/compile/vehicles/EPOCH_vehicle_checkTurretAmmo.sqf +++ b/Sources/epoch_code/compile/vehicles/EPOCH_vehicle_checkTurretAmmo.sqf @@ -1,7 +1,7 @@ /* Author: DirtySanchez - ported from DonkeyPunch eXpoch http://DonkeyPunch.INFO - Contributors: + Contributors: He-Man Licence: Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike @@ -9,31 +9,48 @@ Github: https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/vehicles/EPOCH_vehicle_checkTurretAmmo.sqf */ -params["_weaponTurret", "_turretPath"]; +private ["_ammoTurret","_availAmmo","_ammo","_magazinesAmmoFull","_readd","_selectedmag","_magAmmoCount","_return","_AllFlares","_removeveh","_readdveh"]; +params["_vehicle","_weaponTurret", "_turretPath"]; -if(isNil {_weaponTurret})exitWith{diag_log "[EpochDebug] checkTurretAmmo _weaponTurret was nil"}; +// Fix for not reloadable Flares +if ((["flare", tolower _weaponTurret] call BIS_fnc_inString) || (["smoke", tolower _weaponTurret] call BIS_fnc_inString)) then { + _AllFlares = ((magazinesAllTurrets _vehicle) select {_x param [1] isequalto _turretPath}) select {(["flare", tolower (_x param [0])] call BIS_fnc_inString) || (["smoke", tolower (_x param [0])] call BIS_fnc_inString)}; + _removeveh = []; + _readdveh = []; + { + _removeveh pushbackunique (_x select 0); + if !((_x select 2) isequalto 0) then { + _readdveh pushback _x; + }; + } foreach _AllFlares; + { + _vehicle removeMagazinesTurret [_x,_turretPath]; + } foreach _removeveh; + { + _vehicle addMagazineTurret [_x select 0, _turretPath, _x select 2]; + } foreach _readdveh; +}; -if(isNil {_turretPath})exitWith{diag_log "[EpochDebug] checkTurretAmmo _turretPath was nil"}; - -private _ammoCount = 0; -private _ammoTurret = getArray(configFile >> "CfgWeapons" >> _weaponTurret >> "magazines"); -private _items = magazines player; -private _availAmmo = _items arrayIntersect _ammoTurret; -if (count _availAmmo == 0) then -{ +_ammoTurret = getArray(configFile >> "CfgWeapons" >> _weaponTurret >> "magazines"); +_availAmmo = (magazines player) arrayIntersect _ammoTurret; +if (count _availAmmo == 0) then { [format["You need a can of %1 or any of its variants",_ammoTurret select 0],5] call Epoch_message; } -else -{ - private _ammo = _availAmmo select 0; - private _magazinesAmmoFull = magazinesAmmoFull player; +else { + _ammo = _availAmmo select 0; + _magazinesAmmoFull = magazinesAmmoFull player; + _readd = []; { if((_x select 0) isEqualTo _ammo) then { - _ammoCount = _x select 1; - _magazinesAmmoFull = []; + _readd pushback _x; }; - }forEach _magazinesAmmoFull; - [format["You have added 1 can of %1 with %2 rounds",_ammo,_ammoCount],5] call Epoch_message; - vehicle player addMagazineTurret [_ammo,_turretPath,_ammoCount]; - player removeMagazine _ammo; -}; \ No newline at end of file + } forEach _magazinesAmmoFull; + _selectedmag = _readd deleteat 0; + _magAmmoCount = _selectedmag select 1; + _vehicle addMagazineTurret [_ammo,_turretPath,_magAmmoCount]; + player removeMagazines _ammo; + { + _return = _x call EPOCH_fnc_addMagazineOverflow; + } foreach _readd; + [format["Added 1 can %1 with %2 rounds to %3",getText (configFile >> 'CfgMagazines' >> _ammo >> 'displayName'),_magAmmoCount,getText (configFile >> 'CfgWeapons' >> _weaponTurret >> 'displayName')],5] call Epoch_message; +}; diff --git a/Sources/epoch_code/compile/vehicles/EPOCH_vehicle_removeCommanderAmmo.sqf b/Sources/epoch_code/compile/vehicles/EPOCH_vehicle_removeCommanderAmmo.sqf deleted file mode 100644 index 0cebc4f8..00000000 --- a/Sources/epoch_code/compile/vehicles/EPOCH_vehicle_removeCommanderAmmo.sqf +++ /dev/null @@ -1,48 +0,0 @@ -/* - - 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; -}; - -_return = [_magsTurret,_magAmmo] call EPOCH_fnc_addMagazineOverflow; -if(_return isEqualTo 0)exitWith{diag_log "[EpochDebug] removeCommanderAmmo _return epoch_equip failed"}; -if(_return isEqualTo 1)then{ - [format["You have removed 1 can of %1 with %2 rounds",_magsTurret, _magAmmo],5] call Epoch_message; -}; -if(_return isEqualTo 2)then{ - [format["You dropped 1 can of %1 with %2 rounds on the ground!",_magsTurret, _magAmmo],5] call Epoch_message; -}; -if(_return isEqualTo 3)then{ - [format["You dont have enough space for %1!",_magsTurret],5] call Epoch_message; -}; -vehicle player removeMagazineTurret [_magsTurret,_turretPath]; -reload vehicle player; \ No newline at end of file diff --git a/Sources/epoch_code/compile/vehicles/EPOCH_vehicle_removeTurretAmmo.sqf b/Sources/epoch_code/compile/vehicles/EPOCH_vehicle_removeTurretAmmo.sqf index 5b78fdcd..f433f699 100644 --- a/Sources/epoch_code/compile/vehicles/EPOCH_vehicle_removeTurretAmmo.sqf +++ b/Sources/epoch_code/compile/vehicles/EPOCH_vehicle_removeTurretAmmo.sqf @@ -2,7 +2,7 @@ Author: DirtySanchez - ported from DonkeyPunch eXpoch http://DonkeyPunch.INFO - Contributors: + Contributors: He-Man Licence: Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike @@ -10,31 +10,28 @@ Github: https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/vehicles/EPOCH_vehicle_removeTurretAmmo.sqf */ -params["_weaponTurret", "_turretPath"]; +private ["_AllMagsDetailTurret","_selectedmag","_magAmmoCount","_return","_magtxt","_weapontxt","_msg"]; +params["_vehicle","_weaponTurret","_ammo", "_turretPath"]; -if(isNil {_weaponTurret})exitWith{diag_log "[EpochDebug] removeTurretAmmo _weaponTurret was nil"}; - -if(isNil {_turretPath})exitWith{diag_log "[EpochDebug] removeTurretAmmo _turretPath was nil"}; - -private _magsTurretDetails = magazinesAmmo vehicle player; -if(_magsTurretDetails isEqualTo [])exitWith{ - private _nameTurret = getText(configFile >> "CfgWeapons" >> _weaponTurret >> "displayName"); - [format["The %1 does not have any ammo",_nameTurret],5] call Epoch_message; +_AllMagsDetailTurret = ((magazinesAllTurrets _vehicle) select {_x param [1] isequalto _turretPath}) select {_x param [0] isequalto _ammo}; +if (_AllMagsDetailTurret isequalto []) exitwith { + ["Error - No ammo found",5] call Epoch_message; }; +_selectedmag = _AllMagsDetailTurret deleteat 0; +_magAmmoCount = _selectedmag select 2; +_vehicle removeMagazinesTurret [_ammo,_turretPath]; +{ + _vehicle addMagazineTurret [_x select 0, _turretPath, _x select 2]; +} foreach _AllMagsDetailTurret; +reload _vehicle; +_return = [_ammo,_magAmmoCount] call EPOCH_fnc_addMagazineOverflow; -private _magsTurret = (_magsTurretDetails select 0) select 0; -private _magAmmo = (_magsTurretDetails select 0) select 1; - -_return = [_magsTurret,_magAmmo] call EPOCH_fnc_addMagazineOverflow; -if(_return isEqualTo 0)exitWith{diag_log "[EpochDebug] removeCommanderAmmo _return epoch_equip failed"}; -if(_return isEqualTo 1)then{ - [format["You have removed 1 can of %1 with %2 rounds",_magsTurret, _magAmmo],5] call Epoch_message; +_magtxt = getText (configFile >> 'CfgMagazines' >> _ammo >> 'displayName'); +_weapontxt = getText (configFile >> 'CfgWeapons' >> _weaponTurret >> 'displayName'); +_msg = switch _return do { + case 0: {"Error - return epoch_equip failed"}; + case 1: {format ["Removed 1 can %1 with %2 rounds from %3",_magtxt,_magAmmoCount, _weapontxt]}; + case 2: {format ["Dropped 1 can of %1 with %2 rounds on the ground!",_magtxt,_magAmmoCount, _weapontxt]}; + case 3: {format ["You dont have enough space for %1!",_magtxt]}; }; -if(_return isEqualTo 2)then{ - [format["You dropped 1 can of %1 with %2 rounds on the ground!",_magsTurret, _magAmmo],5] call Epoch_message; -}; -if(_return isEqualTo 3)then{ - [format["You dont have enough space for %1!",_magsTurret],5] call Epoch_message; -}; -vehicle player removeMagazineTurret [_magsTurret,_turretPath]; -reload vehicle player; \ No newline at end of file +[_msg,5] call Epoch_message; diff --git a/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_core.hpp b/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_core.hpp index b8d8e723..ad72eb46 100644 --- a/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_core.hpp +++ b/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_core.hpp @@ -34,23 +34,10 @@ class CfgActionMenu dyna_locked = "locked dyna_cursorTarget in [2,3]"; dyna_lockedInVehicle = "locked vehicle player in [2,3]"; - 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']"; - - dyna_weaponsTurret = "if!(dyna_vehicleRoleEmpty)then{(vehicle player) weaponsTurret ((assignedVehicleRole player) select 1)}else{nil}"; - dyna_weaponsTurretPath = "if(!isNil {dyna_weaponsTurret})then{((assignedVehicleRole player) select 1)}else{nil}"; - dyna_weaponsTurretMags = "if(!isNil {dyna_weaponsTurret})then{vehicle player magazinesTurret dyna_weaponsTurretPath}else{[]}"; - - dyna_driverTurret = "if(dyna_inDriver)then{vehicle player weaponsTurret[-1]}else{nil}"; - dyna_driverTurretMags = "if(!isNil {dyna_driverTurret})then{vehicle player magazinesTurret[-1]}else{[]}"; - - 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}"; + dyna_blockWeapons = "[]"; + dyna_Turret = "if (!dyna_inVehicle) then {[]} else {if ((assignedVehicleRole player) isequalto ['driver']) then {[-1]} else {if (count (assignedVehicleRole player) == 2) then {(assignedVehicleRole player) select 1}else {[]}}}"; + dyna_weaponsTurret = "if (!dyna_inVehicle) then {[]}else {((vehicle player) weaponsTurret dyna_Turret) select {!((getArray(configFile >> 'CfgWeapons' >> _x >> 'magazines')) select {!((getText (configFile >> 'CfgMagazines' >> _x >> 'picture')) isequalto '')} isequalto [])}}"; + dyna_WeapsMagsTurret = "call {_out = [];if (dyna_inVehicle) then {_added = [];{_weapon = _x;_WeaponMags = ((vehicle player) magazinesTurret dyna_Turret) select {(_x in (getArray (configFile >> 'CfgWeapons' >> _weapon >> 'magazines'))) && !((getText (configFile >> 'CfgMagazines' >> _x >> 'picture')) isequalto '')};if !(_WeaponMags isequalto []) then {{if !(_x in _added) then {_out pushback [_weapon,_x];_added pushback _x;};} foreach _WeaponMags;};} foreach dyna_weaponsTurret;};_out}"; }; class self diff --git a/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_self.hpp b/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_self.hpp index 4a308d81..68d20598 100644 --- a/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_self.hpp +++ b/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_self.hpp @@ -163,87 +163,59 @@ class ServicePoint tooltipcode = "Ignatz_Rearm2 select 0"; }; }; -class veh_gunnerRearm +class veh_Rearm1 { - condition = "if(dyna_isGunning)then{!((dyna_weaponsTurret select 0) in dyna_blockTurrets)}else{false}"; - action = "[dyna_weaponsTurret select 0, dyna_weaponsTurretPath] call EPOCH_vehicle_checkTurretAmmo"; + condition = "if (count dyna_weaponsTurret > 0) then {!((dyna_weaponsTurret select 0) in dyna_blockWeapons)}else{false}"; + action = "[vehicle player, dyna_weaponsTurret select 0, dyna_Turret] 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{''}"; + tooltipcode = "format['Add Mag to %1',getText(configFile >> 'CfgWeapons' >> dyna_weaponsTurret select 0 >> 'displayName')]"; }; -class veh_gunnerRemoveAmmo +class veh_Rearm2 { - condition = "dyna_isGunning && !(dyna_weaponsTurretMags isEqualTo [])"; - action = "[dyna_weaponsTurret select 0, dyna_weaponsTurretPath] call EPOCH_vehicle_removeTurretAmmo"; - 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{''}"; -}; -class veh_driverRearm -{ - condition = "if(dyna_isDriving)then{!((dyna_driverTurret select 0) in dyna_blockTurrets)}else{false}"; - action = "[dyna_driverTurret select 0, [-1]] call EPOCH_vehicle_checkTurretAmmo"; + condition = "if (count dyna_weaponsTurret > 1) then {!((dyna_weaponsTurret select 1) in dyna_blockWeapons)}else{false}"; + action = "[vehicle player,dyna_weaponsTurret select 1, dyna_Turret] call EPOCH_vehicle_checkTurretAmmo"; icon = "x\addons\a3_epoch_code\Data\UI\buttons\Rearm.paa"; - tooltipcode = "if(!isNil {dyna_driverTurret})then{format['Add Mag to %1',getText(configFile >> 'CfgWeapons' >> dyna_driverTurret select 0 >> 'displayName')]}else{''}"; + tooltipcode = "format['Add Mag to %1',getText(configFile >> 'CfgWeapons' >> dyna_weaponsTurret select 1 >> 'displayName')]"; }; -class veh_driverRemoveAmmo +class veh_Rearm3 { - condition = "dyna_isDriving && !(dyna_driverTurretMags isEqualTo [])"; - 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_driverRearm1 -{ - condition = "if(dyna_isDriving)then{!((dyna_driverTurret select 1) in dyna_blockTurrets) && (count dyna_driverTurret > 1)}else{false}"; - action = "[dyna_driverTurret select 1, [-1]] call EPOCH_vehicle_checkTurretAmmo"; + condition = "if (count dyna_weaponsTurret > 2) then {!((dyna_weaponsTurret select 2) in dyna_blockWeapons)}else{false}"; + action = "[vehicle player,dyna_weaponsTurret select 2, dyna_Turret] call EPOCH_vehicle_checkTurretAmmo"; icon = "x\addons\a3_epoch_code\Data\UI\buttons\Rearm.paa"; - tooltipcode = "if(!isNil {dyna_driverTurret})then{format['Add Mag to %1',getText(configFile >> 'CfgWeapons' >> dyna_driverTurret select 1 >> 'displayName')]}else{''}"; + tooltipcode = "format['Add Mag to %1',getText(configFile >> 'CfgWeapons' >> dyna_weaponsTurret select 2 >> 'displayName')]"; }; -class veh_driverRemoveAmmo1 +class veh_Rearm4 { - condition = "if(dyna_isDriving)then{(count dyna_driverTurret > 1) && !(dyna_driverTurretMags isEqualTo [])}else{false}"; - action = "[dyna_driverTurret select 1, [-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 1]}else{''}"; -}; -class veh_driverRearm2 -{ - condition = "if(dyna_isDriving)then{!((dyna_driverTurret select 1) in dyna_blockTurrets) && (count dyna_driverTurret > 2)}else{false}"; - action = "[dyna_driverTurret select 2, [-1]] call EPOCH_vehicle_checkTurretAmmo"; + condition = "if (count dyna_weaponsTurret > 3) then {!((dyna_weaponsTurret select 3) in dyna_blockWeapons)}else{false}"; + action = "[vehicle player,dyna_weaponsTurret select 3, dyna_Turret] call EPOCH_vehicle_checkTurretAmmo"; icon = "x\addons\a3_epoch_code\Data\UI\buttons\Rearm.paa"; - tooltipcode = "if(!isNil {dyna_driverTurret})then{format['Add Mag to %1',getText(configFile >> 'CfgWeapons' >> dyna_driverTurret select 2 >> 'displayName')]}else{''}"; + tooltipcode = "format['Add Mag to %1',getText(configFile >> 'CfgWeapons' >> dyna_weaponsTurret select 3 >> 'displayName')]"; }; -class veh_driverRemoveAmmo2 +class veh_RemoveAmmo1 { - condition = "if(dyna_isDriving)then{(count dyna_driverTurret > 2) && !(dyna_driverTurretMags isEqualTo [])}else{false}"; - action = "[dyna_driverTurret select 2, [-1]] call EPOCH_vehicle_removeTurretAmmo"; + condition = "if (count dyna_WeapsMagsTurret > 0) then {!((dyna_WeapsMagsTurret select 0 select 0) in dyna_blockWeapons)}else{false}"; + action = "[vehicle player,dyna_WeapsMagsTurret select 0 select 0,dyna_WeapsMagsTurret select 0 select 1, dyna_Turret] 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 2]}else{''}"; + tooltipcode = "format['Remove %1 from %2',getText(configFile >> 'CfgMagazines' >> (dyna_WeapsMagsTurret select 0 select 1) >> 'displayName'),getText(configFile >> 'CfgWeapons' >> (dyna_WeapsMagsTurret select 0 select 0) >> 'displayName')]"; }; -class veh_commanderRearm +class veh_RemoveAmmo2 { - 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"; + condition = "if (count dyna_WeapsMagsTurret > 1) then {!((dyna_WeapsMagsTurret select 1 select 0) in dyna_blockWeapons)}else{false}"; + action = "[vehicle player,dyna_WeapsMagsTurret select 1 select 0,dyna_WeapsMagsTurret select 1 select 1, dyna_Turret] call EPOCH_vehicle_removeTurretAmmo"; 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{''}"; + tooltipcode = "format['Remove %1 from %2',getText(configFile >> 'CfgMagazines' >> (dyna_WeapsMagsTurret select 1 select 1) >> 'displayName'),getText(configFile >> 'CfgWeapons' >> (dyna_WeapsMagsTurret select 1 select 0) >> 'displayName')]"; }; -class veh_commanderRearm1 +class veh_RemoveAmmo3 { - condition = "if(dyna_isCommanding)then{!((dyna_weaponsTurret select 1) in dyna_blockTurrets) && (count dyna_weaponsTurret > 1)}else{false}"; - action = "[dyna_weaponsTurret select 1, 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 1 >> 'displayName')]}else{''}"; -}; -class veh_commanderRemoveAmmo1 -{ - condition = "if(dyna_isCommanding)then{(count dyna_weaponsTurret > 1) && !(dyna_weaponsTurretMags isEqualTo [])}else{false}"; - action = "[dyna_weaponsTurret select 1, dyna_weaponsTurretPath] call EPOCH_vehicle_removeCommanderAmmo"; + condition = "if (count dyna_WeapsMagsTurret > 2) then {!((dyna_WeapsMagsTurret select 2 select 0) in dyna_blockWeapons)}else{false}"; + action = "[vehicle player,dyna_WeapsMagsTurret select 2 select 0,dyna_WeapsMagsTurret select 2 select 1, dyna_Turret] call EPOCH_vehicle_removeTurretAmmo"; 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 1 >> 'displayName')]}else{''}"; -}; \ No newline at end of file + tooltipcode = "format['Remove %1 from %2',getText(configFile >> 'CfgMagazines' >> (dyna_WeapsMagsTurret select 2 select 1) >> 'displayName'),getText(configFile >> 'CfgWeapons' >> (dyna_WeapsMagsTurret select 2 select 0) >> 'displayName')]"; +}; +class veh_RemoveAmmo4 +{ + condition = "if (count dyna_WeapsMagsTurret > 3) then {!((dyna_WeapsMagsTurret select 3 select 0) in dyna_blockWeapons)}else{false}"; + action = "[vehicle player,dyna_WeapsMagsTurret select 3 select 0,dyna_WeapsMagsTurret select 3 select 1, dyna_Turret] call EPOCH_vehicle_removeTurretAmmo"; + icon = "x\addons\a3_epoch_code\Data\UI\buttons\RemoveMag.paa"; + tooltipcode = "format['Remove %1 from %2',getText(configFile >> 'CfgMagazines' >> (dyna_WeapsMagsTurret select 3 select 1) >> 'displayName'),getText(configFile >> 'CfgWeapons' >> (dyna_WeapsMagsTurret select 3 select 0) >> 'displayName')]"; +}; diff --git a/Sources/epoch_config/Configs/CfgClientFunctions.hpp b/Sources/epoch_config/Configs/CfgClientFunctions.hpp index 390a873f..4c7b08ff 100644 --- a/Sources/epoch_config/Configs/CfgClientFunctions.hpp +++ b/Sources/epoch_config/Configs/CfgClientFunctions.hpp @@ -185,7 +185,6 @@ class CfgClientFunctions class client_VehicleMaintananceDo {}; class vehicle_checkTurretAmmo {}; class vehicle_removeTurretAmmo {}; - class vehicle_removeCommanderAmmo {}; }; class missions {