From 4ae74cdae0662749e63fa7b33a1843eee32a334e Mon Sep 17 00:00:00 2001 From: Novatux Date: Sun, 2 Dec 2012 09:45:00 +0100 Subject: [PATCH] Added textures. Fixed microcontroller placing. --- mesecons_22microcontroller/init.lua | 94 ++++++++++++++++-- .../jeija_microcontroller22_top_bl.png | Bin 0 -> 1034 bytes .../jeija_microcontroller22_top_br.png | Bin 0 -> 989 bytes .../jeija_microcontroller22_top_tl.png | Bin 0 -> 1060 bytes .../jeija_microcontroller22_top_tr.png | Bin 0 -> 1032 bytes 5 files changed, 87 insertions(+), 7 deletions(-) create mode 100644 mesecons_textures/textures/jeija_microcontroller22_top_bl.png create mode 100644 mesecons_textures/textures/jeija_microcontroller22_top_br.png create mode 100644 mesecons_textures/textures/jeija_microcontroller22_top_tl.png create mode 100644 mesecons_textures/textures/jeija_microcontroller22_top_tr.png diff --git a/mesecons_22microcontroller/init.lua b/mesecons_22microcontroller/init.lua index 374fb95..e516de1 100644 --- a/mesecons_22microcontroller/init.lua +++ b/mesecons_22microcontroller/init.lua @@ -3,7 +3,7 @@ EEPROM_SIZE = 255 for a = 0,1 do for b = 0,1 do local nodename = "mesecons_22microcontroller:microcontroller_topleft"..tostring(b)..tostring(a) -local top = "jeija_microcontroller_top.png" +local top = "jeija_microcontroller22_top_tl.png" if tostring(a) == "1" then top = top.."^jeija_microcontroller_LED_A.png" end @@ -46,6 +46,7 @@ minetest.register_node(nodename, { }, on_construct = function(pos) local meta = minetest.env:get_meta(pos) + meta:set_int("destruct",0) meta:set_string("code", "") meta:set_string("formspec", "size[9,2.5]".. "field[0.256,-0.2;9,2;code;Code:;]".. @@ -74,6 +75,11 @@ minetest.register_node(nodename, { pos.z=pos.z+1 end, on_destruct = function(pos) + local meta = minetest.env:get_meta(pos) + local des=meta:get_int("destruct") + if des==0 then + print("Destruction") + meta:set_int("destruct",1) local node = minetest.env:get_node(pos) pos.x = pos.x+1 minetest.env:remove_node(pos) @@ -82,6 +88,7 @@ minetest.register_node(nodename, { pos.x = pos.x-1 minetest.env:remove_node(pos) pos.z=pos.z+1 + end end, on_receive_fields = function(pos, formanme, fields, sender) local meta = minetest.env:get_meta(pos) @@ -133,7 +140,7 @@ end for c = 0,1 do for d = 0,1 do local nodename = "mesecons_22microcontroller:microcontroller_topright"..tostring(d)..tostring(c) -local top = "jeija_microcontroller_top.png" +local top = "jeija_microcontroller22_top_tr.png" if tostring(c) == "1" then top = top.."^jeija_microcontroller_LED_B.png" end @@ -165,6 +172,25 @@ minetest.register_node(nodename, { { -3/16, -6/16, -3/16, 3/16, -5/16, 3/16 }, -- IC } }, + on_construct=function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_int("destruct",0) + end, + on_destruct = function(pos) + local meta = minetest.env:get_meta(pos) + local des=meta:get_int("destruct") + if des==0 then + meta:set_int("destruct",1) + local node = minetest.env:get_node(pos) + pos.z = pos.z-1 + minetest.env:remove_node(pos) + pos.x = pos.x-1 + minetest.env:remove_node(pos) + pos.z = pos.z+1 + minetest.env:remove_node(pos) + pos.x=pos.x+1 + end + end, selection_box = { type = "fixed", fixed = { 0,0,0,0,0,0 }, @@ -188,7 +214,7 @@ end for e = 0,1 do for f = 0,1 do local nodename = "mesecons_22microcontroller:microcontroller_bottomright"..tostring(f)..tostring(e) -local top = "jeija_microcontroller_top.png" +local top = "jeija_microcontroller22_top_br.png" if tostring(e) == "1" then top = top.."^jeija_microcontroller_LED_C.png" end @@ -220,6 +246,25 @@ minetest.register_node(nodename, { { -3/16, -6/16, -3/16, 3/16, -5/16, 3/16 }, -- IC } }, + on_construct=function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_int("destruct",0) + end, + on_destruct = function(pos) + local meta = minetest.env:get_meta(pos) + local des=meta:get_int("destruct") + if des==0 then + meta:set_int("destruct",1) + local node = minetest.env:get_node(pos) + pos.x = pos.x-1 + minetest.env:remove_node(pos) + pos.z = pos.z+1 + minetest.env:remove_node(pos) + pos.x = pos.x+1 + minetest.env:remove_node(pos) + pos.z=pos.z-1 + end + end, selection_box = { type = "fixed", fixed = { 0,0,0,0,0,0 }, @@ -243,7 +288,7 @@ end for g = 0,1 do for h = 0,1 do local nodename = "mesecons_22microcontroller:microcontroller_bottomleft"..tostring(h)..tostring(g) -local top = "jeija_microcontroller_top.png" +local top = "jeija_microcontroller22_top_bl.png" if tostring(g) == "1" then top = top.."^jeija_microcontroller_LED_D.png" end @@ -275,6 +320,25 @@ minetest.register_node(nodename, { { -3/16, -6/16, -3/16, 3/16, -5/16, 3/16 }, -- IC } }, + on_construct=function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_int("destruct",0) + end, + on_destruct = function(pos) + local meta = minetest.env:get_meta(pos) + local des=meta:get_int("destruct") + if des==0 then + meta:set_int("destruct",1) + local node = minetest.env:get_node(pos) + pos.z = pos.z+1 + minetest.env:remove_node(pos) + pos.x = pos.x+1 + minetest.env:remove_node(pos) + pos.z = pos.z-1 + minetest.env:remove_node(pos) + pos.x=pos.x-1 + end + end, selection_box = { type = "fixed", fixed = { 0,0,0,0,0,0 }, @@ -733,27 +797,43 @@ end --Real I/O functions function yc22_action(pos, L) --L-->Lvirtual local Lv = yc22_get_virtual_portstates(pos) - local metatable = minetest.env:get_meta(pos):to_table() - local name = "mesecons_22microcontroller:microcontroller_topleft" + local meta = minetest.env:get_meta(pos) + local metatable = meta:to_table() + local node=minetest.env:get_node(pos) + node.name = "mesecons_22microcontroller:microcontroller_topleft" ..tonumber(L.b and 1 or 0) ..tonumber(L.a and 1 or 0) - minetest.env:add_node(pos, {name=name}) + minetest.env:set_node(pos, node) minetest.env:get_meta(pos):from_table(metatable) + meta = minetest.env:get_meta(pos) + meta:set_int("destruct",0) name = "mesecons_22microcontroller:microcontroller_topright" ..tonumber(L.d and 1 or 0) ..tonumber(L.c and 1 or 0) pos.x=pos.x+1 + meta = minetest.env:get_meta(pos) + meta:set_int("destruct",1) minetest.env:add_node(pos, {name=name}) name = "mesecons_22microcontroller:microcontroller_bottomright" ..tonumber(L.f and 1 or 0) ..tonumber(L.e and 1 or 0) + meta = minetest.env:get_meta(pos) + meta:set_int("destruct",0) pos.z=pos.z-1 + meta = minetest.env:get_meta(pos) + meta:set_int("destruct",1) minetest.env:add_node(pos, {name=name}) name = "mesecons_22microcontroller:microcontroller_bottomleft" ..tonumber(L.h and 1 or 0) ..tonumber(L.g and 1 or 0) + meta = minetest.env:get_meta(pos) + meta:set_int("destruct",0) pos.x=pos.x-1 + meta = minetest.env:get_meta(pos) + meta:set_int("destruct",1) minetest.env:add_node(pos, {name=name}) + meta = minetest.env:get_meta(pos) + meta:set_int("destruct",0) pos.z=pos.z+1 yc22_action_setports(pos, L, Lv) diff --git a/mesecons_textures/textures/jeija_microcontroller22_top_bl.png b/mesecons_textures/textures/jeija_microcontroller22_top_bl.png new file mode 100644 index 0000000000000000000000000000000000000000..a99f3330c36e3f2342d0c7510baad2cabe96df95 GIT binary patch literal 1034 zcmV+l1oiugP)s-hl94-|^jBEcVm#4SJEln78m{{ln}Dni(W z0RKj=sfbzu?z!R;<%|?nQ5vUN+q*LyX5M^?Wi-@FYN*IO!`BV0Z$o$2{g&i|vQDR{fMc#{Y zxeUPE+#CSiZWn-Fujg5QdU~3V%jI%zv8)#)<(yKf1VE)yc})-yjYN_p0iar~0&sSA z=Ea6m>LtsI{uKn|+#m=%L}Y)b(|Ju05Fce(2Ef9?0sw1YeQY(1oQ{EexS^5YHpcq8 zXD2FeSPL^ZHrl?w|LN|?n3z2Rl9$F=BEAYEYqCx)GEpVs-dYoYFMr;`Xu~)4763cD zTa@Mo?{|LMA}l!`=xZ;gB*t>Sm^A{y-rk-mGMwc37tIZC;li^wCp!4~(%)W;e7*jI zmmPx0SOglIEgGAxi7jhvG-+%!$H#zJE?FQNO7w~xA0K|^=tvukYL=zz}*yoEVP{;!K<9E3JzMXjd2;RF6fn-N&Mjo`f zy6R=k;o;%v4>}|zwuA|#)`V_9aSX!BMI{^c7LEGkF>r6KnWyELT44Vi{5F`>8iFy1 zi%*xAmjO6BIvTkyEQg-u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UEBL zjC4l1WqmIjMRB!SWo!EeX=+8K*|aQY44gmvF4z07siM+Q>&Hj2I*wuUqu+Mx_Azh8 zx}iw#``-g9X`14$^jy0R?Y5QHM#GYeJQrd@P)sY&^S9+utkx?|@;ZHi+^C@uP~M9X z`b)U;$6hN1T&pU(p@J39+Nr_%wT+wF4kBK-C%EZ>CVV`zQ{&pmJF zNX8N`NXk07Tn>Ojp)ffD?Y8arzqb9=O7Gd&2*{3li`$io#UcP_XJ;NawALK|X=9&w z5-wbTyWc?Nn*G0mfUFw?frp6JHs@BWH8}$11>kr1`M{1}Scd!eCqp3E-Q6_+Ns<6C zKR*w^%G)nl)`lvJ%(`r7gxneX;;wyAc*N$EWMh-s_wT>9?I9q&V#-a+xincO@~>2A zQ%+-xOjroHvr-4(tFwZyJufqzX3`?Ag3c9?lP51#XB{JhlfMs1WAb##7<97EeAT;$Cq!yQ%}RU zcYSB8RU6c*<8$E7O5GjH5nkXMi}i2_Mj$>nHwVDd(h>kiM@K{BR9+3uT)3pOb+~@R z78l<)ZE+#(*2k~NUdKXU>l4d?V8k??6(+RXJwq`Dbf#o6>ClPIX44~+u-cI1tWj#?awFEfj2(1QmzaC{s}D^iy}&|bkHy56dq5gt@pX1f!eAa-~QrN zOlo|$Ov21n{c3n|anV!G>AT_n{=VsVL8<+!@4f5=rit;~&G~(t`ckU`uMRNTyboUA z_Si4qn?3?^Gm?Mgb~bRc5f+P&OA}=)m&>GS>fH2UuIOsP|4T)rMZqL9QL4fFfV3n@ zP)a$yD3{AlKeW~^b3sfHl$)1i?rOuSBOvEq6md}LWT*W#V-!V>&HX;FlydV2rB{%A e;I=$%1pWb%JF6WdX2Plf0000>% literal 0 HcmV?d00001 diff --git a/mesecons_textures/textures/jeija_microcontroller22_top_tr.png b/mesecons_textures/textures/jeija_microcontroller22_top_tr.png new file mode 100644 index 0000000000000000000000000000000000000000..c1488c6cc55a9bcc1299684c3efdf15db5aff8f8 GIT binary patch literal 1032 zcmV+j1o!)iP)cc zK~z}7&6m$_8$}eyKf61&HxBVB7b4UXDqJFgXgScTLhwg$LE@GsCJ+H?+P?r%gFvWu zA%%YZhl=#Q)4u{$A+T*ym_QlL)HM=vj?|t9*eczj4cX!tU zBuN559LEgKd%Ye2S(X7XKR?g!f7~LDq1%NZfOZ?g5U#%b6JZzv6i@Bb(EE#v3jhpL zj3|O6fu~R0{MvOlpJo_&7)6oypu_>1B?7WYqup);P_0%0I6Xb}xM7Sb;Le?5 z|1sRW<>D&@bZ!s?9wH{U{_N~*dJbfni~IiLJ_mZ;=@1BZc6Ka4nx+8MYBc~>K7ZfE zD9WQ0{(;ANn^D+o&)k+Ss)9=UXA19V^7hv zUWz6~Rg8y+{v%zGLK>0pS>x`bbya|g5a{o7U5l%S_?+XCCjCFfwChR zZQ%0qvX?c7hleBA2}xt%V88$VjcZV=Jr4)!EgJR7IdFfaS)`?tUiWx2!+AJL~xsoMhBY$vka4?e9g}~$bjyzbs+;dB9UQKoWN#40g7sdwm-Vf91z^C6j zDL0k>{)LgpvPjR+1cOpe<<*qN+CVk5(75g9_kR2cn_0hFrcqv1{cd=1anV!G*;m88 zy*)d~e(6E|s}KA(EVW*BE9!lc`Q!})uMe>KzHdI+@@j|vH+uwhGg6ES%Z6??VsW)v zB@Dx2-EbGJYWl3ISoDJbmyXCt!Q_GJ{qTK2BTZAXEW1=aB`$g|#Dt)3Uh=%?4QGyk z@?MHKtaP$;xMvh%=jZ3%eM0+(Z^c6D(rtOx2>c7r(V-#i-Q=(U0000oW literal 0 HcmV?d00001