P.U.M.P.

by Xcone

P.U.M.P. (Prevent Unwanted Manual Pump-placement) adds a selection-tool with which you can select oil wells, and then plans the layout of pumpjacks and pipes for you.

Utilities
a month ago
0.18 - 2.0
70.7K
Mining Fluids Blueprints

b Confirm input control (E) does not trigger ghost placement

5 months ago
(updated 5 months ago)

Hello Xcone,

While looking into adding support for script-raised build events (in the Construction Approvals - formerly known as Construction Planner Continued mod) to improve integration with this mod, I think I have run into a small bug around the handling of keyboard shortcuts.

If I use the P.U.M.P. tool to select an oil patch and then click on the "Confirm" button, the tool will plan out the build using ghosts.

But, if I used the P.U.M.P. tool to select an oil patch and then confirm via keyboard shortcut (E), nothing happens - the although the GUI itself does get closed.

Probably just a missing function invocation somewhere for that one. :)

This is on Factorio 2.0.42 with mod version 2.1.8.

Best regards,
Branko

P.S.
Not a mod user currently, but... I might end up adding this one soon - laying out pipes is fun only once or twice :D

5 months ago

Thank you for me making me aware of this.

I thought it'd be an easy fix, but it seems its not trivial to actually distinguish the manner in which the dialog is closed. The on_gui_closed doesn't specifiy what kind of closure it is. Since the P.U.M.P. dialog is cancellable, I have no way to know if the dialog was closed by pressing ESC or E, and therefor no way to know if to proceed placing ghosts based on that event alone.

I then looked if I could read current keybindings, and just listen to a key-press of the same key attached to 'Confirm window'; but there seems to be no way to go this approach.

I might go the route of always proceeding on gui_close, and make the exception only when the button is clicked directly...
But surely that's some way of distinguishing the shortcut action? Do you know of a way? Or perhaps of a mod that also does it and is open source?

5 months ago

And yes "laying out pipes is fun only once or twice" is exactly what triggered me to make this mod in the first place. :D

5 months ago

Hm... I think you just need to plug in into the on_gui_confirmed event. Not sure how complex it might be, but from a mod I adopted, maybe have a look at this?

But... Maybe you have something more complicated there. :)

Best regards,
Branko

5 months ago
(updated 5 months ago)

Thank you for the links. Much appreciated :-)

I've tried on_gui_confirmed too, but that event never gets raised for me.
According to docs, it seems to be used for confirming other inputs, like a text field, by pressing ENTER; its not entirely clear for me if that should or shouldn't include the confirm window key. Since I don't have inputs, and the event is not responding, it suggests it doesn't?

I've tried to run your mod to try and confirm if it does work for you due to text fields or similar. But all the buttons remained disabled? Placing a car, entering a car and placing stone tiles didnt make a difference. I suppose there's other requirements before it starts working that aren't immediately obvious to me. I was on fulgora with only a small stone patch. Perhaps it needs a more elaborate road system? I'll try that later when I have more time. :-)

The keybinds you're pointing me to, are custom ones. I suppose I could map 'E' myself, but if a player then rebinds 'Confirm window' to another key, I am assuming that won't update my keybind? Not ideal, but I suppose another alternative to explore.

I'll try some more things at a later time. Thanks for the help so far.

5 months ago

Asked around on discord and got a very helpful reply from https://github.com/Wiwiweb
By using 'linked_game_control' with a custom input, a mod can hook into the game's regular bindings.

I just uploaded v2.1.9 where ESC still cancels, en E now continues planning in addition to closing the menu.

Thanks again for the suggestion. It's a nice improvement. 👍

5 months ago

Hey, thank you for implementing it in the mod :)

Best regards,
Branko

New response