Is it possible to use a keybind to say, change an entity from one to another?
I effectively want to GET the entity, then replace it with another magically. I know how to read entity data. I don't know how to call a place action.
For reference it will be the same TYPE and it is a quickplace item (pipe-to-ground)
Example:
Bobs mod has multiple types of material. Lets say I want to press CONTROL + R to change to a different material without having the new pipe in my inventory.
Or maybe I want to do weird things like press CONTROL + R and have a pipe turn into a conveyor belt or something. I just want to know how to make the game replace one item with another without the player having to carry the secondary item in their inventory.
[SOLVED]Replace an already built entity?
-
- Long Handed Inserter
- Posts: 96
- Joined: Sun Mar 25, 2018 5:34 am
- Contact:
[SOLVED]Replace an already built entity?
Last edited by Staplergun on Sun Aug 12, 2018 5:53 pm, edited 1 time in total.
- eradicator
- Smart Inserter
- Posts: 5206
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Replace an already built entity?
Code: Select all
LuaSurface.create_entity{name='stuff',fast_replace=true,...}
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
-
- Long Handed Inserter
- Posts: 96
- Joined: Sun Mar 25, 2018 5:34 am
- Contact:
Re: Replace an already built entity?
Much appreciated. I thought I had deleted this post since I found it after a misclick in the API page.