Page 1 of 1

Allow construction-bots to fast-replace

Posted: Sun Nov 20, 2016 6:47 am
by Mylon
I have written a mod that looks for yellow belts and places red belt ghosts under them. Unfortunately construction bots go the ghost and stay there forever rather than place the red belts!

I would like for construction bots to be able to fast-replace these belts, much in the same way they already can swap bricks and concrete where they lay down the new one and pick up the old one.

In a related note, I would like the ability to call surface.can_place_entity{name="entity-ghost" ...} and have it return true if inner_name matches one of the occupying's entity's fast-replace, this would simplify it by allowing usage of can_place_entity instead of keeping track of where ghosts have been placed.

Re: Allow construction-bots to fast-replace

Posted: Sun Nov 20, 2016 7:45 pm
by ssilk
Hm. Moved from Suggestions to Modding interface requests.

PS: You know this mods:
https://mods.factorio.com/mods/Klonan/upgrade-planner
and
https://mods.factorio.com/mods/NearlyDu ... on-planner

Re: Allow construction-bots to fast-replace

Posted: Mon Nov 21, 2016 3:12 pm
by Mylon
I was able to take the code in my concreep mod and changing just a couple lines turn it into a belt replacer. At the moment I have to deconstruct then place a ghost which is very disruptive.

I'm not quite sure how Klonan's mod works, but it let me know to replace both sides of the underground belt!

Re: Allow construction-bots to fast-replace

Posted: Tue Nov 22, 2016 6:15 am
by Mooncat
Mylon wrote:I was able to take the code in my concreep mod and changing just a couple lines turn it into a belt replacer. At the moment I have to deconstruct then place a ghost which is very disruptive.

I'm not quite sure how Klonan's mod works, but it let me know to replace both sides of the underground belt!
It does the same thing. Just check its code and you will see something interesting. 8-)

Code: Select all

  for k, *beep*_tree in pairs (player.surface.find_entities_filtered({area = area, type = "tree"})) do
    *beep*_tree.order_deconstruction(player.force)
  end
:lol: :lol: :lol: :lol: :lol: :lol: