mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Cargo - Add condition checking durring load/unload (#6821)
This commit is contained in:
parent
860fa0fcfa
commit
ec840a793d
@ -94,13 +94,12 @@ GVAR(objectAction) = [
|
||||
{locked _target < 2} &&
|
||||
{alive _target} &&
|
||||
{[_player, _target, ["isNotSwimming"]] call EFUNC(common,canInteractWith)} &&
|
||||
{0 < {
|
||||
private _type = typeOf _x;
|
||||
private _hasCargoPublic = _x getVariable [QGVAR(hasCargo), false];
|
||||
private _hasCargoConfig = getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(hasCargo)) == 1;
|
||||
(_hasCargoPublic || _hasCargoConfig) && {_x != _target} &&
|
||||
{([_target, _x] call EFUNC(interaction,getInteractionDistance)) < MAX_LOAD_DISTANCE}
|
||||
} count (nearestObjects [_player, GVAR(cargoHolderTypes), (MAX_LOAD_DISTANCE + 10)])}
|
||||
{((nearestObjects [_target, GVAR(cargoHolderTypes), (MAX_LOAD_DISTANCE + 10)]) findIf {
|
||||
private _hasCargoConfig = 1 == getNumber (configFile >> "CfgVehicles" >> typeOf _x >> QGVAR(hasCargo));
|
||||
private _hasCargoPublic = _x getVariable [QGVAR(hasCargo), false];
|
||||
(_hasCargoConfig || {_hasCargoPublic}) && {_x != _target} && {alive _x} && {locked _x < 2} &&
|
||||
{([_target, _x] call EFUNC(interaction,getInteractionDistance)) < MAX_LOAD_DISTANCE}
|
||||
}) > -1}
|
||||
},
|
||||
LINKFUNC(addCargoVehiclesActions)
|
||||
] call EFUNC(interact_menu,createAction);
|
||||
|
@ -25,7 +25,7 @@ private _statement = {
|
||||
private _vehicles = (nearestObjects [_target, GVAR(cargoHolderTypes), (MAX_LOAD_DISTANCE + 10)]) select {
|
||||
private _hasCargoConfig = 1 == getNumber (configFile >> "CfgVehicles" >> typeOf _x >> QGVAR(hasCargo));
|
||||
private _hasCargoPublic = _x getVariable [QGVAR(hasCargo), false];
|
||||
(_hasCargoConfig || {_hasCargoPublic}) && {_x != _target} &&
|
||||
(_hasCargoConfig || {_hasCargoPublic}) && {_x != _target} && {alive _x} && {locked _x < 2} &&
|
||||
{([_target, _x] call EFUNC(interaction,getInteractionDistance)) < MAX_LOAD_DISTANCE}
|
||||
};
|
||||
|
||||
|
@ -42,12 +42,20 @@ if ([_object, _vehicle] call FUNC(canLoadItemIn)) then {
|
||||
GVAR(loadTimeCoefficient) * _size,
|
||||
[_object, _vehicle],
|
||||
{
|
||||
TRACE_1("load finish",_this);
|
||||
[objNull, _this select 0 select 0, true] call EFUNC(common,claim);
|
||||
["ace_loadCargo", _this select 0] call CBA_fnc_localEvent;
|
||||
},
|
||||
{[objNull, _this select 0 select 0, true] call EFUNC(common,claim)},
|
||||
{
|
||||
TRACE_1("load fail",_this);
|
||||
[objNull, _this select 0 select 0, true] call EFUNC(common,claim)
|
||||
},
|
||||
localize LSTRING(LoadingItem),
|
||||
{true},
|
||||
{
|
||||
(_this select 0) params ["_item", "_target"];
|
||||
(alive _target) && {locked _target < 2} && {alive _item}
|
||||
&& {([_item, _target] call EFUNC(interaction,getInteractionDistance)) < MAX_LOAD_DISTANCE}
|
||||
},
|
||||
["isNotSwimming"]
|
||||
] call EFUNC(common,progressBar);
|
||||
_return = true;
|
||||
|
@ -72,10 +72,17 @@ if ([_item, GVAR(interactionVehicle), ACE_player] call FUNC(canUnloadItem)) then
|
||||
[
|
||||
GVAR(loadTimeCoefficient) * _size,
|
||||
[_item, GVAR(interactionVehicle), ACE_player],
|
||||
{["ace_unloadCargo", _this select 0] call CBA_fnc_localEvent},
|
||||
{},
|
||||
{TRACE_1("unload finish",_this); ["ace_unloadCargo", _this select 0] call CBA_fnc_localEvent},
|
||||
{TRACE_1("unload fail",_this);},
|
||||
localize LSTRING(UnloadingItem),
|
||||
{true},
|
||||
{
|
||||
(_this select 0) params ["_item", "_target", "_player"];
|
||||
|
||||
(alive _target)
|
||||
&& {locked _target < 2}
|
||||
&& {([_player, _target] call EFUNC(interaction,getInteractionDistance)) < MAX_LOAD_DISTANCE}
|
||||
&& {_item in (_target getVariable [QGVAR(loaded), []])}
|
||||
},
|
||||
["isNotSwimming"]
|
||||
] call EFUNC(common,progressBar);
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user