[0.10.6][kovarex] game.canplaceentity+item-on-ground fails

This subforum contains all the issues which we already resolved.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14311
Joined: Wed Jun 11, 2014 5:23 am
Contact:

[0.10.6][kovarex] game.canplaceentity+item-on-ground fails

Post by Rseding91 »

I'm not sure if this is expected or not but game.canplaceentity() always returns false when trying to check "item-on-ground".

Running this from the in-game console will always return false:

Code: Select all

game.player.print(tostring(game.canplaceentity({name = "item-on-ground", position = {game.player.position.x + 1, game.player.position.y}})))
It's simply checking if it can place an "item-on-ground" entity 1 tile to the right of the player.
If you want to get ahold of me I'm almost always on Discord.
kovarex
Factorio Staff
Factorio Staff
Posts: 8207
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.10.6][kovarex] game.canplaceentity+item-on-ground fai

Post by kovarex »

You are right.

The problem is, that the game internally creates the object and test if it can be placed (as well as testing the special condition, like resources for mining drill, water for offshore pump etc.).
For the item-on-ground it needs to have additional parameter to know what kind of stack it should create.
It doesn't matter what kind of stack you put there now, but who knows, maybe it can change in the future.

The command is like this then, but note that it will only work in version 0.10.7+

Code: Select all

game.player.print(tostring(game.canplaceentity({name = "item-on-ground", position = {game.player.position.x + 1, game.player.position.y}, stack={name= "iron-plate"}})))
So it is solved for 0.10.7
Post Reply

Return to “Resolved Problems and Bugs”