41 lines
		
	
	
	
		
			1.6 KiB
		
	
	
	
		
			Lua
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
	
		
			1.6 KiB
		
	
	
	
		
			Lua
		
	
	
	
	
	
| local spoil_ticks = settings.startup["hot-metals-time"].value * 60
 | |
| 
 | |
| function createHotVariant(itemName, _spoil_ticks)
 | |
|     -- Create new item
 | |
|     local hotItem = table.deepcopy(data.raw.item[itemName])
 | |
|     hotItem.name = "hot-" .. itemName
 | |
|     hotItem.localised_name = { "", { "item-name.hot" }, " ", { "item-name." .. itemName } }
 | |
|     hotItem.icon = "__hot-metals__/graphics/icons/hot-" .. itemName .. ".png"
 | |
|     hotItem.order = hotItem.order .. "-hot"
 | |
|     hotItem.spoil_result = itemName
 | |
|     hotItem.spoil_ticks = _spoil_ticks or spoil_ticks
 | |
|     data:extend({ hotItem })
 | |
| 
 | |
|     -- Change recipes
 | |
|     for _, recipe in pairs(data.raw.recipe) do
 | |
|         if ((recipe.category == "smelting" or recipe.category == "metallurgy") and recipe.results[1].name == itemName) then
 | |
|             recipe.results[1].name = hotItem.name
 | |
|             recipe.localised_name = { "item-name." .. itemName }
 | |
|         end
 | |
|     end
 | |
| 
 | |
|     -- Change technology triggers
 | |
|     for _, tech in pairs(data.raw.technology) do
 | |
|         if tech.research_trigger and tech.research_trigger.item == itemName then
 | |
|             tech.research_trigger.item = hotItem.name
 | |
|         end
 | |
|     end
 | |
| end
 | |
| 
 | |
| createHotVariant("copper-cable")
 | |
| createHotVariant("copper-plate")
 | |
| createHotVariant("holmium-plate")
 | |
| createHotVariant("iron-gear-wheel")
 | |
| createHotVariant("iron-plate")
 | |
| createHotVariant("iron-stick")
 | |
| -- Disabled because of https://forums.factorio.com/viewtopic.php?f=7&t=123081
 | |
| --createHotVariant("low-density-structure")
 | |
| createHotVariant("pipe")
 | |
| createHotVariant("pipe-to-ground")
 | |
| createHotVariant("steel-plate")
 | |
| createHotVariant("tungsten-plate")
 | 
