[MOD 0.12.x] Nixie Tubes - numeric display elements

Topics and discussion about specific mods
User avatar
impetus maximus
Smart Inserter
Smart Inserter
Posts: 1299
Joined: Sat Aug 20, 2016 10:07 pm
Contact:

Re: [MOD 0.12.x] Nixie Tubes - numeric display elements

Post by impetus maximus »

i've always found github hard to navigate. i just visited the nixie tube's github, and i don't see any discussions.
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3717
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: [MOD 0.12.x] Nixie Tubes - numeric display elements

Post by DaveMcW »

I wanted to build a nixie tube clock, but it does not look so good when leading zeroes are hidden. I wrote this patch to zero pad 2-digit nixie tubes only.

Code: Select all

    local format = "%i"

    -- Zero pad 2-digit nixie tubes
    if global.controllers[entity.unit_number]
    and global.nextdigit[entity.unit_number]
    and global.nextdigit[entity.unit_number].valid
    and not global.nextdigit[global.nextdigit[entity.unit_number].unit_number] then 
      format = "%02i"
    end

    if float and hex then
      format = "%A"
justarandomgeek
Filter Inserter
Filter Inserter
Posts: 302
Joined: Fri Mar 18, 2016 4:34 pm
Contact:

Re: [MOD 0.12.x] Nixie Tubes - numeric display elements

Post by justarandomgeek »

Add 100 (or 10000 or whatever) to the signal so it's longer than the display and it will be truncated leaving the leading zeroes
Post Reply

Return to “Mods”