Page 1 of 1

[0.14.4] [Rseding91] - ghost timer and can_place_entity ghost returns false

Posted: Fri Sep 09, 2016 10:01 am
by Nexela
The ghost timer bars(assumption!) cause can_place_entity to return false when checking a ghost entity.

/c game.player.surface.create_entity{name="entity-ghost", inner_name="transport-belt", position={x=0,y=0}, direction=2, force=game.player.force}
/c game.player.print(tostring(game.player.surface.can_place_entity{name="entity-ghost", inner_name="transport-belt", position={x=0,y=1}, direction=2, force=game.player.force})) --returns false, I think the timer is the issue


/c game.player.print(tostring(game.player.surface.can_place_entity{name="entity-ghost", inner_name="transport-belt", position={x=0,y=0}, direction=2, force=game.player.force})) --returns false, expected
/c game.player.print(tostring(game.player.surface.can_place_entity{name="transport-belt", position={x=0,y=1}, direction=2, force=game.player.force})) --returns true, expected it is an empty tile
/c game.player.print(tostring(game.player.surface.can_place_entity{name="transport-belt", position={x=0,y=0}, direction=2, force=game.player.force})) --returns true, expected as you should be able to place over a ghost


Also a question. if the answer is no then it is a bug or a feature request :)
Is it possible to create ghosts without the timer? The same way they appear when shift-clicking to place a ghost or placing a blueprint.

Re: [0.14.4] [Rseding91] - ghost timer and can_place_entity ghost returns false

Posted: Mon Sep 12, 2016 3:41 pm
by Rseding91
The issue is you're asking if you can build at exact tile positions and because you already built a ghost at another position and it corrected the position you gave it you're now checking if you can build a ghost belt half way over another ghost belt and it's telling you: no.

If you adjust you can_build checks to the correct center-of-tile then they all pass.

Re: [0.14.4] [Rseding91] - ghost timer and can_place_entity ghost returns false

Posted: Mon Sep 12, 2016 7:07 pm
by Nexela
Thanks for looking into this and for the center of tile check.