Construction Planner


Ghosts must now be 'approved' by the player before construction bots will be dispatched. This gives the player improved control over what parts of the factory get built, and when.

Utilities
a month ago
1.1 - 2.0
2.26K
Blueprints

b Tapeline tool approves unapproved ghosts

2 years ago

Hello,

First of all - thanks for the amazing mod you created, I think it's immensely useful when dealing with some late-game bases - and even early-ones if any kind of construction drones/companions/early game robot mods are installed :)

I have ran into a bit of a weird interaction between the Tapeline mod and Construction Planner.

Reproduction steps:

  1. Install Tapeline mod (2.0.7) alongside Construction Planner (1.0.5).
  2. Disable auto-approval of ghost entities.
  3. Place some ghost entities.
  4. Verify that ghost entities are unapproved.
  5. Pick-up the Tapeline tool.
  6. Draw a tapeline over the unapproved ghost entities.
  7. Verify that ghost entities are still unapproved.

Expected results:

  • (4) Ghost entities are unapproved.
  • (7) Ghost entities are still unapproved.

Actual results:

  • (4) Ghost entities are unapproved.
  • (7) Ghost entities are approved. [FAIL]

Additional notes:

I have been digging through the code of both mods to fix a somewhat related issue where some "phantom" ghost entities would end-up being placed when auto-approval is off, and a permanent tapeline is being placed down (using the shift+drag). This boiled down to the Tapeline mod not emitting the script_raised_revive event when it revives the ghost for dummy Tapeline entity. I submitted a patch for that one to Tapeline mod author to simply enable sending of that event - which is then handled correctly via Construction Planner's script_raised_revive handler.

Where this particular problem gets triggered is in Construction Planner's on_pre_build event handler. When the Tapeline revives a ghost entity, I think it triggers the on_pre_build event. Unfortunately, that event does not provide a whole lot of information about what is going to get built, so Construction Planner can only really proceed with its logic, and approve whatever has been below Tapeline's dummy entity.

Not sure what the fix for this would be, or if it can even be done on Construction Planner's side. But I'm open to suggestions and troubleshooting requests.

Best regards,
Branko

2 years ago

Well, after dabbling around a bit more in some other mods, I got back around to trying to fix this particular issue :)

I have opened-up the pull request here:

All feedback is welcome, so please do let me know if I could somehow improve the PR code, I'd be willing to try to look into it :)

New response