LuaEntity.remove_control_behaviour
- protocol_1903
- Filter Inserter

- Posts: 420
- Joined: Fri Sep 09, 2022 4:33 pm
- Contact:
LuaEntity.remove_control_behaviour
A way to remove the control behavior of entities
Py and PyBlock developer, wielder of LUA in arbitrary ways. I make mods. Check them out, maybe.
https://mods.factorio.com/user/protocol_1903
https://mods.factorio.com/user/protocol_1903
Re: LuaEntity.remove_control_behaviour
I would prefer to not have this because it would have huge sideeffects: removing all circuit wires (if there are any), clearing all settings to defaults and in some cases it may even remove items (assembler's dump inventory is part of assembler behavior). That being said, there are at least 2 cases when behavior is removed right now: 1/ when removing last gate next to a wall, behavior on a wall is deleted, and 2/ when copying settings from other entity of the same type when source has no behavior and target has no wires; so if it was decided to be added regardless of sideeffects, it is doable.
- protocol_1903
- Filter Inserter

- Posts: 420
- Joined: Fri Sep 09, 2022 4:33 pm
- Contact:
Re: LuaEntity.remove_control_behaviour
Yes, i believe it should be reasonable as long as those side effects mentioned are documented. They also wouldn't be particularly difficult to work around.
Py and PyBlock developer, wielder of LUA in arbitrary ways. I make mods. Check them out, maybe.
https://mods.factorio.com/user/protocol_1903
https://mods.factorio.com/user/protocol_1903
Re: LuaEntity.remove_control_behaviour
I am curious, why exactly do you need to remove a control behavior? There should be no reason to create a control behavior in the first place if you are not trying to add a wire or to set a setting. There is a significant difference between "get_control_behavior" and "get_or_create_control_behavior" and they should not be mixed up.
- protocol_1903
- Filter Inserter

- Posts: 420
- Joined: Fri Sep 09, 2022 4:33 pm
- Contact:
Re: LuaEntity.remove_control_behaviour
viewtopic.php?p=686155
The exact topic you were just on. For removing control behavior if it isn't used. But yes, I will be attempting to not create control behavior if required, just need to update the mod.
Explanation: I create control behavior on entities when they're connected to circuit wires (assuming other conditions exist) but in reality basically every entity that's connected to circuit wires will have it created. I reset the control behaviors back to default if they are disconnected, but the control behavior still exists and I'd rather not have to replace the entity every single time just to clear control behavior.
The exact topic you were just on. For removing control behavior if it isn't used. But yes, I will be attempting to not create control behavior if required, just need to update the mod.
Explanation: I create control behavior on entities when they're connected to circuit wires (assuming other conditions exist) but in reality basically every entity that's connected to circuit wires will have it created. I reset the control behaviors back to default if they are disconnected, but the control behavior still exists and I'd rather not have to replace the entity every single time just to clear control behavior.
Py and PyBlock developer, wielder of LUA in arbitrary ways. I make mods. Check them out, maybe.
https://mods.factorio.com/user/protocol_1903
https://mods.factorio.com/user/protocol_1903
