矮人要塞吧 关注:9,696贴子:29,982
  • 20回复贴,共1

为什么桶里面东西不能合并

只看楼主收藏回复

就像这样每个都装一点,而且不能一个装满后再去装另一个
酒只装一次生产的那5个。然后就满了。提示要有新桶才能继续



IP属地:河南1楼2023-03-01 16:58回复
    因为它们在游戏里是不同的实体,方括号里的数字是分量。
    不合并模拟的会更真实,想象一下大水冲过来,很多东西会被冲的七零八落,更有真实感。


    IP属地:上海2楼2023-03-01 19:13
    收起回复
      2025-07-20 04:40:17
      广告
      有一个dfhack的script叫combine,可以把大量相同物品融合为1组,比如可以把6组肉盔菇[5]变成1组肉盔菇[30]
      这个指令已经在最新版的dfhack里更新了


      IP属地:加拿大3楼2023-03-02 05:39
      回复
        function Combineitems(building, tabl, food, bool)
        local rootItems
        if building then
        rootItems = dfhack.buildings.getStockpileContents(building)
        else
        rootItems = dfhack.items.getContainedItems(item)
        end
        if #rootItems == 0 and not f.args.all then
        qerror("Select a non-empty container")
        return
        else
        local foodCount = getItems(rootItems, food, 0, bool)
        local removedFood = { } --as:bool[]
        food.max=max
        if f.args.max then max = tonumber(f.args.max)
        if tonumber(f.args.max)== 0 then max = 500
        end
        end
        for i=0,(foodCount-2) do
        local currentFood = food[i] --as:df.item_foodst
        local itemsNeeded = max - currentFood.stack_size
        if removedFood[currentFood.id] == nil and itemsNeeded > 0 then
        local j = i+1
        local last = foodCount
        repeat
        local sourceFood = food[j]
        if bool>=10 and removedFood[sourceFood.id] == nil and FishitemsCompatible(currentFood, sourceFood) then
        local amountToMove = math.min(itemsNeeded, sourceFood.stack_size)
        itemsNeeded = itemsNeeded - amountToMove
        currentFood.stack_size = currentFood.stack_size + amountToMove
        if sourceFood.stack_size == amountToMove then
        removedFood[sourceFood.id] = true
        sourceFood.stack_size = 1
        else
        sourceFood.stack_size = sourceFood.stack_size - amountToMove
        end
        -- else print("failed")
        elseif bool <10 and removedFood[sourceFood.id] == nil and itemsCompatible(currentFood, sourceFood) then
        local amountToMove = math.min(itemsNeeded, sourceFood.stack_size)
        itemsNeeded = itemsNeeded - amountToMove
        currentFood.stack_size = currentFood.stack_size + amountToMove
        if sourceFood.stack_size == amountToMove then
        removedFood[sourceFood.id] = true
        if bool>1 then sourceFood.stack_size = 1 end
        else
        sourceFood.stack_size = sourceFood.stack_size - amountToMove
        end
        -- else print("failed")
        end
        j = j + 1
        until j == foodCount or itemsNeeded == 0
        end
        end
        local removedCount = 0
        for id,removed in pairs(removedFood) do
        if removed then
        removedCount = removedCount + 1
        local removedFood = df.item.find(id)
        dfhack.items.remove(removedFood)
        end
        end
        if food.Tot == nil then food.Tot = 0 end
        if food.xTot == nil then food.xTot = 0 end
        food.Tot = food.Tot + foodCount
        food.xTot = food.xTot + removedCount
        end
        end
        if f.args.help then
        print(f.help)
        return
        end
        if not f.args.all then
        local building = stockpile or dfhack.gui.getSelectedBuilding(true)
        if building ~= nil and building:getType() ~= 29 then building = nil
        end
        if building ~= nil then
        if f.args.drinks or f.args.food then
        Combineitems(building, f, drinks, 1)
        print("found " .. drinks.Tot .. " drinks")
        print("merged " .. drinks.xTot .. " drinks")
        end
        if f.args.plants or f.args.food then
        Combineitems(building, f, plants, 2)
        print("found " .. plants.Tot .. " plants")
        print("merged " .. plants.xTot .. " plants")
        end
        if f.args.meat or f.args.food then
        Combineitems(building, f, meats, 3)
        print("found " .. meats.Tot .. " meat")
        print("merged " .. meats.xTot .. " meat")
        end
        if f.args.fat or f.args.food then
        Combineitems(building, f, fat, 4)
        print("found " .. fat.Tot .. " fat")
        print("merged " .. fat.xTot .. " fat")
        end
        if f.args.roasts or f.args.food then
        Combineitems(building, f, roasts, 5)
        print("found " .. roasts.Tot .. " prepared food")
        print("merged " .. roasts.xTot .. " prepared food")
        end
        if f.args.fish or f.args.food then
        Combineitems(building, f, fish, 10)
        print("found " .. fish.Tot .. " fish")
        print("merged " .. fish.xTot .. " fish")
        end
        else
        print('select a stockpile')
        end
        else
        if f.args.all then
        print('Combining all food...')
        for _, building in pairs(df.global.world.buildings.all) do
        if building:getType() == 29 and building ~= nil then
        if building ~= nil then
        if f.args.drinks or f.args.food then
        Combineitems(building, f, drinks, 1)
        end
        if f.args.plants or f.args.food then
        Combineitems(building, f, plants, 2)
        end
        if f.args.meat or f.args.food then
        Combineitems(building, f, meats, 3)
        end
        if f.args.fat or f.args.food then
        Combineitems(building, f, fat, 4)
        end
        if f.args.roasts or f.args.food then
        Combineitems(building, f, roasts, 5)
        end
        if f.args.fish or f.args.food then
        Combineitems(building, f, fish, 10)
        end
        else
        print('invalid')
        end
        end
        end
        if f.args.drinks or f.args.food then
        print("found " .. drinks.Tot .. " drinks")
        print("merged " .. drinks.xTot .. " drinks")
        end
        if f.args.plants or f.args.food then
        print("found " .. plants.Tot .. " plants")
        print("merged " .. plants.xTot .. " plants")
        end
        if f.args.meat or f.args.food then
        print("found " .. meats.Tot .. " meat")
        print("merged " .. meats.xTot .. " meat")
        end
        if f.args.fat or f.args.food then
        print("found " .. fat.Tot .. " fat or tallow")
        print("merged " .. fat.xTot .. " fat or tallow")
        end
        if f.args.roasts or f.args.food then
        print("found " .. roasts.Tot .. " prepared food")
        print("merged " .. roasts.xTot .. " prepared food")
        end
        if f.args.fish or f.args.food then
        print("found " .. fish.Tot .. " fish")
        print("merged " .. fish.xTot .. " fish")
        end
        end
        return
        end


        IP属地:加拿大6楼2023-03-02 05:43
        回复
          没发完,脚本剩下部分:
          function Combineitems(building, tabl, food, bool)
          local rootItems
          if building then
          rootItems = dfhack.buildings.getStockpileContents(building)
          else
          rootItems = dfhack.items.getContainedItems(item)
          end
          if #rootItems == 0 and not f.args.all then
          qerror("Select a non-empty container")
          return
          else
          local foodCount = getItems(rootItems, food, 0, bool)
          local removedFood = { } --as:bool[]
          food.max=max
          if f.args.max then max = tonumber(f.args.max)
          if tonumber(f.args.max)== 0 then max = 500
          end
          end
          for i=0,(foodCount-2) do
          local currentFood = food[i] --as:df.item_foodst
          local itemsNeeded = max - currentFood.stack_size
          if removedFood[currentFood.id] == nil and itemsNeeded > 0 then
          local j = i+1
          local last = foodCount
          repeat
          local sourceFood = food[j]
          if bool>=10 and removedFood[sourceFood.id] == nil and FishitemsCompatible(currentFood, sourceFood) then
          local amountToMove = math.min(itemsNeeded, sourceFood.stack_size)
          itemsNeeded = itemsNeeded - amountToMove
          currentFood.stack_size = currentFood.stack_size + amountToMove
          if sourceFood.stack_size == amountToMove then
          removedFood[sourceFood.id] = true
          sourceFood.stack_size = 1
          else
          sourceFood.stack_size = sourceFood.stack_size - amountToMove
          end
          -- else print("failed")
          elseif bool <10 and removedFood[sourceFood.id] == nil and itemsCompatible(currentFood, sourceFood) then
          local amountToMove = math.min(itemsNeeded, sourceFood.stack_size)
          itemsNeeded = itemsNeeded - amountToMove
          currentFood.stack_size = currentFood.stack_size + amountToMove
          if sourceFood.stack_size == amountToMove then
          removedFood[sourceFood.id] = true
          if bool>1 then sourceFood.stack_size = 1 end
          else
          sourceFood.stack_size = sourceFood.stack_size - amountToMove
          end
          -- else print("failed")
          end
          j = j + 1
          until j == foodCount or itemsNeeded == 0
          end
          end
          local removedCount = 0
          for id,removed in pairs(removedFood) do
          if removed then
          removedCount = removedCount + 1
          local removedFood = df.item.find(id)
          dfhack.items.remove(removedFood)
          end
          end
          if food.Tot == nil then food.Tot = 0 end
          if food.xTot == nil then food.xTot = 0 end
          food.Tot = food.Tot + foodCount
          food.xTot = food.xTot + removedCount
          end
          end
          if f.args.help then
          print(f.help)
          return
          end
          if not f.args.all then
          local building = stockpile or dfhack.gui.getSelectedBuilding(true)
          if building ~= nil and building:getType() ~= 29 then building = nil
          end
          if building ~= nil then
          if f.args.drinks or f.args.food then
          Combineitems(building, f, drinks, 1)
          print("found " .. drinks.Tot .. " drinks")
          print("merged " .. drinks.xTot .. " drinks")
          end
          if f.args.plants or f.args.food then
          Combineitems(building, f, plants, 2)
          print("found " .. plants.Tot .. " plants")
          print("merged " .. plants.xTot .. " plants")
          end
          if f.args.meat or f.args.food then
          Combineitems(building, f, meats, 3)
          print("found " .. meats.Tot .. " meat")
          print("merged " .. meats.xTot .. " meat")
          end
          if f.args.fat or f.args.food then
          Combineitems(building, f, fat, 4)
          print("found " .. fat.Tot .. " fat")
          print("merged " .. fat.xTot .. " fat")
          end
          if f.args.roasts or f.args.food then
          Combineitems(building, f, roasts, 5)
          print("found " .. roasts.Tot .. " prepared food")
          print("merged " .. roasts.xTot .. " prepared food")
          end
          if f.args.fish or f.args.food then
          Combineitems(building, f, fish, 10)
          print("found " .. fish.Tot .. " fish")
          print("merged " .. fish.xTot .. " fish")
          end
          else
          print('select a stockpile')
          end
          else
          if f.args.all then
          print('Combining all food...')
          for _, building in pairs(df.global.world.buildings.all) do
          if building:getType() == 29 and building ~= nil then
          if building ~= nil then
          if f.args.drinks or f.args.food then
          Combineitems(building, f, drinks, 1)
          end
          if f.args.plants or f.args.food then
          Combineitems(building, f, plants, 2)
          end
          if f.args.meat or f.args.food then
          Combineitems(building, f, meats, 3)
          end
          if f.args.fat or f.args.food then
          Combineitems(building, f, fat, 4)
          end
          if f.args.roasts or f.args.food then
          Combineitems(building, f, roasts, 5)
          end
          if f.args.fish or f.args.food then
          Combineitems(building, f, fish, 10)
          end
          else
          print('invalid')
          end
          end
          end
          if f.args.drinks or f.args.food then
          print("found " .. drinks.Tot .. " drinks")
          print("merged " .. drinks.xTot .. " drinks")
          end
          if f.args.plants or f.args.food then
          print("found " .. plants.Tot .. " plants")
          print("merged " .. plants.xTot .. " plants")
          end
          if f.args.meat or f.args.food then
          print("found " .. meats.Tot .. " meat")
          print("merged " .. meats.xTot .. " meat")
          end
          if f.args.fat or f.args.food then
          print("found " .. fat.Tot .. " fat or tallow")
          print("merged " .. fat.xTot .. " fat or tallow")
          end
          if f.args.roasts or f.args.food then
          print("found " .. roasts.Tot .. " prepared food")
          print("merged " .. roasts.xTot .. " prepared food")
          end
          if f.args.fish or f.args.food then
          print("found " .. fish.Tot .. " fish")
          print("merged " .. fish.xTot .. " fish")
          end
          end
          return
          end


          IP属地:加拿大7楼2023-03-02 05:48
          收起回复
            目前版本是最新的 50.08版
            经过观察测试,发现了偶尔会有一次做出25单位酒的桶。和肉盔菇的叠加数量有关,肉盔菇是一个单位的,就只能做5个酒。肉盔菇是5单位叠加的一次拿到酿造厂就一次生产25单位的。但不管是5单位还是25单位,放一个桶里这桶就满了,必须要矮人喝完才能继续用。

            5单位蘑菇就是25单位酒。一次性装满桶!!


            IP属地:河南8楼2023-03-02 08:58
            收起回复
              应该是这样,由于所有食物在装桶前有保质期,所以每个或每束作物、鱼这些都有是单独内存地址。所以就没法合并了。


              IP属地:河南来自Android客户端9楼2023-03-04 16:16
              回复