Factorio: fix certain recipes (like steel-plate) not getting their crafting time adjusted correctly.
This commit is contained in:
		
							parent
							
								
									54177c7064
								
							
						
					
					
						commit
						babd809fa6
					
				| 
						 | 
				
			
			@ -52,11 +52,19 @@ function copy_factorio_icon(tech, tech_source)
 | 
			
		|||
end
 | 
			
		||||
 | 
			
		||||
function adjust_energy(recipe_name, factor)
 | 
			
		||||
    local energy = data.raw.recipe[recipe_name].energy_required
 | 
			
		||||
    if (energy == nil) then
 | 
			
		||||
        energy = 1
 | 
			
		||||
    end
 | 
			
		||||
    local recipe = data.raw.recipe[recipe_name]
 | 
			
		||||
    local energy = recipe.energy_required
 | 
			
		||||
    if (energy ~= nil) then
 | 
			
		||||
        data.raw.recipe[recipe_name].energy_required = energy * factor
 | 
			
		||||
    end
 | 
			
		||||
    if (recipe.normal ~= nil and recipe.normal.energy_required ~= nil) then
 | 
			
		||||
        energy = recipe.normal.energy_required
 | 
			
		||||
        recipe.normal.energy_required = energy * factor
 | 
			
		||||
    end
 | 
			
		||||
    if (recipe.expensive ~= nil and recipe.expensive.energy_required ~= nil) then
 | 
			
		||||
        energy = recipe.expensive.energy_required
 | 
			
		||||
        recipe.expensive.energy_required = energy * factor
 | 
			
		||||
    end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
data.raw["assembling-machine"]["assembling-machine-1"].crafting_categories = table.deepcopy(data.raw["assembling-machine"]["assembling-machine-3"].crafting_categories)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue