Early Drones Logistics

by Racimir

A factory without belts, drills or pipes. Flying drones mine your patches and carry goods and fluids straight over the terrain, paid for in fuel and later in electricity. Replaces belts, drills and most inserters; roboports keep doing what they always did.

Content
a month ago
2.0 - 2.1
713
Logistics Mining Logistic network

b 2.2.0 crashes on uranium mining: remove_fluid uses the 2.0 table form

9 days ago

Factorio 2.1.19, Early Drones Logistics 2.2.0.

As soon as a mining depot with uranium in range finds a storage tank holding
enough sulfuric acid (>= fluid_amount * mining yield), the game exits to the
menu with:

Error while running event early-drones::on_nth_tick(1)
early-drones/control.lua:953: Arguments count error for 'remove_fluid':
Expected 2 arguments but 1 were given

Cause: Factorio 2.1 changed LuaEntity::remove_fluid to positional
(index :: uint32, amount :: double), i.e. it now targets a fluidbox index.
The mod still calls the 2.0 table form remove_fluid{name = ..., amount = ...}
in two places:

control.lua:953 (acid taken when a mining drone is sent)
scripts/fluids.lua:403 (M.take_fluid, tanker drones drawing from a source)

Fix that keeps the old semantics (engine picks the fluidbox/segment, returns
the amount actually removed): use the new LuaEntity::extract_fluid, which
accepts the same table:

fluid_tank.extract_fluid{ name = need_fluid, amount = fluid_per_ore * mining_yield }
return entity.extract_fluid{ name = fluid_name, amount = amount } or 0

insert_fluid(fluid) still takes a Fluid table, so give_fluid is fine.

Verified locally with the change above: no error, tank drains by the trip
amount on each dispatch.

New response