Yemto's Item Count

by Yemto

Shows the total item amount of what you are holding, unless you hold in a blueprint, then it shows how many times you can complete the blueprint.

Utilities
9 days ago
0.16 - 2.0
3.37K

b Crash when selecting blueprint in preview

11 days ago

Hi!

I've encountered a crash when selecting a blueprint in the blueprint library that is still in "preview state":

The mod Yemto's Item Count (0.7.1) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event yemtositemcount::on_player_cursor_stack_changed (ID 37)
BlueprintRecord cannot be read while it is a preview.
stack traceback:
    [C]: in function '__index'
    __yemtositemcount__/control.lua:153: in function <__yemtositemcount__/control.lua:141>

As far as I understand, this happens when a blueprint contains unknown entities (e.g. from a mod that has been removed). The game needs to sync these blueprints, but that doesn't always happen right away, so you may have unsynced or "preview only" blueprints in the library.

I think the fix is to check the LuaRecord.is_preview flag if the player is holding a blueprint/record?

Thank you for creating this mod! :)

9 days ago

Thanks for letting me know, and you were correct in that is_preview fixed the issue. The crash itself happened when adding blueprints from the library into a server, before they're fully uploaded they're in a preview state, which can't read cost_to_build. 

9 days ago

Awesome, thanks for the quick fix. :)

adding blueprints from the library into a server

That's interesting, because it did happen in a multiplayer game, but one that I hosted myself locally (so, no dedicated server). 🤔
Anyway, thanks again!

New response