Page 1 of 1

How to detect if item is a building and can be placed in the world?

Posted: Sat Mar 30, 2019 12:36 am
by jarcionek
There is a handful of useful functions on LuaItemStack like is_tool, is_armor, is_blueprint.

Putting aside the fact that I would have to call them all, there are no checks for capsules or wires.

I could check for type and expect "item" only, but wire is an item.

How can I check if an entity is a building that can be placed by the player in the world?

Re: How to detect if item is a building and can be placed in the world?

Posted: Sat Mar 30, 2019 12:46 am
by DaveMcW

Code: Select all

if item.prototype.place_result then
  -- item is a building
end

Re: How to detect if item is a building and can be placed in the world?

Posted: Sat Mar 30, 2019 12:47 am
by jarcionek
Thanks! I just found it :)

There is also place_as_tile_result on LuaItemPrototype.