forked from cacklingfiend/lignumis
Fix crash due to error attempt to get length of local 'woodResults' (a nil value)
This commit is contained in:
parent
db4ef37a8f
commit
009fcf4d50
3 changed files with 8 additions and 3 deletions
|
@ -1,4 +1,9 @@
|
||||||
---------------------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------------------
|
||||||
|
Version: 1.0.8
|
||||||
|
Date: 04.02.2025
|
||||||
|
Bug Fixes:
|
||||||
|
- Fix crash due to error `attempt to get length of local 'woodResults' (a nil value)`
|
||||||
|
---------------------------------------------------------------------------------------------------
|
||||||
Version: 1.0.7
|
Version: 1.0.7
|
||||||
Date: 04.02.2025
|
Date: 04.02.2025
|
||||||
Changes:
|
Changes:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "lignumis",
|
"name": "lignumis",
|
||||||
"version": "1.0.7",
|
"version": "1.0.8",
|
||||||
"title": "Lignumis",
|
"title": "Lignumis",
|
||||||
"description": "Dive into the world of Lignumis, a moon of Nauvis offering only the most basic technologies.",
|
"description": "Dive into the world of Lignumis, a moon of Nauvis offering only the most basic technologies.",
|
||||||
"author": "cackling fiend",
|
"author": "cackling fiend",
|
||||||
|
|
|
@ -81,12 +81,12 @@ for _, tree in pairs(data.raw.tree) do
|
||||||
end
|
end
|
||||||
local minable = tree.minable
|
local minable = tree.minable
|
||||||
local woodResults = minable.results and table.filter(minable.results, isWoodResult)
|
local woodResults = minable.results and table.filter(minable.results, isWoodResult)
|
||||||
local isRegularTree = (minable.result == "wood" and minable.count == 4) or (#minable.results == 1 and #woodResults == 1 and woodResults[1].amount == 4)
|
local isRegularTree = (minable.result == "wood" and minable.count == 4) or (minable.results and #minable.results == 1 and #woodResults == 1 and woodResults[1].amount == 4)
|
||||||
if not isRegularTree then goto continue end
|
if not isRegularTree then goto continue end
|
||||||
tree.minable.result = nil
|
tree.minable.result = nil
|
||||||
tree.minable.count = nil
|
tree.minable.count = nil
|
||||||
local woodResult = { type = "item", name = "wood", amount = nil, amount_min = 2, amount_max = 10 }
|
local woodResult = { type = "item", name = "wood", amount = nil, amount_min = 2, amount_max = 10 }
|
||||||
if #woodResults > 0 then
|
if minable.results and #woodResults > 0 then
|
||||||
table.assign(woodResults[1], woodResult)
|
table.assign(woodResults[1], woodResult)
|
||||||
else
|
else
|
||||||
minable.results = { woodResult }
|
minable.results = { woodResult }
|
||||||
|
|
Loading…
Add table
Reference in a new issue