disabled_by_control_behavior inconsistency?

Farzag
Burner Inserter
Burner Inserter
Posts: 16
Joined: Sat Jan 20, 2018 1:59 am
Contact:

disabled_by_control_behavior inconsistency?

Post by Farzag »

I am looking at a requester chest that has been disabled by a circuit condition, and I can tell that this is the case by checking whether chest.status == defines.entity_status.disabled_by_control_behavior. For the same chest, chest.disabled_by_control_behavior == false though, which seems inconsistent.

The docs say that the disabled_by_control_behavior field "Can only be used if this is UpdatableEntity", so maybe that is why? What is an UpdatableEntity?

Reference: https://lua-api.factorio.com/latest/cla ... l_behavior
Farzag
Burner Inserter
Burner Inserter
Posts: 16
Joined: Sat Jan 20, 2018 1:59 am
Contact:

Re: [2.0.69][Modding] disabled_by_control_behavior inconsistency?

Post by Farzag »

Why was this moved from bugs reports to modding help?

I think it’s a bug. If it’s not a bug, why does the behavior appear to be inconsistent?
Rseding91
Factorio Staff
Factorio Staff
Posts: 16190
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.0.69][Modding] disabled_by_control_behavior inconsistency?

Post by Rseding91 »

The docs explain exactly why it works how it does except you don’t know what an UpdatableEntity is, so I moved it here for people to explain that modding concept.
If you want to get ahold of me I'm almost always on Discord.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 4248
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: disabled_by_control_behavior inconsistency?

Post by boskid »

In short terms, an UpdatableEntity is an entity which returns `true` when reading LuaEntity::is_updatable.

LuaEntity::disabled_by_control_behavior is part of a bundle of reads (and one write) around UpdatableEntities so mods can query what is the exact reason that caused given updatable entity to not be active since there are 5 possible sources that force such entities to be inactive: disabling by script, disabling by behavior, being frozen, having an unresearched recipe set (used only by assemblers) or being marked to be deconstructed (some entities may opt out of this bit).

Since logistic containers are not updatable, reads of LuaEntity::disabled_by_control_behavior on them are meaningless.
Farzag
Burner Inserter
Burner Inserter
Posts: 16
Joined: Sat Jan 20, 2018 1:59 am
Contact:

Re: disabled_by_control_behavior inconsistency?

Post by Farzag »

an UpdatableEntity is an entity which returns `true` when reading LuaEntity::is_updatable.
Thank you. It might be worth adding that to the docs, for example here: https://lua-api.factorio.com/latest/cla ... _updatable, since the term is used elsewhere in the docs.
Bilka
Factorio Staff
Factorio Staff
Posts: 3665
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: disabled_by_control_behavior inconsistency?

Post by Bilka »

I've updated the docs to be clearer for the next doc release.
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 “Resolved Requests”