Page 1 of 1

Can_place_entity Question/issue?

Posted: Sat Jan 26, 2019 11:29 pm
by blavek
I am making a mod to place some miner ghosts on ore fields. First I order the deconstruction of trees/rocks on the ore field and then I start placing ghosts.

game.surfaces[1].can_place_entity seems to return false when the item is a ghost and the place it is trying to put the ghost has a tree in it. In the game we can place ghosts over things which have been ordered for deconstruction.

My question is, Is there another function or parameter which I cannot find to tell can_place_entity that its ok to put a ghost on something being deconstructed or will I need to check each time can_place_entity is false if deconstruction has been ordered? I'd rather use a built in because it would be fewer things for me to check for like water, a biter nest, or no ore.

Re: Can_place_entity Question/issue?

Posted: Sat Jan 26, 2019 11:55 pm
by DaveMcW

Code: Select all

surface.can_place_entity{
  name = "electric-mining-drill",
  position = my_position,
  force = my_force,
  build_check_type = defines.build_check_type.ghost_place,
  forced = true,
}

Re: Can_place_entity Question/issue?

Posted: Sun Jan 27, 2019 7:23 pm
by blavek
Thank you that worked out very nicely.