[MOD 0.16] Ammo-Loader

Topics and discussion about specific mods
Post Reply
SilentCrim
Burner Inserter
Burner Inserter
Posts: 14
Joined: Sun Apr 09, 2017 10:56 pm

[MOD 0.16] Ammo-Loader

Post by SilentCrim » Sat May 05, 2018 6:10 am

potentialThumbnail3_large.png
potentialThumbnail3_large.png (35.93 KiB) Viewed 1386 times
Description:
Less turret logistics, more dead aliens. This mod adds chests to automatically fill turrets and vehicles with ammo/fuel.

Details:
  • Name: ammo-loader
  • Latest Release: 0.16.23, May 4, 2018
  • Factorio Version: 0.16
  • Download: Mod Portal
  • License: GNU GPL v3 with some graphical assets governed by the Creative Commons License
  • Tags: turret, load, ammo, auto, fuel, autofill, car
  • Author: SilentCrim
Long Description
Incompatibilities
Changelog
Attribution
Feel free to post any comments/suggestions/bug reports as a reply to this topic.
Image[url=steam://friends/add/'.76561198074798722.']Image[/url]

Sir3n
Inserter
Inserter
Posts: 27
Joined: Tue Apr 03, 2018 11:35 pm

Re: [MOD 0.16] Ammo-Loader

Post by Sir3n » Tue May 08, 2018 5:03 am

I placed down a fuel loader chest, dropped some fuel in it and the game crashed with the following message:
Error while running event ammo-loader::on_tick (ID 0)
__ammo-loader__/lib/TrackedChest.lua:265: attempt to compare number with nil
The crash only happens when "Include burner structures" is enabled.

SilentCrim
Burner Inserter
Burner Inserter
Posts: 14
Joined: Sun Apr 09, 2017 10:56 pm

Re: [MOD 0.16] Ammo-Loader

Post by SilentCrim » Tue May 08, 2018 12:14 pm

Damn and I thought everything seemed pretty stable. Regardless, thanks for taking the time to report the bug.

I'll see if I can take a look at it when I get off work. Most likely there's a nil check missing before I check if an entity has a burner inventory.
Image[url=steam://friends/add/'.76561198074798722.']Image[/url]

OhMods
Manual Inserter
Manual Inserter
Posts: 2
Joined: Fri Jun 09, 2017 7:48 am

Re: [MOD 0.16] Ammo-Loader

Post by OhMods » Wed May 09, 2018 8:50 am

That's the reason I had to keep the option off. Checked with burner crashes but not all the time. I started a vanilla game without my mods (minus creative to test) and if the check is on at game start it doesn't crash. Or at least not right away.

Also, I suppose it doesn't load Artillery Turrets? Probably make it too powerful.

SilentCrim
Burner Inserter
Burner Inserter
Posts: 14
Joined: Sun Apr 09, 2017 10:56 pm

Re: [MOD 0.16] Ammo-Loader

Post by SilentCrim » Wed May 16, 2018 2:14 am

I placed down a fuel loader chest, dropped some fuel in it and the game crashed with the following message:
Ok, there's a new version out that should hopefully fix the issue. I was never able to reproduce the problem on my end, but I think I identified the missing nil check, so hopefully that fixes things. Let me know if it doesn't work and we'll go from there.
Also, I suppose it doesn't load Artillery Turrets? Probably make it too powerful.
Something like that. On the other hand, I personally think the burner structures option is pretty powerful (especially with the AAI industries mod), so I don't see why I can't add an option for that if you want one. However, I created this mod before artillery wagons existed, so it might be extra busted with those in mind. Let me know if you want it and I'll try to add it in this weekend (the weekend is really the only time I have to work on it).
Image[url=steam://friends/add/'.76561198074798722.']Image[/url]

Sir3n
Inserter
Inserter
Posts: 27
Joined: Tue Apr 03, 2018 11:35 pm

Re: [MOD 0.16] Ammo-Loader

Post by Sir3n » Wed May 16, 2018 4:51 pm

SilentCrim wrote:Ok, there's a new version out that should hopefully fix the issue. I was never able to reproduce the problem on my end, but I think I identified the missing nil check, so hopefully that fixes things. Let me know if it doesn't work and we'll go from there.
That crash doesn't happen anymore it seems. Thanks for the fix.
Last edited by Sir3n on Wed May 16, 2018 5:51 pm, edited 1 time in total.

Sir3n
Inserter
Inserter
Posts: 27
Joined: Tue Apr 03, 2018 11:35 pm

Re: [MOD 0.16] Ammo-Loader

Post by Sir3n » Wed May 16, 2018 5:51 pm

I found more bugs i think:

Bug 1:
If you set the "Max items per slot" to something bigger than the maximum stack size of the item and max items per inventory is uncapped, the fuel loader chest keeps deleting items from the game.

Steps to reproduce:
1) Start a fresh game.
2) Set "Max items per slot" to 100, have "Include burner structures" enabled, make sure "Max items per inventory" is set to 0.
3) Place down a Fuel Loader Chest. Fill it completely with coal
4) Place down a furnace.
5) Furnace gets filled up, but all your excess coal in the Loader chest disappears.

Bug 2:
Same problem happens with "Max items per inventory" too. If "Max items per inventory" is set to something bigger than the inventory can hold, and "max items per slot" is uncapped, the fuel chest basically just deletes items from the game.

1) Start a fresh game.
2) Set "Max items per inventory" to 1000, have "Include burner structures" enabled, make sure "Max items per slot" is set to 0.
3) Place down a Fuel Loader Chest. Fill it completely with coal
4) Place down tracks + locomotive.
5) Locomotive gets filled up, but all your excess coal in the Loader chest disappears.

