P2P-Automation : Platform to Platform Logistics

by SirPuck

Automated logistic requests from Platfrom to Platfrom in the same orbit (space location) using vanilla mechanics.

Content
10 days ago
2.0
1.56K
Logistics Logistic network

b [FIXED] Bug with requesting from any within range

12 days ago

Seems to be an issue where a platform that is requesting from any platforms in range can get stuck requesting from a platform that has the item in question, but that platform also has a request for the same item for any platform within range with the "Allow other global requests" option set to "no". This results it simply no items being sent at all

For example In the usual situation I'm running into, Platform A is a stationary platform with a large stockpile of fuel. Platform B and C are mobile and have a request for 20 fuel from any Platform within range with a threshold of 100 with the option set to no. B and C should be keeping a buffer of between 20 and 70 fuel cells with this arrangement, always being supplied a stack from A when they drop below and reach A's orbit. Only Platform C is moving back and forth between planets and Platform B is parked in the same orbit as Platform A.

What often will happen is C will simply be unable to receive any fuel from A and eventually run out so long as B is parked in the same orbit as A, or has its any within range request set, regardless of the threshold or global demand setting, seemingly stuck trying to request fuel from B. Deleting the request from B will immediately allow C to receive fuel from A.

12 days ago
(updated 12 days ago)

Ah, I think I found the issue. Line 50 in control.lua is breaking the entire for loop if the option is set to no as soon as it evaluates the request on platform B, which depending on what order A and B are in the list can prevent the script from ever iterating over platform A as a valid candidate for fulfilling the request.

12 days ago
(updated 12 days ago)

Ah, I think I found the issue. Line 50 in control.lua is breaking the entire for loop if the option is set to no as soon as it evaluates platform B when considering providers to fulfill platform C's request. Depending on what order A and B are in the list this can prevent the script from ever iterating over platform A as a valid candidate for fulfilling the request, so it simply doesnt get filled.

12 days ago
(updated 12 days ago)

Changing line 50 to 52 from:

  if global_request_conflict(_request.provider.unit_number, _request) then break end

  logistics.evaluate_request(_request)

to:

  if not global_request_conflict(_request.provider.unit_number, _request) then
        logistics.evaluate_request(_request)
  end

Seems to fix the problem, though not 100% sure if this plays nice with the rest of the code. Will use it in this state for now and see what happens

10 days ago
(updated 10 days ago)

Hello Joe ! Yes it's possible that this check isn't made properly.
The system tries to avoid making infinite loops (when 2 platforms request the same item from one another).

I'll let you tell me if your fix doesn't disturb the rest. P2P Automation is now in maintenance mode, there won't be any new feature, and I will only fix critical bugs. A new major version of this mod is on its way and should solve most issues P2P currently has.

10 days ago

Seems to be working as expected now with the above change

10 days ago

This has been integrated in the latest release. Thanks Joe

New response