Skip to content

Commit

Permalink
fixed placement
Browse files Browse the repository at this point in the history
  • Loading branch information
AdlerSalbei committed Jun 4, 2019
1 parent ca424c2 commit c9a7eea
Show file tree
Hide file tree
Showing 10 changed files with 7 additions and 15 deletions.
5 changes: 0 additions & 5 deletions addons/trenches/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class CfgVehicles {
GVAR(removalDuration) = QGVAR(smallEnvelopeRemovalTime);
GVAR(placementData)[] = {2,3,0.35};
GVAR(grassCuttingPoints)[] = {{0,-0.5,0}};
GVAR(boundingBoxOffset) = 0.16;

editorCategory = "EdCat_Things";
editorSubcategory = "EdSubcat_Military";
Expand Down Expand Up @@ -136,7 +135,6 @@ class CfgVehicles {
GVAR(removalDuration) = QGVAR(bigEnvelopeRemovalTime);
GVAR(placementData)[] = {6,1.1,0.20};
GVAR(grassCuttingPoints)[] = {{-1.5,-1,0},{1.5,-1,0}};
GVAR(boundingBoxOffset) = 0.197;

class GVAR(camouflagePositions) {
center[] = {-0.4, 0.4, 0.2};
Expand All @@ -152,7 +150,6 @@ class CfgVehicles {
GVAR(placementData)[] = {15,1.1,0.40};
GVAR(grassCuttingPoints)[] = {{-1.5,-1,0},{1.5,-1,0}};
model = QPATHTOF(data\trench_huge.p3d);
GVAR(boundingBoxOffset) = 0.557;

class GVAR(camouflagePositions) {
left1[] = {-0.5, 0.3, 0.5};
Expand All @@ -169,7 +166,6 @@ class CfgVehicles {
GVAR(placementData)[] = {6,1.1,0.20};
GVAR(grassCuttingPoints)[] = {{-1.5,-1,0},{1.5,-1,0}};
model = QPATHTOF(data\trench_vehicle.p3d);
GVAR(boundingBoxOffset) = 0.34;

class GVAR(camouflagePositions) {};
class Attributes {};
Expand All @@ -183,7 +179,6 @@ class CfgVehicles {
GVAR(placementData)[] = {10,1.1,0.20};
GVAR(grassCuttingPoints)[] = {{-1.5,-1,0},{1.5,-1,0}};
model = QPATHTOF(data\trench_short.p3d);
GVAR(boundingBoxOffset) = 0.16;

class GVAR(camouflagePositions) {
right[] = {1.1,0.2,0.2};
Expand Down
Binary file modified addons/trenches/data/trench_big.p3d
Binary file not shown.
Binary file modified addons/trenches/data/trench_huge.p3d
Binary file not shown.
Binary file modified addons/trenches/data/trench_short.p3d
Binary file not shown.
Binary file modified addons/trenches/data/trench_small.p3d
Binary file not shown.
Binary file modified addons/trenches/data/trench_vehicle.p3d
Binary file not shown.
5 changes: 2 additions & 3 deletions addons/trenches/functions/fnc_continueDiggingTrench.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,8 @@ if (_actualProgress == 0) then {
_lbfc params ["", "", "_lbfcZ"];

private _pos = getPosWorld _trench;
private _posDiff = ((abs((_trench getVariable [QGVAR(diggingSteps), 0]) + _lbfcZ)) * _diggerCount)/(_digTime*5);
private _posDiff = (_trench getVariable [QGVAR(diggingSteps), 0]) * _diggerCount;
_pos set [2,(_pos select 2) + _posDiff];

_trench setPosWorld _pos;
_trench setVectorDirAndUp _vecDirAndUp;

Expand All @@ -127,7 +126,7 @@ if (_actualProgress == 0) then {
// Save progress
_trench setVariable [QGVAR(progress), _actualProgress + ((1/(_digTime *10)) * _diggerCount)];

if (GVAR(stopBuildingAtFatigueMax) && EGVAR(advanced_fatigue,anReserve) <= 0) exitWith {
if (GVAR(stopBuildingAtFatigueMax) && {EGVAR(advanced_fatigue,anReserve) <= 0}) exitWith {
[_handle] call CBA_fnc_removePerFrameHandler;
_trench setVariable [QGVAR(digging), false, true];
_trench setVariable [QGVAR(diggingPlayers), _trench getVariable [QGVAR(diggingPlayers), []] - [_unit], true];
Expand Down
4 changes: 0 additions & 4 deletions addons/trenches/functions/fnc_getSurfaceTexturePath.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ params [
["_object", objnull, [objNull]]
];

diag_log format ["ACE_TRENCHES Object: %1", _object];

if (isNull _object) exitWith {};
if !((isNil QGVAR(automaticFileSetup)) && {isText (configFile >> "CfgWorldTexture" >> worldName >> "surfaceTextureBasePath")}) exitWith {DEFAULT_TEXTURE};

Expand Down Expand Up @@ -60,6 +58,4 @@ private _result = if !(isNil QGVAR(automaticFileSetup)) then {
[_surfaceType, _basePath, getText(configFile >> "CfgWorldTexture" >> worldName >> "suffix")] call _getTexturePath;
};

diag_log format ["ACE_TRENCHES Result: %1", _result];

_result
6 changes: 4 additions & 2 deletions addons/trenches/functions/fnc_placeConfirm.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ private _pos = getPosWorld GVAR(trench);
deleteVehicle GVAR(trench);

private _trench = createVehicle [_trenchClass, _pos, [], 0, "CAN_COLLIDE"];
_trench setObjectTextureGlobal [0, [_trench] call FUNC(getSurfaceTexturePath)];
_trench setPosWorld _pos;
_trench setVectorDirAndUp _vecDirAndUp;
_trench setObjectTextureGlobal [0, [_trench] call FUNC(getSurfaceTexturePath)];

private _boundingBox = 0 boundingBoxReal _trench;
_boundingBox params ["_lbfc", "_rtbc"]; //_lbfc(Left Bottom Front Corner) _rtbc (Right Top Back Corner)
Expand All @@ -53,7 +54,8 @@ private _posDiff = abs _lbfcZ + abs _rtbcZ;
private _newPos = _trench modelToWorldWorld [0, 0, -_posDiff];
_trench setPosWorld _newPos;

_trench setVariable [QGVAR(diggingSteps), _posDiff/100,true];
private _digTime = missionNamespace getVariable [getText (configFile >> "CfgVehicles" >> (typeOf _trench) >> QGVAR(diggingDuration)), 20];
_trench setVariable [QGVAR(diggingSteps), _posDiff/_digTime, true];
_trench setVectorDirAndUp _vecDirAndUp;

_trench setVariable [QGVAR(placeData), [_newPos, _vecDirAndUp], true];
Expand Down
2 changes: 1 addition & 1 deletion addons/trenches/functions/fnc_removeTrench.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private _fnc_condition = {
_lbfc params ["", "", "_lbfcZ"];

private _pos = getPosWorld _trench;
private _posDiff = (abs(((_trench getVariable [QGVAR(diggingSteps), 0]) * _diggerCount) + _lbfcZ))/(_removeTime*5);
private _posDiff = (_trench getVariable [QGVAR(diggingSteps), 0]) * _diggerCount;
_pos set [2,((_pos select 2) - _posDiff)];

_trench setPosWorld _pos;
Expand Down

0 comments on commit c9a7eea

Please sign in to comment.