From b8d7238cdd558e27ef0db863f8eb78b33df982c7 Mon Sep 17 00:00:00 2001
From: Carter Kolwey <cheapiephp@gmail.com>
Date: Sun, 5 Feb 2017 02:24:05 -0600
Subject: [PATCH] Add numitron tubes

---
 init.lua                        |  53 +++++++++++++++++++++++++++++++-
 textures/numitron_0.png         | Bin 0 -> 435 bytes
 textures/numitron_1.png         | Bin 0 -> 311 bytes
 textures/numitron_2.png         | Bin 0 -> 417 bytes
 textures/numitron_3.png         | Bin 0 -> 390 bytes
 textures/numitron_4.png         | Bin 0 -> 373 bytes
 textures/numitron_5.png         | Bin 0 -> 408 bytes
 textures/numitron_6.png         | Bin 0 -> 441 bytes
 textures/numitron_7.png         | Bin 0 -> 366 bytes
 textures/numitron_8.png         | Bin 0 -> 452 bytes
 textures/numitron_9.png         | Bin 0 -> 437 bytes
 textures/numitron_colon.png     | Bin 0 -> 368 bytes
 textures/numitron_filaments.png | Bin 0 -> 242 bytes
 textures/numitron_period.png    | Bin 0 -> 369 bytes
 14 files changed, 52 insertions(+), 1 deletion(-)
 create mode 100644 textures/numitron_0.png
 create mode 100644 textures/numitron_1.png
 create mode 100644 textures/numitron_2.png
 create mode 100644 textures/numitron_3.png
 create mode 100644 textures/numitron_4.png
 create mode 100644 textures/numitron_5.png
 create mode 100644 textures/numitron_6.png
 create mode 100644 textures/numitron_7.png
 create mode 100644 textures/numitron_8.png
 create mode 100644 textures/numitron_9.png
 create mode 100644 textures/numitron_colon.png
 create mode 100644 textures/numitron_filaments.png
 create mode 100644 textures/numitron_period.png

diff --git a/init.lua b/init.lua
index 81bfe8f..7f10e5b 100644
--- a/init.lua
+++ b/init.lua
@@ -43,7 +43,11 @@ local on_digiline_receive_std = function(pos, node, channel, msg)
 	if setchan ~= channel then return end
 	local num = tonumber(msg)
 	if msg == "colon" or msg == "period" or msg == "off" or (num and (num >= 0 and num <= 9)) then
-		minetest.swap_node(pos, { name = "nixie_tubes:tube_"..msg, param2 = node.param2})
+		if string.sub(node.name,1,21) == "nixie_tubes:numitron_" then
+			minetest.swap_node(pos, { name = "nixie_tubes:numitron_"..msg, param2 = node.param2})
+		else
+			minetest.swap_node(pos, { name = "nixie_tubes:tube_"..msg, param2 = node.param2})
+		end
 	end
 end
 
@@ -90,6 +94,7 @@ for _,tube in ipairs(nixie_types) do
 	local description2 = S("Decatron ("..tube..")")
 	local cathode = "nixie_tube_cathode_off.png^nixie_tube_cathode_"..tube..".png"
 	local cathode2 = "decatron_cathode_"..tube..".png"
+	local cathode3 = "numitron_filaments.png^numitron_"..tube..".png"
 
 	if tube == "off" then
 		groups = {cracky = 2}
@@ -97,8 +102,10 @@ for _,tube in ipairs(nixie_types) do
 		light2 = nil
 		description = S("Nixie Tube")
 		description2 = S("Decatron")
+		description3 = S("Numitron Tube")
 		cathode = "nixie_tube_cathode_off.png"
 		cathode2 = "nixie_tube_blank.png"
+		cathode3 = "numitron_filaments.png"
 	end
 
 	minetest.register_node("nixie_tubes:tube_"..tube, {
@@ -136,6 +143,41 @@ for _,tube in ipairs(nixie_types) do
 		drop = "nixie_tubes:tube_off"
 	})
 
