Replicators; Graphics

Place to get help with not working mods / modding interface.
User avatar
darkshadow1809
Filter Inserter
Filter Inserter
Posts: 306
Joined: Thu Jan 15, 2015 10:13 pm
Contact:

Replicators; Graphics

Post by darkshadow1809 »

Hi there,

I might have a silly question. I've fiddled with this stuff for about a week now and I am seriously thinking about recoding the whole thing. But before I do! lets see if theres a solution the community might bring as I am no where near an experienced coder. I only took this up for fun a year back and been modding on and off.

So I was hugely interested in the replicator mod. The original concept by jamupsi and me and doublespin made a spinoff off of that. We didnt have time anymore eventually someone else made his own spinoff.

However now that I actually have a decent amount of time on my hands I wanted to completely overhaul factorio with the help of the replicator mod + my own mod that never hit the forum. I need to merge those two later.
So I asked yuoki for some custom graphics (Really good work by him so far) however I cannot get these to work due to the nature of how the code works. (In my opinion) Now it wouldnt be an issue if all these textures were the same size same shape shame length of animation etc. However their all slightly different in size.

So basically its about this line of code here;

Code: Select all

		{
			type = "assembling-machine",
			name = "replicator-"..tier,
			icon = "__MatterTech__/graphics/icons/replicator-"..tier..".png",
			flags = {"placeable-neutral", "placeable-player", "player-creation"},
			minable = {hardness = 0.2, mining_time = 0.5, result = "replicator-"..tier},
			max_health = 200,
			corpse = "big-remnants",
			dying_explosion = "big-explosion",
			resistances = {
				{
					type = "fire",
					percent = 70
				}
			},
			fluid_boxes = {
				{
					base_area = 10,
					base_level = 1,
					production_type = "output",
					pipe_picture = replicatorpipepictures(),
					pipe_covers = pipecoverspictures(),
					pipe_connections =
					{
						{ position = {0.575, 1.15} }
					},
				},
				off_when_no_fluid_recipe = true
			},
			
			collision_box = {{-0.75, -0.75}, {0.75, 0.75}},
			selection_box = {{-1.0, -1.0}, {1.0, 1.0}},
			light = {intensity = 1.00, size = 8},
			
			
			fast_replaceable_group = "replicator",
			animation =
			{
				filename = "__MatterTech__/graphics/entity/replicators/replicator-"..tier..".png",
				priority="high",
				width = 256,
				height = 256,
				frame_count = 16,
				line_length = 4,
				animation_speed = 1/3,
				shift = {0.0, 0.0},
				scale = 0.5
			},
 
http://prntscr.com/e96qzu see that ..tier.. right there? Ive tried numerous ways. Of duplicating the code 5x and then making it replicator-1.png etc etc. But it will never ever change the model. Well... sometimes. But then the rest of the replicators arent the correct texture and also the same.
So what am I doing wrong here and how can I change it?

Ill upload the mod please look in

Prototypes\replicators\replicators.lua for the code on the animations.

The graphics are as follows in

graphics\entity\replicators


what needs to be done?

Have the replicator 1-3 assigned to their correct textures. If anyone could do that. that'd be awesome!
Attachments
MatterTech_0.0.0.zip
(23.35 MiB) Downloaded 125 times
ShadowsModpackDevelopment
User avatar
darkshadow1809
Filter Inserter
Filter Inserter
Posts: 306
Joined: Thu Jan 15, 2015 10:13 pm
Contact:

Re: Replicators; Graphics

Post by darkshadow1809 »

Bump .-.? Really cant figure this out.
ShadowsModpackDevelopment
keyboardhack
Filter Inserter
Filter Inserter
Posts: 478
Joined: Sat Aug 23, 2014 11:43 pm
Contact:

Re: Replicators; Graphics

Post by keyboardhack »

In the method make_replicator you have defined two different assembling-machines with the same name name = "replicator-"..tier
The second definition overrides the first one which is why nothing happens when you make changes in the first one. The second one is specificly set to use filename = "__MatterTech__/graphics/entity/replicators/replicator-2.png" as its animation texture.

Here is the data:extend method used in make_replicator with the duplicate removed

Code: Select all

	data:extend({
		{
			type = "recipe",
			name = "replicator-"..tier,
			enabled = "false",
			ingredients = ingredients,
			result = "replicator-"..tier,
			subgroup = "replicators",
			order = "b"..tier,
		},
		{
			type = "item",
			name = "replicator-"..tier,
			icon = "__MatterTech__/graphics/icons/replicator-"..tier..".png",
			flags = {"goes-to-quickbar"},
			subgroup = "production-machine",
			order = "b"..tier,
			place_result = "replicator-"..tier,
			stack_size = 50
		},
		
		{
			type = "assembling-machine",
			name = "replicator-"..tier,
			icon = "__MatterTech__/graphics/icons/replicator-"..tier..".png",
			flags = {"placeable-neutral", "placeable-player", "player-creation"},
			minable = {hardness = 0.2, mining_time = 0.5, result = "replicator-"..tier},
			max_health = 200,
			corpse = "big-remnants",
			dying_explosion = "big-explosion",
			resistances = {
				{
					type = "fire",
					percent = 70
				}
			},
			fluid_boxes = {
				{
					base_area = 10,
					base_level = 1,
					production_type = "output",
					pipe_picture = replicatorpipepictures(),
					pipe_covers = pipecoverspictures(),
					pipe_connections =
					{
						{ position = {0.575, 1.15} }
					},
				},
				off_when_no_fluid_recipe = true
			},
			
			collision_box = {{-0.75, -0.75}, {0.75, 0.75}},
			selection_box = {{-1.0, -1.0}, {1.0, 1.0}},
			light = {intensity = 1.00, size = 8},
			
			
			fast_replaceable_group = "replicator",
			animation =
			{
				filename = "__MatterTech__/graphics/entity/replicators/replicator-"..tier..".png",
				priority="high",
				width = 256,
				height = 256,
				frame_count = 16,
				line_length = 4,
				animation_speed = 1/3,
				shift = {0.0, 0.0},
				scale = 0.5
			},
			crafting_categories = categories,
			crafting_speed = base_speed * speed_factor^(tier-1),
			energy_source =
			{
				type = "electric",
				usage_priority = "secondary-input",
				emissions = base_pollution * pollution_factor^(tier-1),
			},
			energy_usage = (base_power * power_factor^(tier-1)) .. "kW",
			ingredient_count = -0,
			module_specification =
			{
				module_slots = math.floor(tier / 2) + 1
			},
			allowed_effects = {"consumption", "speed", "productivity", "pollution"},
			open_sound = { filename = "__base__/sound/machine-open.ogg", volume = 0.85 },
			close_sound = { filename = "__base__/sound/machine-close.ogg", volume = 0.75 },
			working_sound = {
				sound = {
					{
					filename = "__base__/sound/lab.ogg",
					volume = 0.7
					},
				},
				idle_sound = { filename = "__base__/sound/idle1.ogg", volume = 0.6 },
				apparent_volume = 1.5,
			}
		},
		{
			type = "recipe",
			name = "replicator-"..tier,
			enabled = "false",
			ingredients = ingredients,
			result = "replicator-"..tier,
			subgroup = "replicators",
			order = "b"..tier,
		},
		{
			type = "item",
			name = "replicator-"..tier,
			icon = "__MatterTech__/graphics/icons/replicator-"..tier..".png",
			flags = {"goes-to-quickbar"},
			subgroup = "production-machine",
			order = "b"..tier,
			place_result = "replicator-"..tier,
			stack_size = 50
		},
	})
Waste of bytes : P
Odynius
Inserter
Inserter
Posts: 21
Joined: Wed Feb 22, 2017 10:36 pm
Contact:

Re: Replicators; Graphics

Post by Odynius »

So, if I got that right, you want someone to take those sprite sheets and kind of equalize them?
User avatar
darkshadow1809
Filter Inserter
Filter Inserter
Posts: 306
Joined: Thu Jan 15, 2015 10:13 pm
Contact:

Re: Replicators; Graphics

Post by darkshadow1809 »

keyboardhack wrote:In the method make_replicator you have defined two different assembling-machines with the same name name = "replicator-"..tier
The second definition overrides the first one which is why nothing happens when you make changes in the first one. The second one is specificly set to use filename = "__MatterTech__/graphics/entity/replicators/replicator-2.png" as its animation texture.

Here is the data:extend method used in make_replicator with the duplicate removed

Code: Select all

	data:extend({
		{
			type = "recipe",
			name = "replicator-"..tier,
			enabled = "false",
			ingredients = ingredients,
			result = "replicator-"..tier,
			subgroup = "replicators",
			order = "b"..tier,
		},
		{
			type = "item",
			name = "replicator-"..tier,
			icon = "__MatterTech__/graphics/icons/replicator-"..tier..".png",
			flags = {"goes-to-quickbar"},
			subgroup = "production-machine",
			order = "b"..tier,
			place_result = "replicator-"..tier,
			stack_size = 50
		},
		
		{
			type = "assembling-machine",
			name = "replicator-"..tier,
			icon = "__MatterTech__/graphics/icons/replicator-"..tier..".png",
			flags = {"placeable-neutral", "placeable-player", "player-creation"},
			minable = {hardness = 0.2, mining_time = 0.5, result = "replicator-"..tier},
			max_health = 200,
			corpse = "big-remnants",
			dying_explosion = "big-explosion",
			resistances = {
				{
					type = "fire",
					percent = 70
				}
			},
			fluid_boxes = {
				{
					base_area = 10,
					base_level = 1,
					production_type = "output",
					pipe_picture = replicatorpipepictures(),
					pipe_covers = pipecoverspictures(),
					pipe_connections =
					{
						{ position = {0.575, 1.15} }
					},
				},
				off_when_no_fluid_recipe = true
			},
			
			collision_box = {{-0.75, -0.75}, {0.75, 0.75}},
			selection_box = {{-1.0, -1.0}, {1.0, 1.0}},
			light = {intensity = 1.00, size = 8},
			
			
			fast_replaceable_group = "replicator",
			animation =
			{
				filename = "__MatterTech__/graphics/entity/replicators/replicator-"..tier..".png",
				priority="high",
				width = 256,
				height = 256,
				frame_count = 16,
				line_length = 4,
				animation_speed = 1/3,
				shift = {0.0, 0.0},
				scale = 0.5
			},
			crafting_categories = categories,
			crafting_speed = base_speed * speed_factor^(tier-1),
			energy_source =
			{
				type = "electric",
				usage_priority = "secondary-input",
				emissions = base_pollution * pollution_factor^(tier-1),
			},
			energy_usage = (base_power * power_factor^(tier-1)) .. "kW",
			ingredient_count = -0,
			module_specification =
			{
				module_slots = math.floor(tier / 2) + 1
			},
			allowed_effects = {"consumption", "speed", "productivity", "pollution"},
			open_sound = { filename = "__base__/sound/machine-open.ogg", volume = 0.85 },
			close_sound = { filename = "__base__/sound/machine-close.ogg", volume = 0.75 },
			working_sound = {
				sound = {
					{
					filename = "__base__/sound/lab.ogg",
					volume = 0.7
					},
				},
				idle_sound = { filename = "__base__/sound/idle1.ogg", volume = 0.6 },
				apparent_volume = 1.5,
			}
		},
		{
			type = "recipe",
			name = "replicator-"..tier,
			enabled = "false",
			ingredients = ingredients,
			result = "replicator-"..tier,
			subgroup = "replicators",
			order = "b"..tier,
		},
		{
			type = "item",
			name = "replicator-"..tier,
			icon = "__MatterTech__/graphics/icons/replicator-"..tier..".png",
			flags = {"goes-to-quickbar"},
			subgroup = "production-machine",
			order = "b"..tier,
			place_result = "replicator-"..tier,
			stack_size = 50
		},
	})

That was ofcourse the first generation of the mod. And I did a clumsy (workaround) which did not really work as intended. to have each specific replicator have their own unique graphics. (With varying sizes) As to why I am stuck on this

I need 5 different replicators which each their own unique specification for

width = 256,
height = 256,
frame_count = 16,
line_length = 4,
animation_speed = 1/3,
shift = {0.0, 0.0},
scale = 0.5


Theres where I get stuck.
ShadowsModpackDevelopment
User avatar
darkshadow1809
Filter Inserter
Filter Inserter
Posts: 306
Joined: Thu Jan 15, 2015 10:13 pm
Contact:

Re: Replicators; Graphics

Post by darkshadow1809 »

Odynius wrote:So, if I got that right, you want someone to take those sprite sheets and kind of equalize them?
No, i want a solution for the graphics on size variety

width = 256,
height = 256,
frame_count = 16,
line_length = 4,
animation_speed = 1/3,
shift = {0.0, 0.0},
scale = 0.5

I need 5 replicators to be vastly different from eachother. I've got 3 done ATM and id like each replicator to link to their sprite size and such. However that is not possible with the original code.
ShadowsModpackDevelopment
User avatar
darkshadow1809
Filter Inserter
Filter Inserter
Posts: 306
Joined: Thu Jan 15, 2015 10:13 pm
Contact:

Re: Replicators; Graphics

Post by darkshadow1809 »

bump :( still no solution
ShadowsModpackDevelopment
TempiDrachen
Burner Inserter
Burner Inserter
Posts: 15
Joined: Tue Jul 21, 2015 2:42 pm
Contact:

Re: Replicators; Graphics

Post by TempiDrachen »

I tried the following and it works for giving each tier its own different animation speed. It should be robust enough to give each tier its own animation:

First, I had each tier's animation be defined at the before the main set of data is extended, like so:

Code: Select all

	local rep_animation = {}
	if tier == 1 then
		--This animation information will be used for tier 1
		rep_animation = {
			filename = "__dark-matter-replicators__/graphics/entity/replicators/replicator-1.png",
			priority="high",
			width = 113,
			height = 91,
			frame_count = 33,
			line_length = 11,
			animation_speed = 1/3,
			shift = {0.2, 0.15},
			scale = 0.66
		}
	elseif tier == 2 then
		--This animation information will be used for tier 2
		rep_animation = {
			filename = "__dark-matter-replicators__/graphics/entity/replicators/replicator-2.png",
			priority="high",
			width = 113,
			height = 91,
			frame_count = 33,
			line_length = 11,
			animation_speed = 1/2,
			shift = {0.2, 0.15},
			scale = 0.66
		}
	else
		--This information will be used for all other tiers, as it is in the else case
		rep_animation = {
			filename = "__dark-matter-replicators__/graphics/entity/replicators/replicator-"..tier..".png",
			priority="high",
			width = 113,
			height = 91,
			frame_count = 33,
			line_length = 11,
			animation_speed = 1,
			shift = {0.2, 0.15},
			scale = 0.66
		}
	end
	data:extend({ --This line is the normal start of what you wrote, to show you where to put the new code
Then, I had the game use these new animations be replacing this:

Code: Select all

			fast_replaceable_group = "replicator", --This line is included so you know where to start
			animation =
			{
				filename = "__dark-matter-replicators__/graphics/entity/replicators/replicator-"..tier..".png",
				priority="high",
				width = 113,
				height = 91,
				frame_count = 33,
				line_length = 11,
				animation_speed = 1/3,
				shift = {0.2, 0.15},
				scale = 0.66
			},
			crafting_categories = categories, --This line is included so you know where to stop
With this:

Code: Select all

			fast_replaceable_group = "replicator", --This line is included so you know where to start
			animation = rep_animation,
			crafting_categories = categories, --This line is included so you know where to stop
If you are going to change the sizes of the different replicators then I would strongly recommend also redoing the fluid, collision and selection boxes the same way.
Post Reply

Return to “Modding help”