Skip to content

Commit

Permalink
fixed plow
Browse files Browse the repository at this point in the history
  • Loading branch information
AdlerSalbei committed Sep 3, 2023
1 parent 76c4f3d commit 9fc58eb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 39 deletions.
4 changes: 2 additions & 2 deletions addons/functions/CfgDigVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ class CfgDigVehicles {

class PRACS_M88 {
type = "animate";
animation = "blade_elev_source";
animation = "Blade";
selection = "Blade";
plowRaised = 0;
plowLowered = 0.9;
plowLowered = 0.93;
distanceToTrench = 3;
};
};
38 changes: 1 addition & 37 deletions addons/functions/functions/fnc_vehicleAction.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,43 +17,6 @@ if (isServer) then {
[_vehicle] call FUNC(vehicleTrenchBuild);
};

// needs to be local to driver, thats why everyone get this
/*
_vehicle addEventHandler ["EpeContactStart", {
params ["_object1", "_object2", "_selection1", "_selection2", "_force"];
if (typeOf _object2 != "GRAD_envelope_vehicle") exitWith {};
if (!(_object1 getVariable ["grad_trenches_functions_plowlowered", 0])) exitWith {};
private _dir1 = getDir _object1;
private _dir2 = getDir _object2;
private _config = configFile >> "CfgDigVehicles" >> typeOf _object1;
private _distanceToTrench = getNumber (_config >> "distanceToTrench");
if ((abs(_dir1 - _dir2)) > 15) exitWith { systemchat "angle not fitting"; };
// if vehicle is inside trench
if ((getPos _object1) inArea [(_object2 modelToWorld [-0.15,-_distanceToTrench,0]), 1, 1, getDir _object2, true, -1]) then {
// check which trench is larger and attach the larger one, delete the other
private _trench = _object1 getVariable ["grad_trenches_functions_trenchDigged", objNull];
private _actualProgress = _trench getVariable ["ace_trenches_progress", 0];
if (_object2 getVariable ["ace_trenches_progress", 0] > _actualProgress) then {
deleteVehicle _trench;
_object2 attachTo [_object1, [-0.15,_distanceToTrench,-5]];
_object1 setVariable ["grad_trenches_functions_isDigging", true, true];
_object1 setVariable ["grad_trenches_functions_trenchDigged", _object2, true];
} else {
deleteVehicle _object2;
_trench attachTo [_object1, [-0.15,_distanceToTrench,-5]];
_object1 setVariable ["grad_trenches_functions_isDigging", true, true];
_object1 setVariable ["grad_trenches_functions_trenchDigged", _trench, true];
};
};
}];
*/

if (hasInterface) then {
_vehicle addAction [
"Lower Plow",
Expand All @@ -69,6 +32,7 @@ if (hasInterface) then {
} else {
_target animatesource [_animation, _plowLowered];
};

_target setCruiseControl [7, false];
_target setVariable ["grad_trenches_functions_plowlowered", -1, true]; // animating state to prevent multi execution

Expand Down

0 comments on commit 9fc58eb

Please sign in to comment.