Page 1 of 1

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

Posted: Mon Jul 11, 2016 2:14 pm
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?

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

Posted: Mon Jul 11, 2016 2:32 pm
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.

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

Posted: Wed Jul 13, 2016 11:53 am
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