-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
alerts: handle missing material alerts with any storage #13
base: master
Are you sure you want to change the base?
Conversation
This allows using the player inventory, if available. If you have construction robots, you can now automatically build without a roboport and storage chest. This saves searching for the item in the resource bar and clicking it.
@@ -105,10 +105,12 @@ local function handle_items_request(storage, force, entity, item_requests) | |||
local entity_position = entity.position | |||
local nets = entity.surface.find_logistic_networks_by_construction_area(entity_position, force) | |||
local chests = {} | |||
local avail_net |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the order of the found networks deterministic? What happens in the case of overlapping networks? I'm not sure if I'd want to prioritise players over vehicles, for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what would happen with overlapping mobile logistic networks. I suppose it wouldn't much matter if both have an available construction robot.
@@ -153,6 +155,15 @@ local function handle_items_request(storage, force, entity, item_requests) | |||
break | |||
end | |||
end | |||
|
|||
-- if there is still some left, just insert it anywhere in the network |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'd want to check what the network has available and only insert what's necessary, to avoid inserting more items each time the alert is handled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, there is quite a lag with those alerts. Maybe it would be better to track ghosts instead of looking at alerts. Although that wouldn't help with repair packs.
Thanks for this PR, I was thinking about adding this, but I didn't come up with a nice solution for sucking items back into storage in the case of cancelled requests (for example if you were to walk past a bunch of ghosts, outside of roboport coverage, you'll get stuff inserted into your inventory). I'm not sure if it'd be an issue in practise, so I'll have to give your changes a try first. |
Yeah, you'd get items stuck in your inventory if you have fewer available construction bots than missing items and you leave the construction range before all the items/bots are sent out. I don't know how that would work with a Spidertron. In practice, though, this most often triggers when the player puts down a ghost within construction range and the required items are not in the player inventory, but are in the global inventory. It works great. |
This allows using the player inventory, if available. If you have construction robots, you can now automatically build without a roboport and storage chest.
This saves searching for the item in the resource bar and clicking it.