+	minetest.register_node("nixie_tubes:numitron_"..tube, {
+		description = description3,
+		drawtype = "mesh",
+		mesh = "nixie_tube.obj",
+		tiles = {
+			"nixie_tube_base.png",
+			"nixie_tube_backing.png",
+			cathode3,
+			"nixie_tube_anode.png",
+			"nixie_tube_glass.png",
+		},
+		use_texture_alpha = true,
+		groups = groups,
+		paramtype = "light",
+		paramtype2 = "facedir",
+		light_source = light,
+		selection_box = tube_cbox,
+		collision_box = tube_cbox,
+		on_construct = function(pos)
+			reset_meta(pos)
+		end,
+		on_receive_fields = function(pos, formname, fields, sender)
+			if (fields.channel) then
+				minetest.get_meta(pos):set_string("channel", fields.channel)
+			end
+		end,
+		digiline = {
+			receptor = {},
+			effector = {
+				action = on_digiline_receive_std
+			},
+		},
+		drop = "nixie_tubes:numitron_off"
+	})
+
 	if tube ~= "colon" and tube ~= "period" then
 		minetest.register_node("nixie_tubes:decatron_"..tube, {
 			description = description2,
@@ -411,6 +453,15 @@ minetest.register_craft({
 	},
 })
 
+minetest.register_craft({
+	output = "nixie_tubes:numitron_off 4",
+	recipe = {
+		{ "", "default:glass", "" },
+		{ "default:glass", "default:copper_ingot", "default:glass" },
+		{ "default:glass", "default:mese_crystal_fragment", "default:glass" }
+	},
+})
+
 
 minetest.register_craft({
 	output = "nixie_tubes:alnum_32 4",
diff --git a/textures/numitron_0.png b/textures/numitron_0.png
new file mode 100644
index 0000000000000000000000000000000000000000..2ff78c93dc7b4e724ea84012d69c077bb541fa9b
GIT binary patch
literal 435
zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI
z1_o|n5N2eUHAey{$X?><>&pI+iIszs^Vj{!4Gav74xTQKArXg@6C_?XOq|fvTlnhj
z6RCImU!<ujn(DYng?!w9cv3}ts7(3|iRJek3psLng6-=bUoGe6H9VKj!^6|<@uB8U
zZ}|PCCPyr+Ia-+(3Rna@Q^?);^44zGBP{BZ4ojYrS)y$gTkRg8D?Ib!@A(Y#GaS}2
zOGHOS{WCT&FmT9ptFmrbxNKS5#-&T2*8BSMDy!a{ki&jJr@fVBuPnoN%PGt1r4+V0
zC|_sfE7Z;h>9LrQWw7yAN9oW1)24|932C@4Yzh)OCe`)lzQppnIWD#Sombs8xcGFq
z!c!9x5-c1R-4+*IoxepzMwipw+o{QS)4OJW$t$jw#b(D=PEN}6yL0L`kK(RFS2Q`3
zd0qcGe>S~%^uwdi`4T5Nz2>MYt!x$4^tFg$UL_jEGbJT5rOM&Jf(<nbWDGxKCIm1u
YRCrF*s*J9=4-8%gPgg&ebxsLQ09rt!oB#j-

literal 0
HcmV?d00001

diff --git a/textures/numitron_1.png b/textures/numitron_1.png
new file mode 100644
index 0000000000000000000000000000000000000000..3da47646535c6b7c412bc4c469c2481c4eb32419
GIT binary patch
literal 311
zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI
z1_o|n5N2eUHAey{$X?><>&pI+iIsy(^|98P1wf%Ao-U3d5r>l#Bv_ewBsxRB?_avK
zHN!bOE6c-h_J*fRvTjH$ud}%p@Z|q7i?3x)Su;5_6^=glcyM4*LFgh8qd?7&f0L#6
zJh5unxOC}Ldy|%b!9w?eyoJk_wSh$HeSLXdJ9~5359qYFvh0;*_-;96S-q6PW*f!3
zj2E0*Qv|kuGGk_DZa&<h%Q@f4`_N<NP$9jhX)Ww--iIzuD%heT^Fr)mVNk7+hW8;w
x{uN;vh5?gOC%$B4Y(Dg<vFONw<&BQK45G%_y}N!S-vs)H!PC{xWt~$(69DU5bEg0R

literal 0
HcmV?d00001

diff --git a/textures/numitron_2.png b/textures/numitron_2.png
new file mode 100644
index 0000000000000000000000000000000000000000..6748af62ff90bc192f2c77d2b6e88d2022b55bba
GIT binary patch
literal 417
zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI
z1_o|n5N2eUHAey{$X?><>&pI+iIs!P^xxb)M;I6w^*mi1Ln00*CrG?(m^h)SxA4{5
zCsObBzerP6G}UpD3i-JI@T7|PP?_`_63g#7P8H}d75OQ@Nc)cCqUVqE_WaUYs(9?C
zqmRY|R$X1)|DIPj8~W}2Ti^b)K50>Zr%(A`^#kfs6J9g8MVxTRbgQy%Sh#Fi+s36!
zpVs^O@+zwao^kQK)nJ*VAj9z8a>}xLDFsvO$+3I}1_pobODzA_)7Y3OsQL83tkd~R
zol08$f9UVZ^jyg-k;LozPoFDX_1?Fs+a<;3*B|yM<jCm>w%_;cQ*^gL>_dGX9-d$i
z4o3F>uI9QLol=v$O^UoPT%1&}MMXxJlhf?vE`Gbz0P&}1Zb~da=MZEW5bV5lQN;r<
zrzb)a8yg=oY>hthg(*aPi$>m!pjoLe@9mN^Q#AOHnGnFtuuNnU(-r#}^MQfM;OXk;
Jvd$@?2>@F0qA36X

literal 0
HcmV?d00001

diff --git a/textures/numitron_3.png b/textures/numitron_3.png
new file mode 100644
index 0000000000000000000000000000000000000000..67744bc6632eb12da78553d6570a3f3d4af58c73
GIT binary patch
literal 390
zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI
z1_o|n5N2eUHAey{$X?><>&pI+iIsz!S;Iy`hJk@m*we)^B;s&#g2c;)i4&T73tzo`
zBK2<ni!@b5QymwnkdONhPpXIyl}W!LvHYInRDljtk)QI5wC^}Bdj2?X&o8~DipOp`
z`e;00)z#Jg?|F5zq2J!W_3cmVlNR-N`jr1wKcFr(;WdL>#0iH?w<_y~h0B(;ZCtwa
zX}zy6ud-_385hr64VFm?G7R4>r!1?NQZTii9Lr~5VDRU@#PWYVjg5(dnokeRI-S4N
zsif8ahyJci&y~y)NxZKA^tr-S?|qxPT~cg*{b7%@0u~1k94KgL5zvS#{;4Z%sAv!+
z)HkhVvFgJKnw*}x>_yjN>P{QycsaEJeR$lHhmo!8c2fvTi1ro@y>pspH<hdpZu8~f
esgaVn!oa}iIz2&wLCX*rVho<HelF{r5}E*ErjX14

