[2.0.72] can_satisfy_request ignore count

User avatar
Stargateur
Filter Inserter
Filter Inserter
Posts: 401
Joined: Sat Oct 05, 2019 6:17 am
Contact:

[2.0.72] can_satisfy_request ignore count

Post by Stargateur »

https://lua-api.factorio.com/latest/cla ... fy_request look like to ignore count. the following code:

Code: Select all

local n = aqu.get_used_item_by_network(network, module.name, quality.name) + 1
if network.can_satisfy_request({ name = module.name, quality = quality }, n, true) then
if n > 100 then
  log(n)
  log(module.name .. quality.name)
end
106.193 Script @__AutoQualityUpgrades__/control.lua:207: 101
106.193 Script @__AutoQualityUpgrades__/control.lua:208: productivity-module-3uncommon
106.194 Script @__AutoQualityUpgrades__/control.lua:207: 102
106.194 Script @__AutoQualityUpgrades__/control.lua:208: productivity-module-3uncommon
106.194 Script @__AutoQualityUpgrades__/control.lua:207: 103
106.194 Script @__AutoQualityUpgrades__/control.lua:208: productivity-module-3uncommon
106.194 Script @__AutoQualityUpgrades__/control.lua:207: 104
for only one module available with this quality n would be far superior to 100 and can_satisfy_request still return true somehow

Edit: replaced with `if network.get_item_count({ name = module.name, quality = quality }) > n then` work as expect, I will see if I can give a MRE later I need to go.
Last edited by Stargateur on Wed Jan 07, 2026 6:11 pm, edited 2 times in total.
Rseding91
Factorio Staff
Factorio Staff
Posts: 16586
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: can_satisfy_request ignore count

Post by Rseding91 »

Thanks for the report however I am unable to reproduce any such issue when I test and you haven't provided any save file or test mod to show what issue you're running into.
If you want to get ahold of me I'm almost always on Discord.
User avatar
Stargateur
Filter Inserter
Filter Inserter
Posts: 401
Joined: Sat Oct 05, 2019 6:17 am
Contact:

Re: [2.0.72] can_satisfy_request ignore count

Post by Stargateur »

I have trouble to produce a MRE, it's look like it's happen when item count return negative number.

Code: Select all

 106.679 Script @__AutoQualityUpgrades__/control.lua:208: item_count = -6
 106.679 Script @__AutoQualityUpgrades__/control.lua:209: n = 101
 106.679 Script @__AutoQualityUpgrades__/control.lua:210: productivity-module-3
 106.679 Script @__AutoQualityUpgrades__/control.lua:211: "[LuaQualityPrototype: uncommon (quality)]"

Code: Select all

local n = aqu.get_used_item_by_network(network, module.name, quality.name) + 1
if network.can_satisfy_request({ name = module.name, quality = quality }, n, true) then
  if n > 100 then
    log("item_count = " .. network.get_item_count({ name = module.name, quality = quality }))
    log("n = " .. n)
    log(module.name)
    log(serpent.block(quality))
  end
Or I don't understand `can_satisfy_request` I ask can you satisfy 101 item of this quality it's answer true even when item count say network have -6
Attachments
Enemy 2.zip
(16.11 MiB) Downloaded 25 times
User avatar
Stargateur
Filter Inserter
Filter Inserter
Posts: 401
Joined: Sat Oct 05, 2019 6:17 am
Contact:

Re: can_satisfy_request ignore count

Post by Stargateur »

Rseding91 wrote: Wed Jan 07, 2026 5:44 pm Thanks for the report however I am unable to reproduce any such issue when I test and you haven't provided any save file or test mod to show what issue you're running into.
Do you need more info ? I will use get_item_count for now, even if I guess it's cost more UPS cause it will count every item in the network.
Rseding91
Factorio Staff
Factorio Staff
Posts: 16586
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.0.72] can_satisfy_request ignore count

Post by Rseding91 »

Ah that would do it. I'll fix it for 2.1.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Fixed for 2.1”