Utilities
10 months ago
2.0
230
Power

b [resolved] Crash when no value is present in the text box

10 months ago

Screenshot of the crash message: https://imgur.com/a/kifExO1

The mod crashes when I backspace to clear the value out of the textbook. I wanted to delete the "1" so I could type "2", but then it seems like the mod tries to do math on nothing, and crashes? A workaround for the user is to type the new value into the text box before deleting the old value, so that there is never nothing in the box.

10 months ago

Screenshot of the crash message: https://imgur.com/a/kifExO1

The mod crashes when I backspace to clear the value out of the text box. I wanted to delete the "1" so I could type "2", but then it seems like the mod tries to do math on nothing, and crashes? A workaround for the user is to type the new value into the text box before deleting the old value, so that there is never nothing in the box.

10 months ago

can be fixed by adding these lines to the scripts/gui/main.lua at line 153: so now if value is 0 or lower it will output 0.

-- 0 div fix by Atem
if not requested_power or requested_power <= 0 then
    storage.computations[player_index].panels_required = 0
    storage.computations[player_index].accumulators_required = 0

    if storage.guis[player_index] then
        local output_flow = storage.guis[player_index].output_flow
        output_flow["solarcalc-panels-required"].caption = "0.000"
        output_flow["solarcalc-accumulators-required"].caption = "0.000"
    end
    return
end
10 months ago

Resolved in 0.0.3. The calculations will retain the previous value if no value has been provided.

New response