diff --git a/lua/sim/Unit.lua b/lua/sim/Unit.lua index ab94b77166..9805bd9073 100644 --- a/lua/sim/Unit.lua +++ b/lua/sim/Unit.lua @@ -1424,11 +1424,15 @@ Unit = Class(moho.unit_methods) { mass = mass * 0.5 energy = energy * 0.5 end + + if self:GetCurrentLayer() == 'Air' then + pos[2] = GetSurfaceHeight(pos[1], pos[3]) + elseif self:GetCurrentLayer() == 'Seabed' or self:GetCurrentLayer() == 'Land' then + pos[2] = GetTerrainHeight(pos[1], pos[3]) + GetTerrainTypeOffset(pos[1], pos[3]) + else + pos[2] = GetSurfaceHeight(pos[1], pos[3]) + GetTerrainTypeOffset(pos[1], pos[3]) + end - -- Stop the Y position of the wreck being on the seabed for Naval Factories - if not (EntityCategoryContains(categories.FACTORY, self) and EntityCategoryContains(categories.STRUCTURE, self) and EntityCategoryContains(categories.NAVAL, self)) then - pos[2] = GetTerrainHeight(pos[1], pos[3]) + GetTerrainTypeOffset(pos[1], pos[3]) - end local prop = CreateProp( pos, wreck )