mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Rearm - Add enable setting (#8067)
* Add enable setting * Update test * Optimize eden macro * Fix bad command name in eden * Apply suggestions from code review Co-authored-by: jonpas <jonpas33@gmail.com> * Cleanup unused argument * Handle RHS config * Optimize init function a little * Improve macro Co-authored-by: jonpas <jonpas33@gmail.com> * compats and leftovers * function header (sorry jonpas) * add enabled check to initSupplyVehicle * use toString * fix validate * inheritance cleanup --------- Co-authored-by: jonpas <jonpas33@gmail.com> Co-authored-by: LinkIsGrim <salluci.lovi@gmail.com>
This commit is contained in:
@ -15,16 +15,26 @@
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
if (!hasInterface) exitWith {}; // For now we just add actions, so no need non-clients
|
||||
if (!GVAR(enabled)) exitWith {};
|
||||
|
||||
params ["_vehicle"];
|
||||
|
||||
private _typeOf = typeOf _vehicle;
|
||||
private _configOf = configOf _vehicle;
|
||||
TRACE_2("initSupplyVehicle",_vehicle,_typeOf);
|
||||
|
||||
if (local _vehicle && {getAmmoCargo _vehicle > 0}) then {
|
||||
_vehicle setAmmoCargo 0;
|
||||
};
|
||||
|
||||
if (!hasInterface) exitWith {}; // For now we just add actions, so no need non-clients
|
||||
|
||||
if (!alive _vehicle) exitWith {};
|
||||
|
||||
private _configSupply = getNumber (_configOf >> QGVAR(defaultSupply));
|
||||
if (_configSupply == 0) then {
|
||||
_configSupply = getNumber (_config >> "transportAmmo");
|
||||
};
|
||||
private _isSupplyVehicle = _vehicle getVariable [QGVAR(isSupplyVehicle), false];
|
||||
private _oldRearmConfig = isClass (_configOf >> "ACE_Actions" >> "ACE_MainActions" >> QGVAR(takeAmmo));
|
||||
TRACE_3("",_configSupply,_isSupplyVehicle,_oldRearmConfig);
|
||||
|
@ -4,8 +4,7 @@
|
||||
* Returns if vehicle or object is a rearm source.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: target <OBJECT>
|
||||
* 1: check for vanilla rearm vehicle <BOOL> (default: false)
|
||||
* 0: Target <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
@ -15,10 +14,7 @@
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
params [
|
||||
["_target", objNull, [objNull]],
|
||||
["_testVanillaRearm", false, [false]]
|
||||
];
|
||||
params [["_target", objNull, [objNull]]];
|
||||
|
||||
if ((_target getVariable [QGVAR(currentSupply), 0]) < 0) exitWith {false};
|
||||
|
||||
@ -27,4 +23,4 @@ private _vanillaCargoConfig = getNumber (_vehCfg >> "transportAmmo");
|
||||
private _rearmCargoConfig = getNumber (_vehCfg >> QGVAR(defaultSupply));
|
||||
private _supplyVehicle = _target getVariable [QGVAR(isSupplyVehicle), false];
|
||||
|
||||
_rearmCargoConfig > 0 || {_supplyVehicle} || {_testVanillaRearm && _vanillaCargoConfig > 0}
|
||||
_rearmCargoConfig > 0 || {_supplyVehicle} || {_vanillaCargoConfig > 0}
|
||||
|
@ -41,7 +41,11 @@ private _currentSupply = if (_addToCurrent) then {
|
||||
|
||||
_source setVariable [QGVAR(currentSupply), _currentSupply + _rearmCargo, true];
|
||||
|
||||
private _rearmCargoConfig = getNumber (configOf _source >> QGVAR(defaultSupply));
|
||||
private _config = configOf _source;
|
||||
private _rearmCargoConfig = getNumber (_config >> QGVAR(defaultSupply));
|
||||
if (_rearmCargoConfig == 0) then {
|
||||
_rearmCargoConfig = getNumber (_config >> "transportAmmo");
|
||||
};
|
||||
|
||||
// initialize if it's not a config rearm vehicle
|
||||
if (!(_rearmCargoConfig > 0 && _source getVariable [QGVAR(isSupplyVehicle), false])) then {
|
||||
|
Reference in New Issue
Block a user