Page 1 of 1
Recipe can only be crafted in assembly machines
Posted: Fri Jul 01, 2016 12:59 am
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!
Re: Recipe can only be crafted in assembly machines
Posted: Fri Jul 01, 2016 2:16 am
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
Re: Recipe can only be crafted in assembly machines
Posted: Fri Jul 01, 2016 4:02 am
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.
Re: Recipe can only be crafted in assembly machines
Posted: Fri Jul 01, 2016 4:46 am
by vedrit
OK, I'll look into that. Any idea why the events would be throwing null? Did they change the events class?
Re: Recipe can only be crafted in assembly machines
Posted: Fri Jul 01, 2016 7:23 am
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)
Re: Recipe can only be crafted in assembly machines
Posted: Fri Jul 01, 2016 4:05 pm
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
Re: Recipe can only be crafted in assembly machines
Posted: Fri Jul 01, 2016 4:17 pm
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