djmango / BlackMarket2

A mod for Factorio economics
https://mods.factorio.com/mod/BlackMarket2
GNU General Public License v3.0
17 stars 7 forks source link

Mod item pricing fix and Flib 0.8 compatibility #32

Closed xsirh925 closed 2 years ago

xsirh925 commented 2 years ago

Hi,

This is my first public PR, so please feel free to let me know what I can do better with regards to contributing.

The current release gets around problems caused by recent changes to Flib by listing dependency on a prior version, but Factorio (and presumably some of the other mods I'm using) don't want to downgrade to that prior version. There seems to be a bug causing most angel-bob items to default to the price for unknown items, as well.

The reason why Flib 0.8+ causes BM2 to crash is because it has depreciated a few of its functions (Flib seems to just automatically take care of what those functions accomplished without needing "users" to manually call them). To that end, those calls have been commented out and the flib dependency is now "flib >= 0.8.0".

For mod item pricing, I added a function that allows for logging of the reason for any item's price getting set to unknown_price and an accompanying setting (off by default) so that it isn't stuck always logging. The cause for lots of items getting set to unknown_price seems to have been a small typo at the end of price calculation.

I took the liberty of making some spelling changes in some comments and debug_print statements (to one local variable as well) and reformatting some one line for/if blocks.

I incremented the minor version number by 1 ("version": "2.0.7").

Finally symlink.sh creates a link from wherever it is being run to the mods folder, in case the current user organizes their files a bit differently.

djmango commented 2 years ago

Looks good, water prices are a bit funky but this solves problems for a huge chunk of people so pushing it through, thanks for your contribution!