From c4fe70ba30a6b7738913a88208d1005e350e111d Mon Sep 17 00:00:00 2001 From: HybridDog Date: Sun, 17 Nov 2013 21:04:15 +0100 Subject: [PATCH] change nether trees --- nether/init.lua | 195 +++++++++++++++++---- nether/textures/nether_blood.png | Bin 0 -> 448 bytes nether/textures/nether_blood_side.png | Bin 0 -> 525 bytes nether/textures/nether_blood_stem.png | Bin 0 -> 446 bytes nether/textures/nether_blood_stem_top.png | Bin 0 -> 442 bytes nether/textures/nether_blood_top.png | Bin 0 -> 463 bytes nether/textures/nether_brick_shadow.png | Bin 0 -> 196 bytes nether/textures/nether_portal_particle.png | Bin 0 -> 368 bytes nether/textures/nether_portal_stuff.png | Bin 497 -> 678 bytes 9 files changed, 160 insertions(+), 35 deletions(-) create mode 100644 nether/textures/nether_blood.png create mode 100644 nether/textures/nether_blood_side.png create mode 100644 nether/textures/nether_blood_stem.png create mode 100644 nether/textures/nether_blood_stem_top.png create mode 100644 nether/textures/nether_blood_top.png create mode 100644 nether/textures/nether_brick_shadow.png create mode 100644 nether/textures/nether_portal_particle.png diff --git a/nether/init.lua b/nether/init.lua index 9d358ce..81b3107 100644 --- a/nether/init.lua +++ b/nether/init.lua @@ -296,6 +296,23 @@ NETHER_PORTAL = { --== END OF EDITABLE OPTIONS ==-- +local function r_area(manip, width, height, pos) + local emerged_pos1, emerged_pos2 = manip:read_from_map( + {x=pos.x-width, y=pos.y, z=pos.z-width}, + {x=pos.x+width, y=pos.y+height, z=pos.z+width} + ) + return VoxelArea:new({MinEdge=emerged_pos1, MaxEdge=emerged_pos2}) +end + +local function set_vm_data(manip, nodes, pos, t1, name) + manip:set_data(nodes) + manip:write_to_map() + print(string.format("[nether] "..name.." grew at ("..pos.x.."|"..pos.y.."|"..pos.z..") after ca. %.2fs", os.clock() - t1)) + local t1 = os.clock() + manip:update_map() + print(string.format("[nether] map updated after ca. %.2fs", os.clock() - t1)) +end + -- Generated variables NETHER_BOTTOM = (NETHER_DEPTH - NETHER_HEIGHT) NETHER_ROOF_ABS = (NETHER_DEPTH - NETHER_RANDOM) @@ -372,7 +389,7 @@ function nether:inside_nether(pos) return false end --- Nether Lava +--[[ Nether Lava minetest.register_node("nether:lava_flowing", { description = "Nether Lava (flowing)", inventory_image = minetest.inventorycube("default_lava.png"), @@ -419,22 +436,43 @@ minetest.register_node("nether:lava_source", { {image="default_lava.png", backface_culling=false}, }, groups = {lava=3, liquid=2, hot=3}, -}) +})]] -- Netherrack minetest.register_node("nether:netherrack", { description = "Netherrack", tiles = {"nether_netherrack.png"}, groups = {cracky=3, oddly_breakable_by_hand=3}, - drop = "nether:netherrack", + sounds = default.node_sound_stone_defaults(), +}) + +-- Netherbrick +minetest.register_node("nether:netherrack_brick", { + description = "Netherrack Brick", + tiles = {"nether_netherrack.png^nether_brick_shadow.png"}, + groups = {cracky=3, oddly_breakable_by_hand=3}, sounds = default.node_sound_stone_defaults(), }) -- Nether tree -minetest.register_node("nether:tree", { - description = "Nether Tree", - tiles = {"nether_tree_top.png", "nether_tree_top.png", "nether_tree.png"}, - groups = {tree=1, snappy=2, choppy=2, oddly_breakable_by_hand=1}, +minetest.register_node("nether:blood", { + description = "Nether Blood", + tiles = {"nether_blood.png"}, + groups = {snappy=2, choppy=2, oddly_breakable_by_hand=1}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("nether:blood_top", { + description = "Nether Blood", + tiles = {"nether_blood_top.png", "nether_blood.png", "nether_blood.png^nether_blood_side.png"}, + groups = {snappy=2, choppy=2, oddly_breakable_by_hand=1}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("nether:blood_stem", { + description = "Nether Blood Stem", + tiles = {"nether_blood_stem_top.png", "nether_blood_stem_top.png", "nether_blood_stem.png"}, + groups = {snappy=2, choppy=2, oddly_breakable_by_hand=1}, sounds = default.node_sound_wood_defaults(), }) @@ -453,7 +491,6 @@ minetest.register_node("nether:leaves", { minetest.register_node("nether:apple", { description = "Nether Apple", drawtype = "plantlike", - visual_scale = 1.0, tiles = {"nether_apple.png"}, inventory_image = "nether_apple.png", paramtype = "light", @@ -479,8 +516,8 @@ minetest.register_node("nether:vine", { after_dig_node = function(pos) local p = {x=pos.x, y=pos.y-1, z=pos.z} local vine = "nether:vine" - while minetest.env:get_node(p).name == vine do - minetest.env:remove_node(p) + while minetest.get_node(p).name == vine do + minetest.remove_node(p) p.y = p.y-1 end end @@ -670,7 +707,7 @@ minetest.register_on_generated(function(minp, maxp, seed) -- Notice I did not put a -1 for the beginning. This is because we don't want the throne to float for y=HADES_THRONE_STARTPOS_ABS.y, (HADES_THRONE_ENDPOS_ABS.y + 1), 1 do addpos = {x=x, y=y, z=z} - minetest.env:add_node(addpos, {name="air"}) + minetest.add_node(addpos, {name="air"}) end end end @@ -681,7 +718,7 @@ minetest.register_on_generated(function(minp, maxp, seed) nether:save_portal_from_nether(v.pos) nether:createportal(v.pos) else - minetest.env:add_node(v.pos, {name=v.block}) + minetest.add_node(v.pos, {name=v.block}) end end nether:touch(HADES_THRONE_GENERATED) @@ -734,7 +771,7 @@ end)]] -- Return the name of the node below a position function nether:nodebelow(pos) - return minetest.env:get_node({x=pos.x, y=(pos.y-1), z=pos.z}).name + return minetest.get_node({x=pos.x, y=(pos.y-1), z=pos.z}).name end -- Check if we can add a "sticky" node (i.e. it has to stick to something else, or else it won't be added) @@ -745,7 +782,7 @@ function nether:can_add_sticky_node(pos) for y = -1, 1 do for z = -1, 1 do local p = {x=pos.x+x, y=pos.y+y, z=pos.z+z} - local n = minetest.env:get_node(p) + local n = minetest.get_node(p) objname = n.name if minetest.registered_nodes[objname].walkable == true then return true @@ -759,21 +796,73 @@ end -- Add a "sticky" node function nether:add_sticky_node(pos, opts) if nether:can_add_sticky_node(pos) == true then - minetest.env:add_node(pos, opts) + minetest.add_node(pos, opts) return true else return false end end --- Create a nether tree + +local nether_c_blood = minetest.get_content_id("nether:blood") +local nether_c_blood_top = minetest.get_content_id("nether:blood_top") +local nether_c_blood_stem = minetest.get_content_id("nether:blood_stem") +local nether_c_apple = minetest.get_content_id("default:apple") +local nether_c_nether_apple = minetest.get_content_id("nether:apple") + +function nether:grow_nethertree(pos) + local t1 = os.clock() + local height = 6 + local manip = minetest.get_voxel_manip() + local area = r_area(manip, 2, height, pos) + local nodes = manip:get_data() + + for i = 0, height-1 do + nodes[area:index(pos.x, pos.y+i, pos.z)] = nether_c_blood_stem + end + + for i = -1,1 do + for j = -1,1 do + nodes[area:index(pos.x+i, pos.y+height, pos.z+j)] = nether_c_blood_top + end + end + + for k = -1, 1, 2 do + for l = -2+1, 2 do + local p1 = {pos.x+2*k, pos.y+height, pos.z-l*k} + local p2 = {pos.x+l*k, pos.y+height, pos.z+2*k} + local udat = nether_c_blood_top + if math.random(2) == 1 then + nodes[area:index(p1[1], p1[2], p1[3])] = nether_c_blood_top + nodes[area:index(p2[1], p2[2], p2[3])] = nether_c_blood_top + udat = nether_c_blood + end + nodes[area:index(p1[1], p1[2]-1, p1[3])] = udat + nodes[area:index(p2[1], p2[2]-1, p2[3])] = udat + end + for l = 0, 1 do + for _,p in ipairs({ + {pos.x+k, pos.y+height-1, pos.z-l*k}, + {pos.x+l*k, pos.y+height-1, pos.z+k}, + }) do + if math.random(2) == 1 then + nodes[area:index(p[1], p[2], p[3])] = nether_c_nether_apple + elseif math.random(10) == 1 then + nodes[area:index(p[1], p[2], p[3])] = nether_c_apple + end + end + end + end + set_vm_data(manip, nodes, pos, t1, "blood") +end +--[[ Create a nether tree function nether:grow_nethertree(pos) --TRUNK pos.y=pos.y+1 local trunkpos={x=pos.x, z=pos.z} for y=pos.y, pos.y+4+math.random(2) do trunkpos.y=y - minetest.env:add_node(trunkpos, {name="nether:tree"}) + minetest.add_node(trunkpos, {name="nether:tree"}) end --LEAVES local leafpos={} @@ -785,22 +874,22 @@ function nether:grow_nethertree(pos) +(z-trunkpos.z)*(z-trunkpos.z) <= NETHER_TREESIZE*NETHER_TREESIZE + NETHER_TREESIZE then leafpos={x=x, y=y, z=z} - if minetest.env:get_node(leafpos).name=="air" then + if minetest.get_node(leafpos).name=="air" then if math.random(NETHER_APPLE_FREQ) == 1 then if math.random(NETHER_HEAL_APPLE_FREQ) == 1 then - minetest.env:add_node(leafpos, {name="default:apple"}) + minetest.add_node(leafpos, {name="default:apple"}) else - minetest.env:add_node(leafpos, {name="nether:apple"}) + minetest.add_node(leafpos, {name="nether:apple"}) end else - minetest.env:add_node(leafpos, {name="nether:leaves"}) + minetest.add_node(leafpos, {name="nether:leaves"}) end end end end end end -end +end]] -- == PORTAL RELATED STUFF == NETHER_PORTALS_TO_NETHER = {} @@ -1028,7 +1117,7 @@ function nether:createportal(pos) curry = v.pos.y + pos.y currz = v.pos.z + pos.z currpos = {x=currx, y=curry, z=currz} - minetest.env:add_node(currpos, {name=v.block}) + minetest.add_node(currpos, {name=v.block}) end end @@ -1054,7 +1143,7 @@ end) minetest.register_abm({ nodenames = "nether:portal_creator", - interval = 1.0, + interval = 1, chance = 1, action = function(pos) nether:createportal(pos) @@ -1071,32 +1160,68 @@ minetest.register_node("nether:portal", { light_source = LIGHT_MAX - 2, paramtype = "light", sunlight_propagates = true, + use_texture_alpha = true, walkable = false, - groups = {choppy=2,dig_immediate=3}, + digable = false, + pointable = false, legacy_wallmounted = false, - buildable_to = true, - post_effect_color = {a=64, r=150, g=100, b=200}, +-- buildable_to = true, + drop = "", + groups = {not_in_creative_inventory=1}, + post_effect_color = {a=200, r=50, g=0, b=60}, metadata_name = "generic" }) minetest.register_abm({ nodenames = {"nether:portal"}, - interval = 1.0, + interval = 1, chance = 1, action = function(pos, node) - local nodemeta = minetest.env:get_meta(pos) - local objs = minetest.env:get_objects_inside_radius(pos, 1) + minetest.add_particlespawner( + 32, --amount + 4, --time + {x=pos.x-0.47, y=pos.y-0.5, z=pos.z-1}, --minpos + {x=pos.x+0.47, y=pos.y+0.34, z=pos.z+1}, --maxpos + {x=0, y=1, z=0}, --minvel + {x=0, y=2, z=0}, --maxvel + {x=-0.5,y=-3,z=-0.3}, --minacc + {x=0.5,y=-0.4,z=0.3}, --maxacc + 1, --minexptime + 2, --maxexptime + 0.4, --minsize + 3, --maxsize + true, --collisiondetection + "nether_portal_particle.png" --texture + ) + local objs = minetest.get_objects_inside_radius(pos, 1) if objs[1] ~= nil then - for k, obj in pairs(objs) do + local nodemeta = minetest.get_meta(pos) + for _,obj in pairs(objs) do local objpos = obj:getpos() - local objmeta = minetest.env:get_meta(objpos) - if objpos.y>pos.y-1 and objpos.y pos.y-1 + and objpos.y < pos.y + and objplayername ~= nil + and objplayername ~= "" then local innether = nether:inside_nether(obj:getpos()) - if innether == true and (objmeta:get_string("teleportingfromnether") == "" or objmeta:get_string("teleportingfromnether") == nil) then + local objstring1 = objmeta:get_string("teleportingfromnether") + if innether + and ( + objstring1 == "" + or objstring1 == nil + ) then objmeta:set_string("teleportingfromnether", "true") objmeta:set_string("teleportingtonether", "") nether:teleport_player(innether, obj) - elseif innether == false and (objmeta:get_string("teleportingtonether") == "" or objmeta:get_string("teleportingtonether") == nil) then + return + end + local objstring2 = objmeta:get_string("teleportingtonether") + if not innether + and ( + objstring2 == "" + or objstring2 == nil + ) then objmeta:set_string("teleportingtonether", "true") objmeta:set_string("teleportingfromnether", "") nether:teleport_player(innether, obj) diff --git a/nether/textures/nether_blood.png b/nether/textures/nether_blood.png new file mode 100644 index 0000000000000000000000000000000000000000..067285bf57446dc51ee2404ed7f5a3fcabd13f6d GIT binary patch literal 448 zcmV;x0YCnUP)Px#8FWQhbVF}#ZDnqB07G(RVRU6=Aa`kWXdp*PO;A^X4i^9b0aZyvK~yLe1;I;h z(@+2a!0F42YuweWCZpsd3o4%Rl#ULBDLV!_0v$W%Y)KsQi4Bp+nh>eDLq|pA7l}V)bhNCQGNB?C zG@KJaO~GgOspttTL8K-${G?&W0R<%|ydsh)xZx1|CL|UtNnA6KnDdS^PQjKdCL9q5 zmLxK6iJTF+q@^U06Zi%~#fpLrTUtu)@sfct9RnRXJ)_s$WyF{jdrVny!idOo63Cbn z_Sw(} literal 0 HcmV?d00001 diff --git a/nether/textures/nether_blood_side.png b/nether/textures/nether_blood_side.png new file mode 100644 index 0000000000000000000000000000000000000000..468a8dc26fbd27fc18c7db3071bf285eaa78dd53 GIT binary patch literal 525 zcmV+o0`mQdP)Px#8FWQhbVF}#ZDnqB07G(RVRU6=Aa`kWXdp*PO;A^X4i^9b0isDnK~y*q1;M>e z6j2xe(DU87yGvMHwJ^~_JD8yzAVHa6Jq*BFt)a)tbcEnvAd&p?=Twq&16iw9d556cJi$PD^ndVUlUl z_u#fQ_e;@7_z|HVjH9D*^fbZ*n>fj|YR!lPtTR2pGdzy4YR#`qH>g`U%yfcjghgwf zqu^(RI~->^BQD6_*vvG?-w5SAQ;l$z>9REqJq~e^X_@Jc*u@{>DAOgbu#u^Dh)e}D zoMVj(B&PTZ*diM)aE&X}h5>L&RLseS4@3`mixC3`z<|2K3>}t$0VA=4B^H>Gcep`8 z5Dj&WISP=CxFaTHPi$dA1_C3o2Y|9Bj))aHY>-oOMHD32qoG3s0F(|5XT(5sn4zK} zi6m}_L*ffw0ig64u#Y_;5_5b)MUWry4X{xFsM87HA1^Cs1N+1yyuo`Q-UiuGN8U96 z>M$jeo#1m1Y$LJ8iv`O$WyyNvW&i*Hz|M?q00000yaoUO00000004mhWFF0=+mmmC P00000NkvXXu0mjfQqR-< literal 0 HcmV?d00001 diff --git a/nether/textures/nether_blood_stem.png b/nether/textures/nether_blood_stem.png new file mode 100644 index 0000000000000000000000000000000000000000..21ac5cc58241d50c961fa4333eb3b77be4f70f59 GIT binary patch literal 446 zcmV;v0YUzWP)Px#8FWQhbVF}#ZDnqB07G(RVRU6=Aa`kWXdp*PO;A^X4i^9b0aHmtK~yLe1;N{H z(qI4p;E%sQltaT|4Cdn0WHIi-xA4*z_Qt31*2IYMz!I6IFxo;3eqZM!OS&N8h6gGl zpZLIc3akrm6Ma%JXlAMYzVZeqS zJu3D*lGA6$UoI3}b0QMDZ0Qim=&)kRGZ{FLf&qchkdx45#5;b0lo>l(YF12nCZz1? zQ&Z6Ln=J*eNT}%1up}j3sEBMBf<85C4oq2-vLvA)9B8O1d1Ow*KgO(yoOq(7U`r?& zQPSZ+%Y{h64{)R*upuG2XUd2UISVG-@`Z#6Ek_po0U@y9K$kfeZdvh`pG1(cXUBz5 oGhj$XpdsN7Jb{v&gn}Ob0Z2-D#;5Kc5C8xG07*qoM6N<$f=J)EhX4Qo literal 0 HcmV?d00001 diff --git a/nether/textures/nether_blood_stem_top.png b/nether/textures/nether_blood_stem_top.png new file mode 100644 index 0000000000000000000000000000000000000000..2191e370d815cead8d1f6e05c717642d67ccfbe4 GIT binary patch literal 442 zcmV;r0Y(0aP)Px#8FWQhbVF}#ZDnqB07G(RVRU6=Aa`kWXdp*PO;A^X4i^9b0Z&OpK~yLe1;NX5 z(og^Z(39kn7o{`_)B(EcI9+$4|G)GHoN?h}obk~jQi>oALcnvPH}pxlAfcq=NMJ`t z!=A5TONi+>P*U+sL%}Z&97q_mrsYWTnufrPn3ORs1t}-S49FQVC)CUcyfC1qW&&2k zbo5F1!j!nr23$~)Q8T4rKutx)h>n7gk+7#?Lc)xSloTw9NXh6EQc5P2l-yC$a%M`- zEn8MpM8rEz94Say5Yw_`&47fOPu$ZZ8IgjBnv^wI@P`(3{Nyu_gutFPL%xx5LjY$M zL_D)*#S_ULXK>(5LB)cEIXgCN=@{~z4& z{39l3%#JxZNyCY2a#H?sX30mk42anh@qr~_!~-XCM%?m9;EMOWP;y1X6PJWQPD{aW k7GxkMBBIBJcigb&Kg0`Sm;4FyivR!s07*qoM6N<$g6w9w1poj5 literal 0 HcmV?d00001 diff --git a/nether/textures/nether_blood_top.png b/nether/textures/nether_blood_top.png new file mode 100644 index 0000000000000000000000000000000000000000..622fbcc69332052aa4d69520cc00abcf7fb01c96 GIT binary patch literal 463 zcmV;=0WkiFP)Px#8FWQhbVF}#ZDnqB07G(RVRU6=Aa`kWXdp*PO;A^X4i^9b0c1%;K~yLe1;JZy z(qI4p&{JCYU{D6TV$@B2@RAsf+0*oY8z1yV6Qe)C#6({-(V8LLCugSd?s+j zODYcN^OSRDB(I2kWXT^Q6)htoYq|^>FyoX?!Ge7P9Y*Z1;gHCP2_puie5DgfDH(H< z$e4Sav7us*>#SLGK^C~AVa1$;K&0iE$PzR(%*kfdL`uf=$O&Xb0tE@T*&!jz`AxzN zTCgGKI|nQ|W}7Z04@j?Z#gxE`9zS_YV3!FAfr^43{0F#cdp`+$^M?Qc002ovPDHLk FV1k`_x`hA$ literal 0 HcmV?d00001 diff --git a/nether/textures/nether_brick_shadow.png b/nether/textures/nether_brick_shadow.png new file mode 100644 index 0000000000000000000000000000000000000000..1d4ba10b99f6b1b52af1e47c92fd6d914d7a7a8a GIT binary patch literal 196 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|>O5T>Lo7}& zon*+>93a5TuI;TYc>WWALheuQ_x0VLizm!z*{;ZanUDK(!0(fRDdFMkg3U_$KeotYr^0E;ahSnp5Tk!A9zi-Az+g pZkVj$VZE~a-=@hIEZ;m~TyQKh>t*Bfr9hW3c)I$ztaD0e0s!^@Oxyqf literal 0 HcmV?d00001 diff --git a/nether/textures/nether_portal_particle.png b/nether/textures/nether_portal_particle.png new file mode 100644 index 0000000000000000000000000000000000000000..f598e7a872589b5fac10283aaa14d2019da963a4 GIT binary patch literal 368 zcmV-$0gwKPP)Px$DoI2^R5;6xQo(A&FbsVdOd$ksvv&mcQr++*qggI-DVYScY5$HZZ7N!~*= z4+Kc!G-+(vjVy`exy*De`IEo?cG|Jw9fU!wjWj?yL0k&uR?)4|jg59~)N|1Giv3WM zSY`R6;U9tLgk2Kp#ppXF8N_+TSPWZ??rvc@TsfyeJ4N3CTYoFm0*s3860#py&ppGG zNFrz$c2&}%=sYlXEBd#ErOPb0jap5R&k%jW^1#h@V7vvQ(QM-F6U2{%m4P9YbPSji zx(Q-({A|Ek>Fy8QHKTi})XT)VFO-cF4!#%kzs#~2U9afAQB~0l6jRcd8+PnC)J8iO zPLmTB_yfcpNPi1r$jqsbwWHq*tfi746X}a}bal;G1+hZjHR{S~If#vr9y;voa9x-q zC?d$-Fa)GfUNw<^Z?wb2)Gy5IiR(?FY@B!np94lCy(#jKpf&Kh(LNUPQ{X=vh*#PH z@@`@J-l)%x4-gaZAraNE^T0S(ig)y%D&<3?isSd@w0~SFH;R}d1BfW}fh2)%PJJvC zA6ftAxK`>@A-mHKfiKo@Z%kM4IngZxawyDGrTq(WYP1#PDTqhlr=aDAuL3^@EEf31 z@vjT?Bbs~qdqrHymrPzD4vzPk?0p9>mHaM< zB*=3Rb9&$&@Sw;VBAerYD`;0(MB%9Dn9wcQ%JKJ&>VaDjCqRJ?bd%6(f)L0_kZ81i zW*U{WGR%P_uvN4=J_}NVxF{S!-kiv$Xc2UB=mp<9{NlJM@?A(X@T#Z@qCsRqjzM%m bR3QEb2cdHk$-ob900000NkvXXu0mjfj*>RN delta 459 zcmV;+0W|)m1@QxrFn<6Ea7bBm000XU000XU0RWnu7ytkO2XskIMF-pj5d#P$LXj{| z0004lNklIISlS^8q&xocZy(!H0<>u&wX$u) zFkOygTUtp&8s@QV2Q3W4FkI3=yL}pl>GF8|_^Xwa2y@wJA%9H6?bGEp3?WTZ8d7@M zK3pD;Z8^3{gJHUTxxK(~y#1$@VY=PY&`6=RQYH+S-~N~`+xGajEJvXb9&ghnrE;Xy zT88xHm*4)ly|l6&rO-%( zIKF**`|;!3wtqn?Fr)yfmE+hJ+9YfTkL_`6rO-CgaJ#*HI=1O@Y{yp0EJry?2!W77 zgSI_F`1GZe<5(W$Xk{Ly{NR>`moLlPvd~Id9sun)N-K?7j@IDiWtvh5;qjog_IL{c zpaIz$ZCjS3HNtSYd`JnPwN_dSAuvm!g|xgS(vZ@0fkb0#trZA_l!h5XYf#GDk71f7 zNTChoAhi}kqqUh5p@q;|+m;YQYNQZ`QUF?m{{e_Q=B#hXP-OrB002ovPDHLkV1nfv B)W84$