Compare commits
No commits in common. "master" and "1.2.5" have entirely different histories.
6 changed files with 58 additions and 45 deletions
|
@ -1,16 +1,4 @@
|
||||||
---------------------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------------------
|
||||||
Version: 1.2.7
|
|
||||||
Date: 22.08.2025
|
|
||||||
Bug Fixes:
|
|
||||||
- Simplify weight calculation to prevent infinite recursion (https://mods.factorio.com/mod/hot-metals/discussion/68a3a137a86e2ca3d73388fe)
|
|
||||||
- Always show hot variants in filter menus (https://mods.factorio.com/mod/hot-metals/discussion/685ac28c1436373189fc0bff)
|
|
||||||
---------------------------------------------------------------------------------------------------
|
|
||||||
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
|
Version: 1.2.5
|
||||||
Date: 04.02.2025
|
Date: 04.02.2025
|
||||||
Changes:
|
Changes:
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
require("prototypes/hot-metals-final")
|
|
|
@ -1,10 +1,10 @@
|
||||||
{
|
{
|
||||||
"name": "hot-metals",
|
"name": "hot-metals",
|
||||||
"version": "1.2.7",
|
"version": "1.2.5",
|
||||||
"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",
|
||||||
"homepage": "https://discord.gg/ufvFUJtVwk",
|
"homepage": "",
|
||||||
"factorio_version": "2.0",
|
"factorio_version": "2.0",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"base",
|
"base",
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
[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ę.
|
|
|
@ -1,9 +0,0 @@
|
||||||
-- 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
|
|
|
@ -1,5 +1,52 @@
|
||||||
local defaultSpoilTicks = settings.startup["hot-metals-time"].value * 60
|
local defaultSpoilTicks = settings.startup["hot-metals-time"].value * 60
|
||||||
|
|
||||||
|
---@param name data.ItemID
|
||||||
|
---@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)
|
function createHotVariant(config)
|
||||||
local itemName = config
|
local itemName = config
|
||||||
local spoilTicks = defaultSpoilTicks
|
local spoilTicks = defaultSpoilTicks
|
||||||
|
@ -11,13 +58,13 @@ function createHotVariant(config)
|
||||||
iconFolder = config.iconFolder or iconFolder
|
iconFolder = config.iconFolder or iconFolder
|
||||||
end
|
end
|
||||||
local item = data.raw.item[itemName]
|
local item = data.raw.item[itemName]
|
||||||
item.weight = item.weight or 10000
|
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 config.icons then
|
if (config.icons) then
|
||||||
hotItem.icons = config.icons
|
hotItem.icons = config.icons
|
||||||
else
|
else
|
||||||
hotItem.icon = iconFolder .. "hot-" .. itemName .. ".png"
|
hotItem.icon = iconFolder .. "hot-" .. itemName .. ".png"
|
||||||
|
@ -27,15 +74,8 @@ function createHotVariant(config)
|
||||||
hotItem.weight = item.weight
|
hotItem.weight = item.weight
|
||||||
hotItem.spoil_result = itemName
|
hotItem.spoil_result = itemName
|
||||||
hotItem.spoil_ticks = spoilTicks
|
hotItem.spoil_ticks = spoilTicks
|
||||||
hotItem.flags = hotItem.flags or {}
|
|
||||||
if not table.contains(hotItem.flags, "always-show") then
|
|
||||||
table.insert(hotItem.flags, "always-show")
|
|
||||||
end
|
|
||||||
|
|
||||||
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
|
||||||
|
@ -61,6 +101,13 @@ function createHotVariant(config)
|
||||||
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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue