Page 1 of 1

[Rseding91] can_place_entity{} bugs

Posted: Thu Nov 03, 2016 6:05 pm
by Mylon
I hope modding/API bugs go here.

I've run into a weird problem trying to build a mod. Here's the code I'm using:

Code: Select all

if roboport.surface.can_place_entity{name="tile-ghost", position={roboport.position.x + xx, roboport.position.y + yy}, inner_name="concrete", force=roboport.force} then
roboport.surface.create_entity{name="tile-ghost", position={roboport.position.x + xx, roboport.position.y + yy}, inner_name="concrete", force=roboport.force}
And here is what it looks like in execution:

Image

The check is being made based on the 2x2 placement tool for concrete so the check is failing on every other xx/yy in my loop. Additionally, it's being returned as true on the water, which should not happen.

As a side note, I also discovered this test to be very CPU intensive as running it a few thousand times per second really slows down the game. Shouldn't be a big deal as it won't run nearly this often outside of my testing but just a random remark.

Re: can_place_entity{} bugs

Posted: Fri Nov 04, 2016 9:58 am
by kovarex
Do you know that you can build concrete or any terrain also in 1X1 square or bigger than 2X2 by changing the size by pressing the keypad + and keypad - keys? (Can be configured in control settings).

In other words, concrete tile size is 1X1 not 2X2.

Re: can_place_entity{} bugs

Posted: Fri Nov 04, 2016 2:36 pm
by Mylon
So can_place_entity{} returning true on water is not a bug?

Re: can_place_entity{} bugs

Posted: Fri Nov 04, 2016 3:23 pm
by kovarex
Mylon wrote:So can_place_entity{} returning true on water is not a bug?
That seems like a bug.

Re: [Rseding91] can_place_entity{} bugs

Posted: Sun Nov 06, 2016 8:44 pm
by Rseding91
Fixed the buildability checks for the next version of 0.14.