Bug 3:
If "Include burner structures" is disabled, the Fuel loader chest does not fill up locomotives.
I'm not sure if this is expected behaviour or a bug, might as well report it just to make sure.

SilentCrim
Burner Inserter
Burner Inserter
Posts: 14
Joined: Sun Apr 09, 2017 10:56 pm

Re: [MOD 0.16] Ammo-Loader

Post by SilentCrim » Sat May 19, 2018 5:14 am

I found more bugs i think:
:D Awesome, I really appreciate your help with improving the mod. There is a new version out now that should address these issues.

Bug 1:
If you set the "Max items per slot" to something bigger than the maximum stack size of the item and max items per inventory is uncapped, the fuel loader chest keeps deleting items from the game.
Lol this made me facepalm. When I recently restructured the code, I took out the line that checked an item's stack size before inserting it. For whatever reason I remember thinking that it was redundant, but obviously it wasn't. Good catch.

Bug 2:
Same problem happens with "Max items per inventory" too. If "Max items per inventory" is set to something bigger than the inventory can hold, and "max items per slot" is uncapped, the fuel chest basically just deletes items from the game.
This was just an odd consequence of bug 1. The max items per inventory option actually doesn't do anything anymore; I stopped using it a while back because the calls to inventory.get_item_count() each tick were too expensive. This setting has been removed in the new version.

Bug 3:
If "Include burner structures" is disabled, the Fuel loader chest does not fill up locomotives.
I actually never intended for locomotives to be filled at all, but instead of taking this out I made it a separate option. You can now enable/disable filling locomotives in the mod options menu.

Also, I suppose it doesn't load Artillery Turrets? Probably make it too powerful.
There is now an option to enable/disable loading artillery.
Image[url=steam://friends/add/'.76561198074798722.']Image[/url]

danieltudor94
Manual Inserter
Manual Inserter
Posts: 2
Joined: Wed Aug 15, 2018 3:13 am

Re: [MOD 0.16] Ammo-Loader

Post by danieltudor94 » Wed Aug 15, 2018 3:26 am

I just encountered an error, its suspicious because factorio was the last program i ran last night and the first i started this morning,havent installed any mods to have an incompatibility and only modified the item stack from 5 to 15.

>>> Notice

Error while running deserialisation for mod-ammo-loader: [string "do local_={ammo_loader={},created_queue={fir..."]:1: function or expression too complex near 'nil' <<<

Untitled.png
Untitled.png (1.36 MiB) Viewed 760 times
:(

SilentCrim
Burner Inserter
Burner Inserter
Posts: 14
Joined: Sun Apr 09, 2017 10:56 pm

Re: [MOD 0.16] Ammo-Loader

Post by SilentCrim » Sun Sep 02, 2018 3:51 am

That's a strange one. It's probably due to the way the mod handles the global table disagreeing with Factorio's savegame serialization.

I just released a new version that's a much cleaner rewrite, so I would try upgrading first to see if that helps.
Image[url=steam://friends/add/'.76561198074798722.']Image[/url]

komodo99
Manual Inserter
Manual Inserter
Posts: 4
Joined: Tue Sep 12, 2017 5:33 am

Re: [MOD 0.16] Ammo-Loader

Post by komodo99 » Sun Sep 02, 2018 5:51 am

I've just added this mod to my current save, or at least attempted to. I am getting an error on save load that is as follows.

Code: Select all

Error while applying migration: Ammo Loader+:v16_23.lua

__ammo-loader__/migrations/v16_23.lua:5:attempt to index field 'ammo-loader-tech-ammo1' (a nil value)
I suspect it is trying to migrate something that doesn't exist as it has just been added, but I have not delved too deeply into it.

danieltudor94
Manual Inserter
Manual Inserter
Posts: 2
Joined: Wed Aug 15, 2018 3:13 am

Re: [MOD 0.16] Ammo-Loader

Post by danieltudor94 » Sun Sep 02, 2018 7:47 am

komodo99 wrote:I've just added this mod to my current save, or at least attempted to. I am getting an error on save load that is as follows.

Code: Select all

Error while applying migration: Ammo Loader+:v16_23.lua

__ammo-loader__/migrations/v16_23.lua:5:attempt to index field 'ammo-loader-tech-ammo1' (a nil value)
I suspect it is trying to migrate something that doesn't exist as it has just been added, but I have not delved too deeply into it.

Im getting the error too :/

SilentCrim
Burner Inserter
Burner Inserter
Posts: 14
Joined: Sun Apr 09, 2017 10:56 pm

Re: [MOD 0.16] Ammo-Loader

Post by SilentCrim » Sun Sep 02, 2018 2:59 pm

komodo99 wrote:I've just added this mod to my current save, or at least attempted to. I am getting an error on save load that is as follows.

Code: Select all

Error while applying migration: Ammo Loader+:v16_23.lua

__ammo-loader__/migrations/v16_23.lua:5:attempt to index field 'ammo-loader-tech-ammo1' (a nil value)
I suspect it is trying to migrate something that doesn't exist as it has just been added, but I have not delved too deeply into it.
I just released a new version (0.16.29) that should fix this issue.
Image[url=steam://friends/add/'.76561198074798722.']Image[/url]

komodo99
Manual Inserter
Manual Inserter
Posts: 4
Joined: Tue Sep 12, 2017 5:33 am

Re: [MOD 0.16] Ammo-Loader

Post by komodo99 » Wed Sep 05, 2018 3:03 am

Aside from some debugging printing when a related research finishes, working well here. Thanks much!

Post Reply

Return to “Mods”