Robot Replacer

by Peppe

Utility mod to help replace/upgrade bots within a network. Bots in the replacer provider chest are released to the network when a bot of the same type, but different name is found in a roboport. The bots that do not match the provider are removed from the roboport and placed in the logistics storage network. Should work with all modded bots and roboports. *** Megabase warning: Chest is Calculation heavy when any items are in it. Only put bots in it and keep empty to idle efficiently. ***

2 years ago
0.14 - 1.1
32.2K

b game crashes... stack count has to be positive

7 years ago

Hey! I noticed a bug, at least with my game.
control.lua:51 has this line:
count = network.insert({name=itemDestination, count=math.min(sizeSource, sizeDestination)})
math.min returned a negative integer and crashed my game. I added an if statement and now it seems to be working.

7 years ago

I seem to be having the same problem. I can verify that adding an 'if' statement around line 51 in control.lua works. The if statement just checks to see if the call to math.min() > 0. Everything seems to work after this, but it seems a bit hackish.

The modified code is as follows:

local count = 0
if math.min(sizeSource, sizeDestination) then
count2 = math.min(sizeSource, sizeDestination)
end
count = network.insert({name=itemDestination, count2})

New response