literal 0
HcmV?d00001

diff --git a/textures/numitron_4.png b/textures/numitron_4.png
new file mode 100644
index 0000000000000000000000000000000000000000..9cc27f783cd47c072000216d3efe08c6f38499d9
GIT binary patch
literal 373
zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI
z1_o|n5N2eUHAey{$X?><>&pI+iIsy}%=O`)?+gr#Or9=|ArXg@6C_xfc_cbRzVBbU
zv^B#yJ1fh>P}=;4#PT|uYXMLGAG7%SIOSEg`jTm#4SyP4AFkp70(OrQYae;$rF;h@
zRat(xFc--lxN+&yr}>SIjf`H#mu@rin3|gQ=<4eJ2O6j0m6Kx4kY=f)^5QMSj`Ism
z{$6I7`IM6_K~dqo!1hmO&K>ItE*`Te4LZ}?{Hl0?m#0Lw#;5r=YR(=wZ~!EK_|fNl
ziIbdOYd-EZ^!v-w*&29p*6IA4P9?4WKlFEHdIlEy_-WmjSbp!{{=<{BTt8-bT0{x)
z{hu^pj)?!&X;&WP3G<0NY<22>^k~i{9q;c}sW(~<99Z7y$jk7UuR+4?cExO905N#F
L`njxgN@xNA?9P))

literal 0
HcmV?d00001

diff --git a/textures/numitron_5.png b/textures/numitron_5.png
new file mode 100644
index 0000000000000000000000000000000000000000..56dfe82a99ef12bc8ad8c56cb51c2c56b996676e
GIT binary patch
literal 408
zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI
z1_o|n5N2eUHAey{$X?><>&pI+iIsy}^_St?hYSpis-7;6ArXg@6C_?XOq|fvTlnhj
z6RCImU!<ujn(DYng?!w9cv3}ts7(3|iRJek3psLng6-=bUoGe6H9VKj!^6|<@$v7h
z)A`zB^Xm_L1pWa^=l{Q-_;dc8jEv08pZ+~oYDRaz&1aaO;joTbBGInpQqPw%24`Pi
z-ehm@)Bk79lInUiGl%_vj=I^pmGjsV?AkAV@n>ElmXR`@Ia_c4R*s9J|BfCwaKXK4
zC*QyByeNUk28&|kvNb-{2ky|ixb67bJ!c(q6kU22{g-}x#oxfdKt@54rR!Qu-D$B!
z+BJvjFZz0W328E0uADPPsAP+Zj4r3Uw^P(qW=o*qPZgKRNC>Ga9zJIA^|4ADL!fR_
x72_(=C=v1JQ_>=LUDrIU#=>UD%ag^xpr}1FA>Vk>TwoY7c)I$ztaD0e0s!f{nuq`Z

literal 0
HcmV?d00001

diff --git a/textures/numitron_6.png b/textures/numitron_6.png
new file mode 100644
index 0000000000000000000000000000000000000000..4e147c839a052b0dc59bfb564a80b55979334947
GIT binary patch
literal 441
zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI
z1_o|n5N2eUHAey{$X?><>&pI+iIs!f^m$uvD+2?go2QFoNW|gf1c{do6DKtF7QTA>
zMC#rC7ip@BraCTCAs_c2o>UPZDwBRgV);GCLXMoCVEekqSIfD14bP?X@bGkdeEd7>
zbiTIO{QAQlfq#I~`Ty@H{+vH2BO^2Or+<%?n$g{F^BLx6IILrqNVIFY)bpi`!P(cB
zH`&|!^#572q`Dr>%wa#Eqi(it<vg|oyY@?8{F#@CWu#1J&eq$%mE)r5zoQ2ZTySsN
z$@i~2FG}FC!J-(sY>iL#fjhJ=Zacnq&sm2YMVB0on#6>J8BR_dB5Qa4nWpO!{-fpp
zqS@1?Tw!GwYh4|cv+G+Pm!T;4q{EUxZWxgJ?m&j8MU+tAv=$Nble_rsQUk=Fp1CQp
z+^=h=WubPyamx!XYo5201a`WlBqUfkcnM4hD!3>Wu=YaI0+rK~E(I)IsmyleQ)AJQ
e1Irs7c^Ul0=Q#<h3!MN4GJ~h9pUXO@geCydM6iSa

literal 0
HcmV?d00001

diff --git a/textures/numitron_7.png b/textures/numitron_7.png
new file mode 100644
index 0000000000000000000000000000000000000000..b701433e042909f47b403acb4f8112a6958b03aa
GIT binary patch
literal 366
zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI
z1_o|n5N2eUHAey{$X?><>&pI+iIszgOKzcAJy7Vkr;B4q#Np%wiI)u%Cp7gIzIyva
z>fQbqX{w5*IxbQnANL=gR1qI4lYT>D`8~&}0v)CzKjjx`-*H^@{Bho%UwTUwkKJ_i
z(RjeBtE>Cp^Xg_pzrBC!+n?4aE$Z*|DgUc}KwWCWYX-N76AqbfRn`p)mo01CxOC~$
zdS72&W!1nlE}pj<ERz&u7`|IhSynHlU}`=2ZNsctQk!`CqAO=NHZ~q?eAL7t_5^79
z5|w~1r`E<xHv0_y{${ROc;Y|MvBx$0n1X8hSj2R>!c!9x5-bd&g!-nnELMH!FqQdu
zr!IS&i>JjC#;aVqUDDg8q($!9zOLPugQrGH;tB)9{AX1YUOtk$1q=oTPgg&ebxsLQ
E05(dD@&Et;

literal 0
HcmV?d00001

diff --git a/textures/numitron_8.png b/textures/numitron_8.png
new file mode 100644
index 0000000000000000000000000000000000000000..bf9da7a7d234c05450175d96bafb4956728ce505
GIT binary patch
literal 452
zcmV;#0XzPQP)<h;3K|Lk000e1NJLTq001BW001Be1^@s6b9#F800006VoOIv0RI60
z0RN!9r;`8x010qNS#tmY3ljhU3ljkVnw%H_000McNliru;Q|E+3>4(93mgCd0Z~ar
zK~z}7V_+ERfRT`bjdAMj<Qne3=w>A$H7rCLRPn#Vl6YTL9B0@Vr`|zv2yBc~KYruY
zcMA<M&Swk^42wwceB6y!-=#FfI6DZ10-+E%Q05?QvFX~oMZ^RrlEWFw9Hc8YU3*7R
zEfbm1`=0=xXh5z57+YFe{xdKzFhFTWdOLujrly9mrKRP6O-&6WCE1W{2f!?cg#^7F
z0QWhRrhghBwLl{`8#=_Tyv-1zD_pcOPMs8U<DmK+C@zW_7#J904MqMh3RflG_La98
z7N38^NKQ~<l!R+8zqJU_75>7&z%Ye`5GY!6`7K+BuJ8%}MK>)eDhU^bt6FTj_HGKP
zCE=oQ)rw8m-W?b%2}eu9(UOqjCRz8vrwr<%oH-<xggL{bBt$L|85kH2kP-x>6kN0h
uR4cR?D9N(O^nidtVfjEgV&K!jpauZyR-q6xipMGd0000<MNUMnLSTYLSgf4@

literal 0
HcmV?d00001

diff --git a/textures/numitron_9.png b/textures/numitron_9.png
new file mode 100644
index 0000000000000000000000000000000000000000..65b138b7ab6961ccd55fcdfbd09d2df684a099f1
GIT binary patch
literal 437
zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI
z1_o|n5N2eUHAey{$X?><>&pI+iIsy#=2dC49s>iTlc$SgNW|gf1c{do6DKtF7QTA>
zMC#rC7ip@BraCTCAs_c2o>UPZDwBRgV);GCLXMoCVEekqSIfD14bP?X@bGkde5kq8
z8-9PO$q@@{j#j3H0u}+!6mmDdytUi)2#flp!;+_DmS~&BR=Wr23eUXwdp^Vb42N~h
z646mn|BMX`3>-4us;nCpE?d^Nap}^h^}fEm%BnXf<gg#mX>VoOE6ecRa>}xLDTS>L
z%I4BmN7n8+E3imAW{aWUT#@3(3x3IH=ygd-NJu2{y8hGW3Rk`NZR&POvHA6fJ^TWa
zdfx+mqYjkin;^jCnyt4#mHVQo-NXGamZ_?CPHCJIvd_?O@8A0Nr}ar%n=Vc&*rFn%
z%b6L<_hik^KhxT06eV~}Y2lH6e5HS~1QX8^lZP3+E5b4YW99_UN_`o(oM*Ox#19jL
b6^smfvgYVrs$Vn@7{Cmku6{1-oD!M<KR%{0

literal 0
HcmV?d00001

diff --git a/textures/numitron_colon.png b/textures/numitron_colon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ca097d88ff7066392ff35e5d4659c6d44d11f432
GIT binary patch
literal 368
zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI
z1_o|n5N2eUHAey{$X?><>&pI+iIsy#bI&n%UZBulPZ!6Kh{MSV60FQT5}hI6_b*-A
zn&F(CmE~bLd&AQ$SB|@QFzU_E?+MOtPYn7p@eM=Hg44n8?3tOFn+?Rh4S*DLk3XNn
zO-AX*S8iW*wY2`TrA12u2!OQC6(GN$mBrV|VMe#=j~C7U+t-Tz2<f-`Q6eoR#8Xmy
z;C6ofwL?1F!yW|J{(gHtYM14K`io~z&0fDhJZIOpb<K^9jft1Hmdl#Q*RTH&U$S{p
zo?^hZzk<p-DieNgVKUKWck@29FjD9occ7adr{s$`A+F+$3e#Ie7pp$Z@U(~$y0lA0
z=F<cFsf(u6T)1@Ull)9M0Rs&kc@1}-8Yzh@3=E+Mmu61>q5cyX5DcEKelF{r5}E*(
CcZ#zB

literal 0
HcmV?d00001

diff --git a/textures/numitron_filaments.png b/textures/numitron_filaments.png
new file mode 100644
index 0000000000000000000000000000000000000000..8f4d9b342288c12ac683b3f9eac3ca06b6a9e67d
GIT binary patch
literal 242
zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI
z1_o|n5N2eUHAey{$X?><>&pI+iIv?-X=RAVS)fq8r;B4q#NoG7tc4CJaJU>S4t}@S
zGkK=ugaa!iw@vL|^P?kb_R(_|tPk|Gl(e_LeKxi7FjvG(n@Q%AmUZtE*~h?q!E$BV
zzVEZA&Z?dEkbyBkFfo5|4*MC|6=e<0HkSR&zK7HjCvWh)p|Yo`<+?U+)cpFOpVNDp
i-hStMbH8!%SB3{Z$%~UGzA*<ng~8L+&t;ucLK6UDR9H#?

literal 0
HcmV?d00001

diff --git a/textures/numitron_period.png b/textures/numitron_period.png
new file mode 100644
index 0000000000000000000000000000000000000000..335d2a5c57ddcf048d450f10ff8e53770030712d
GIT binary patch
literal 369
zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI
z1_o|n5N2eUHAey{$X?><>&pI+iIs!L*m23ea-h&ZPZ!6Kh{MSV60FQT5}hI6_b*-A
zn&F(CmE~bLd&AQ$SB|@QFlySVyUPntt#QxOnE00A*tBWW{s+wew>+&TnfuiLE7KOc
zaTsjbvgObEl`9ift|?`;GaNK=crB2ive`zm=IMb9Pm3s_zG*FsRUZPG4^$O>oB7zx
zj;-8&_{P8Pys#iuaRKfmUe|xd1_l-!#T!|Gv_VPbslUskIS$mkTdo>X_~YO4_1n7s
z+?l;@?`sD>&ROjZ2IAfZXFeVNZeQ2h%5rzngSXr5vlFM?*7{Vu|L?bS-B{to>C5lb
zmj<5WOVpe8VEg@lYxe&9RqcB7n|n_QH{*;{gZawQb{Y%}^_TkID7eO207HVo)78&q
Iol`;+05H&#KL7v#

literal 0
HcmV?d00001