mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Refuel - Add ownership concept to nozzles & jerry cans (#9826)
Add ownership concept to nozzles & jerry cans
This commit is contained in:
parent
61ca55f268
commit
78334e2be4
@ -24,7 +24,7 @@ if (isNull _unit ||
|
|||||||
{!alive _object} ||
|
{!alive _object} ||
|
||||||
{!isNull (_unit getVariable [QGVAR(nozzle), objNull])} || // Not already carrying a nozzle
|
{!isNull (_unit getVariable [QGVAR(nozzle), objNull])} || // Not already carrying a nozzle
|
||||||
{(_object getVariable [QGVAR(jerryCan), false]) && {!isNull (_object getVariable [QGVAR(nozzle), objNull])}} || // Prevent jerry cans from being picked up if they have a nozzle connected
|
{(_object getVariable [QGVAR(jerryCan), false]) && {!isNull (_object getVariable [QGVAR(nozzle), objNull])}} || // Prevent jerry cans from being picked up if they have a nozzle connected
|
||||||
{typeOf _object == QGVAR(fuelNozzle) && {!isNull (attachedTo _object)}} || // Not carried by someone else
|
{!([_unit, _object, [INTERACT_EXCEPTIONS]] call EFUNC(common,canInteractWith))} || // Not carried by someone else
|
||||||
{([_unit, _object] call EFUNC(interaction,getInteractionDistance)) > REFUEL_ACTION_DISTANCE}) exitWith {false};
|
{([_unit, _object] call EFUNC(interaction,getInteractionDistance)) > REFUEL_ACTION_DISTANCE}) exitWith {false};
|
||||||
|
|
||||||
!(_object getVariable [QGVAR(isConnected), false]) && {!(_unit getVariable [QGVAR(isRefueling), false])}
|
!(_object getVariable [QGVAR(isConnected), false]) && {!(_unit getVariable [QGVAR(isRefueling), false])}
|
||||||
|
@ -116,6 +116,9 @@ private _attachPosModel = _sink worldToModel (ASLtoAGL _bestPosASL);
|
|||||||
// Reset fuel counter
|
// Reset fuel counter
|
||||||
_source setVariable [QGVAR(fuelCounter), 0, true];
|
_source setVariable [QGVAR(fuelCounter), 0, true];
|
||||||
|
|
||||||
|
// Let other players access nozzle
|
||||||
|
[objNull, _nozzle] call EFUNC(common,claim);
|
||||||
|
|
||||||
[_unit, _sink, _nozzle, _endPosTestOffset] call FUNC(refuel);
|
[_unit, _sink, _nozzle, _endPosTestOffset] call FUNC(refuel);
|
||||||
|
|
||||||
private _canReceive = getNumber ((configOf _sink) >> QGVAR(canReceive)) == 1;
|
private _canReceive = getNumber ((configOf _sink) >> QGVAR(canReceive)) == 1;
|
||||||
|
@ -24,6 +24,9 @@ TRACE_3("dropNozzle",_unit,_nozzle,_disconnectOnly);
|
|||||||
detach _nozzle;
|
detach _nozzle;
|
||||||
_nozzle setVariable [QGVAR(isRefueling), false, true];
|
_nozzle setVariable [QGVAR(isRefueling), false, true];
|
||||||
|
|
||||||
|
// Remove claim on nozzle
|
||||||
|
[objNull, _nozzle] call EFUNC(common,claim);
|
||||||
|
|
||||||
if (_disconnectOnly) exitWith {};
|
if (_disconnectOnly) exitWith {};
|
||||||
_nozzle setVelocity [0, 0, 0];
|
_nozzle setVelocity [0, 0, 0];
|
||||||
|
|
||||||
|
@ -35,11 +35,9 @@ TRACE_2("start",_unit,_nozzle);
|
|||||||
_args params ["_unit", "_nozzle"];
|
_args params ["_unit", "_nozzle"];
|
||||||
|
|
||||||
if !(
|
if !(
|
||||||
alive _unit
|
_unit call EFUNC(common,isAwake)
|
||||||
&& {"" isEqualTo currentWeapon _unit || {_unit call EFUNC(common,isSwimming)}}
|
&& {"" isEqualTo currentWeapon _unit || {_unit call EFUNC(common,isSwimming)}}
|
||||||
&& {[_unit, objNull, [INTERACT_EXCEPTIONS, "notOnMap"]] call EFUNC(common,canInteractWith)}
|
&& {[_unit, objNull, [INTERACT_EXCEPTIONS, "notOnMap"]] call EFUNC(common,canInteractWith)}
|
||||||
&& {"unconscious" isNotEqualTo toLower animationState _unit}
|
|
||||||
&& {!(_unit getVariable ["ACE_isUnconscious", false])}
|
|
||||||
) exitWith {
|
) exitWith {
|
||||||
TRACE_3("stop dead/weapon/interact/uncon",_unit,alive _unit,currentWeapon _unit);
|
TRACE_3("stop dead/weapon/interact/uncon",_unit,alive _unit,currentWeapon _unit);
|
||||||
DROP_NOZZLE
|
DROP_NOZZLE
|
||||||
|
@ -32,17 +32,23 @@ params [
|
|||||||
|
|
||||||
private _source = _object;
|
private _source = _object;
|
||||||
private _nozzle = _object;
|
private _nozzle = _object;
|
||||||
if (typeOf _object isEqualTo QGVAR(fuelNozzle) || {_object getVariable [QGVAR(jerryCan), false]}) then { // func is called on muzzle either connected or on ground
|
if (typeOf _object isEqualTo QGVAR(fuelNozzle) || {_object getVariable [QGVAR(jerryCan), false]}) then { // func is called on nozzle either connected or on ground
|
||||||
_source = _nozzle getVariable QGVAR(source);
|
_source = _nozzle getVariable QGVAR(source);
|
||||||
if (_nozzle getVariable [QGVAR(jerryCan), false]) then {
|
if (_nozzle getVariable [QGVAR(jerryCan), false]) then {
|
||||||
_nozzle attachTo [_unit, [0,1,0], "pelvis"];
|
_nozzle attachTo [_unit, [0,1,0], "pelvis"];
|
||||||
} else {
|
} else {
|
||||||
_nozzle attachTo [_unit, [-0.02,0.05,-0.12], "righthandmiddle1"];
|
_nozzle attachTo [_unit, [-0.02,0.05,-0.12], "righthandmiddle1"];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Don't allow other players to take nozzle
|
||||||
|
[_unit, _nozzle] call EFUNC(common,claim);
|
||||||
} else { // func is called on fuel truck
|
} else { // func is called on fuel truck
|
||||||
_nozzle = QGVAR(fuelNozzle) createVehicle [0,0,0];
|
_nozzle = QGVAR(fuelNozzle) createVehicle [0,0,0];
|
||||||
_nozzle attachTo [_unit, [-0.02,0.05,-0.12], "righthandmiddle1"];
|
_nozzle attachTo [_unit, [-0.02,0.05,-0.12], "righthandmiddle1"];
|
||||||
|
|
||||||
|
// Don't allow other players to take nozzle
|
||||||
|
[_unit, _nozzle] call EFUNC(common,claim);
|
||||||
|
|
||||||
private _ropeTarget = _source;
|
private _ropeTarget = _source;
|
||||||
if !(_source isKindOf "AllVehicles") then {
|
if !(_source isKindOf "AllVehicles") then {
|
||||||
private _helper = QGVAR(helper) createVehicle [0,0,0];
|
private _helper = QGVAR(helper) createVehicle [0,0,0];
|
||||||
|
Loading…
Reference in New Issue
Block a user