(But then I will need an answer for this: [Implemented request] API for accessing the entity state (enabled/disabled))
Otherwise, please read:
This property always returns false no matter I wire or unwire the entity and set or unset conditions.
I am using this snippet to check whether my inserter entity is working:
Code: Select all
function is_inserter_enabled(inserter)
local control = inserter.get_control_behavior()
-- Does it have control behaviour? (Not connected = no control?)
if control and control.valid then
-- New API from Factorio 0.13.16
if control.disabled == nil then
print_to_all_players("Is control disabled? nil")
else
if control.disabled then
print_to_all_players("Is control disabled? true")
return false
else
print_to_all_players("Is control disabled? false")
return true
end
end
end
-- No control? Because not connected to network?
return true
end
If the entity has not been wired since it was placed, nothing is printed as expected.
But once the entity is wired, "Is control disabled? false" is printed. But I expected "Is control disabled? true" because vanilla inserters are disabled once they are wired without conditions.
Then, no matter I set or unset conditions, as well as unwire or wire again, the same message is printed.
In case you need print_to_all_players:
Code: Select all
function print_to_all_players(message)
for _, player in pairs(game.players) do
player.print(message)
end
end