Smart Display (circuit network signal display on map)

by system

A combinator that displays a signal from the circuit network, with formating options.

6 years ago
0.15 - 0.16
8

g Crash using "on the map" feature when LTN is also running.

6 years ago
(updated 6 years ago)

This crash only seems to happen with the "on the map" feature. I'm guessing because it makes a fake train stop to show up on the map, it conflicts with LTN watching for name changes.

Error while running event SmartDisplayRedux::on_tick (ID 0)
Error while running event LogisticTrainNetwork::on_entity_renamed (ID 57)
LogisticTrainNetwork/control.lua:521: bad argument #1 to 'next' (table expected, got nil)
stack traceback:
SmartDisplayRedux/control.lua:220: in function 'update_display'
SmartDisplayRedux/control.lua:582: in function <SmartDisplayRedux/control.lua:573>

edit More specifically, it happens once the smart display is hooked up to buffer chests to monitor the count (iron in this case), and then "on the map" is ticked, and the value changes. If I enable "on the map" before the circuit network is connected, it does not crash, or even if it's hooked up and an item to monitor is not yet selected. As soon as I selected iron ore, and the value is updated, the crash happens. All hooked up showing 0 it's fine, it's specifically when the value updates, and it goes to rename the fake train stop with the updated ore count that things go bad. I'm using the "bulk rail loader/unloader" mod connected to the network, however I can reproduce the same crash with a vanilla iron chest so that does not appear to be related at all.

So simple repro steps, with LTN (logistic train network) up and running, though perhaps even just installed would do it.

1) Place smart display.
2) Place iron chest.
3) Wire the two together.
4) Enable "on the map" check box.
5) Configure smart display to monitor for an item in the chest.
6) Add at least 1 of monitored item, observe crash on "train stop" rename.

6 years ago

I've been looking in to this bug for a bit here, and found a simple way to fix it.
What I did is I added a check to the LTN mod to check if it's a smart display or not, this made the map marker working for me. I'll make a pull request see if LTN can maybe include this change in any of it's updates in case not I'll put the change here:

on line 764 of control.lua in the LTN zip change the line from:
if event.entity.name == "logistic-train-stop" then

to

if event.entity.type == "train-stop" and event.entity.name ~= "smart-display-mapmark" then

This fixxed the crash for me since it only adds actual train stops to to list, not sure if this has any adverse effects or not, but don't think so since it's not being used as a train stop anyway.

6 years ago
(updated 6 years ago)

Coming back to this, figured out the root cause now, the mod didn't call a custom event telling other mods that a train stop has been added, this caused LTN to not know about the train stop whatsoever so it couldn't find the stop to rename, I fixxed it now and I'll try to get the plugin owner to update the plugin with the fix, I'll provide a download link here wth the updated version for now.

https://drive.google.com/file/d/1nUGhKYTDY0Aoms9osqDfNsF0iI6i5RhO/view?usp=sharing

EDIT: forgot link added it

New response