Recipe can only be crafted in assembly machines

Place to get help with not working mods / modding interface.
vedrit
Filter Inserter
Filter Inserter
Posts: 293
Joined: Sun Aug 03, 2014 2:25 am
Contact:

Recipe can only be crafted in assembly machines

Post by vedrit »

Hi all,
How would one go about making it so that a recipe can only be crafted in an assembly machine when it doesn't require fluids? Is there a way?

Thanks!
vedrit
Filter Inserter
Filter Inserter
Posts: 293
Joined: Sun Aug 03, 2014 2:25 am
Contact:

Re: Recipe can only be crafted in assembly machines

Post by vedrit »

I'm also having some issues with the following chunk of script

Code: Select all

script.on_event(events.on_tick, function(event)
		if (game.tick % 60) == 0 then
			heal_wall()
		end
end)
which throws this: "Attempt to index global 'events' (a nil value)"
when starting the game
User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2179
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: Recipe can only be crafted in assembly machines

Post by Ranakastrasz »

in overrides

Code: Select all

for _, assembler in pairs (data.raw["assembling-machine"]) do
    for _, category in pairs (assembler.crafting_categories) do
        if category == "crafting" then
            table.insert(assembler.crafting_categories,"electronics")
        end
    end
end
as prototype

Code: Select all

    {
        type = "recipe-category",
        name = "electronics"
    },
as prototype.

Code: Select all

  {
    type = "recipe", name = "electronic-circuit-3",
    icon = "__base__/graphics/icons/electronic-circuit.png",
	enabled = false,
	category = "electronics",
	energy_required = 1.0,--2.0,
	ingredients = {
		{"prepped-pcb", 1},
		{"electronic-components",2}
	},
	results = {{"electronic-circuit",2}}
  },  
Just ripped that from Cartmans electronics overhaul. Should work fine. This is the current version which I have messed with.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16
vedrit
Filter Inserter
Filter Inserter
Posts: 293
Joined: Sun Aug 03, 2014 2:25 am
Contact:

Re: Recipe can only be crafted in assembly machines

Post by vedrit »

OK, I'll look into that. Any idea why the events would be throwing null? Did they change the events class?
vedrit
Filter Inserter
Filter Inserter
Posts: 293
Joined: Sun Aug 03, 2014 2:25 am
Contact:

Re: Recipe can only be crafted in assembly machines

Post by vedrit »

I'm having a hard time finding out how to force technologies to be researched. I've added pre-req techs to some existing technologies, and how I thought it should be done isn't working.

Code: Select all

script.on_load(function()
  for _,player in pairs(game.players) do
    if player.force.technologies["alien-hybridization1"].researched then
	  player.force.technologies['alien-bioengineering'].researched = true
	  player.force.recipes['alien-bioconstruct'].enabled = true
	end
  end
end)
patmo98
Inserter
Inserter
Posts: 27
Joined: Sat Mar 21, 2015 10:59 pm
Contact:

Re: Recipe can only be crafted in assembly machines

Post by patmo98 »

vedrit wrote:I'm having a hard time finding out how to force technologies to be researched. I've added pre-req techs to some existing technologies, and how I thought it should be done isn't working.
What do you mean when you say it "isn't working"? Are you saying:
*) You want alien-bioconstruct to require research, but it can be crafted at the beginning of the game
*) You're trying to enable the recipe for alien-bioconstruct when alien-hybridization1 is researched, but the recipe isn't getting enabled?
*) You're trying to make alien-bioengineering become researched when alien-hybridization1 is researched
vedrit
Filter Inserter
Filter Inserter
Posts: 293
Joined: Sun Aug 03, 2014 2:25 am
Contact:

Re: Recipe can only be crafted in assembly machines

Post by vedrit »

Alien Bio Engineering tech enables the alien bioconstruct and is a prerequisite for alien hybridization 1. I'm trying to check if alien hybridization 1 is already researched to then mark alien bio engineering as researched and enable alien bioconstruct. It's not working in that neither happens.

Edit: Ok, I got it so the recipe will unlock, but is there a way to mark the tech as researched? When I try to use force.technologies['alien-bioengineering'].researched = true I get an error saying that I'm trying to do research before the game has started
Post Reply

Return to “Modding help”