Inventory Sensor

by Optera

Adds a combinator that reads inventories, fuel and equipment grid of locomotives, wagons, cars, furnaces, assemblers, roboports, rocket silos and reactors.

Content
5 months ago
0.14 - 2.0
34.3K
Circuit network

i Crafting speed

2 months ago
(updated 2 months ago)

Just wondering, since this is one of the few combinator type mods that attach to assembling machines, I was hoping to maybe be able to read the current actual crafting speed of the machine (which includes all beacons, modules, quality, etc...). It IS a little bit outside the purview of inventory sensor, but since the mod already does crafting completion %, it's not a totally crazy idea. This feature used to exist in the Crafting Combinator mod, which is now effectively dead since most of the functionality is in the base game. But sadly ability to read the true craft speed is not possible.

I suspect it would be fairly easy to add? The value is just a property on the attached assembler, multiplied by 100 to allow for representing the fractional speed values, some machines have say 1.25 speed.
https://github.com/loneguardian/CraftingCombinator/blob/64abfb57c4225ac0102c3b578434895110ec088b/crafting_combinator_xeraph/script/cc.lua#L476
Seems like it would be straightforward to add to Inventory Sensor's UpdateSensor function, and there's even a new in 2.0 virtual signal named 'signal-speed' with a little tachometer icon.
https://github.com/hgschmie/factorio-0ptera-Inventory-Sensor/blob/master/control.lua#L414

I'd take a crack at making a PR but I'm not sure I understand what's going on with the add_filter function.

2 months ago

Turned out to be fairly simple, for using the builtin signal-speed I just added the signal filter:

---@type SignalFilter
local signal_speed = {type = "virtual",name = "signal-speed", quality='normal'}

And then added this snippet to the assembly machine and silo:

local speed = connectedEntity.crafting_speed
if speed then
add_filter({value = signal_speed, min = floor(speed*100)})
end

Unfortunately labs are much harder as their entity doesn't provide researching_speed in the same way. And the values I could get from speed_bonus didn't make sense to me, and you'd have to get the researching_speed from the underlying prototype as well. So I couldn't get that working.

New response