Compare commits

...

11 commits

Author SHA1 Message Date
Simon Brodtmann
215dd76d90 1.2.6 2025-04-18 10:41:15 +02:00
Simon Brodtmann
1adf84ef1a Move technology changes to final fixes stage 2025-04-15 18:08:54 +02:00
Simon Brodtmann
3c0ebc98e2 Add polish translation 2025-04-15 18:04:59 +02:00
Simon Brodtmann
ae788825fe 1.2.5 2025-02-04 23:04:39 +01:00
Simon Brodtmann
4d875f2eaa Add support for Muluna 2025-02-04 22:16:07 +01:00
Simon Brodtmann
562ed9dd76 Revert "Remove hot LDS"
See https://forums.factorio.com/123081
2025-02-04 22:16:07 +01:00
Simon Brodtmann
19012408a5 1.2.4 2025-02-03 23:04:21 +01:00
Simon Brodtmann
42c7360a39 Fix item weights 2025-02-03 21:56:54 +01:00
Simon Brodtmann
b6e46d3849 1.2.3 2025-02-03 15:48:25 +01:00
Simon Brodtmann
c8ff481c4d Propertly load cf-lib util 2025-02-03 15:47:14 +01:00
Simon Brodtmann
935ee5268e Use non-hot icon variants for the recipes 2025-02-03 10:34:31 +01:00
13 changed files with 169 additions and 69 deletions

View file

