diff --git a/addons/trenches/CfgWorldTexture.hpp b/addons/trenches/CfgWorldTexture.hpp index 811afe614b4..19a27477ae7 100644 --- a/addons/trenches/CfgWorldTexture.hpp +++ b/addons/trenches/CfgWorldTexture.hpp @@ -1,3 +1,4 @@ +class CfgWorlds {}; class CfgWorldTexture: CfgWorlds { //Altis class Altis { diff --git a/addons/trenches/functions/fnc_getSurfaceTexturePath.sqf b/addons/trenches/functions/fnc_getSurfaceTexturePath.sqf index a10087a84b6..db83f82d5cc 100644 --- a/addons/trenches/functions/fnc_getSurfaceTexturePath.sqf +++ b/addons/trenches/functions/fnc_getSurfaceTexturePath.sqf @@ -19,6 +19,8 @@ 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}; @@ -58,4 +60,6 @@ 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 diff --git a/addons/trenches/functions/fnc_initTrench.sqf b/addons/trenches/functions/fnc_initTrench.sqf index 605dec13bd1..b6dd0a781ea 100644 --- a/addons/trenches/functions/fnc_initTrench.sqf +++ b/addons/trenches/functions/fnc_initTrench.sqf @@ -29,7 +29,8 @@ if (is3DEN) exitWith { if (local _object) then { // Has to be delayed to ensure MP compatibility (vehicle spawned in same frame as texture is applied) [{ - private _texture = [_this select 0] call FUNC(getSurfaceTexturePath); - (_this select 0) setObjectTextureGlobal [0, _texture]; - }, [_this]] call CBA_fnc_execNextFrame; + private _obj = if (_this isEqualType []) then {_this select 0} else {_this}; + private _texture = [_obj] call FUNC(getSurfaceTexturePath); + _obj setObjectTextureGlobal [0, _texture]; + }, _this] call CBA_fnc_execNextFrame; }; diff --git a/addons/trenches/functions/fnc_placeConfirm.sqf b/addons/trenches/functions/fnc_placeConfirm.sqf index 9906abaa707..82ffabf0297 100644 --- a/addons/trenches/functions/fnc_placeConfirm.sqf +++ b/addons/trenches/functions/fnc_placeConfirm.sqf @@ -37,12 +37,14 @@ if (isNull GVAR(trench)) exitWith {}; private _trenchClass = typeOf GVAR(trench); private _vecDirAndUp = [vectorDir GVAR(trench), vectorUp GVAR(trench)]; +private _pos = getPosWorld GVAR(trench); +diag_log format ["ACE_TRENCHES Old Pos: %1", _pos]; deleteVehicle GVAR(trench); -GVAR(trenchPos) set [2, -0.2]; -private _trench = createVehicle [_trenchClass, GVAR(trenchPos), [], 0, "CAN_COLLIDE"]; +diag_log format ["ACE_TRENCHES New Pos: %1", _pos]; +private _trench = createVehicle [_trenchClass, _pos, [], 0, "CAN_COLLIDE"]; _trench setObjectTextureGlobal [0,[_trench] call FUNC(getSurfaceTexturePath)]; -_trench setPosWorld GVAR(trenchPos); +_trench setPosWorld _pos; private _boundingBox = boundingBoxReal _trench; _boundingBox params ["_lbfc", "_rtbc"]; //_lbfc(Left Bottom Front Corner) _rtbc (Right Top Back Corner) @@ -52,6 +54,7 @@ _rtbc params ["", "", "_rtbcZ"]; private _boundingBoxOffset = missionNamespace getVariable [getText (configFile >> "CfgVehicles" >> _trenchClass >> QGVAR(boundingBoxOffset)),0]; private _posDiff = abs _lbfcZ + abs _rtbcZ - _boundingBoxOffset; private _newPos = _trench modelToWorldWorld [0,0, -_posDiff]; +diag_log format ["ACE_TRENCHES Underearth Pos: %1", _pos]; _trench setPosWorld _newPos; _trench setVariable [QGVAR(diggingSteps), _posDiff/1000,true]; diff --git a/addons/trenches/functions/fnc_placeTrench.sqf b/addons/trenches/functions/fnc_placeTrench.sqf index c886199f155..008765fe155 100644 --- a/addons/trenches/functions/fnc_placeTrench.sqf +++ b/addons/trenches/functions/fnc_placeTrench.sqf @@ -84,11 +84,11 @@ GVAR(digPFH) = [{ #endif }; }; - _basePos set [2, (_basePos select 2) + _minzoffset + _offset]; +// _basePos set [2, (_basePos select 2) + _minzoffset + _offset]; + _basePos set [2, (_basePos select 2) + _minzoffset]; TRACE_2("",_minzoffset,_offset); _trench setPosASL _basePos; _trench setVectorDirAndUp [_v1, _v3]; - GVAR(trenchPos) = _basePos; if (surfaceType position _trench != GVAR(currentSurface)) then { GVAR(currentSurface) = surfaceType (position _trench);