Skip to content

Commit

Permalink
Merge pull request #139 from gruppe-adler/PRACS_M88_support
Browse files Browse the repository at this point in the history
Add Support for PRACS_M88
  • Loading branch information
AdlerSalbei authored Sep 3, 2023
2 parents 3dd66c1 + 9fc58eb commit ac7a149
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 37 deletions.
9 changes: 9 additions & 0 deletions addons/functions/CfgDigVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,13 @@ class CfgDigVehicles {
class gm_dk_army_bpz2a0_un : gm_dk_army_bpz2a0 {};
class gm_dk_army_bpz2a0_wdl : gm_dk_army_bpz2a0 {};
class gm_dk_army_bpz2a0_win : gm_dk_army_bpz2a0 {};

class PRACS_M88 {
type = "animate";
animation = "Blade";
selection = "Blade";
plowRaised = 0;
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 ac7a149

Please sign in to comment.