[Rseding91] can_place_entity{} bugs

This subforum contains all the issues which we already resolved.
Post Reply
User avatar
Mylon
Filter Inserter
Filter Inserter
Posts: 513
Joined: Sun Oct 23, 2016 11:42 pm
Contact:

[Rseding91] can_place_entity{} bugs

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

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: can_place_entity{} bugs

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

User avatar
Mylon
Filter Inserter
Filter Inserter
Posts: 513
Joined: Sun Oct 23, 2016 11:42 pm
Contact:

Re: can_place_entity{} bugs

Post by Mylon »

So can_place_entity{} returning true on water is not a bug?

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: can_place_entity{} bugs

Post by kovarex »

Mylon wrote:So can_place_entity{} returning true on water is not a bug?
That seems like a bug.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13201
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [Rseding91] can_place_entity{} bugs

Post by Rseding91 »

Fixed the buildability checks for the next version of 0.14.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Resolved Problems and Bugs”