Problems with inserting hires tile textures

Looking for a mod? Have a review on a mod you'd like to share?
Ingo-Igel
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sun Nov 03, 2024 7:01 pm
Contact:

Problems with inserting hires tile textures

Post by Ingo-Igel »

Hi, I am in the process of creating several mods with high resolution textures. For the most part, I was able to add a lot of textures using the code provided by the TextureBase mod. Unfortunately it was not possible to replace the ground textures.
Now I am desperately trying to add them manually.

Does anyone here have an idea, know a simpler way or see an obvious error?

Below is the code of the data.lua, with which I am trying to change the texture of the artificial-jellynut-soil.

Code: Select all

local function tile_variations_template_new(high_res_picture, high_res_transition_mask, options)
	local function main_variation(size_)
		local y_ = ((size_ == 1) and 0) or ((size_ == 2) and 128) or ((size_ == 4) and 320) or 640
		local ret =
		{
			picture = high_res_picture,
			count = (options[size_] and options[size_].weights) and #options[size_].weights or 16,
			size = size_,
			y = y_,
			line_length = (size_ == 8) and 8 or 16,
			scale = 0.25
		}

		if options[size_] then
			for k, v in pairs(options[size_]) do
			ret[k] = v
			end
		end

		return ret
	end

	local result = {
		main =
		{
			main_variation(1),
			main_variation(2),
			main_variation(4)
		}
	}

	if (options.max_size == 8) then
	table.insert(result.main, main_variation(8))
	end

	if options.empty_transitions then
	result.empty_transitions = true
	else
	result.transition =
	{
		spritesheet = high_res_transition_mask,
		layout =
		{
		scale = 0.25,
		count = (options and options.mask_variations) or 8,
		double_side_count = 0,
		u_transition_count = 1,
		o_transition_count = 1,
		u_transition_line_length = 1,
		o_transition_line_length = 2,
		outer_corner_x = 1152,
		side_x = 2304,
		u_transition_x = 3456,
		o_transition_x = 4608,
		mask = { y_offset = 0 }
		}
	}
	end
	return result

end

local function tile_variations_template_with_transitions_new(high_res_picture, options)
	local result = tile_variations_template_new(high_res_picture, high_res_picture, options)

	if result.transition then
	result.transition.layout =
	{
		scale = 0.25,
		inner_corner_x = 2432 * 2,
		outer_corner_x = 3008 * 2,
		side_x         = 3584 * 2,
		u_transition_x = 2112 * 2,
		o_transition_x = 1088 * 2,
		inner_corner_count = 8,
		outer_corner_count = 8,
		side_count         = 8,
		u_transition_count = 1,
		o_transition_count = 1,
		u_transition_line_length = 4,
		o_transition_line_length = 4,
		overlay = { x_offset = 0 }
	}
	end

	return result
end

-- artificial-jellynut-soil

local artificial_jellynut_soil = data.raw["tile"]["artificial-jellynut-soil"]
artificial_jellynut_soil.variants = tile_variations_template_with_transitions_new(
	"__factorio_hd_age_space_age_terrain_gleba__/data/space-age/graphics/terrain/artificial-jellynut-soil.png",
	{
		max_size = 4,
		[1] = { weights = {0.085, 0.085, 0.085, 0.085, 0.087, 0.085, 0.065, 0.085, 0.045, 0.045, 0.045, 0.045, 0.005, 0.025, 0.045, 0.045 } },
		[2] = { probability = 1, weights = {0.018, 0.020, 0.015, 0.025, 0.015, 0.020, 0.025, 0.015, 0.025, 0.025, 0.010, 0.025, 0.020, 0.025, 0.025, 0.010 }, },
		[4] = { probability = 0.1, weights = {0.018, 0.020, 0.015, 0.025, 0.015, 0.020, 0.025, 0.015, 0.025, 0.025, 0.010, 0.025, 0.020, 0.025, 0.025, 0.010 }, },
	}
)
Post Reply

Return to “Questions, reviews and ratings”