Page 1 of 1

[0.12] LuaSurface:can_place_entity always true

Posted: Fri Jul 17, 2015 4:39 pm
by Choumiko
LuaSurface:can_place_entity seems to return always true. Trying to place by hand shows the rail in red, running the command returns true.
mouse.jpg
mouse.jpg (253.66 KiB) Viewed 7208 times
can_place_entity.jpg
can_place_entity.jpg (193.57 KiB) Viewed 7208 times
Command used (hard to see in the picture): /c game.player.print(serpent.dump(game.player.surface.can_place_entity{name="straight-rail", position={x=-203,y=7}}))
When i check with the position of an already placed rail, it's the same, seems to always be true, the good thing is, create_entity returns nil when trying to place a rail over another.

Re: [0.12] LuaSurface:can_place_entity always true

Posted: Fri Jul 17, 2015 4:48 pm
by orzelek
Might break resource spawning in RSO too - it will skip those it can't place but will wrongly think they were placed.

Re: [0.12] LuaSurface:can_place_entity always true

Posted: Fri Jul 17, 2015 5:49 pm
by Rseding91
Does it act this way with other buildable entities or just rail?

Rail are special in that you can build them over each other when rotated so that may be the issue here.

Re: [0.12] LuaSurface:can_place_entity always true

Posted: Fri Jul 17, 2015 6:16 pm
by orzelek
I didn't investigate further - it looks like it's working for RSO to check for ore and biters spawning. I didn't try to verify it in controlled way tho.

Re: [0.12] LuaSurface:can_place_entity always true

Posted: Fri Jul 17, 2015 7:52 pm
by Choumiko
Rseding91 wrote:Does it act this way with other buildable entities or just rail?

Rail are special in that you can build them over each other when rotated so that may be the issue here.
Seems to be only rails, tried it with a wooden-chest, with correct results.
As a side note: it also returns true when the position is over water, again only with rails.

Re: [0.12] LuaSurface:can_place_entity always true

Posted: Sat Jul 18, 2015 3:59 am
by Rseding91
Thanks for the report. This is now fixed for 0.12.1.

Re: [0.12] LuaSurface:can_place_entity always true

Posted: Sat Jul 18, 2015 7:36 am
by Choumiko
That was quick, thank you