Skip to content

Commit d10e5a3

Browse files
committed
Add lazyAPI.adapt_ItemProduct_for_LootItem(table?): table?
1 parent c202b1d commit d10e5a3

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

changelog.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
Version: 0.17.12
33
Date: 28. 11. 2025
44
Scripting:
5-
- Added Add lazyAPI.adapt_LootItem_for_ItemProduct(table?): table?
5+
- Added lazyAPI.adapt_ItemProduct_for_LootItem(table?): table?
6+
- Added lazyAPI.adapt_LootItem_for_ItemProduct(table?): table?
67
- Added lazyAPI.EntityWithHealth.add_item_from_mining(prototype, item, item_product): prototype
78
- Added lazyAPI.get_valid_items(data?): string[]|table[]|table<string, any>
89
---------------------------------------------------------------------------------------------------

experimental/lazyAPI.lua

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ lazyAPI.scale_pipes(prototype, fluid_box, size, string|string[]?): prototype
144144
lazyAPI.scale_vector(table?, size)
145145
lazyAPI.scale_pipe_sprite(table?, size)
146146
lazyAPI.adapt_LootItem_for_ItemProduct(table?): table?
147+
lazyAPI.adapt_ItemProduct_for_LootItem(table?): table?
147148
148149
149150
lazyAPI.base.override_data(table): prototype
@@ -4759,6 +4760,22 @@ function lazyAPI.adapt_LootItem_for_ItemProduct(loot)
47594760
loot.amount_min = loot.count_min
47604761
loot.amount_max = loot.count_max
47614762
end
4763+
4764+
---@cast loot +ItemProduct
4765+
return loot
4766+
end
4767+
4768+
4769+
---@param product ItemProduct
4770+
function lazyAPI.adapt_ItemProduct_for_LootItem(product)
4771+
if product == nil then return end
4772+
4773+
product.item = product.name
4774+
product.count_min = product.amount or product.amount_min
4775+
product.count_max = product.amount_max
4776+
4777+
---@cast product +LootItem
4778+
return product
47624779
end
47634780

47644781

0 commit comments

Comments
 (0)