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

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

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

Post by Rseding91 » Thu Aug 07, 2014 4:40 pm

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: 7424
Joined: Wed Feb 06, 2013 12:00 am
Contact:

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

Post by kovarex » Fri Aug 08, 2014 7:12 am

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”

Who is online

Users browsing this forum: No registered users