diff --git a/Changelog.txt b/Changelog.txt index 6358167..88c89e9 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,8 +1,13 @@ +Version 0.3-beta: + Improve some textures. + Fix large chest issue. + added /mcnodes command to easly get the mod version. + Version 0.2-beta: -Textures updated. -Set textures license (See LICENSE.txt file for more information). -Some code improvements. + Textures updated. + Set textures license (See LICENSE.txt file for more information). + Some code improvements. Version 0.1-beta: -First release. + First release. diff --git a/README.md b/README.md index 11b0ea1..2ceb915 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,9 @@ -# Mcnodes 0.2-beta -More custom nodes mod for minetest. - +# Mcnodes 0.3-beta -- This mod adds a 3d chest, if you don't like it edit nodes.lua file and set the ChangeChest variable to 0 -- The large chest still have some problems will be solved in the next release. --- Large chest can be disabled by changing LargeChest variable to 0 at nodes.lua file +-- Large chest can be disabled by changing LargeChest variable to 0 at init.lua file -- Auto stairs can be disabled by changing AutoStairs variable to 0 at init.lua file diff --git a/VERSION.txt b/VERSION.txt index 9098aa1..b15a71a 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -0.2-beta +0.3-beta diff --git a/chatcommands.lua b/chatcommands.lua new file mode 100644 index 0000000..1534d4e --- /dev/null +++ b/chatcommands.lua @@ -0,0 +1,8 @@ +minetest.register_chatcommand("mcnodes", { + params = "", + description = "Mcnodes mod version", + privs = {}, + func = function() + return true, mcnodes.version + end, +}) diff --git a/chest.functions.lua b/chest.functions.lua new file mode 100644 index 0000000..c69ed43 --- /dev/null +++ b/chest.functions.lua @@ -0,0 +1,35 @@ +function PlaceChest(NodeOn, Pos, OldNodePos) + if NodeOn == 'ZN' then + if getNodeYaxis(Pos) == '270' and getNodeYaxis(OldNodePos) == '270' or getNodeYaxis(Pos) == '90' and getNodeYaxis(OldNodePos) == '270' or getNodeYaxis(Pos) == '270' and getNodeYaxis(OldNodePos) == '90' then + True = false + else + True = true + end + end + + if NodeOn == 'ZP' then + if getNodeYaxis(Pos) == '270' and getNodeYaxis(OldNodePos) == '270' or getNodeYaxis(Pos) == '270' and getNodeYaxis(OldNodePos) == '90' or getNodeYaxis(Pos) == '90' and getNodeYaxis(OldNodePos) == '270' then + True = false + else + True = true + end + end + + if NodeOn == 'XN' then + if getNodeYaxis(Pos) == '180' and getNodeYaxis(OldNodePos) == '180' or getNodeYaxis(Pos) == '0' and getNodeYaxis(OldNodePos) == '180' or getNodeYaxis(Pos) == '180' and getNodeYaxis(OldNodePos) == '0' then + True = false + else + True = true + end + end + + if NodeOn == 'XP' then + if getNodeYaxis(Pos) == '0' and getNodeYaxis(OldNodePos) == '0' or getNodeYaxis(Pos) == '180' and getNodeYaxis(OldNodePos) == '0' or getNodeYaxis(Pos) == '0' and getNodeYaxis(OldNodePos) == '180' then + True = false + else + True = true + end + end + + return True +end diff --git a/chest.lua b/chest.lua index 5737f4f..2977b6c 100644 --- a/chest.lua +++ b/chest.lua @@ -65,72 +65,87 @@ if LargeChest == '1' then done = '0' if done == '0' then - if minetest.get_node_or_nil({x=pos.x+1, y=pos.y, z=pos.z}).name == "default:chest" then + oldnodepos = {x=pos.x+1, y=pos.y, z=pos.z} + if minetest.get_node_or_nil(oldnodepos).name == "default:chest" then MainNodeOn = 'XP' - NewNodeRotation = getNodeYaxis(pos) - - minetest.remove_node({x=pos.x+1, y=pos.y, z=pos.z}) - minetest.remove_node(pos) - - if placer_pos.z < pos.z then - minetest.set_node(pos, {name="mcnodes:large_chest", param2 = facedir}) - else - minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z}, {name="mcnodes:large_chest", param2 = facedir}) + + if PlaceChest('XP', pos, oldnodepos) == true then + minetest.remove_node(oldnodepos) + minetest.remove_node(pos) + + if placer_pos.z < pos.z then + minetest.set_node(pos, {name="mcnodes:large_chest", param2 = facedir}) + else + minetest.set_node(oldnodepos, {name="mcnodes:large_chest", param2 = facedir}) + end + + done = '1' end - - done = '1' end end if done == '0' then - if minetest.get_node_or_nil({x=pos.x, y=pos.y, z=pos.z+1}).name == "default:chest" then + oldnodepos = {x=pos.x, y=pos.y, z=pos.z+1} + if minetest.get_node_or_nil(oldnodepos).name == "default:chest" then MainNodeOn = 'ZP' - minetest.remove_node({x=pos.x, y=pos.y, z=pos.z+1}) - minetest.remove_node(pos) + + if PlaceChest('ZP', pos, oldnodepos) == true then + minetest.remove_node(oldnodepos) + minetest.remove_node(pos) - if placer_pos.x < pos.x then - minetest.set_node({x=pos.x, y=pos.y, z=pos.z+1}, {name="mcnodes:large_chest", param2 = facedir}) - else - minetest.set_node(pos, {name="mcnodes:large_chest", param2 = facedir}) + if placer_pos.x < pos.x then + minetest.set_node(oldnodepos, {name="mcnodes:large_chest", param2 = facedir}) + else + minetest.set_node(pos, {name="mcnodes:large_chest", param2 = facedir}) + end + + done = '1' end - - done = '1' end end if done == '0' then - if minetest.get_node_or_nil({x=pos.x-1, y=pos.y, z=pos.z}).name == "default:chest" then + oldnodepos = {x=pos.x-1, y=pos.y, z=pos.z} + if minetest.get_node_or_nil(oldnodepos).name == "default:chest" then MainNodeOn = 'XN' - minetest.remove_node({x=pos.x-1, y=pos.y, z=pos.z}) - minetest.remove_node(pos) - if placer_pos.z > pos.z then - minetest.set_node(pos, {name="mcnodes:large_chest", param2 = facedir}) - else - minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z}, {name="mcnodes:large_chest", param2 = facedir}) - end + + if PlaceChest('XN', pos, oldnodepos) == true then + minetest.remove_node(oldnodepos) + minetest.remove_node(pos) + if placer_pos.z > pos.z then + minetest.set_node(pos, {name="mcnodes:large_chest", param2 = facedir}) + else + minetest.set_node(oldnodepos, {name="mcnodes:large_chest", param2 = facedir}) + end - done = '1' + done = '1' + end end end if done == '0' then - if minetest.get_node_or_nil({x=pos.x, y=pos.y, z=pos.z-1}).name == "default:chest" then + oldnodepos = {x=pos.x, y=pos.y, z=pos.z-1} + if minetest.get_node_or_nil(oldnodepos).name == "default:chest" then MainNodeOn = 'ZN' - minetest.remove_node({x=pos.x, y=pos.y, z=pos.z-1}) - minetest.remove_node(pos) - - if placer_pos.x > pos.x then - minetest.set_node({x=pos.x, y=pos.y, z=pos.z-1}, {name="mcnodes:large_chest", param2 = facedir}) - else - minetest.set_node(pos, {name="mcnodes:large_chest", param2 = facedir}) + + if PlaceChest('ZN', pos, oldnodepos) == true then + minetest.remove_node(oldnodepos) + minetest.remove_node(pos) + + if placer_pos.x > pos.x then + minetest.set_node(oldnodepos, {name="mcnodes:large_chest", param2 = facedir}) + else + minetest.set_node(pos, {name="mcnodes:large_chest", param2 = facedir}) + end + + done = '1' end - - done = '1' end end - --minetest.chat_send_all('State: ' .. MainNodeOn .. ', Y-axis: ' .. NewNodeRotation) + minetest.chat_send_all('State: ' .. MainNodeOn) end end + minetest.chat_send_all('Y-axis: ' .. getNodeYaxis(pos)) end) end diff --git a/init.lua b/init.lua index 940ed41..a18d2e4 100644 --- a/init.lua +++ b/init.lua @@ -1,3 +1,9 @@ +mcnodes = {} + +mcnodes.version = '0.3-beta' + +LargeChest = '1' + AutoStairs = '1' dofile(minetest.get_modpath("mcnodes").."/functions.general.lua") @@ -15,13 +21,18 @@ dofile(minetest.get_modpath("mcnodes").."/crafting.lua") --dofile(minetest.get_modpath("mcnodes").."/hand.lua") -dofile(minetest.get_modpath("mcnodes").."/chest.lua") +if LargeChest == '1' then + dofile(minetest.get_modpath("mcnodes").."/chest.functions.lua") + dofile(minetest.get_modpath("mcnodes").."/chest.lua") +end dofile(minetest.get_modpath("mcnodes").."/register_ores.lua") dofile(minetest.get_modpath("mcnodes").."/register_biome.lua") dofile(minetest.get_modpath("mcnodes").."/replaced_nodes.lua") +dofile(minetest.get_modpath("mcnodes").."/chatcommands.lua") + if AutoStairs == '1' then dofile(minetest.get_modpath("mcnodes").."/auto_stairs_functions.lua") diff --git a/nodes.lua b/nodes.lua index 82c1538..90f4c7a 100644 --- a/nodes.lua +++ b/nodes.lua @@ -1,5 +1,4 @@ ChangeChest = '1' -LargeChest = '1' minetest.register_node("mcnodes:quartz_block", { description = "Quartz block", diff --git a/textures/mcnodes_andesite.png b/textures/mcnodes_andesite.png index eaa1d2d..b4a1722 100644 Binary files a/textures/mcnodes_andesite.png and b/textures/mcnodes_andesite.png differ diff --git a/textures/mcnodes_diorite.png b/textures/mcnodes_diorite.png index b230d31..e405c59 100644 Binary files a/textures/mcnodes_diorite.png and b/textures/mcnodes_diorite.png differ diff --git a/textures/mcnodes_diorite_smooth.png b/textures/mcnodes_diorite_smooth.png index f381a7e..0227381 100644 Binary files a/textures/mcnodes_diorite_smooth.png and b/textures/mcnodes_diorite_smooth.png differ diff --git a/textures/mcnodes_granite.png b/textures/mcnodes_granite.png index 3c156e4..6a1a159 100644 Binary files a/textures/mcnodes_granite.png and b/textures/mcnodes_granite.png differ