@ -1,4 +1,28 @@
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
Version: 1.2.6
Date: 18.04.2025
Changes:
- Add polish translation (I forgot who did it :-( )
- Move technology changes to final fixes stage
---------------------------------------------------------------------------------------------------
Version: 1.2.5
Date: 04.02.2025
Changes:
- Add Low density structure again after Wube fixed a bug (https://forums.factorio.com/123081)
- Add support for Muluna (Aluminum plate)
---------------------------------------------------------------------------------------------------
Version: 1.2.4
Date: 03.02.2025
Bug Fixes:
- Fix item weights (many items weights where way off)
---------------------------------------------------------------------------------------------------
Version: 1.2.3
Date: 03.02.2025
Changes:
- Use non-hot icon variants for the recipes
Bug Fixes:
- Properly load cf-lib util
---------------------------------------------------------------------------------------------------
Version: 1.2.2 Version: 1.2.2
Date: 02.02.2025 Date: 02.02.2025
Changes: Changes:

View file

@ -1,6 +1,7 @@
local modList = { local modList = {
"space-age", "space-age",
"aai-industry" "aai-industry",
"planet-muluna"
} }
for _, mod in pairs(modList) do for _, mod in pairs(modList) do

View file

@ -0,0 +1 @@
table.insert(HotMetals.items, "aluminum-plate")

View file

@ -5,8 +5,7 @@ table.insert(HotMetals.items, "iron-stick")
table.insert(HotMetals.items, "pipe") table.insert(HotMetals.items, "pipe")
table.insert(HotMetals.items, "pipe-to-ground") table.insert(HotMetals.items, "pipe-to-ground")
table.insert(HotMetals.items, "tungsten-plate") table.insert(HotMetals.items, "tungsten-plate")
-- Disabled because of https://forums.factorio.com/viewtopic.php?f=7&t=123081 table.insert(HotMetals.items, "low-density-structure")
--table.insert(HotMetals.items, "low-density-structure")
table.insert(HotMetals.craftingCategories, "metallurgy") table.insert(HotMetals.craftingCategories, "metallurgy")
table.insert(HotMetals.craftingCategories, "crafting-with-fluid-or-metallurgy") table.insert(HotMetals.craftingCategories, "crafting-with-fluid-or-metallurgy")

View file

@ -0,0 +1 @@
require("prototypes/hot-metals-final")

View file

@ -2,7 +2,7 @@ HotMetals = {
items = { items = {
"copper-plate", "copper-plate",
"iron-plate", "iron-plate",
"steel-plate", "steel-plate"
}, },
craftingCategories = { craftingCategories = {
"smelting" "smelting"
@ -10,6 +10,8 @@ HotMetals = {
skipTechUnlocksFor = {} skipTechUnlocksFor = {}
} }
require("__cf-lib__/util")
if settings.startup["hot-metals-plastic"].value then if settings.startup["hot-metals-plastic"].value then
table.insert(HotMetals.items, "plastic-bar") table.insert(HotMetals.items, "plastic-bar")
if not mods["space-age"] then -- Space age uses other crafting categories if not mods["space-age"] then -- Space age uses other crafting categories

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View file

@ -1,6 +1,6 @@
{ {
"name": "hot-metals", "name": "hot-metals",
"version": "1.2.2", "version": "1.2.6",
"title": "Hot metals", "title": "Hot metals",
"description": "A furnace doesn't just output cold usable results. You need to wait for them to cool down.", "description": "A furnace doesn't just output cold usable results. You need to wait for them to cool down.",
"author": "cackling fiend", "author": "cackling fiend",

View file

@ -0,0 +1,12 @@
[item-name]
hot=Hot
[mod-setting-name]
hot-metals-time=Czas stygnięcia
hot-metals-plastic=Dodaj gorący plastik
hot-metals-bricks=dodaj gorące kamienne cegły i beton
[mod-setting-description]
hot-metals-time=Czas w sekundach, jaki jest potrzebny, aby gorący przedmiot ostygł.
hot-metals-plastic=Chociaż temperatura gorącego plastiku jest znacznie niższa w porównaniu do metali, możesz chcieć mieć jego gorącą wersję.
hot-metals-bricks=Kamienne cegły i beton nie są domyślnie uwzględnione. Jeśli lubisz grać z gorącymi wariantami, możesz włączyć tę opcję.

View file

@ -0,0 +1,9 @@
-- Change technology triggers
for _, tech in pairs(data.raw.technology) do
if tech.research_trigger then
local item = data.raw.item[tech.research_trigger.item]
if item and item.hot_item and not contains(HotMetals.skipTechUnlocksFor, item.name) then
tech.research_trigger.item = item.hot_item
end
end
end

View file

@ -1,30 +1,83 @@
local defaultSpoilTicks = settings.startup["hot-metals-time"].value * 60 local defaultSpoilTicks = settings.startup["hot-metals-time"].value * 60
function createHotVariant(item) ---@param name data.ItemID
local itemName = item ---@return data.ItemPrototype?
function getItem(name)
if data.raw.item[name] then
return data.raw.item[name] --[[@as data.ItemPrototype]]
end
for item_type in pairs(defines.prototypes.item) do
local type_lookup = data.raw[item_type]
if type_lookup and type_lookup[name] then
return type_lookup[name] --[[@as data.ItemPrototype]]
end
end
end
---@param table item
---@return number
function getWeight(item)
if type(item) == "string" then
item = getItem(item)
end
if item.weight then return item.weight end
local factor = item.ingredient_to_weight_coefficient or 0.5
for _, recipe in pairs(data.raw.recipe) do
if recipe.results == nil then
goto continue
end
local function isResultMatch(result)
return result.name == item.name
end
local results = table.filter(recipe.results, isResultMatch)
if #results > 0 then
for _, ingredient in pairs(recipe.ingredients) do
if ingredient.type == "item" then
local weight = data.raw.item[ingredient.name].weight or getWeight(data.raw.item[ingredient.name])
local amount = ingredient.amount
if ingredient.amount_min and ingredient.amount_max then
amount = (ingredient.amount_min + ingredient.amount_max) / 2
end
return amount * weight * factor
end
end
end
::continue::
end
return 100
end
function createHotVariant(config)
local itemName = config
local spoilTicks = defaultSpoilTicks local spoilTicks = defaultSpoilTicks
local iconFolder = "__hot-metals__/graphics/icons/" local iconFolder = "__hot-metals__/graphics/icons/"
if type(item) == "table" then if type(config) == "table" then
itemName = item.name itemName = config.name
spoilTicks = item.spoilTicks or spoilTicks spoilTicks = config.spoilTicks or spoilTicks
iconFolder = item.iconFolder or iconFolder iconFolder = config.iconFolder or iconFolder
end end
local item = data.raw.item[itemName]
item.weight = getWeight(item)
-- Create new item -- Create new item
local hotItem = table.deepcopy(data.raw.item[itemName]) local hotItem = table.deepcopy(data.raw.item[itemName])
hotItem.name = "hot-" .. itemName hotItem.name = "hot-" .. itemName
hotItem.localised_name = { "", { "item-name.hot" }, " ", { "item-name." .. itemName } } hotItem.localised_name = { "", { "item-name.hot" }, " ", { "item-name." .. itemName } }
if (item.icons) then if (config.icons) then
hotItem.icons = item.icons hotItem.icons = config.icons
else else
hotItem.icon = iconFolder .. "hot-" .. itemName .. ".png" hotItem.icon = iconFolder .. "hot-" .. itemName .. ".png"
end end
hotItem.order = hotItem.order .. "-hot" hotItem.order = hotItem.order .. "-hot"
hotItem.ingredient_to_weight_coefficient = item.ingredient_to_weight_coefficient
hotItem.weight = item.weight
hotItem.spoil_result = itemName hotItem.spoil_result = itemName
hotItem.spoil_ticks = spoilTicks hotItem.spoil_ticks = spoilTicks
data:extend({ hotItem }) data:extend({ hotItem })
item.hot_item = hotItem.name
-- Change recipes -- Change recipes
for _, recipe in pairs(data.raw.recipe) do for _, recipe in pairs(data.raw.recipe) do
if contains(HotMetals.craftingCategories, recipe.category) then if contains(HotMetals.craftingCategories, recipe.category) then
@ -33,25 +86,23 @@ function createHotVariant(item)
end end
local results = table.filter(recipe.results, isResultMatch) local results = table.filter(recipe.results, isResultMatch)
if #results > 0 then if #results > 0 then
-- Change regular recipe to be the "hot" recipe
for _, result in pairs(results) do for _, result in pairs(results) do
result.name = hotItem.name result.name = hotItem.name
end end
recipe.localised_name = { "item-name." .. itemName } recipe.localised_name = { "item-name." .. itemName }
recipe.icon = recipe.icon or item.icon
recipe.icon_size = recipe.icon_size or item.icon_size
recipe.icons = recipe.icons or item.icons
if recipe.main_product == itemName then if recipe.main_product == itemName then
recipe.main_product = hotItem.name recipe.main_product = hotItem.name
end end
recipe.preserve_products_in_machine_output = true recipe.preserve_products_in_machine_output = true
recipe.result_is_always_fresh = true recipe.result_is_always_fresh = true
end end
end end
end end
-- Change technology triggers
for _, tech in pairs(data.raw.technology) do
if tech.research_trigger and tech.research_trigger.item == itemName and not contains(HotMetals.skipTechUnlocksFor, itemName) then
tech.research_trigger.item = hotItem.name
end
end
end end
-- Checks if a table contains a certain value -- Checks if a table contains a certain value

Binary file not shown.

Binary file not shown.