How to no choose recipe for assembling mashine?

Place to get help with not working mods / modding interface.
zurisar
Burner Inserter
Burner Inserter
Posts: 13
Joined: Sun Mar 13, 2016 8:31 pm
Contact:

How to no choose recipe for assembling mashine?

Post by zurisar »

Hi, I continue work on my mod - Zorio and have another problem, I add some ore subproducts like in IC from Minecraft, so firstly I mashing ore, than I need to washing ore, for washing entity I use chemical-plant, because I need to input water and mashed ore and output washed ore, so I use this code

Code: Select all

-- Ore washing
	{
    type = "assembling-machine",
    name = "zwasher",
    icon = "__base__/graphics/icons/chemical-plant.png",
    flags = {"placeable-neutral","placeable-player", "player-creation"},
    minable = {hardness = 0.2, mining_time = 0.5, result = "zwasher"},
    max_health = 300,
    corpse = "big-remnants",
    dying_explosion = "medium-explosion",
    collision_box = {{-1.4, -1.4}, {1.4, 1.4}},
    selection_box = {{-1.5, -1.5}, {1.5, 1.5}},
    --[[ module_specification =
    {
      module_slots = 2
    },
    allowed_effects = {"consumption", "speed", "productivity", "pollution"}, ]]--
  -- animation and sound sections are miss for this post
    crafting_speed = 1.25,
    energy_source =
		{
			type = "burner",
			effectivity = 1,
			fuel_inventory_size = 1,
			emissions = 0.01,
			smoke =
				{
					{
						name = "smoke",
						deviation = {0.1, 0.1},
						frequency = 5,
						position = {0.0, -0.8},
						starting_vertical_speed = 0.08,
						starting_frame_deviation = 60
					}
				}
		},
    energy_usage = "250kW",
    ingredient_count = 2,
    crafting_categories = {"washing"},
    fluid_boxes =
    {
      {
        production_type = "input",
        pipe_covers = pipecoverspictures(),
        base_area = 10,
        base_level = -1,
        pipe_connections = {{ type="input", position = {-1, -2} }}
      },
      {
        production_type = "input",
        pipe_covers = pipecoverspictures(),
        base_area = 10,
        base_level = -1,
        pipe_connections = {{ type="input", position = {1, -2} }}
      },
      --[[{
        production_type = "output",
        pipe_covers = pipecoverspictures(),
        base_level = 1,
        pipe_connections = {{ position = {-1, 2} }}
      },
      {
        production_type = "output",
        pipe_covers = pipecoverspictures(),
        base_level = 1,
        pipe_connections = {{ position = {1, 2} }}
      }]]--
    }
  },
When I click on new washer first time I need to choose recipe, and it show me all avaliable recipes, as it should be I can choose only recipe from "washing" category, how I can skip this and use it like furnace, just put in coal, shredded ore, some water and get hutched ore at end?
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3733
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: How to no choose recipe for assembling mashine?

Post by DaveMcW »

You can set the recipe in events.on_built_entity and events.on_robot_built_entity.

Code: Select all

function set_default_recipe(entity)
	if (entity and entity.name == "zwasher" and not entity.recipe) then
		entity.recipe = "hutched-ore"
	end
end

script.on_event(defines.events.on_built_entity, function(event) 
	set_default_recipe(event.created_entity)
end)

script.on_event(defines.events.on_robot_built_entity, function(event) 
	set_default_recipe(event.created_entity)
end)

zurisar
Burner Inserter
Burner Inserter
Posts: 13
Joined: Sun Mar 13, 2016 8:31 pm
Contact:

Re: How to no choose recipe for assembling mashine?

Post by zurisar »

DaveMcW wrote:You can set the recipe in events.on_built_entity and events.on_robot_built_entity.
Thanks for the answer, but as I understand this function set one recipe to one entity, I use more than 6 ores with this types of subproducts...
I can compile subproducts from all ores to one subproduct and then get final ore's dust from this one subproduct, but I don't sure about it, this need too much balancing for midgame phase :(
anyway I can use this code for uranium processing ;)
orzelek
Smart Inserter
Smart Inserter
Posts: 3924
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: How to no choose recipe for assembling mashine?

Post by orzelek »

Did you make sure to mark washer with only washing category not also other standard categories?
zurisar
Burner Inserter
Burner Inserter
Posts: 13
Joined: Sun Mar 13, 2016 8:31 pm
Contact:

Re: How to no choose recipe for assembling mashine?

Post by zurisar »

orzelek wrote:Did you make sure to mark washer with only washing category not also other standard categories?
yep

Item

Code: Select all

-- Washer
	{
		type = "item",
		name = "zwasher",
		icon = "__base__/graphics/icons/chemical-plant.png",
		flags = {"goes-to-quickbar"},
		subgroup = "ore-processing",
		order = "b",
		place_result = "zwasher",
		stack_size = 50
	},
Recipe

Code: Select all

	{
		type = "recipe",
		name = "zwasher",
		enabled = true,
		ingredients = 
			{
				{"iron-housing", 1},
				{"iron-gear", 2},
				{"iron-barrel", 1},
				{"iron-roll", 1}
			},
		result = "zwasher"
	},
recipe category

Code: Select all

  {
    type = "recipe-category",
    name = "washing"
  },
example recipe

Code: Select all

{
		type = "recipe",
		name = "hutched-iron-ore",
		category = "washing",
		energy_required = 1,
		enabled = true,
		ingredients =
		{
			{type="fluid", name="water", amount=5},
			{type="item", name="shredded-iron-ore", amount=1}
		},
		results=
		{
			{type="item", name="hutched-iron-ore", amount=1}
		}
	},
and entity at my first post, as I undestand type of my washer is assembling-machinem that why I see all avaliable recipes for all machines
Screenshot
if I use type furnace, it doen't work, said that I can't smelt any ore, with assembling machine type work fine, but this dialog window after first click a bit rediculous :(
Post Reply

Return to “Modding help”