From 194155fff8e848750dc716fd920045b3c340310d Mon Sep 17 00:00:00 2001 From: Jeija Date: Sat, 22 Nov 2014 11:37:47 +0100 Subject: [PATCH] Rewrite mesecon wires. This should increase the efficiency and speed of large machines. It also makes the wires.lua code easier to understand and more maintainable. In case any other mod depends on mesecon:update_autoconnect, please update it to use mesecon.update_autoconnect. This should also fix some other minor bugs. Please report bugs if this commit creates new ones. This commit changes wire looks and removes some unneccesary textures. --- mesecons/actionqueue.lua | 2 +- mesecons/internal.lua | 18 +- mesecons/services.lua | 7 +- .../textures/jeija_mesecon_crossing_off.png | Bin 341 -> 0 bytes .../textures/jeija_mesecon_crossing_on.png | Bin 340 -> 0 bytes .../textures/jeija_mesecon_curved_off.png | Bin 307 -> 0 bytes mesecons/textures/jeija_mesecon_curved_on.png | Bin 307 -> 0 bytes .../textures/jeija_mesecon_inverter_off.png | Bin 743 -> 0 bytes .../textures/jeija_mesecon_inverter_on.png | Bin 725 -> 0 bytes mesecons/textures/jeija_mesecon_on.png | Bin 196 -> 0 bytes mesecons/textures/jeija_mesecon_plug.png | Bin 713 -> 0 bytes .../textures/jeija_mesecon_socket_off.png | Bin 751 -> 0 bytes mesecons/textures/jeija_mesecon_socket_on.png | Bin 737 -> 0 bytes .../textures/jeija_mesecon_t_junction_off.png | Bin 330 -> 0 bytes .../textures/jeija_mesecon_t_junction_on.png | Bin 319 -> 0 bytes ..._mesecon_off.png => mesecons_wire_inv.png} | Bin ...res_full_off.png => mesecons_wire_off.png} | Bin ...wires_full_on.png => mesecons_wire_on.png} | Bin mesecons/textures/wires_bump_off.png | Bin 347 -> 0 bytes mesecons/textures/wires_bump_on.png | Bin 386 -> 0 bytes mesecons/textures/wires_inv.png | Bin 167 -> 0 bytes mesecons/textures/wires_off.png | Bin 454 -> 0 bytes mesecons/textures/wires_on.png | Bin 492 -> 0 bytes mesecons/textures/wires_vertical_off.png | Bin 373 -> 0 bytes mesecons/textures/wires_vertical_on.png | Bin 396 -> 0 bytes mesecons/util.lua | 17 + mesecons/wires.lua | 471 ++++++++---------- mesecons_extrawires/vertical.lua | 12 +- mesecons_insulated/init.lua | 6 +- mesecons_microcontroller/init.lua | 14 +- mesecons_movestones/init.lua | 4 +- mesecons_mvps/init.lua | 9 +- mesecons_receiver/init.lua | 19 +- 33 files changed, 273 insertions(+), 306 deletions(-) delete mode 100644 mesecons/textures/jeija_mesecon_crossing_off.png delete mode 100644 mesecons/textures/jeija_mesecon_crossing_on.png delete mode 100644 mesecons/textures/jeija_mesecon_curved_off.png delete mode 100644 mesecons/textures/jeija_mesecon_curved_on.png delete mode 100644 mesecons/textures/jeija_mesecon_inverter_off.png delete mode 100644 mesecons/textures/jeija_mesecon_inverter_on.png delete mode 100644 mesecons/textures/jeija_mesecon_on.png delete mode 100644 mesecons/textures/jeija_mesecon_plug.png delete mode 100644 mesecons/textures/jeija_mesecon_socket_off.png delete mode 100644 mesecons/textures/jeija_mesecon_socket_on.png delete mode 100644 mesecons/textures/jeija_mesecon_t_junction_off.png delete mode 100644 mesecons/textures/jeija_mesecon_t_junction_on.png rename mesecons/textures/{jeija_mesecon_off.png => mesecons_wire_inv.png} (100%) rename mesecons/textures/{wires_full_off.png => mesecons_wire_off.png} (100%) rename mesecons/textures/{wires_full_on.png => mesecons_wire_on.png} (100%) delete mode 100644 mesecons/textures/wires_bump_off.png delete mode 100644 mesecons/textures/wires_bump_on.png delete mode 100644 mesecons/textures/wires_inv.png delete mode 100644 mesecons/textures/wires_off.png delete mode 100644 mesecons/textures/wires_on.png delete mode 100644 mesecons/textures/wires_vertical_off.png delete mode 100644 mesecons/textures/wires_vertical_on.png diff --git a/mesecons/actionqueue.lua b/mesecons/actionqueue.lua index e0b8c65..e7cbc55 100644 --- a/mesecons/actionqueue.lua +++ b/mesecons/actionqueue.lua @@ -14,7 +14,7 @@ function mesecon.queue:add_action(pos, func, params, time, overwritecheck, prior priority = priority or 1 local action = { pos=mesecon:tablecopy(pos), func=func, - params=mesecon:tablecopy(params), + params=mesecon:tablecopy(params or {}), time=time, owcheck=(overwritecheck and mesecon:tablecopy(overwritecheck)) or nil, priority=priority} diff --git a/mesecons/internal.lua b/mesecons/internal.lua index d45b0bf..edf361f 100644 --- a/mesecons/internal.lua +++ b/mesecons/internal.lua @@ -26,10 +26,6 @@ -- mesecon:deactivate(pos, node, recdepth) --> Deactivates the effector node at the specific pos (calls nodedef.mesecons.effector.action_off), " -- mesecon:changesignal(pos, node, rulename, newstate) --> Changes the effector node at the specific pos (calls nodedef.mesecons.effector.action_change), " --- RULES --- mesecon:add_rules(name, rules) | deprecated? --> Saves rules table by name --- mesecon:get_rules(name, rules) | deprecated? --> Loads rules table with name - -- CONDUCTORS -- mesecon:is_conductor(nodename) --> Returns true if nodename is a conductor -- mesecon:is_conductor_on(node) --> Returns true if node is a conductor with state = mesecon.state.on @@ -244,18 +240,6 @@ function mesecon:changesignal(pos, node, rulename, newstate, recdepth) mesecon.queue:add_action(pos, "change", {rulename, newstate}, nil, rulename, 1 / recdepth) end --- ######### --- # Rules # "Database" for rulenames --- ######### - -function mesecon:add_rules(name, rules) - mesecon.rules[name] = rules -end - -function mesecon:get_rules(name) - return mesecon.rules[name] -end - -- Conductors function mesecon:is_conductor_on(node, rulename) @@ -548,7 +532,7 @@ function mesecon:rules_link(output, input, dug_outputrules) --output/input are p return false end -function mesecon:rules_link_rule_all(output, rule) --output/input are positions (outputrules optional, used if node has been dug), second return value: affected input rules +function mesecon:rules_link_rule_all(output, rule) local input = mesecon:addPosRule(output, rule) local inputnode = minetest.get_node(input) local inputrules = mesecon:get_any_inputrules (inputnode) diff --git a/mesecons/services.lua b/mesecons/services.lua index d549cb0..0cf94d2 100644 --- a/mesecons/services.lua +++ b/mesecons/services.lua @@ -1,6 +1,8 @@ -- Dig and place services mesecon.on_placenode = function (pos, node) + mesecon.update_autoconnect(pos, node) + -- Receptors: Send on signal when active if mesecon:is_receptor_on(node.name) then mesecon:receptor_on(pos, mesecon:receptor_get_rules(node)) @@ -18,7 +20,7 @@ mesecon.on_placenode = function (pos, node) mesecon:turnon(pos, rule) end --mesecon:receptor_on (pos, mesecon:conductor_get_rules(node)) - elseif mesecon:is_conductor_off(node.name) then + elseif mesecon:is_conductor_on(node) then minetest.swap_node(pos, {name = mesecon:get_conductor_off(node)}) end end @@ -41,8 +43,11 @@ mesecon.on_dignode = function (pos, node) elseif mesecon:is_receptor_on(node.name) then mesecon:receptor_off(pos, mesecon:receptor_get_rules(node)) end + mesecon.queue:add_action(pos, "update_autoconnect", {node}) end +mesecon.queue:add_function("update_autoconnect", mesecon.update_autoconnect) + minetest.register_on_placenode(mesecon.on_placenode) minetest.register_on_dignode(mesecon.on_dignode) diff --git a/mesecons/textures/jeija_mesecon_crossing_off.png b/mesecons/textures/jeija_mesecon_crossing_off.png deleted file mode 100644 index 4e3ca032e76db7e22b7b44245f1427c953c6e62b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 341 zcmV-b0jmCqP)Px#32;bRa{vGgP5=N469IKCxxWAa00(qQO+^RX1P>MhD}w5TVgLXD=Sf6CR5;6} zlCe$#VGxABT~J~)flg~0uZD)Fp{L~uJQ7O6+gVf55rZdq=-rORnb_!$z}N0(c6W9l z!EEMw%3Y}*=LmjDT?kz?APlp#L_1ZiBOo|mU@&;3C|bbt=_f1}H#!`;Y&Nefmk)p5 zVR`N{0}0H8JM8z@tk;I*n2F)=j-q&@s!9|FE)4tGpz&Hn7~^2cL>I_F5aL_r7pBuIZMVT_bkAz_!hHU2oXU9I)@0Js*|*o n*6}1J1Px#32;bRa{vGgP5=N469IKCxxWAa00(qQO+^RX1P>MhBaAT&Pyhe`=1D|BR5;6} zlRrxXK@i1%Gu&P{!r|Gdg$e!%Ns-ptd|REuyn_1g~#1>-BC>J>`9Q z_wN|u{kb6m1|pzptkwmpm*n{cNdj56V^ckox)Oqd)DBs#f$Y}|p?-_P;oJ#E;3z+% z+LnY+)t}@?Ujvfiu>8aBPv$R~i5%1Kr&QYoeYNS9gAin| mOS>q4JJUYO()kvekKqgSKtxEI5%^dD0000Eak-ar*7Vy?l&?0!Qkr_c?+aQmp$mhDzP{q*WSzCx?DS!SzuD2DA#oy5`< zvrj)jM2Us@OKmU1q{L^|1*~TZlK!1wJby~YhQaQw*Jc~771w|sV(@hJb6Mw<&;$Ve C!*VqM diff --git a/mesecons/textures/jeija_mesecon_curved_on.png b/mesecons/textures/jeija_mesecon_curved_on.png deleted file mode 100644 index fa882e43b979fcec2d621f79f7f356326dbf42f5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 307 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|I14-?iy0Vr z{1_Oxg&9kAckTxYvX^-Jy0YJ4;TL024B+Jd2NXK$>Eak-ar*59TdqS6049a$Z7Tml@qZ5uWk8jE>mhPl3xnUQwy%=b3-Kd-l!?sF-! zaZS1%Sa~STS|Hgf;MCD~24`9?Y<`$>OZ@uE#W8sf*$X1}JeJZ=KTVCi?)$opiJJ#))k$+g#_I=B$TtMEza1B2lUvjxg2XWs!m#Ng@b=d#Wzp$Pzw C{&Cd+ diff --git a/mesecons/textures/jeija_mesecon_inverter_off.png b/mesecons/textures/jeija_mesecon_inverter_off.png deleted file mode 100644 index bd4de1b0837fd7718a189e61c113dee7120f2a1b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 743 zcmV?P)Px#32;bRa{vGgP5=N469IKCxxWAa00(qQO+^RX1P=iqAgkl9KL7v%c}YY;R5;6R zlRHaXQ51#0^SXCNG;@g$5F0@RyVO$%v9YtWQpCm-$zMnl2&7GZfC$=XNE~}hK_rD> zLIM^kq9AH;$e`Ytxt>>wi5G?JY8Pi67JGe5G#ZTHP%{`QV1b%&h>NvjYgxirj({ub2OW;>2^C@Uj9Jq4}{P} zYtyr>HQU?UD5X%>*Vk`atrkm5D@;s`b9#Ep&!6u&K5p~t*A>mCV`Ky_E)L1E=hW+U zYPAt|c0O}*a?-oO!|~oTIH*X|r<|YvVSM}v-bXqe&;Ld)FE5j28Q;GjvbVQKnpQ}X zmt0-_20X*V2^SYFYPAA4 zd#Y8KoP5RT=r~2uEjiIzb8~Zpz8Br+Erg)kZ8J19$jr=JoO4tvRlIkPIPu;ir9|H6 z3OvYJ5M!iXuQNS8O}E=Y2vKsPlmh5+V2mj_c$hOlo;&i~p|yU*iTAyO8e@80P)e0O z08mP?wYA0S>S|f0#l^+4Ox}Bh5WQQp+imhZ$2nIP1z>h|mfhXma?kS|?|mtjQj+I6 Ze*q~YZ0!3HA7KCh002ovPDHLkV1oCML1h2{ diff --git a/mesecons/textures/jeija_mesecon_inverter_on.png b/mesecons/textures/jeija_mesecon_inverter_on.png deleted file mode 100644 index be41599e30a65c04c847072a33f406b29bb01833..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 725 zcmV;`0xJE9P)Px#32;bRa{vGgP5=N469IKCxxWAa00(qQO+^RX1P=irBP;RF!~g&SXGugsR5;6R zlQByiQ51#0dGF24I-0m)NyH{X2sRe6P=A8mZbYoK^@qg&A)+?gxS&-qrQ{dbWLJ`i zq!Dx(&{5yMdGDr}?4Xd_+*`cEJNKS*qHebL{VNfJba5CV^nj~HVN zAq3($rYuX+G{rf``uaMHi;Do9ot*&?MN$3MIY%7F80Q>mni4|5drt@f5y4tZtJSK3 zqaH;O!{HF66yAFbfVGw+Nr>aPp1t=RA0MNXLMera)YPA|F-j=_M%_6_2%h=*CuU}T z<4WPz&kywb)d90CBZNR%mK6@5+wK0N<}gO{X+GxNRF|>rJz5X>IQyNsxe{YcMcWvT zj*ie;qjq<9$@83rg#}htK2w$+rS};OUU74Cg>z$Q)#UBeSG3l2IvtjlmdNv*larI` z2G2`Gc+(ssNv46o#6$~g?-8;5uk_Z|)|Xzd$K>QB=jZ1Dyna24(%*1y$oP0h@$iE` zS8WD^m|m~P_4PFu7ZZ5Zt18vTC4NOI>K z#u)DI?l2>eh}1eiJy|XG+^TH>i-{Uy0vY@rDa{!>V=J4>4?d|P4OdA^;b(p;O zL{U`T;^EFH?6b0V<8myF}C<^`p=TdB!Ri9a700000NkvXX Hu0mjffN)I- diff --git a/mesecons/textures/jeija_mesecon_on.png b/mesecons/textures/jeija_mesecon_on.png deleted file mode 100644 index d7ebeecb1f0e3fe24caa72bb865cd6c878abd8e0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 196 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|I14-?iy0Vr z{1_Oxg&9kAckTxYvX^-Jy0YJ4;TK~x-+Qe49Z)FD)5S5w;`H92gS-bEIG8S*=KbIK zO6d;Ug_b3Ch8+wEY2RPmRo?#DV!{byz7X#Zt%+P;_*oew=4{dQ=!)#wf9}UIm!B@L qi-VV#u^LTwVO?XBaQ8^gAy%IoB2UW8ChrB>z~JfX=d#Wzp$PylPC{`2 diff --git a/mesecons/textures/jeija_mesecon_plug.png b/mesecons/textures/jeija_mesecon_plug.png deleted file mode 100644 index 8a4d28171fb7c4df848b8b1874db486ac9d6f590..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 713 zcmV;)0yh1LP)Px#32;bRa{vGgP5=N469IKCxxWAa00(qQO+^RX1P=iMBH~|(GXMYrTS-JgR5;6B zlD|tFK^TUg`L*lmCEG|Ky&+&@Es2Vp_90bL=buVz8;G?i=yeLwE|rayBqW@==kBeu zv-3@g!$tEpGXwJt?>q0K_V@Rbh#(?_5Lj4PAjXLIo|Tmq0IsgC=(>)@#YMdL!CX)%)TBg$}S(Z^%6(T~@G-zurB7(J+uIu`BG#XJ9 z1w~OX8jS!@O7(Y@QaI<(Aq4U~2O!3Xh>%iZJRYO9Mno8o$Nd9JDcZJ0DMgGC3*fyc z%QBpE{XRzF`1qKoN+}^C&)jIOH2_*`j4`B?2q97w4e#ImU~TOJkr_%ELI@aRP)gBt z-Fz;kMBBEkudma#Eyh@ummNz>UqJgb>hLqfSpx6F^ZE z0Gynh;M^Y9*S{GIGPKsLt-avpX2{*$C$_h@5fRF=oI7}$(OQdhEw5hXtggPsxyYM0 z1tBQBkAzV3zx3thCFkeo02~|~kkS%={(NLI`Gr!#^6~=HX~lH`9nK6be%b866GMjy4I5Z3fpK)$T2rYS@6GFgR%l-X5_Hihs)c5TD1H<7< zhQlv}5O8ilO7e`87$aJ1^kc98_Y8@RjSY5pcWIiYC(nD2F$Q4Hfpf0s;AziWTU%(Y zNhz_jv-6CT7$d+OWos?Q7(}E;+8D#p(Gg`?QkEr$hlf47S(f#2LkQT}Y(`zzbX|vt v@aV{U-$#3Rc)%D#jFA{4N-4C~)OF227^GudGF(=#00000NkvXXu0mjf852OP diff --git a/mesecons/textures/jeija_mesecon_socket_off.png b/mesecons/textures/jeija_mesecon_socket_off.png deleted file mode 100644 index ad3f60145dbacfad7ec86caf68d101a38d607a71..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 751 zcmVPx#32;bRa{vGgP5=N469IKCxxWAa00(qQO+^RX1P=it7^uueVgLXFfk{L`R5;6R zlRs-6M-;_>Gdr{U^e~dJjKHW-qbeAL;1vS30fP&HK1Qk(h7@V?4U(^*R-k7RRH>61 zfj~$Glis$3d2vMKr`>%!JA3b>czFwg6vLf=ckVfJ&NbulIH@YCN{o@gV1S6wwk>&{ zPx#32;bRa{vGgP5=N469IKCxxWAa00(qQO+^RX1P=iu3u7~qdjJ3eb4f%&R5;63 zlCf$fHx!0Hozc~d9TV(XNC+$`vPs#2Jn`~vslcdc%(x@a=ApT zwWuoAT2e~WdUSLIfT~V=W6Y#A#xR@BkQgI%T?3GFrj&v)hMSuk`o5>{d#;9Nu7wx}u>7Z=#g!)+?Y z#NO@}&V2zWJ3G$^!J{Rx!3D6^t`TC4oS&cLz32A!miznP`S;yxy#JM9_={3{R^dlO zYb{StPgqr@s;ZALmdh0(w7h!tBc&An`1?0XQBq2iHs_3ptQ%}fRS6+rjKNxq$m~PI z<;1*Nt#Hm!N^8nLRF_oiwIX& zSJS^=US3X7-?$rNh%sUpiv`0lkWxZb*-R8dpzAtHDa06AEEZFgjWLJ_!!YnaGL(U* Ty3c`O00000NkvXXu0mjfeJxU9 diff --git a/mesecons/textures/jeija_mesecon_t_junction_off.png b/mesecons/textures/jeija_mesecon_t_junction_off.png deleted file mode 100644 index 71318465fac1ae668eddc2324b211d5deae70e0e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 330 zcmV-Q0k!^#P)Px#32;bRa{vGgP5=N469IKCxxWAa00(qQO+^RX1P>Mh6+?@e$p8QV+(|@1R5;6} zl08oXVGx9$eGh_06D>%zrtxZM_%-yjRFpzON%(ivlr+TPNj&u2vA_}*;ilY=+1cHJ z0MlvG>m(_vNt{8dlNUm@2Do7sQ#7LFk2^Tm6Lh;T6h#IsFJECkztw*Kz-IH#V)1-( z4?7kdk8iYI3n{})^m_Lc#RpYYA~#6F{#uVJXtzbD^GK`pMV{YLmdW$g#)3_9aK|{k~rmMe@=Z>p}52{MI8w7rgt*rA-3<=B#&ipS0 c99|aS7yPnT6UNDv1^@s607*qoM6N<$f|D78@Bjb+ diff --git a/mesecons/textures/jeija_mesecon_t_junction_on.png b/mesecons/textures/jeija_mesecon_t_junction_on.png deleted file mode 100644 index a6609ee190d9af7d6a98d77d99e83331b2af2955..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 319 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|I14-?iy0Vr z{1_Oxg&9kAckTxYvX^-Jy0YJ4;TL1#QGZ~_2^6~M>Eak-aeC?GynpMS)zu8sF&1NTh!32A=6 z+vC0Z7psrv5qq-D-hZw#{xSbZ+3U39jn`P#<_4rSoM21cw6FD1as`vRj@4#a{@i~+ P&oOwq`njxgN@xNA6q9*n diff --git a/mesecons/textures/jeija_mesecon_off.png b/mesecons/textures/mesecons_wire_inv.png similarity index 100% rename from mesecons/textures/jeija_mesecon_off.png rename to mesecons/textures/mesecons_wire_inv.png diff --git a/mesecons/textures/wires_full_off.png b/mesecons/textures/mesecons_wire_off.png similarity index 100% rename from mesecons/textures/wires_full_off.png rename to mesecons/textures/mesecons_wire_off.png diff --git a/mesecons/textures/wires_full_on.png b/mesecons/textures/mesecons_wire_on.png similarity index 100% rename from mesecons/textures/wires_full_on.png rename to mesecons/textures/mesecons_wire_on.png diff --git a/mesecons/textures/wires_bump_off.png b/mesecons/textures/wires_bump_off.png deleted file mode 100644 index 1e0bd7473fb04724c1d3414afbc4c0910ea7d467..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 347 zcmV-h0i^zkP)ZKzpqVmeD}|PXcFwznkPw3FDY%w&9W-~>Re z^?0tLF_x;r3GFJDrC_alfRjPDtLXJQ?HPEU0@VK*?DunlE7G)Px%?!{p5=HHqUc3k zxPs`0crk#Z5jV)i2wiq07*qoM6N<$f|m=VI{*Lx diff --git a/mesecons/textures/wires_inv.png b/mesecons/textures/wires_inv.png deleted file mode 100644 index 626f8d4fecc3c0c295f1be6a464bc627e0421a89..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 167 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9GG!XV7ZFl&wkP>{XE z)7O>#4hILDu8!B__!OX!o2QFoh{fsT1PP80FD5?wZ=62mzp;UV!G;NoBO_+at(m>Q z&h*EBkWAp&#k1I_r-`w#v9*P-uQLQHGB|NEHhoF;ITnUJ7xP))&*OUvG?Bs6)z4*} HQ$iB}67V%l diff --git a/mesecons/textures/wires_off.png b/mesecons/textures/wires_off.png deleted file mode 100644 index 757d339bf13de9437e7ab2f00d66bc00630efcc1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 454 zcmV;%0XhDOP)*{tL=yl20aHmt zK~y-)b(6tv8!-$-A1Qi$$+`A776B6fN0J_D=O5d90NX2Za*&k(@h*>|9xV$1{b9m zN^yAlXZ)y_*I)7ihv)xyz2j*wrSR57#9beNQjG27i@m{lt)jK%0bW?G!FkF!pL6k2 zlyA>JYj9yEHY*k+tqvHR{XOoK0{8AY6XvUWjJJ5*4eSIP@W(@rgWgrz{X9-Wz?oBC-oB#{XvjCmGgLE_`1 wFU!M&VSIn(;)c-IkUHODHqn}xCd1wM1Z!H%u3zy%;s5{u07*qoM6N<$f*vux1^@s6 diff --git a/mesecons/textures/wires_on.png b/mesecons/textures/wires_on.png deleted file mode 100644 index 57bb82d0ab6148e1920ccb568a920a1809887db3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 492 zcmV%oRlC0r4$DoGbfhf#3-Z$DG4B`f;+sv8X_P9W{zq= z#Bq0O?OcpeF>|i3e+&Pehle|lQMkGJa}qlo?%mAMd2Xbnj800zW)p_7h0}S4T8BBr z*hd-{=$y9Zyu6fQ(rTrE4`T}#RUzl`EoNgFx}BT_+3$DW+G0X!&3SukEG_|i$ zy3U*fwc2+VTB~zBHq5$Lk-sh0>XhP`ff>xR(V9_fj~$PVn6r>l@$sCW5Km6iC zxxGEr`24){lw$8d^ zVrR!&IN9%idabZp2{8(_I@8op72Nx$+HUpB5~S3@Zp?{?L&F`et`e$32+n#PNJ+jS ik$-p5)vnk5-FyP^jq20daEyik0000b&FE2ZD*Ie zhOzkYG#LvfdAcdglww()E$Z+otiLu-a1Jl~t%E7O4ZrW$T15LKOtTdU(zPfxn!6yv zE~;QxzJrjRO4NMmnQPluT{(mscALM?&TF%D# z{3HBZ({wfG;B@-_&vMr)d4 zG`7u}+B_$G-wPr5X4Z#8J)y#Bj7DRQ@E%0k6^MY&bH>%9CTDoPtkIjD)0C{)L=mCy zT{A`y{5UGh(wg_&d|u&Xn!YSX=sLlBd3RS;FaxvQob&!KLfFBa4H3iNZV5BETmq_s qbH*?@LXbBk^0yazw8J2Tp!@>Zjj7!t$pZ-h0000 01000100) +local nid_inc = function() end +nid_inc = function (nid) + local i = 0 + while nid[i-1] ~= 1 do + nid[i] = (nid[i] ~= 1) and 1 or 0 + i = i + 1 end - local nodebox = {} - local adjx = false - local adjz = false - if xp == 1 then table.insert(nodebox, box_xp) adjx = true end - if zp == 1 then table.insert(nodebox, box_zp) adjz = true end - if xm == 1 then table.insert(nodebox, box_xm) adjx = true end - if zm == 1 then table.insert(nodebox, box_zm) adjz = true end - if xpy == 1 then table.insert(nodebox, box_xpy) end - if zpy == 1 then table.insert(nodebox, box_zpy) end - if xmy == 1 then table.insert(nodebox, box_xmy) end - if zmy == 1 then table.insert(nodebox, box_zmy) end - - if adjx and adjz and (xp + zp + xm + zm > 2) then - table.insert(nodebox, box_bump1) - tiles_off = { - "wires_bump_off.png", - "wires_bump_off.png", - "wires_vertical_off.png", - "wires_vertical_off.png", - "wires_vertical_off.png", - "wires_vertical_off.png" - } - tiles_on = { - "wires_bump_on.png", - "wires_bump_on.png", - "wires_vertical_on.png", - "wires_vertical_on.png", - "wires_vertical_on.png", - "wires_vertical_on.png" - } - else - table.insert(nodebox, box_center) - tiles_off = { - "wires_off.png", - "wires_off.png", - "wires_vertical_off.png", - "wires_vertical_off.png", - "wires_vertical_off.png", - "wires_vertical_off.png" - } - tiles_on = { - "wires_on.png", - "wires_on.png", - "wires_vertical_on.png", - "wires_vertical_on.png", - "wires_vertical_on.png", - "wires_vertical_on.png" - } + -- BUT: Skip impossible nodeids: + if ((nid[0] == 0 and nid[4] == 1) or (nid[1] == 0 and nid[5] == 1) + or (nid[2] == 0 and nid[6] == 1) or (nid[3] == 0 and nid[7] == 1)) then + return nid_inc(nid) end - if nodeid == "00000000" then - nodebox = {-8/16, -.5, -1/16, 8/16, -.5+1/16, 1/16} - end + return i <= 8 +end - minetest.register_node("mesecons:wire_"..nodeid.."_off", { - description = wiredesc, - drawtype = "nodebox", - tiles = tiles_off, --- inventory_image = "wires_inv.png", --- wield_image = "wires_inv.png", - inventory_image = "jeija_mesecon_off.png", - wield_image = "jeija_mesecon_off.png", - paramtype = "light", - paramtype2 = "facedir", - sunlight_propagates = true, - selection_box = { - type = "fixed", - fixed = {-.5, -.5, -.5, .5, -.5+4/16, .5} - }, - node_box = { - type = "fixed", - fixed = nodebox - }, - groups = groups, - walkable = false, - stack_max = 99, - drop = "mesecons:wire_00000000_off", - mesecons = {conductor={ +register_wires = function() + local nid = {} + while true do + -- Create group specifiction and nodeid string (see note above for details) + local nodeid = (nid[0] or "0")..(nid[1] or "0")..(nid[2] or "0")..(nid[3] or "0") + ..(nid[4] or "0")..(nid[5] or "0")..(nid[6] or "0")..(nid[7] or "0") + + -- Calculate nodebox + local nodebox = {type = "fixed", fixed={box_center}} + for i=0,7 do + if nid[i] == 1 then + table.insert(nodebox.fixed, nbox_nid[i]) + end + end + + -- Add bump to nodebox if curved + if (nid[0] == 1 and nid[1] == 1) or (nid[1] == 1 and nid[2] == 1) + or (nid[2] == 1 and nid[3] == 1) or (nid[3] == 1 and nid[0] == 1) then + table.insert(nodebox.fixed, box_bump1) + end + + -- If nothing to connect to, still make a nodebox of a straight wire + if nodeid == "00000000" then + nodebox.fixed = {-8/16, -.5, -1/16, 8/16, -.5+1/16, 1/16} + end + + local rules = {} + if (nid[0] == 1) then table.insert(rules, vector.new( 1, 0, 0)) end + if (nid[1] == 1) then table.insert(rules, vector.new( 0, 0, 1)) end + if (nid[2] == 1) then table.insert(rules, vector.new(-1, 0, 0)) end + if (nid[3] == 1) then table.insert(rules, vector.new( 0, 0, -1)) end + + if (nid[0] == 1) then table.insert(rules, vector.new( 1, -1, 0)) end + if (nid[1] == 1) then table.insert(rules, vector.new( 0, -1, 1)) end + if (nid[2] == 1) then table.insert(rules, vector.new(-1, -1, 0)) end + if (nid[3] == 1) then table.insert(rules, vector.new( 0, -1, -1)) end + + if (nid[4] == 1) then table.insert(rules, vector.new( 1, 1, 0)) end + if (nid[5] == 1) then table.insert(rules, vector.new( 0, 1, 1)) end + if (nid[6] == 1) then table.insert(rules, vector.new(-1, 1, 0)) end + if (nid[7] == 1) then table.insert(rules, vector.new( 0, 1, -1)) end + + local meseconspec_off = { conductor = { + rules = rules, state = mesecon.state.off, onstate = "mesecons:wire_"..nodeid.."_on" }} - }) - minetest.register_node("mesecons:wire_"..nodeid.."_on", { - description = "Wire ID:"..nodeid, - drawtype = "nodebox", - tiles = tiles_on, --- inventory_image = "wires_inv.png", --- wield_image = "wires_inv.png", - inventory_image = "jeija_mesecon_off.png", - wield_image = "jeija_mesecon_off.png", - paramtype = "light", - paramtype2 = "facedir", - sunlight_propagates = true, - selection_box = { - type = "fixed", - fixed = {-.5, -.5, -.5, .5, -.5+4/16, .5} - }, - node_box = { - type = "fixed", - fixed = nodebox - }, - groups = {dig_immediate = 3, mesecon = 2, not_in_creative_inventory = 1}, - walkable = false, - stack_max = 99, - drop = "mesecons:wire_00000000_off", - mesecons = {conductor={ + local meseconspec_on = { conductor = { + rules = rules, state = mesecon.state.on, offstate = "mesecons:wire_"..nodeid.."_off" }} - }) -end -end -end -end -end -end -end -end --- Updating the wires: --- Place the right connection wire + local groups_on = {dig_immediate = 3, not_in_creative_inventory = 1} + local groups_off = {dig_immediate = 3} + if nodeid ~= "00000000" then + groups_off["not_in_creative_inventory"] = 1 + end -local update_on_place_dig = function (pos, node) - if minetest.registered_nodes[node.name] - and minetest.registered_nodes[node.name].mesecons then - mesecon:update_autoconnect(pos) + mesecon.register_node("mesecons:wire_"..nodeid, { + description = "Mesecon", + drawtype = "nodebox", + inventory_image = "mesecons_wire_inv.png", + wield_image = "mesecons_wire_inv.png", + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + selection_box = selectionbox, + node_box = nodebox, + walkable = false, + drop = "mesecons:wire_00000000_off", + mesecon_wire = true + }, {tiles = tiles_off, mesecons = meseconspec_off, groups = groups_off}, + {tiles = tiles_on, mesecons = meseconspec_on, groups = groups_on}) + + if (nid_inc(nid) == false) then return end end end +register_wires() -minetest.register_on_placenode(update_on_place_dig) -minetest.register_on_dignode(update_on_place_dig) - -function mesecon:update_autoconnect(pos, secondcall, replace_old) - local xppos = {x=pos.x+1, y=pos.y, z=pos.z} - local zppos = {x=pos.x, y=pos.y, z=pos.z+1} - local xmpos = {x=pos.x-1, y=pos.y, z=pos.z} - local zmpos = {x=pos.x, y=pos.y, z=pos.z-1} - - local xpympos = {x=pos.x+1, y=pos.y-1, z=pos.z} - local zpympos = {x=pos.x, y=pos.y-1, z=pos.z+1} - local xmympos = {x=pos.x-1, y=pos.y-1, z=pos.z} - local zmympos = {x=pos.x, y=pos.y-1, z=pos.z-1} - - local xpypos = {x=pos.x+1, y=pos.y+1, z=pos.z} - local zpypos = {x=pos.x, y=pos.y+1, z=pos.z+1} - local xmypos = {x=pos.x-1, y=pos.y+1, z=pos.z} - local zmypos = {x=pos.x, y=pos.y+1, z=pos.z-1} - - if secondcall == nil then - mesecon:update_autoconnect(xppos, true) - mesecon:update_autoconnect(zppos, true) - mesecon:update_autoconnect(xmpos, true) - mesecon:update_autoconnect(zmpos, true) - - mesecon:update_autoconnect(xpypos, true) - mesecon:update_autoconnect(zpypos, true) - mesecon:update_autoconnect(xmypos, true) - mesecon:update_autoconnect(zmypos, true) - - mesecon:update_autoconnect(xpympos, true) - mesecon:update_autoconnect(zpympos, true) - mesecon:update_autoconnect(xmympos, true) - mesecon:update_autoconnect(zmympos, true) - end - - nodename = minetest.get_node(pos).name - if string.find(nodename, "mesecons:wire_") == nil and not replace_old then return nil end - - if mesecon:rules_link_anydir(pos, xppos) then xp = 1 else xp = 0 end - if mesecon:rules_link_anydir(pos, xmpos) then xm = 1 else xm = 0 end - if mesecon:rules_link_anydir(pos, zppos) then zp = 1 else zp = 0 end - if mesecon:rules_link_anydir(pos, zmpos) then zm = 1 else zm = 0 end - - if mesecon:rules_link_anydir(pos, xpympos) then xp = 1 end - if mesecon:rules_link_anydir(pos, xmympos) then xm = 1 end - if mesecon:rules_link_anydir(pos, zpympos) then zp = 1 end - if mesecon:rules_link_anydir(pos, zmympos) then zm = 1 end - - if mesecon:rules_link_anydir(pos, xpypos) then xpy = 1 else xpy = 0 end - if mesecon:rules_link_anydir(pos, zpypos) then zpy = 1 else zpy = 0 end - if mesecon:rules_link_anydir(pos, xmypos) then xmy = 1 else xmy = 0 end - if mesecon:rules_link_anydir(pos, zmypos) then zmy = 1 else zmy = 0 end - - if xpy == 1 then xp = 1 end - if zpy == 1 then zp = 1 end - if xmy == 1 then xm = 1 end - if zmy == 1 then zm = 1 end - - local nodeid = tostring(xp )..tostring(zp )..tostring(xm )..tostring(zm ).. - tostring(xpy)..tostring(zpy)..tostring(xmy)..tostring(zmy) - - - if string.find(nodename, "_off") ~= nil then - minetest.set_node(pos, {name = "mesecons:wire_"..nodeid.."_off"}) - else - minetest.set_node(pos, {name = "mesecons:wire_"..nodeid.."_on" }) - end -end - -if not minetest.registered_nodes["default:stone_with_mese"] then --before MESE update, use old recipes - minetest.register_craft({ - output = "mesecons:wire_00000000_off 18", - recipe = { - {"default:mese"}, - } - }) -else - - minetest.register_craft({ - type = "cooking", - output = "mesecons:wire_00000000_off 2", - recipe = "default:mese_crystal_fragment", - cooktime = 3, - }) - - minetest.register_craft({ - type = "cooking", - output = "mesecons:wire_00000000_off 18", - recipe = "default:mese_crystal", - cooktime = 15, - }) - - minetest.register_craft({ - type = "cooking", - output = "mesecons:wire_00000000_off 162", - recipe = "default:mese", - cooktime = 30, - }) - -end +-- ############## +-- ## Crafting ## +-- ############## +minetest.register_craft({ + type = "cooking", + output = "mesecons:wire_00000000_off 2", + recipe = "default:mese_crystal_fragment", + cooktime = 3, +}) minetest.register_craft({ type = "cooking", - output = "mesecons:wire_00000000_off 16", + output = "mesecons:wire_00000000_off 18", recipe = "default:mese_crystal", + cooktime = 15, +}) + +minetest.register_craft({ + type = "cooking", + output = "mesecons:wire_00000000_off 162", + recipe = "default:mese", + cooktime = 30, }) diff --git a/mesecons_extrawires/vertical.lua b/mesecons_extrawires/vertical.lua index 16de55e..24e36e1 100644 --- a/mesecons_extrawires/vertical.lua +++ b/mesecons_extrawires/vertical.lua @@ -69,7 +69,7 @@ end minetest.register_node("mesecons_extrawires:vertical_on", { description = "Vertical mesecon", drawtype = "nodebox", - tiles = {"wires_vertical_on.png"}, + tiles = {"mesecons_wire_on.png"}, walkable = false, paramtype = "light", sunlight_propagates = true, @@ -91,7 +91,7 @@ minetest.register_node("mesecons_extrawires:vertical_on", { minetest.register_node("mesecons_extrawires:vertical_off", { description = "Vertical mesecon", drawtype = "nodebox", - tiles = {"wires_vertical_off.png"}, + tiles = {"mesecons_wire_off.png"}, walkable = false, paramtype = "light", sunlight_propagates = true, @@ -113,7 +113,7 @@ minetest.register_node("mesecons_extrawires:vertical_off", { minetest.register_node("mesecons_extrawires:vertical_top_on", { description = "Vertical mesecon", drawtype = "nodebox", - tiles = {"wires_full_on.png","wires_full_on.png","wires_vertical_on.png"}, + tiles = {"mesecons_wire_on.png"}, walkable = false, paramtype = "light", sunlight_propagates = true, @@ -135,7 +135,7 @@ minetest.register_node("mesecons_extrawires:vertical_top_on", { minetest.register_node("mesecons_extrawires:vertical_top_off", { description = "Vertical mesecon", drawtype = "nodebox", - tiles = {"wires_full_off.png","wires_full_off.png","wires_vertical_off.png"}, + tiles = {"mesecons_wire_off.png"}, walkable = false, paramtype = "light", sunlight_propagates = true, @@ -158,7 +158,7 @@ minetest.register_node("mesecons_extrawires:vertical_top_off", { minetest.register_node("mesecons_extrawires:vertical_bottom_on", { description = "Vertical mesecon", drawtype = "nodebox", - tiles = {"wires_full_on.png","wires_full_on.png","wires_vertical_on.png"}, + tiles = {"mesecons_wire_on.png"}, walkable = false, paramtype = "light", sunlight_propagates = true, @@ -179,7 +179,7 @@ minetest.register_node("mesecons_extrawires:vertical_bottom_on", { minetest.register_node("mesecons_extrawires:vertical_bottom_off", { description = "Vertical mesecon", drawtype = "nodebox", - tiles = {"wires_full_off.png","wires_full_off.png","wires_vertical_off.png"}, + tiles = {"mesecons_wire_off.png"}, walkable = false, paramtype = "light", sunlight_propagates = true, diff --git a/mesecons_insulated/init.lua b/mesecons_insulated/init.lua index 9fdf494..26e3efb 100644 --- a/mesecons_insulated/init.lua +++ b/mesecons_insulated/init.lua @@ -41,7 +41,7 @@ minetest.register_node("mesecons_insulated:insulated_on", { minetest.register_node("mesecons_insulated:insulated_off", { drawtype = "nodebox", - description = "insulated mesecons", + description = "Insulated Mesecon", tiles = { "jeija_insulated_wire_sides_off.png", "jeija_insulated_wire_sides_off.png", @@ -78,7 +78,3 @@ minetest.register_craft({ {"mesecons_materials:fiber", "mesecons_materials:fiber", "mesecons_materials:fiber"}, } }) - -mesecon:add_rules("insulated", { -{x = 1, y = 0, z = 0}, -{x =-1, y = 0, z = 0}}) diff --git a/mesecons_microcontroller/init.lua b/mesecons_microcontroller/init.lua index 8c9f3b8..9883b85 100644 --- a/mesecons_microcontroller/init.lua +++ b/mesecons_microcontroller/init.lua @@ -1,5 +1,7 @@ EEPROM_SIZE = 255 +local microc_rules = {} + for a = 0, 1 do for b = 0, 1 do for c = 0, 1 do @@ -34,7 +36,7 @@ if (a == 0) then table.insert(input_rules, {x = -1, y = 0, z = 0, name = "A"}) if (b == 0) then table.insert(input_rules, {x = 0, y = 0, z = 1, name = "B"}) end if (c == 0) then table.insert(input_rules, {x = 1, y = 0, z = 0, name = "C"}) end if (d == 0) then table.insert(input_rules, {x = 0, y = 0, z = -1, name = "D"}) end -mesecon:add_rules(nodename, rules) +microc_rules[nodename] = rules local mesecons = {effector = { @@ -131,7 +133,7 @@ minetest.register_node(nodename, { sounds = default.node_sound_stone_defaults(), mesecons = mesecons, after_dig_node = function (pos, node) - rules = mesecon:get_rules(node.name) + rules = microc_rules[node.name] mesecon:receptor_off(pos, rules) end, }) @@ -600,22 +602,22 @@ function yc_action_setports(pos, L, Lv) local name = "mesecons_microcontroller:microcontroller" local rules if Lv.a ~= L.a then - rules = mesecon:get_rules(name.."0001") + rules = microc_rules[name.."0001"] if L.a == true then mesecon:receptor_on(pos, rules) else mesecon:receptor_off(pos, rules) end end if Lv.b ~= L.b then - rules = mesecon:get_rules(name.."0010") + rules = microc_rules[name.."0010"] if L.b == true then mesecon:receptor_on(pos, rules) else mesecon:receptor_off(pos, rules) end end if Lv.c ~= L.c then - rules = mesecon:get_rules(name.."0100") + rules = microc_rules[name.."0100"] if L.c == true then mesecon:receptor_on(pos, rules) else mesecon:receptor_off(pos, rules) end end if Lv.d ~= L.d then - rules = mesecon:get_rules(name.."1000") + rules = microc_rules[name.."1000"] if L.d == true then mesecon:receptor_on(pos, rules) else mesecon:receptor_off(pos, rules) end end diff --git a/mesecons_movestones/init.lua b/mesecons_movestones/init.lua index e31f2d2..e8c52cb 100644 --- a/mesecons_movestones/init.lua +++ b/mesecons_movestones/init.lua @@ -67,7 +67,7 @@ minetest.register_node("mesecons_movestones:movestone", { local direction=mesecon:get_movestone_direction(pos) if not direction then return end minetest.remove_node(pos) - mesecon:update_autoconnect(pos) + mesecon.update_autoconnect(pos) minetest.add_entity(pos, "mesecons_movestones:movestone_entity") end }} @@ -146,7 +146,7 @@ minetest.register_node("mesecons_movestones:sticky_movestone", { local direction=mesecon:get_movestone_direction(pos) if not direction then return end minetest.remove_node(pos) - mesecon:update_autoconnect(pos) + mesecon.update_autoconnect(pos) minetest.add_entity(pos, "mesecons_movestones:sticky_movestone_entity") end }} diff --git a/mesecons_mvps/init.lua b/mesecons_mvps/init.lua index 0079f1a..a9c0da8 100644 --- a/mesecons_mvps/init.lua +++ b/mesecons_mvps/init.lua @@ -42,9 +42,7 @@ end function mesecon:mvps_process_stack(stack) -- update mesecons for placed nodes ( has to be done after all nodes have been added ) for _, n in ipairs(stack) do - nodeupdate(n.pos) mesecon.on_placenode(n.pos, minetest.get_node(n.pos)) - mesecon:update_autoconnect(n.pos) end end @@ -92,7 +90,6 @@ function mesecon:mvps_push(pos, dir, maximum) -- pos: pos of mvps; dir: directio -- update mesecons for removed nodes ( has to be done after all nodes have been removed ) for _, n in ipairs(nodes) do mesecon.on_dignode(n.pos, n.node) - mesecon:update_autoconnect(n.pos) end -- add nodes @@ -121,7 +118,7 @@ end mesecon:register_on_mvps_move(function(moved_nodes) for _, n in ipairs(moved_nodes) do mesecon.on_placenode(n.pos, n.node) - mesecon:update_autoconnect(n.pos) + mesecon.update_autoconnect(n.pos) end end) @@ -140,7 +137,7 @@ function mesecon:mvps_pull_single(pos, dir) -- pos: pos of mvps; direction: dire nodeupdate(np) nodeupdate(pos) mesecon.on_dignode(np, nn) - mesecon:update_autoconnect(np) + mesecon.update_autoconnect(np) on_mvps_move({{pos = pos, oldpos = np, node = nn, meta = meta}}) end return {{pos = np, node = {param2 = 0, name = "air"}}, {pos = pos, node = nn}} @@ -188,7 +185,7 @@ function mesecon:mvps_pull_all(pos, direction) -- pos: pos of mvps; direction: d and minetest.registered_nodes[lnode.name].liquidtype ~= "none") minetest.remove_node(oldpos) mesecon.on_dignode(oldpos, lnode2) - mesecon:update_autoconnect(oldpos) + mesecon.update_autoconnect(oldpos) on_mvps_move(moved_nodes) end diff --git a/mesecons_receiver/init.lua b/mesecons_receiver/init.lua index 3b1108e..b368f24 100644 --- a/mesecons_receiver/init.lua +++ b/mesecons_receiver/init.lua @@ -81,16 +81,8 @@ minetest.register_node("mesecons_receiver:receiver_off", { }} }) -mesecon:add_rules("receiver_pos", {{x = 2, y = 0, z = 0}}) - -mesecon:add_rules("receiver_pos_all", { -{x = 2, y = 0, z = 0}, -{x =-2, y = 0, z = 0}, -{x = 0, y = 0, z = 2}, -{x = 0, y = 0, z =-2}}) - function mesecon:receiver_get_pos_from_rcpt(pos, param2) - local rules = mesecon:get_rules("receiver_pos") + local rules = {{x = 2, y = 0, z = 0}} if param2 == nil then param2 = minetest.get_node(pos).param2 end if param2 == 2 then rules = mesecon:rotate_rules_left(rules) @@ -119,7 +111,7 @@ function mesecon:receiver_place(rcpt_pos) else minetest.add_node(pos, {name = "mesecons_receiver:receiver_off", param2 = node.param2}) end - mesecon:update_autoconnect(pos) + mesecon.update_autoconnect(pos) end end @@ -130,7 +122,7 @@ function mesecon:receiver_remove(rcpt_pos, dugnode) minetest.dig_node(pos) local node = {name = "mesecons:wire_00000000_off"} minetest.add_node(pos, node) - mesecon:update_autoconnect(pos) + mesecon.update_autoconnect(pos) mesecon.on_placenode(pos, node) end end @@ -149,7 +141,10 @@ end) minetest.register_on_placenode(function (pos, node) if string.find(node.name, "mesecons:wire_") ~=nil then - rules = mesecon:get_rules("receiver_pos_all") + rules = { {x = 2, y = 0, z = 0}, + {x =-2, y = 0, z = 0}, + {x = 0, y = 0, z = 2}, + {x = 0, y = 0, z =-2}} local i = 1 while rules[i] ~= nil do np = {