From 69475ac2043d73106b1c07571c5aa462867659fd Mon Sep 17 00:00:00 2001 From: LeMagnesium Date: Thu, 5 Mar 2015 17:09:02 +0100 Subject: [PATCH] Updated nether mod - Kept values for pickaxes and tools - Fixed calls of LIGHT_MAX - Fixed typos - Added sound and randomness in craft recipe --- mods/nether/.gitignore | 4 ++ mods/nether/nether/crafting.lua | 37 ++++++++++++++++++- mods/nether/nether/init.lua | 4 +- mods/nether/nether/items.lua | 26 +++++++++---- mods/nether/nether/portal.lua | 2 - mods/nether/nether/textures/nether_torch.png | Bin 154 -> 1083 bytes 6 files changed, 59 insertions(+), 14 deletions(-) create mode 100644 mods/nether/.gitignore diff --git a/mods/nether/.gitignore b/mods/nether/.gitignore new file mode 100644 index 00000000..d9c069a6 --- /dev/null +++ b/mods/nether/.gitignore @@ -0,0 +1,4 @@ +## Generic ignorable patterns and files +*~ +.*.swp +debug.txt diff --git a/mods/nether/nether/crafting.lua b/mods/nether/nether/crafting.lua index 43bceb91..84905511 100644 --- a/mods/nether/nether/crafting.lua +++ b/mods/nether/nether/crafting.lua @@ -153,14 +153,47 @@ minetest.register_craft({ } }) -minetest.register_craft({ --crafting bad here, needs to become changed +minetest.register_craft({ output = "nether:forest_planks 7", recipe = { {"nether:tree"}, }, - replacements = {{"nether:tree", "nether:bark 4"}}, }) +local sound_allowed = true +minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv) + if itemstack:get_name() == "nether:forest_planks" + and itemstack:get_count() == 7 then + local tree + for i = 1,9 do + if old_craft_grid[i]:get_name() == "nether:tree" then + tree = i + break + end + end + if not tree then -- do nth if theres no tree + return + end + local rdif = math.random(-1,1) -- add a bit randomness + local barkstack = ItemStack("nether:bark "..4-rdif) + local inv = player:get_inventory() + if not inv:room_for_item("main", barkstack) then -- disallow crafting if there's not enough free space + craft_inv:set_list("craft", old_craft_grid) + itemstack:set_name("") + return + end + itemstack:set_count(7+rdif) + inv:add_item("main", barkstack) + if sound_allowed then + minetest.sound_play("default_wood_footstep", {pos=player:getpos(), gain=0.25}) + sound_allowed = false + minetest.after(0, function() + sound_allowed = true + end) + end + end +end) + minetest.register_craft({ output = "default:paper", recipe = { diff --git a/mods/nether/nether/init.lua b/mods/nether/nether/init.lua index 6b7def38..ac57c5a4 100644 --- a/mods/nether/nether/init.lua +++ b/mods/nether/nether/init.lua @@ -356,7 +356,7 @@ minetest.register_on_generated(function(minp, maxp, seed) --local perlin2 = minetest.get_perlin(133,3, 0.5, 10) --local perlin3 = minetest.get_perlin(112,3, 0.5, 5) - local side_length = maxp.x - minp.x + 1 + local side_length = maxp.x - minp.x - 1 -- maybe mistake here local map_lengths_xyz = {x=side_length, y=side_length, z=side_length} local pmap1 = minetest.get_perlin_map(perlins[1], map_lengths_xyz):get2dMap_flat(minp) @@ -389,7 +389,7 @@ minetest.register_on_generated(function(minp, maxp, seed) local test3 = math.abs(pmap3[count]) local t = math.floor(test*3+0.5) - local h = 0 + if test2 < 0 then h = math.floor(test2*3+0.5)-1 else diff --git a/mods/nether/nether/items.lua b/mods/nether/nether/items.lua index f398bac1..4d9f4d15 100644 --- a/mods/nether/nether/items.lua +++ b/mods/nether/nether/items.lua @@ -432,7 +432,7 @@ minetest.register_node("nether:vine", { for n,i in pairs({"small", "middle", "big"}) do minetest.register_node("nether:grass_"..i, { - description = "Nehter Grass", + description = "Nether Grass", drawtype = "plantlike", waving = 1, tiles = {"nether_grass_"..i..".png"}, @@ -487,7 +487,7 @@ minetest.register_node("nether:tree_sapling", { }) minetest.register_node("nether:tree", { - description = "Nehter Trunk", + description = "Nether Trunk", tiles = {"nether_tree_top.png", "nether_tree_top.png", "nether_tree.png"}, paramtype2 = "facedir", is_ground_content = false, @@ -497,7 +497,7 @@ minetest.register_node("nether:tree", { }) minetest.register_node("nether:tree_corner", { - description = "Nehter Trunk Corner", + description = "Nether Trunk Corner", tiles = {"nether_tree.png^[transformR180", "nether_tree_top.png", "nether_tree_corner.png^[transformFY", "nether_tree_corner.png^[transformR180", "nether_tree.png", "nether_tree_top.png"}, paramtype2 = "facedir", @@ -578,14 +578,24 @@ minetest.register_node("nether:dirt_bottom", { minetest.register_node("nether:torch", { description = "Nether Torch", drawtype = "torchlike", - tiles = {"nether_torch_on_floor.png", "nether_torch_on_ceiling.png", "nether_torch.png"}, + tiles = {"nether_torch_on_floor.png", "nether_torch_on_ceiling.png", + { + name = "nether_torch.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 2.0, + }, + }, + }, inventory_image = "nether_torch_on_floor.png", wield_image = "nether_torch_on_floor.png", paramtype = "light", paramtype2 = "wallmounted", sunlight_propagates = true, walkable = false, - light_source = LIGHT_MAX-1, + light_source = 13, selection_box = { type = "wallmounted", wall_top = {-0.1, 0.5-0.6, -0.1, 0.1, 0.5, 0.1}, @@ -603,7 +613,7 @@ minetest.register_node("nether:portal", { tiles = {invisible, invisible, invisible, invisible, "nether_portal_stuff.png"}, inventory_image = "nether_portal_stuff.png", wield_image = "nether_portal_stuff.png", - light_source = LIGHT_MAX - 2, + light_source = 12, paramtype = "light", sunlight_propagates = true, use_texture_alpha = true, @@ -627,12 +637,12 @@ minetest.register_node("nether:portal", { minetest.register_craftitem("nether:grass", { - description = "Nehter Grass", + description = "Nether Grass", inventory_image = "nether_grass.png", }) minetest.register_craftitem("nether:grass_dried", { - description = "Dried Nehter Grass", + description = "Dried Nether Grass", inventory_image = "nether_grass_dried.png", furnace_burntime = 1, }) diff --git a/mods/nether/nether/portal.lua b/mods/nether/nether/portal.lua index 96ee613b..83f7bc26 100644 --- a/mods/nether/nether/portal.lua +++ b/mods/nether/nether/portal.lua @@ -147,7 +147,6 @@ minetest.register_chatcommand("from_hell", { local stsp_conf = minetest.setting_get("static_spawnpoint") pos_togo = {x = stsp_conf:split(",")[1],y = stsp_conf:split(",")[2],z = stsp_conf:split(",")[3]} end - table.foreach(pos_togo,print) player:moveto(pos_togo) return true end @@ -545,7 +544,6 @@ function nether_port(player, pos) local stsp_conf = minetest.setting_get("static_spawnpoint") pos_togo = {x = stsp_conf:split(",")[1],y = stsp_conf:split(",")[2],z = stsp_conf:split(",")[3]} end - table.foreach(pos_togo,print) player:moveto(pos_togo) else player:moveto({x=pos.x, y=portal_target+math.random(4), z=pos.z}) diff --git a/mods/nether/nether/textures/nether_torch.png b/mods/nether/nether/textures/nether_torch.png index 8fb95f62dc5d6e632dafa8d788cb462b0f1b7025..317c88077c8d445a7a8d324c9bed9676c0e3cd2d 100644 GIT binary patch delta 1075 zcmV-31kC%I0lNs07k_{V0{{R3HA@)~0005wP)t-sCk_uP4+1)CIuZ~t6%sTQ6E+kNH53#&6A>~N4l@=H zHx&>&6cRTU5i=JRI2RH*7ZW`e6gn6bI~f!}7#2Mn7GEJ9TYn=QTqGT0BN|~NA6+FL zVs6?I5L_#Fq%3wmOL+&JT##> zGn+dxn>#j_J%2EkJvE{_G@U#$oIE#}J~5X*HlsT=o;@?2Jvf;^GMGO%pFT65J~^2{ zIG{f?pFcXAK{J~{IiWx`pg=pELNu5}GonE@q(U;KLpY&EIKp0A$6{Z@WLU&yS;}Nv z#b#Q@XIso>UB_r#$Z1{5YF^K2X3J||(Q0ALY+%xBVt>tTVajo0*qM;onvvU_li{0` z*`1l(os`<1n%$n2)}Wf(pPSyFme--1-JqP`pqJR9oZg|G*`uA`qMq8Mp5mjK;G>`2 zrJ38MpW~#O;iRD6rkdQQpyH*W-=~}2r=jJhoa3gV;;EhBsiWtpp5v;X;i{zKtEJ*6 zEhGQ{0Dl2=QchCrWF=5XG+u*pPxYt^wkfR1naHmnf~k zVyS>zplX+rQl;e)pQy;o`a%&kWlKe1(IE0r{#3u-bDG$Y<$gQA+}xQtJ2NZ9|IU5V z{)6!-lCi`}Le{Zgdt2R-?o#^9j-Y(w_UfVXO@9UxJLf8b_^P{t0>AdYCsKHsz>8YW z{sebOI$xbjx7!lP%;8wBgL|G99 zp7zf2$8RR^%A1odg95wt50DOvM?PvPb8HP;$`^tb5<%;e20Ll;Z{;>TdR|dAd{yPq zUub&AwKWn*<@5&+op9Rqqla|B9Ps0X_J7z9EPvnp5(W_4n79h%dvs+<2HA(@m4g`P zLK!cIni<}W+#jjNy!+#fT|aJ+HWtNGBtyf8*8%Kg?|?!5yGD3X(w*f`K32g1jbs%U zda8N&OU^YLtp_(dXoA|z5pZmE-IUko&Eo#F(FXI9(QuzWNGvG) tBXpGzm~UV|)Qj974V-;Z-iFCN{{VaxT~&oZOZxx-002ovPDHLkV1k$o*~kC@ delta 139 zcmV;60CfMm2$}(q7k>~41^@s6AM^iV0001CNkl;Lt05S|jlWYJ?GYFF(kQQRX{|$r$$dAsG>2d#))fD~% tY4QyLx&UMd<*op+DRKqn1`Id=0BJ&4R>9Ybr~m)}07*qoL