Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for PRACS_M88 #139

Merged
merged 2 commits into from
Sep 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading