Not all items showing up, even when all tech is researched

Place to get help with not working mods / modding interface.
Post Reply
User avatar
bigyihsuan
Filter Inserter
Filter Inserter
Posts: 299
Joined: Thu Jan 01, 2015 12:57 pm
Contact:

Not all items showing up, even when all tech is researched

Post by bigyihsuan »

So in my latest commits for updating Complicated Recipes to 0.13.xx, the mod loads fine.

But then if you research the technologies, half of the items don't appear. Is there a fix to this?

User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: Not all items showing up, even when all tech is researched

Post by prg »

Code: Select all

recipes = {
	['logistics'] = 'basic-transport-belt-to-ground-hood',
	['logistics'] = 'basic-splitter-mechanism',
	['logistics-2'] = 'fast-transport-belt-to-ground-hood',
	['logistics-2'] = 'fast-splitter-mechanism',
	['logistics-2'] = 'fast-belt-surface',
	['logistics-2'] = 'stack-inserter-arm',
	['logistics-2'] = 'stack-inserter-platform',
	['logistics-2'] = 'filter-stack-inserter-arm',
	['logistics-2'] = 'filter-stack-inserter-platform',
...
You can't assign multiple values to a single key like that, the last value will overwrite the previous ones.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

User avatar
bigyihsuan
Filter Inserter
Filter Inserter
Posts: 299
Joined: Thu Jan 01, 2015 12:57 pm
Contact:

Re: Not all items showing up, even when all tech is researched

Post by bigyihsuan »

prg wrote:

Code: Select all

recipes = {
	['logistics'] = 'basic-transport-belt-to-ground-hood',
	['logistics'] = 'basic-splitter-mechanism',
	['logistics-2'] = 'fast-transport-belt-to-ground-hood',
	['logistics-2'] = 'fast-splitter-mechanism',
	['logistics-2'] = 'fast-belt-surface',
	['logistics-2'] = 'stack-inserter-arm',
	['logistics-2'] = 'stack-inserter-platform',
	['logistics-2'] = 'filter-stack-inserter-arm',
	['logistics-2'] = 'filter-stack-inserter-platform',
...
You can't assign multiple values to a single key like that, the last value will overwrite the previous ones.
That's legacy code. Below doesn't seem to work, despite the fact that Bob's seems to use it for its migrations. It doesn't help that the wiki's guide to migration scripts doesn't mention how to handle multiple recipes for one technology.

Code: Select all

for index, force in pairs(game.forces) do
 	force.reset_recipes()
 	force.reset_technologies()

	--researched
	if force.technologies['logistics'].researched then
		force.recipes['underground-belt-hood'].enabled = true
		force.recipes['splitter-mechanism'].enabled = true
	end

	if force.technologies['logistics-2'].researched then
		force.recipes['fast-belt-surface'].enabled = true
		force.recipes['fast-transport-belt-to-ground-hood'].enabled = true
		force.recipes['fast-splitter-mechanism'].enabled = true
		force.recipes['stack-inserter-arm'].enabled = true
		force.recipes['stack-inserter-platform'].enabled = true
		force.recipes['filter-stack-inserter-arm'].enabled = true
		force.recipes['filter-stack-inserter-platform'].enabled = true
	end

	if force.technologies['logistics-3'].researched then
		force.recipes['express-belt-surface'].enabled = true
		force.recipes['express-splitter-mechanism'].enabled = true
		force.recipes['express-transport-belt-to-ground-hood'].enabled = true
	end

	if force.technologies['automation'].researched then
		force.recipes['assembling-machine-1-frame'].enabled = true
	end

	if force.technologies['automation-2'].researched then
		force.recipes['assembling-machine-2-frame'].enabled = true
	end

	if force.technologies['automation-3'].researched then
		force.recipes['assembling-machine-3-frame'].enabled = true
	end

	if force.technologies['advanced-electronics'].researched then
		force.recipes['advanced-circuit-board'].enabled = true
	end

	if force.technologies['advanced-electronics-2'].researched then
		force.recipes['processing-circuit-board'].enabled = true
	end

	if force.technologies['automation'].researched then
		force.recipes['long-armed-inserter-arm'].enabled = true
		force.recipes['long-armed-inserter-platform'].enabled = true
	end

	if force.technologies['logistics'].researched then
		force.recipes['fast-inserter-arm'].enabled = true
		force.recipes['fast-inserter-platform'].enabled = true
	end

	if force.technologies['electronics'].researched then
		force.recipes['smart-inserter-arm'].enabled = true
		force.recipes['smart-inserter-platform'].enabled = true
	end

	if force.technologies['military'].researched then
		force.recipes['blank-shotgun-shell'].enabled = true
	end

	if force.technologies['military-2'].researched then
		force.recipes['piercing-bullet'].enabled = true
	end

	if force.technologies['military-3'].researched then
		force.recipes['blank-capsule'].enabled = true
	end

	if force.technologies['oil-processing'].researched then
		force.recipes['compressed-solid-fuel'].enabled = true
	end

	if force.technologies['rocket-silo'].researched then
		force.recipes['low-density-structure-frame'].enabled = true
		force.recipes['rocket-control-unit-cpu'].enabled = true
		force.recipes['rocket-control-unit-case'].enabled = true
		force.recipes['satellite-frame'].enabled = true
	end

	if force.technologies['speed-module'].researched then
		force.recipes['speed-module-casing'].enabled = true
		force.recipes['speed-augment'].enabled = true
	end

	if force.technologies['effectivity-module'].researched then
		force.recipes['effectivity-module-casing'].enabled = true
		force.recipes['effectivity-augment'].enabled = true
	end

	if force.technologies['productivity-module'].researched then
		force.recipes['productivity-module-casing'].enabled = true
		force.recipes['productivity-augment'].enabled = true
	end
end

Post Reply

Return to “Modding help”