Can_place_entity Question/issue?

Place to get help with not working mods / modding interface.
Post Reply
blavek
Inserter
Inserter
Posts: 20
Joined: Mon Jul 04, 2016 4:47 am
Contact:

Can_place_entity Question/issue?

Post 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.

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Can_place_entity Question/issue?

Post 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,
}

blavek
Inserter
Inserter
Posts: 20
Joined: Mon Jul 04, 2016 4:47 am
Contact:

Re: Can_place_entity Question/issue?

Post by blavek »

Thank you that worked out very nicely.

Post Reply

Return to “Modding help”