Utilization Monitor

by suan2

Displays utilization of factories, miners, labs and furnaces.

4 years ago
0.15 - 0.18
16

b Incompatibility with "Dark Matter Replicators" mod.

6 years ago

I receive the following error when placing a Dark Matter replicator with the Utilization Monitor mod enabled:

35.884 Error MainLoop.cpp:864: Exception at tick 6559201: Error while running event UtilizationMonitor::on_tick (ID 0)
Index out of inventory bounds.
stack traceback:
UtilizationMonitor/control.lua:59: in function 'is_working'
UtilizationMonitor/control.lua:72: in function 'update_entity'
UtilizationMonitor/control.lua:135: in function <UtilizationMonitor/control.lua:124>

I assume that Utilization Monitor is expecting something from the replicator that it isn't getting, and is just choking on it instead of handling the error gracefully. It's a hard crash, too - locks the game up until I force a close.

For the record, I've submitted this to the Dark Matter Replicators mod thread as well - on their end, they should probably be providing whatever is being given by the rest of my mods, but it seems like the lack of error handling is a bug on this end as well. :)

Thanks!

6 years ago

Just as an addition, I got a reply from the Dark Matter Replicators mod author:

Your error message shows that the Utilization Monitor crashes on line 59 of control.lua. I downloaded the Utilization Monitor mod and glanced over its code and it seems to be that the problem is that Utilization Monitor assumes that every lab has exactly seven input slots. Because the replication lab has four slots, there is a crash when you place such a lab down and Utilization Monitor tries to access the nonexistent slot #5.

I can't fix this bug my changing my mod. However, if you open up Utilization Monitor's control.lua file then you can replace lines 58 and 59

for i = 1, 7 do
  local item = inventory[i]

with the line

for i,item in ipairs(inventory) do

which should in theory allow Utilization Monitor to work with labs of any inventory size.

I've tested the patch, and it DOES allow me to run UM with DMR - but seems to break actual monitoring of lab usage. Better than crashing, of course. :D

6 years ago

Thanks for reporting this issue. I try to fix this today.
p.s. is there a way to get notifications for new discussion threads and messages? i just happened to browse through my mod

6 years ago

Uploaded the 0.2.1 update. Let me know if it still crashes.

6 years ago
(updated 6 years ago)

Yup. No crashing, and labs are showing usage now. Thanks!

Edit: Also, no clue on the notifications thing. Might be a feature request that needs to be made. :/

New response