Braver New World deprecated


RTS-like scenario for Factorio. Player character is removed, all work must be done by bots. Minimal 0.18 port of Brave New World by candidae, ported by Sladki, published by Omnifarious.

4 years ago
0.18 - 1.0
12

b Crash with equipment items with inventories

4 years ago

Hello,

I hope you're not to annoyed by me, since the issue I will be describing is one entirely caused by me changing around stuff in the control.lua. If you don't want to offer support in that case, I fully understand. Especially since I already found a workaround. But I thought you might be interested in this Crash regardless, especially if you should find a way to include the whitelist idea I had previously, since that would happen in this case too.

I play BNW with a bunch of mods, including Krastorio. Krastorio adds equipment generators that need fuel to work. The Fuel needs to be manually inserted into the generator by right-clicking on the item while it is inside the equipment grid. This opens up a new GUI where you can deposit the Fuel.

I added the Uranium Fuel Cell item to the whitelisted items, so that I can put it into the generator. That works flawlessly. But when I remove the Fuel Cells again and the item count in the inventory would become higher than the set limit, the game crashes.

As a reference, here are the lines I added to the code:

-- Allow Uranium Fuel Cells from Krastorio to be manually inserted into Equipment
elseif name == "uranium-fuel-cell" then
    return math.min(10, count)

Here is the ingame crash report:

Error while running event level::on_player_main_inventory_changed (ID 32)
LuaEquipment doesn't contain key insert.
stack traceback:
...Data/Roaming/Factorio/temp/currently-playing/control.lua:97: in function 'dropItems'
...Data/Roaming/Factorio/temp/currently-playing/control.lua:88 in function <...Data/Roaming/Factorio/temp/currently-playing/control.lua:30>
stack traceback:
[C]: in function '__index'
...Data/Roaming/Factorio/temp/currently-playing/control.lua:97: in function 'dropItems'
...Data/Roaming/Factorio/temp/currently-playing/control.lua:88 in function <...Data/Roaming/Factorio/temp/currently-playing/control.lua:30>

I have only very limited knowledge in programming and even less in Factorio. But I think this means the equipment doesn't have the insert function?

My workaround: setting the item count to 50000. The Uranium Fuel Cells only stacks to 10. so I'd have to fill 500 inventory slots with Uranium Fuel Cells before the error could crop up again.

4 years ago
(updated 4 years ago)

I presume these are equipment grids for vehicles, not armor. :-)

4 years ago

And yes, I think you're right. On line 97 it tries to check to see if something (perhaps the entity you were trying to pull from) has an insert function, and doesn't go about doing it in the right way.

New response