From 867af5ed2ec59059114eebc3829a09007b811348 Mon Sep 17 00:00:00 2001 From: sys4-fr Date: Tue, 6 Nov 2018 15:37:40 +0100 Subject: [PATCH] Ajout du support des mods youngtrees, woodsoils, flowers --- depends.txt | 5 +- init.lua | 3 - snow.lua | 183 +++++++++++------------ textures/christmas_craft_leaves_side.png | Bin 0 -> 495 bytes textures/christmas_craft_leaves_top.png | Bin 0 -> 338 bytes textures/christmas_grass_1.png | Bin 0 -> 151 bytes textures/christmas_grass_2.png | Bin 0 -> 155 bytes textures/christmas_grass_3.png | Bin 0 -> 193 bytes textures/christmas_grass_4.png | Bin 0 -> 170 bytes textures/christmas_grass_5.png | Bin 0 -> 202 bytes textures/christmas_junglegrass.png | Bin 0 -> 205 bytes textures/christmas_leaves.png | Bin 273 -> 205 bytes textures/christmas_youngtree16xa.png | Bin 0 -> 344 bytes textures/christmas_youngtree16xb.png | Bin 0 -> 277 bytes textures/snow.png | Bin 0 -> 342 bytes textures/snow_apple.png | Bin 0 -> 249 bytes textures/snow_dandelion_white.png | Bin 0 -> 122 bytes textures/snow_dandelion_yellow.png | Bin 0 -> 118 bytes textures/snow_geranium.png | Bin 0 -> 269 bytes textures/snow_rose.png | Bin 0 -> 120 bytes textures/snow_tulip.png | Bin 0 -> 124 bytes textures/snow_viola.png | Bin 0 -> 117 bytes 22 files changed, 88 insertions(+), 103 deletions(-) create mode 100644 textures/christmas_craft_leaves_side.png create mode 100644 textures/christmas_craft_leaves_top.png create mode 100644 textures/christmas_grass_1.png create mode 100644 textures/christmas_grass_2.png create mode 100644 textures/christmas_grass_3.png create mode 100644 textures/christmas_grass_4.png create mode 100644 textures/christmas_grass_5.png create mode 100644 textures/christmas_junglegrass.png create mode 100644 textures/christmas_youngtree16xa.png create mode 100644 textures/christmas_youngtree16xb.png create mode 100755 textures/snow.png create mode 100644 textures/snow_apple.png create mode 100644 textures/snow_dandelion_white.png create mode 100644 textures/snow_dandelion_yellow.png create mode 100644 textures/snow_geranium.png create mode 100644 textures/snow_rose.png create mode 100644 textures/snow_tulip.png create mode 100644 textures/snow_viola.png diff --git a/depends.txt b/depends.txt index 331d858..8383c10 100644 --- a/depends.txt +++ b/depends.txt @@ -1 +1,4 @@ -default \ No newline at end of file +default +youngtrees? +woodsoil? +flowers? diff --git a/init.lua b/init.lua index 7104040..e492ebe 100644 --- a/init.lua +++ b/init.lua @@ -13,9 +13,6 @@ local config = Settings(worldpath.."/christmas_craft.conf") local conf_table = config:to_table() - - - --look into readme.md how to change settings local defaults = { enable_snowing = "true", diff --git a/snow.lua b/snow.lua index fceca58..c67fa6c 100644 --- a/snow.lua +++ b/snow.lua @@ -1,118 +1,103 @@ print (" ---- Overrider christmas_craft = true! ---- ") -minetest.register_node(":default:dirt_with_grass", { - description = "Dirt with Grass", - tiles = {"default_snow.png", "default_dirt.png", "default_dirt.png^default_snow_side.png"}, - is_ground_content = true, - groups = {crumbly=3,soil=1}, - drop = { - max_items = 2, items = { - {items = {'default:dirt'}, rarity = 0,}, - {items = {'default:snow'}, rarity = 0,}, - }}, - sounds = default.node_sound_dirt_defaults({ - footstep = {name="default_grass_footstep", gain=0.4}, - }), -}) +local snowballdrop = {items = {'default:snow'}, rarity = 0} - -minetest.register_node(":default:leaves", { - description = "Leaves", - drawtype = "allfaces_optional", - waving = 1, - visual_scale = 1.3, - tiles = {"christmas_leaves_side.png"}, - special_tiles = {"default_leaves_simple.png"}, - paramtype = "light", - is_ground_content = false, - groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1}, - drop = { - max_items = 1, - items = { - { - -- player will get sapling with 1/20 chance - items = {'default:sapling'}, - rarity = 20, - }, - { - -- player will get leaves only if he get no saplings, - -- this is because max_items is 1 - items = {'default:leaves'}, +local add_drop = function (def) + if type(def.drop) == "table" then + if def.drop.max_items then + def.drop.max_items = def.drop.max_items + 1 + end + table.insert(def.drop.items, snowballdrop) + elseif type(def.drop) == "string" then + def.drop = { + items = { + {items = {def.drop}, rarity = 0}, + snowballdrop } } - }, - sounds = default.node_sound_leaves_defaults(), - - after_place_node = default.after_place_leaves, -}) - - -minetest.register_node(":default:aspen_leaves", { - description = "Aspen Leaves", - drawtype = "allfaces_optional", - visual_scale = 1.3, - tiles = {"christmas_aspen_leaves.png"}, - waving = 1, - paramtype = "light", - is_ground_content = false, - groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1}, - drop = { - max_items = 1, - items = { - {items = {"default:aspen_sapling"}, rarity = 20}, - {items = {"default:aspen_leaves"}} + else + def.drop = { + items = { + snowballdrop + } } - }, - sounds = default.node_sound_leaves_defaults(), + end +end - after_place_node = default.after_place_leaves, +local data = minetest.registered_nodes["default:dirt_with_snow"] +minetest.override_item( + "default:dirt_with_grass", { + tiles = data.tiles, + sounds = data.sounds, }) +minetest.override_item( + "default:dirt_with_dry_grass", { + tiles = data.tiles, + sounds = data.sounds, +}) - --- old code ---[[ -minetest.register_node(":default:leaves", { - description = "Leaves", +local nodebox = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5} + } +} +local leavesoverride = { drawtype = "nodebox", - visual_scale = 1.3, - tiles = {"default_snow.png", "christmas_leaves_bot.png", "christmas_leaves_side.png"}, + visual_scale = 1, + tiles = {"snow.png", "christmas_craft_leaves_top.png", "christmas_craft_leaves_side.png"}, paramtype = "light", - groups = {snappy=3, leafdecay=3, flammable=2, leaves=1}, - drop = { - max_items = 1, - items = { - { - -- player will get sapling with 1/20 chance - items = {'default:sapling'}, - rarity = 20, - }, - { - -- player will get leaves only if he get no saplings, - -- this is because max_items is 1 - items = {'default:leaves'}, - } - } - }, - sounds = default.node_sound_leaves_defaults(), - node_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, - }, - }, - selection_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, - }, - }, + node_box = nodebox, + selection_box = nodebox +} -}) +-- replace leaves +minetest.override_item("default:leaves", leavesoverride) +minetest.override_item("default:aspen_leaves", leavesoverride) +minetest.override_item("default:jungleleaves", leavesoverride) -]] +-- replace grass +for i=1,5 do + minetest.override_item("default:grass_" .. i, {tiles = {"christmas_grass_"..i..".png"}}) +end +-- Replace junglegrass +minetest.override_item("default:junglegrass", {tiles = {"christmas_junglegrass.png"}}) +-- Replace youngtrees +if minetest.registered_items["youngtrees:youngtree_top"] then + minetest.override_item("youngtrees:youngtree_top", {tiles = {"christmas_youngtree16xa.png"}}) + minetest.override_item("youngtrees:youngtree_middle", {tiles = {"christmas_youngtree16xb.png"}}) +end + +-- Replace woodsoils +if minetest.registered_items["woodsoils:grass_with_leaves_1"] then + minetest.override_item("woodsoils:grass_with_leaves_1", {tiles = {"snow.png", "default_dirt.png", "default_dirt.png^grass_w_snow_side.png"}}) + add_drop(minetest.registered_items["woodsoils:grass_with_leaves_1"]) +end + +if minetest.registered_items["woodsoils:grass_with_leaves_2"] then + minetest.override_item("woodsoils:grass_with_leaves_2", {tiles = {"snow.png", "default_dirt.png", "default_dirt.png^grass_w_snow_side.png"}}) + add_drop(minetest.registered_items["woodsoils:grass_with_leaves_2"]) +end + +if minetest.registered_items["woodsoils:dirt_with_leaves_1"] then + minetest.override_item("woodsoils:dirt_with_leaves_1", {tiles = {"snow.png", "default_dirt.png", "default_dirt.png^grass_w_snow_side.png^woodsoils_ground_cover_side.png"}}) + add_drop(minetest.registered_items["woodsoils:dirt_with_leaves_1"]) +end + +if minetest.registered_items["woodsoils:dirt_with_leaves_2"] then + minetest.override_item("woodsoils:dirt_with_leaves_2", {tiles = {"snow.png", "default_dirt.png", "default_dirt.png^grass_w_snow_side.png^woodsoils_ground_cover_side.png"}}) + add_drop(minetest.registered_items["woodsoils:dirt_with_leaves_2"]) +end + +-- replace flowers +for _,name in pairs({"dandelion_yellow", "geranium", "rose", "tulip", "dandelion_white", "viola"}) do + local flowername = "flowers:"..name + local tiles = { "snow_" .. name .. ".png" } + minetest.override_item(flowername, { tiles = tiles }) +end print (" ---- Overrider christmas_craft [OK] ---- ") diff --git a/textures/christmas_craft_leaves_side.png b/textures/christmas_craft_leaves_side.png new file mode 100644 index 0000000000000000000000000000000000000000..2b6c4a873622906ba74fbcd33ab2c048c1ef0c14 GIT binary patch literal 495 zcmVAZ|4fbzoq6C@6$OERt+&vSehty1Bo;zQe-8 z#KOVJ#Kh3h&(YD))6&w@)6&$$zSY&#)z#J3*4EhA*xA_E+S=OO+}z&T*Wc96-{0Th z;NRfj;NjNK;n>vT!@1+!*W=&Z%tw=jZ3>=;-R|>hSRJ`}_O<^Yj1z z|L4ebfdBvi19VbOQvd+_&>8Pa0002SNkl>cid+EoioPk`83@ZProQ-EC{%Cbn3gqjclq71#-{5)DvO z4KNf7H#AH%QphtEC{0MH($Hve)|r%(vneIzk*bC&&<>`OAU~j;Ws}cZ0D1F0T^vIy zZpoerEIVYt<8o15G0S=Jss_$uyc_<HcwJ(AHVS|jz>q1s1^gA%HZkh=d#Wzp$P!y<8Lqk literal 0 HcmV?d00001 diff --git a/textures/christmas_grass_1.png b/textures/christmas_grass_1.png new file mode 100644 index 0000000000000000000000000000000000000000..93faba5520b2d5abd2afc9071c1f93ce068bcf17 GIT binary patch literal 151 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPFv4DbnY1=5oyO`0)d#_ZX%=gyrw zZ{EBG3l^+gxpLL2RU0>M+_Y(v*^Qf)Kt+rtL4Lsu4$p3+0XZt3E{-7_vdIY&90!hW vV90pOq{r6ABF2|yrl9XIcW$8)_hA?Af#D z&6~Gi!Ge`5S8m+6anq(vi?WwL0jgju3GxeOaCmkj4am{B*-tA!Qt7BG$6;x z)5S5Qg7Ip5qhNyp$B|27TWhZVJuW&$^~n$KL;UabxWY>RM2c-PnxdDkw$Cd&KZB!e p#)`|5J1mc|P2ZWg!ne zAc=%*lSgMuLRkxKAO3L4qvIHlZ8cA$+>s|A1rfHYy`ZH0Ro||Ree9il++svzH Sb?G6HBRpOGT-G@yGywp}k3T2? literal 0 HcmV?d00001 diff --git a/textures/christmas_grass_5.png b/textures/christmas_grass_5.png new file mode 100644 index 0000000000000000000000000000000000000000..8cfff79283d858f5d2728c4c36cc4faa18e2c485 GIT binary patch literal 202 zcmeAS@N?(olHy`uVBq!ia0vp^0wBx*Bp9q_EZ7UAm`Z~Df*BafCZDwc@|rze977}| zSr2Z^Y6%cwJ@E6pNT80G-{U5mN&&GwjNJLt_n+ngsxx6Qzpx-vZ%2dusorG=-!A$Y zy5(ApjoQ*3H5;{qFXTzaJ<|R2AtGseXTTKII3;5v%Sl)BHeXX~u2OeXQoiRpO=k18 w6ElsQQ&(@)w=~Yarg3e~*0=8StlVntzw%!b@ijfwwFB%(Pgg&ebxsLQ03}mNb^rhX literal 0 HcmV?d00001 diff --git a/textures/christmas_junglegrass.png b/textures/christmas_junglegrass.png new file mode 100644 index 0000000000000000000000000000000000000000..31f154e4d774cfea1df31da2b2f018cade1e4d35 GIT binary patch literal 205 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbL!P=HT}E0At(Ztm~zpEPOGmMvS( zo;|zM=VcR6l(8hpFPOpM*^M+HC)3l#F+}3BYoB8uizCk=nFIg-f0EnfR;@funPCw_ z!oCZ?-W{)hQt1-rnE9XchMn%DEJl%sDQ_L@)r(xWbZs+ru8wus@h;2#{)EzN_x?nk zjha<$yhx_Rl{GKwRqk4i?yZs2-Zy){ou*MQxQEH5cA~*nprs6+u6{1-oD!M<0B%hl literal 0 HcmV?d00001 diff --git a/textures/christmas_leaves.png b/textures/christmas_leaves.png index b84468826705a64ecd5bd4afe87088ccc2aa89e4..be611d4f90f36a3fdfa7383cc84f139dac40fa4d 100644 GIT binary patch delta 189 zcmbQpbe3^~L_G&H0|SGGE`KnP5(@AMaRt)S8sdsZGOFhCmSF~VaVAm~-phcZj3q&S z!3+-1ZlnP@nVv3=ArhBO`yKgM90i Qt2h$!{yYzD1!WLEx}r-b|kG1O;LFL>E3D zCZKZV9Bu#eTjduKkXV<9+ z0VMAN(cRs5-<>(QeeHv5*B-n&^Xkikd(X~Zf3o-Pi?c7@-ECdvaP#S*$FDEA8!6~2 zE4mvirnSrG&ebZMEK#x8sH!WZYQ9;`(%`yf?u|&px-}vhJkmaX=N7o-U3d5|XS3Ih9-t z1y~PkI)8)r(#N-s`+wgL5M{W;_+Ux(eNG1Rmv_`<4>(ul_1&MOyqo2E_Wzo|&s(Fd z7)@vFFR8o7{hU=g@A~P55)40n$2c=4oLkDqkaIb8?Gna>8&(VfIae7Mth@4ukKyr` koIAB^)ftvn{Q1CtLy~)a%$e^yfsSDCboFyt=akR{01Qc)6aWAK literal 0 HcmV?d00001 diff --git a/textures/christmas_youngtree16xb.png b/textures/christmas_youngtree16xb.png new file mode 100644 index 0000000000000000000000000000000000000000..d3bd8615933c89a62490b9a89fa631c2354dde8e GIT binary patch literal 277 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbK}V1Q4EE0F#V0jpO1|G#Sg|NZ~Z zoB;|Pdvxr=g$vK0U$}AO#-~r8p1r$w;?SYvhxR;veD}rMYwpGhy2^^~#){!h8foqF zg_9*(Ry%z7@Bye%;^hV+U&kq=J^Is67nCwRIz zhDb=V9_(anau8tI(D38`J&t$Z;#Y7s7#?JCkYi|I1Uk5Zfq{kLE;r+XT>=d&Hy>np zf9dO4Var9ku6nUm7QUKw_u;fygK}L4&SO!$3UfY3OFP6Q?-y+-{BhtZztmIKaGvS2 Regf@c@O1TaS?83{1OUiJbEyCT literal 0 HcmV?d00001 diff --git a/textures/snow.png b/textures/snow.png new file mode 100755 index 0000000000000000000000000000000000000000..d558746fe28d1353eec51403b4cbc9cdd61b2df0 GIT binary patch literal 342 zcmeAS@N?(olHy`uVBq!ia0vp^0wBx*Bp9q_EZ7UA7>k44ofy`glX(f`u%tWsIx;Y9 z?C1WI$O`0h7I;J!Gca%qfiUBxyLEqng6t)pzOL+dSOs|al!`U1MS((6C9V-A!TD(= z<%vb93;~Imc_n&&t|1C##(JiDh6V;-iWUM@ZSr(+43UszJ;)t)*no%Sz}547x&{A} zgMLX#oz^x~whz<&v+C++)xHmVt_vqi>+RhhRQt-c#Z%^M-sdYZx6@R!MV+@P21mHIc&D8UYn;zB&+4tUu9cXpYFaP8*AEhR>;)! g%<83FKgB-Cb0t+jY)j182XsAyr>mdKI;Vst0C2s1AOHXW literal 0 HcmV?d00001 diff --git a/textures/snow_apple.png b/textures/snow_apple.png new file mode 100644 index 0000000000000000000000000000000000000000..33493edb87a4d85085127f6eed779c8a1487d3bc GIT binary patch literal 249 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbK}cz{ocD<>0!FfY5bFpsLVppJr= zuA;bvzO1RbjJbx4jJcA%zM`X{vZB4Zw}pnUjdp~qVZ4`VvaflnzeR4CeQ~r?S&UP8 ztaE*`M{9;pN49TQj{l5`i21cKz3gs=Kr0wag8YIR9G=}s19Ad9T^vIyZmm6G$<(00 z!{8{Oe?VJEbi)7r!5cl6Y%1I>`!Tud$D}av-Im$cpMG^``C#4M{qmf2n=$h@mf|W0 qK_5kX4<=(amkbG)@YP%hJopVP^$2o59o7&t;ucLK6TOphmR- literal 0 HcmV?d00001 diff --git a/textures/snow_dandelion_white.png b/textures/snow_dandelion_white.png new file mode 100644 index 0000000000000000000000000000000000000000..336e893992f492ecec5821aadb42996fca811a3a GIT binary patch literal 122 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`j-D=#Ar*|t3k)S#r>~#ip2%gQ zY*5Me=GN|BCFT{+c{eqBN^z$eJ~Z#{HDZ3|bLyx6Mn(mnZO3+S?EZhnfMt0a1N)(X V(%9oC`hkWqc)I$ztaD0e0s!Z1CtCmj literal 0 HcmV?d00001 diff --git a/textures/snow_dandelion_yellow.png b/textures/snow_dandelion_yellow.png new file mode 100644 index 0000000000000000000000000000000000000000..3ebb9e62bb4681d4a82fc319523f053bbcfb9672 GIT binary patch literal 118 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`ww^AIAr*|t3k)S#^Vc6RV4Wp6 z!-u&~XTb@ESC!2*36qXFMf#k{JNw`M1KW?YNy`4p9LIlIH}EdFArOzopr0A3X(DF6Tf literal 0 HcmV?d00001 diff --git a/textures/snow_geranium.png b/textures/snow_geranium.png new file mode 100644 index 0000000000000000000000000000000000000000..33b809d1900d51174a5e3d1f86d6add40645b248 GIT binary patch literal 269 zcmV+o0rLKdP)Ned^i*&c>M>v z#`_S1fzv6{V`BZCXa5(UzWjgT=}Z5~j?VtNH1af8XNUZU836J>*@nOjpqUo{Pz6`W TC|=kC00000NkvXXu0mjf4WDm1 literal 0 HcmV?d00001 diff --git a/textures/snow_rose.png b/textures/snow_rose.png new file mode 100644 index 0000000000000000000000000000000000000000..7e32736663c914747fb67cc7105c92a7c75c4947 GIT binary patch literal 120 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`_MR?|Ar*|t5^oYj<}^N1eUcT| z)N|6TK_~oxN$@M)md~0DYMDAuGT*HG{7?STV%B3RxA`vnOk`BxDdBw^!^jZ6U#?wu S9&0$zCVcy-##4ONufOo~Iu3!G^7zNIzFrDK4u*vw?YDos; Xf07?>TV?(M8pq)2>gTe~DWM4fn*}ND literal 0 HcmV?d00001 diff --git a/textures/snow_viola.png b/textures/snow_viola.png new file mode 100644 index 0000000000000000000000000000000000000000..95d2871a98c023f38e017fa40680a859f6500256 GIT binary patch literal 117 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Hl8kyAr*|t3T!=1fdNthzT4bN zeC8?UzO4O!@+!}<+soen;y;v9z0|_zrM+w8j@9RX+PltjoS_shaEXWE)Eni+i>{}| Q1I=OZboFyt=akR{0KEh#X8-^I literal 0 HcmV?d00001