diff -u -r "Inventory Sensor_1.7.3/changelog.txt" "Inventory Sensor_1.7.4/changelog.txt" --- "Inventory Sensor_1.7.3/changelog.txt" 2019-04-15 18:48:12.000000000 +0200 +++ "Inventory Sensor_1.7.4/changelog.txt" 2019-07-25 11:02:12.278789919 +0200 @@ -1,4 +1,9 @@ --------------------------------------------------------------------------------------------------- +Version: 1.7.4 +Date: 2019-07-25 + Features: + - read inventory stack size if this is supported (wagons only) +--------------------------------------------------------------------------------------------------- Version: 1.7.3 Date: 2019-04-15 Features: diff -u -r "Inventory Sensor_1.7.3/control.lua" "Inventory Sensor_1.7.4/control.lua" --- "Inventory Sensor_1.7.3/control.lua" 2019-07-25 10:33:13.453732723 +0200 +++ "Inventory Sensor_1.7.4/control.lua" 2019-07-25 10:58:25.362519650 +0200 @@ -47,6 +47,7 @@ local signal_progress = {type = "virtual",name = "inv-sensor-progress"} local signal_temperature = {type = "virtual",name = "inv-sensor-temperature"} local signal_fuel = {type = "virtual",name = "inv-sensor-fuel"} +local signal_stack_size = {type = "virtual",name = "inv-sensor-stack-size-signal"} local floor = math.floor local ceil = math.ceil @@ -377,12 +378,19 @@ end end + local stack_size_combined = 0 + -- get items in all inventories for inv_index, inv in pairs(itemSensor.Inventory) do - local contentsTable = inv.get_contents() - log('---') - log(inv.getbar()) - log('---') + local contentsTable = inv.get_contents() + + -- Hotbar is this fancy red cross in practically every + -- inventory. getbar() returns its position, so we need to substract 1 + -- from it to return maximum wagon stack size from it + if inv.hasbar() then + stack_size_combined = stack_size_combined + inv.getbar() - 1 + end + for k,v in pairs(contentsTable) do signals[signalIndex] = { index = signalIndex, signal = {type = "item",name = k}, count = v } signalIndex = signalIndex+1 @@ -392,6 +400,12 @@ end end end + + -- Set inventory stack size signal + if stack_size_combined > 0 then + signals[signalIndex] = { index = signalIndex, signal = signal_stack_size, count = stack_size_combined} + signalIndex = signalIndex+1 + end -- get remaining fuel from burner if burner then diff -u -r "Inventory Sensor_1.7.3/info.json" "Inventory Sensor_1.7.4/info.json" --- "Inventory Sensor_1.7.3/info.json" 2019-04-15 18:40:18.000000000 +0200 +++ "Inventory Sensor_1.7.4/info.json" 2019-07-25 11:02:28.626805465 +0200 @@ -1,6 +1,6 @@ { "name": "Inventory Sensor", - "version": "1.7.3", + "version": "1.7.4", "title": "Inventory Sensor", "author": "Optera", "contact": "https://forums.factorio.com/memberlist.php?mode=viewprofile&u=21729", Only in Inventory Sensor_1.7.4: inventory_sensor_stack_size_feature.patch diff -u -r "Inventory Sensor_1.7.3/locale/de/de.cfg" "Inventory Sensor_1.7.4/locale/de/de.cfg" --- "Inventory Sensor_1.7.3/locale/de/de.cfg" 2019-02-14 11:29:04.000000000 +0100 +++ "Inventory Sensor_1.7.4/locale/de/de.cfg" 2019-07-25 10:49:24.553163903 +0200 @@ -15,3 +15,4 @@ inv-sensor-temperature=Temperatur inv-sensor-progress=Fortschritt inv-sensor-fuel=Brennstoff (MJ) +inv-sensor-stack-size-signal=Stapelgrösse \ No newline at end of file diff -u -r "Inventory Sensor_1.7.3/locale/en/en.cfg" "Inventory Sensor_1.7.4/locale/en/en.cfg" --- "Inventory Sensor_1.7.3/locale/en/en.cfg" 2019-02-14 11:28:36.000000000 +0100 +++ "Inventory Sensor_1.7.4/locale/en/en.cfg" 2019-07-25 10:48:25.536893838 +0200 @@ -15,6 +15,7 @@ inv-sensor-temperature=Temperature inv-sensor-progress=Crafting Progress inv-sensor-fuel=Remaining fuel (MJ) +inv-sensor-stack-size-signal=Stack size signal [mod-setting-name] inv_sensor_update_interval=Inventory update interval (ticks) diff -u -r "Inventory Sensor_1.7.3/migrations/1.4.6.json" "Inventory Sensor_1.7.4/migrations/1.4.6.json" --- "Inventory Sensor_1.7.3/migrations/1.4.6.json" 2017-06-02 11:21:12.000000000 +0200 +++ "Inventory Sensor_1.7.4/migrations/1.4.6.json" 2019-07-25 10:53:23.973932347 +0200 @@ -4,6 +4,7 @@ ["detected-car", "inv-sensor-detected-car"], ["detected-tank", "inv-sensor-detected-tank"], ["detected-wagon", "inv-sensor-detected-wagon"], - ["detected-locomotive", "inv-sensor-detected-locomotive"] + ["detected-locomotive", "inv-sensor-detected-locomotive"], + ["stack-size-signal", "inv-sensor-stack-size-signal"] ] -} \ No newline at end of file +} diff -u -r "Inventory Sensor_1.7.3/prototypes/signal.lua" "Inventory Sensor_1.7.4/prototypes/signal.lua" --- "Inventory Sensor_1.7.3/prototypes/signal.lua" 2019-02-14 11:51:28.000000000 +0100 +++ "Inventory Sensor_1.7.4/prototypes/signal.lua" 2019-07-25 10:46:16.795978867 +0200 @@ -69,5 +69,15 @@ }, subgroup = "sensor-signals", order = "x[sensor-signals]-dc" - } -}) \ No newline at end of file + }, +{ + type = "virtual-signal", + name = "inv-sensor-stack-size-signal", + icons = { + { icon = "__base__/graphics/icons/signal/signal_green.png", icon_size = 32 }, + { icon = "__base__/graphics/icons/steel-chest.png", icon_size = 32, scale = 0.75 }, + }, + subgroup = "sensor-signals", + order = "x[sensor-signals]-dc" + } +})