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

Place to get help with not working mods / modding interface.
jarcionek
Fast Inserter
Fast Inserter
Posts: 137
Joined: Thu Mar 10, 2016 11:26 am
Contact:

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

Post 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?
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3749
Joined: Tue May 13, 2014 11:06 am
Contact:

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

Post by DaveMcW »

Code: Select all

if item.prototype.place_result then
  -- item is a building
end
jarcionek
Fast Inserter
Fast Inserter
Posts: 137
Joined: Thu Mar 10, 2016 11:26 am
Contact:

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

Post by jarcionek »

Thanks! I just found it :)

There is also place_as_tile_result on LuaItemPrototype.
Post Reply

Return to “Modding help”