Construction Planner Continued

by azaghal

Ghosts require player's approval before construction bots are dispatched. This gives the player improved control over what parts of the factory get built, and when.

Utilities
7 hours ago
1.1 - 2.0
2.56K
Logistic network Blueprints

b Ghosts created by mods like P.U.M.P. skip the approval process

1 year, 8 months ago

I used P.U.M.P. to create oil pumps and the ghosts were created, but they were immediately built without any approval process.

1 year, 8 months ago
(updated 1 year, 8 months ago)

As of today, version 1.1.5 of P.U.M.P. raises an event when it places ghosts. It seems construction planner is not listening to that event.
https://lua-api.factorio.com/latest/events.html#script_raised_built

1 year, 8 months ago

Hm... I will try to look into this issue, but the solution could end-up being a bit more complicated than just processing the listed event, since most of the mod logic was written with the assumption that it is the player who places the ghost - and Construction Planner certainly abuses the modding API in some rather unconventional ways :)

4 months ago

I have started looking into this once again, and maybe it will not be much of an issue after all. I am in fact not sure why I thought it would be previously - maybe I simply didn't look closely enough into it. I think it was related to handling of undo logic, but then again there is normally no undo possibility for script-created entities anyway, so who knows...

As a quick hack, just pulling out the existing event handler to be applied against script_raised_built seems to work fine, with small caveat that I need to figure out what player invoked the action (since auto-approval setting is per-player). With P.U.M.P. it looks to be a non-issue - I seem to be able to rely on the last_user property of an entity.

But I'll need to figure out what kind of logic to use for picking the player for ghost entities where last_user is not set. Maybe the safest bet there would be to simply auto-approve.

New response