it would be nice if the two functions in the Title would get a fluidbox index support, because currently they detect that automaticly and that is not so good in many cases.
Here a example.
Current Code:
Code: Select all
function dsu:give_item( requested_name, requested_count )
local fluidbox = self.entity.fluidbox
local box = fluidbox[3]
if not box then return 0 end
if box.name ~= requested_name then return 0 end
local amount = box.amount
if amount <= requested_count then
fluidbox[3] = nil
return amount
end
box.amount = amount - requested_count
fluidbox[3] = box
return requested_count
end
New potential code:
Code: Select all
function dsu:give_item( requested_name, requested_count )
local removed_amount = self.entity.insert_fluid( { name = requested_name, amount = requested_count }, 3 )
return removed_amount
end
And for remove, just adding a fluidbox_index = double (optional) would do fine I would say.
For get_fluid_count, like in insert just adding another optional number for the Fluidbox Index.
Greetz,
Luzifer