[Rseding91] [for 0.17] [0.16.37] [API] Inserting artillery shells is capped at 1

This subforum contains all the issues which we already resolved.
Post Reply
Aidiakapi
Inserter
Inserter
Posts: 48
Joined: Fri Apr 14, 2017 6:13 pm
Contact:

[Rseding91] [for 0.17] [0.16.37] [API] Inserting artillery shells is capped at 1

Post by Aidiakapi » Thu Apr 26, 2018 11:14 am

Likely because the stack size limit of artillery shells is 1, you cannot insert more than 1 into an artillery wagon using the modding API.

How to reproduce:
  1. Place some rail & artillery wagon.
  2. Hover over the wagon and run one or multiple of:

    Code: Select all

    /c game.player.selected.get_inventory(1).insert({name = 'artillery-shell', count = 10})
    /c game.player.selected.get_inventory(1)[1].set_stack({name = 'artillery-shell', count = 10})
    -- After inserting a single one:
    /c game.player.selected.get_inventory(1)[1].count = 10
Expected:
Multiple artillery shells to be inside the wagon, up to the limit a player can insert of 100.

Result:
At most 1 artillery shell is inserted.

mrvn
Smart Inserter
Smart Inserter
Posts: 3862
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: [16.37] [API] Inserting artillery shells is capped at 1

Post by mrvn » Thu Apr 26, 2018 11:18 am

iirc insert returns the amount inserted and you have to handle anything that remains yourself. Same if you have 30 coal in the inventory and insert 100. It will fill up the 30 to 50 (one stack) and return 20. Then you have to insert the remaining 80 into the next stack.

Aidiakapi
Inserter
Inserter
Posts: 48
Joined: Fri Apr 14, 2017 6:13 pm
Contact:

Re: [16.37] [API] Inserting artillery shells is capped at 1

Post by Aidiakapi » Thu Apr 26, 2018 11:23 am

mrvn wrote:iirc insert returns the amount inserted and you have to handle anything that remains yourself. Same if you have 30 coal in the inventory and insert 100. It will fill up the 30 to 50 (one stack) and return 20. Then you have to insert the remaining 80 into the next stack.
Sorry, but that's not what this post is about whatsoever. Artillery wagons only have a single LuaItemStack. The LuaInventory.insert function also takes care of the behavior you're describing.

Rseding91
Factorio Staff
Factorio Staff
Posts: 9978
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.16.37] [API] Inserting artillery shells is capped at 1

Post by Rseding91 » Fri May 11, 2018 3:18 am

There are a few problems like this that need to be fixed - the same thing happens with assembling machines over stack limit.

At this point I don't want to mess with the logic in 0.16. I'll add it to the 0.17 to-do.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Resolved Problems and Bugs”

Who is online

Users browsing this forum: Bing [Bot]