[2.0.76] calling get_filter() / get_or_create_control_behavior() on a ghost

Place to post guides, observations, things related to modding that are not mods themselves.
User avatar
hgschmie
Fast Inserter
Fast Inserter
Posts: 186
Joined: Tue Feb 06, 2024 5:18 am
Contact:

[2.0.76] calling get_filter() / get_or_create_control_behavior() on a ghost

Post by hgschmie »

I noticed that you can call e.g. LuaEntity.get+filter() or LuaEntity.get_or_create_control_behavior() on an entity ghost representing an inserter and it returns the information associated with it.

Is that intentional / officially supported or some undocumented behavior that might go away at any moment? The docs are unclear (they don't mention ghosts at all).
Rseding91
Factorio Staff
Factorio Staff
Posts: 16794
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.0.76] calling get_filter() / get_or_create_control_behavior() on a ghost

Post by Rseding91 »

It is intended. Since 2.0 configuring ghosts has been expanded to cover as much of the mod API as we can without crashing.
If you want to get ahold of me I'm almost always on Discord.
Bilka
Factorio Staff
Factorio Staff
Posts: 3739
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: [2.0.76] calling get_filter() / get_or_create_control_behavior() on a ghost

Post by Bilka »

Ghosts are mentioned at the top of the LuaEntity page:
Most functions on LuaEntity also work when the entity is contained in a ghost.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Post Reply

Return to “Modding discussion”