[MOD 0.17.x] Ammo-Loader

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

[MOD 0.17.x] Ammo-Loader

Post by SilentCrim »

potentialThumbnail3_large.png
potentialThumbnail3_large.png (35.93 KiB) Viewed 17689 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.
Last edited by SilentCrim on Sat Sep 07, 2019 3:30 pm, edited 1 time in total.
Image[url=steam://friends/add/'.76561198074798722.']Image[/url]
Sir3n
Inserter
Inserter
Posts: 32
Joined: Tue Apr 03, 2018 11:35 pm
Contact:

Re: [MOD 0.16] Ammo-Loader

Post by Sir3n »

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: 17
Joined: Sun Apr 09, 2017 10:56 pm
Contact:

Re: [MOD 0.16] Ammo-Loader

Post by SilentCrim »

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
Burner Inserter
Burner Inserter
Posts: 5
Joined: Fri Jun 09, 2017 7:48 am
Contact:

Re: [MOD 0.16] Ammo-Loader

Post by OhMods »

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: 17
Joined: Sun Apr 09, 2017 10:56 pm
Contact:

Re: [MOD 0.16] Ammo-Loader

Post by SilentCrim »

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: 32
Joined: Tue Apr 03, 2018 11:35 pm
Contact:

Re: [MOD 0.16] Ammo-Loader

Post by Sir3n »

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: 32
Joined: Tue Apr 03, 2018 11:35 pm
Contact:

Re: [MOD 0.16] Ammo-Loader

Post by Sir3n »

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: 17
Joined: Sun Apr 09, 2017 10:56 pm
Contact:

Re: [MOD 0.16] Ammo-Loader

Post by SilentCrim »

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
Contact:

Re: [MOD 0.16] Ammo-Loader

Post by danieltudor94 »

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 17063 times
:(
SilentCrim
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sun Apr 09, 2017 10:56 pm
Contact:

Re: [MOD 0.16] Ammo-Loader

Post by SilentCrim »

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
Burner Inserter
Burner Inserter
Posts: 5
Joined: Tue Sep 12, 2017 5:33 am
Contact:

Re: [MOD 0.16] Ammo-Loader

Post by komodo99 »

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
Contact:

Re: [MOD 0.16] Ammo-Loader

Post by danieltudor94 »

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: 17
Joined: Sun Apr 09, 2017 10:56 pm
Contact:

Re: [MOD 0.16] Ammo-Loader

Post by SilentCrim »

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
Burner Inserter
Burner Inserter
Posts: 5
Joined: Tue Sep 12, 2017 5:33 am
Contact:

Re: [MOD 0.16] Ammo-Loader

Post by komodo99 »

Aside from some debugging printing when a related research finishes, working well here. Thanks much!
luc
Fast Inserter
Fast Inserter
Posts: 229
Joined: Sun Jul 17, 2016 9:53 pm
Contact:

Re: [MOD 0.16] Ammo-Loader

Post by luc »

I can't use this mod in 0.17 anymore: it causes my game to try to use >10GB of memory when loading the map (and RAM is still more expensive today than it was in 2016, so I didn't upgrade to 16GB yet). Without this mod, it uses about 5.5GB.
SilentCrim
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sun Apr 09, 2017 10:56 pm
Contact:

Re: [MOD 0.16] Ammo-Loader

Post by SilentCrim »

Hm yeah I've noticed really long load times in 0.17 as well, but only when updating/changing mods. After saving the first time loading goes back to normal.

I'll take another look but I have yet to see what's causing the issue. Unfortunately I'm tied up this week and don't have much time to work on it. Still thanks for letting me know about the problem.
Image[url=steam://friends/add/'.76561198074798722.']Image[/url]
Post Reply

Return to “Mods”