Transport Drones


Adds transport drones and transport depots

Content
9 months ago
2.0
10.5K
Transportation Logistics Logistic network Storage

g 流体消失问题

18 days ago

需求车站液体消失好像是因为游戏自带液体流动到管道然后脚本重新设置液体数量了。我想到不使用脚本,加一个隐藏的泵应该是性能最好的,但是好像很麻烦。我修改了一下这段代码,如果有需要的可以试试看找到Transport_Drones-1.0.26/script/depots/request_depot.lua这个文件替换

function request_depot:push_fluid_hack()
if self.mode == request_mode.fluid then
local box = self:get_output_fluidbox()
local connected_pipelines = self.entity.fluidbox.get_connections(2)
for i, next_box in ipairs(connected_pipelines) do
for j = 1, #next_box do
local next_fluid = next_box[j]
if (box and next_fluid and next_fluid.name == box.name) or not next_fluid then
local old_amount = next_fluid and next_fluid.amount or 0
local old_temperature = next_fluid and next_fluid.temperature or 0
local space = next_box.get_capacity(j) - old_amount
local push_amount = math.min(space, box and box.amount or 0)
if push_amount > 0 then
next_box[j] = { name = box.name, amount = old_amount + push_amount, temperature = ((old_amount * old_temperature) + (push_amount * box.temperature)) / (old_amount + push_amount) }
local new_next_fluid = next_box[j]
local new_amount = new_next_fluid and new_next_fluid.amount or 0
local pushed_amount = math.max(new_amount - old_amount, 0)
box.amount = box.amount - pushed_amount
if box.amount <= 0 then box = nil end
self:set_output_fluidbox(box)
box = self:get_output_fluidbox()
end
end
end
end
end
end

18 days ago

function request_depot:push_fluid_hack()
if self.mode ~= request_mode.fluid then return end

local box = self:get_output_fluidbox()
if not box or box.amount <= 0 then return end

local connections = self.entity.fluidbox.get_connections(2)
if not connections then return end

for _, pipe in pairs(connections) do
for i = 1, #pipe do
local inserted = pipe.owner.insert_fluid{
name = box.name,
amount = box.amount,
temperature = box.temperature
}

  if inserted > 0 then
    box.amount = box.amount - inserted
    if box.amount <= 0 then
      self:set_output_fluidbox(nil)
      return
    end
    self:set_output_fluidbox(box)
  end
end

end
end

18 days ago

不知道有没有什么问题,我自己也没进一步测试

10 days ago

如果觉得可以的话可以发pr到 仓库 我会进行合并

New response