Trenches - Fix mission placed trench interactions (#7672)

Assume progress is 1 if undefined
define placeData if undefined
This commit is contained in:
PabstMirror 2020-06-05 11:35:32 -05:00 committed by GitHub
parent 7a8a17b924
commit 1b94b25ff6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 3 deletions

View File

@ -19,7 +19,7 @@
params ["_trench", "_unit"];
if !("ACE_EntrenchingTool" in (_unit call EFUNC(common,uniqueItems))) exitWith {false};
if ((_trench getVariable [QGVAR(progress), 0]) >= 1) exitWith {false};
if ((_trench getVariable [QGVAR(progress), 1]) >= 1) exitWith {false};
// Prevent removing/digging trench by more than one person
if (_trench getVariable [QGVAR(digging), false]) exitWith {false};

View File

@ -19,7 +19,7 @@
params ["_trench", "_unit"];
TRACE_2("continueDiggingTrench",_trench,_unit);
private _actualProgress = _trench getVariable [QGVAR(progress), 0];
private _actualProgress = _trench getVariable [QGVAR(progress), 1];
if(_actualProgress == 1) exitWith {};
// Mark trench as being worked on

View File

@ -38,6 +38,7 @@ if (isNull GVAR(trench)) exitWith {};
deleteVehicle GVAR(trench);
private _trench = createVehicle [GVAR(trenchClass), [0, 0, 0], [], 0, "NONE"];
_trench setVariable [QGVAR(progress), 0, true];
GVAR(trenchPlacementData) params ["_dx", "_dy", "_offset"];
private _basePos = GVAR(trenchPos);

View File

@ -19,7 +19,7 @@
params ["_trench", "_unit"];
TRACE_2("removeTrench",_trench,_unit);
private _actualProgress = _trench getVariable [QGVAR(progress), 0];
private _actualProgress = _trench getVariable [QGVAR(progress), 1];
if(_actualProgress == 0) exitWith {};
// Mark trench as being worked on
@ -28,6 +28,9 @@ _trench setVariable [QGVAR(digging), true, true];
private _removeTime = getNumber (configFile >> "CfgVehicles" >> (typeof _trench) >> QGVAR(removalDuration));
private _removeTimeLeft = _removeTime * _actualProgress;
if (isNil {_trench getVariable QGVAR(placeData)}) then {
_trench setVariable [QGVAR(placeData), [getPosASL _trench, [vectorDir _trench, vectorUp _trench]], true];
};
private _placeData = _trench getVariable [QGVAR(placeData), [[], []]];
_placeData params ["_basePos", "_vecDirAndUp"];