Skip to content

Commit

Permalink
Updated to work with Minetest 5.2
Browse files Browse the repository at this point in the history
Made some minor updates to the orginal archived code so it will now work with minetest_game included with Minetest engine 5.2.

Changes
added farming as a dependancy
added snowblock
added iceblock
adjusted a few lines of code to allow comboblock to work with the current version of the stairs mod.
  • Loading branch information
SirrobZeroone committed May 6, 2020
1 parent 3f24b2b commit 6a915d5
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 17 deletions.
1 change: 1 addition & 0 deletions depends.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
stairs
farming
54 changes: 37 additions & 17 deletions init.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
comboblock = {index = {
-- _________ ___. __________.__ __ --
-- \_ ___ \ ____ _____\_ |__ ____\______ \ | ____ ____ | | __ --
-- / \ \/ / _ \ / \| __ \ / _ \| | _/ | / _ \_/ ___\| |/ / --
-- \ \___( <_> ) Y Y \ \_\ ( <_> ) | \ |_( <_> ) \___| < --
-- \______ /\____/|__|_| /___ /\____/|______ /____/\____/ \___ >__|_ \ --
-- \/ \/ \/ \/ \/ \/ --

--Orginally written/created by Pithydon/Pithy

comboblock = {index = { --List of slab files to allow to combo
["default:wood"] = "stairs:slab_wood",
["default:junglewood"] = "stairs:slab_junglewood",
["default:pine_wood"] = "stairs:slab_pine_wood",
Expand All @@ -15,22 +24,31 @@ comboblock = {index = {
["default:obsidian"] = "stairs:slab_obsidian",
["default:obsidianbrick"] = "stairs:slab_obsidianbrick",
["default:brick"] = "stairs:slab_brick",
["farming:straw"] = "stairs:slab_straw",
["default:steelblock"] = "stairs:slab_steelblock",
["default:copperblock"] = "stairs:slab_copperblock",
["default:bronzeblock"] = "stairs:slab_bronzeblock",
["default:goldblock"] = "stairs:slab_goldblock"
["default:goldblock"] = "stairs:slab_goldblock",
["default:ice"] = "stairs:slab_ice",
["default:snowblock"] = "stairs:slab_snowblock",
["farming:straw"] = "stairs:slab_straw"
}}
local creative = minetest.setting_getbool("creative_mode")
for k,v1 in pairs(comboblock.index) do
local v1_def = minetest.registered_nodes[v1]
local v1_groups = table.copy(v1_def.groups)
local v1_def = minetest.registered_nodes[v1] -- Makes a copy of the relevant node settings
local v1_groups = table.copy(v1_def.groups) -- Takes the above and places the groups into its own seperate copy
v1_groups.not_in_creative_inventory = 1
local v1_tiles = table.copy(v1_def.tiles)
if not v1_tiles[2] then
v1_tiles[2] = v1_tiles[1]
end
if not v1_tiles[3] then
local v1_tiles = table.copy(v1_def.tiles) -- The first group of tiles ie v1
--[[for k,v in pairs(v1_tiles) do -- Bunch of debug I(S01) added to get my head around data structure.
minetest.debug("k",tostring(k)," v", tostring(v))
minetest.debug ("direct:",v1_tiles[k].name)
for k2, v2 in pairs(v) do
minetest.debug("k2",tostring(k2),"v2",tostring(v2))
end
end ]]--
if not v1_tiles[2] then -- This bit checks if we have an image name
v1_tiles[2] = v1_tiles[1] -- for each side of the node, if it dosen't it
end -- copies the previous one in
if not v1_tiles[3] then -- 1 = Top, 2 = Bottom, 3-6 = Sides
v1_tiles[3] = v1_tiles[2]
end
if not v1_tiles[4] then
Expand All @@ -43,7 +61,7 @@ for k,v1 in pairs(comboblock.index) do
v1_tiles[6] = v1_tiles[5]
end
for _,v2 in pairs(comboblock.index) do
if v1 ~= v2 then
if v1 ~= v2 then -- this creates a second copy of all slabs and is identical to v1
local v2_def = minetest.registered_nodes[v2]
local v2_tiles = table.copy(v2_def.tiles)
if not v2_tiles[2] then
Expand All @@ -61,13 +79,15 @@ for k,v1 in pairs(comboblock.index) do
if not v2_tiles[6] then
v2_tiles[6] = v2_tiles[5]
end
minetest.register_node("comboblock:"..v1:split(":")[2].."_onc_"..v2:split(":")[2], {

minetest.register_node("comboblock:"..v1:split(":")[2].."_onc_"..v2:split(":")[2], { -- registering the new combo nodes
description = v1_def.description.." on "..v2_def.description,
tiles = {v1_tiles[1], v2_tiles[2],
v1_tiles[3].."^[lowpart:50:"..v2_tiles[3],
v1_tiles[4].."^[lowpart:50:"..v2_tiles[4],
v1_tiles[5].."^[lowpart:50:"..v2_tiles[5],
v1_tiles[6].."^[lowpart:50:"..v2_tiles[6]},
tiles = {v1_tiles[1].name, v2_tiles[2].name,
v1_tiles[3].name.."^[lowpart:50:"..v2_tiles[3].name, -- Stairs registers it's tiles slightly differently now
v1_tiles[4].name.."^[lowpart:50:"..v2_tiles[4].name, -- in a nested table structure and now makes use of
v1_tiles[5].name.."^[lowpart:50:"..v2_tiles[5].name, -- align_style = "world" for most slabs....I think
v1_tiles[6].name.."^[lowpart:50:"..v2_tiles[6].name
},
paramtype = "light",
paramtype2 = "facedir",
drawtype = "normal",
Expand Down

0 comments on commit 6a915d5

Please sign in to comment.