Better Quality


Adds quality scaling to belt speed, drill/pumpjack mining speed, cargo/fluid wagon size, storage tank size, and locomotive speed/power usage, adds options for speed module quality penalty, quality module quality bonus, and adds a number of optional quality-related items and entities.

Tweaks
4 months ago
2.0
2.32K
Transportation Logistics Trains Combat Armor Mining Fluids Logistic network Circuit network Manufacturing Power Storage

b [Resolved] Error on start up

4 months ago

2.1.0:

Failed to load mods: better-quality/data-final-fixes.lua:48: attempt to perform arithmetic on field 'amount' (a nil value)
stack traceback:
better-quality/data-final-fixes.lua:48: in main chunk

4 months ago
(updated 4 months ago)

That's part of the function that auto-generates the bulk recycling recipes. Based on the error, it sounds like a malformed recycling recipe added by one of your mods. I'll add a nil check that should prevent the error from occurring.

4 months ago

Submitted v2.1.1. Let me know if it fixes the issue.

4 months ago
(updated 4 months ago)

Resolved thank you :-) I have 400 mods so this helped a lot.

4 months ago

Thanks for trying out my mod. Marking as resolved :)

4 months ago
(updated 4 months ago)

Is this the same error again or new fun? I disabled all the mods I have that mess with Recyling and still got this error?

Failed to load mods: better-quality/data-final-fixes.lua:59: attempt to index field '?' (a nil value)
stack traceback:
better-quality/data-final-fixes.lua:59: in main chunk

4 months ago
(updated 4 months ago)

It's not recycling mods that are the issue, any mod that adds any item that can be recycled will go through this code. I'm using a function that someone gave me to try to find an item's prototype but apparently it failed in this instance. New issue due to new code. Another day, another nil check.

4 months ago

Submitted v2.1.5, let me know if it works.

4 months ago

Yes, it now builds :-)

My unwanted Lua scripting advice if you are going have functions that will be dealing with unknown data sets, would be to use pcall and that way you can catch the errors and aim to have a handler function that'll sort out 99% of the chaos for you.

4 months ago
(updated 4 months ago)

Not unwanted at all! Looks like I removed it from the mod description by accident, but this mod is actually both my first time using Lua and my first time modding Factorio so I appreciate any help.

As for pcall, that seems interesting and I wasn't aware of that previously. It's basically errors as values like Go, but only when you want it.

4 months ago

I've been using LUA for work for 5ish years, I wish I didn't have to. I've found if you do functional over OOP with LUA you have less pain, but that's a sample size of me so grain of salt

4 months ago

I've been using LUA for work for 5ish years, I wish I didn't have to. I've found if you do functional over OOP with LUA you have less pain, but that's a sample size of me so grain of salt

Totally unrelated to the mod (sorry author!) but i'm curious what "functional over OOP with LUA" means, coming from a background of working with OOP based languages

4 months ago
(updated 4 months ago)

A Functional method/function;
- just does *one specific thing.
- it is stateless & deterministic
- it don't mess with other stuff (no coupling :-)) .
- it can be assigned to variables, passed as arguments, and returned from other functions.

so in this case you'd have a protected call function call others

If you are using more than 3 indents you're not functional (exaggerating but I've used this to help juniors)

4 months ago

still getting the nil check error at game start up with version 2.1.5 [same error as #5 here] => 680884ff6436488ec8dadf56?quote=5

4 months ago

Let me know if the new update helps.

4 months ago

unfortunately it didn't. just tried it

4 months ago

Are you sure the error is exactly the same? Same line number and everything?

4 months ago

no, Failed to load mods: better-quality/data-final-fixes.lua:56: attempt to index field '?' (a nil value)
stack traceback:
better-quality/data-final-fixes.lua:56: in main chunk

4 months ago

sorry about that misread/dyslexic-ed the 59/56

4 months ago

That means that one of your mods added a recycling recipe that somehow has no ingredients which I... I don't even know anymore. A smarter version of me would have stopped making assumptions in my code a long time ago, but better late than never.

4 months ago
(updated 4 months ago)

ok. weird. probably disable it then. bug's in that one probably

4 months ago

as for your code, well, pretty sure you're doing the best you can :) . have a suspicion which one, but unsure. will update

4 months ago
(updated 4 months ago)

as for your code, well, pretty sure you're doing the best you can :) . have a suspicion which one, but unsure. will update.

edit: ok, it loaded. disabled a few after disabling the suspected one didn't. more testing

edit 2: enabled the suspect, and confirmed, it's not it. running on latest experimental, FYI. was running stable before with identical error msgs

edit 3: found the exact mod, lagless promethium, https://mods.factorio.com/mod/lagless_promethium . crashed with that weird ? nil check.

4 months ago
(updated 4 months ago)

I was unable to reproduce the error with Lagless Promethium installed myself, but hopefully the latest update fixes the issue regardless.

4 months ago

it did, TY so much

New response