add stacking function for scaffolding mod

This commit is contained in:
Milan* 2017-01-06 18:55:57 +01:00
parent 6d207c93d7
commit 7a702f0180
3 changed files with 53 additions and 1 deletions

View File

@ -4,6 +4,7 @@ farming ?
darkage ? darkage ?
building_blocks ? building_blocks ?
teleport_potion ? teleport_potion ?
scaffolding ?
moreores ? moreores ?
mobs_animal ? mobs_animal ?
mobs_better_rat ? mobs_better_rat ?

40
functions.lua Normal file
View File

@ -0,0 +1,40 @@
--[[ Nodestacking function by https://github.com/minetest-mods/gloopblocks ]]
local nodes={"scaffolding:reinforced_iron_scaffolding",
"scaffolding:iron_scaffolding",
"scaffolding:scaffolding",
"scaffolding:reinforced_scaffolding"
}
for i = 1, 4 do
local nodes = nodes[i]
minetest.override_item(nodes, {
on_rightclick = function(pos, node, clicker, itemstack)
if itemstack and itemstack:get_name() == node.name then
for i = 1,19 do
if minetest.get_node({x=pos.x,z=pos.z}).name == nodes and scafffound ~= 0 and scafffound ~= 1 then
local scafffound = 1
return itemstack
else
break
end
end
for i = 1,19 do
if minetest.get_node({x=pos.x,y=pos.y+i,z=pos.z}).name == "air" and scaffworked ~= 1 and scaffworked ~= 0 then
minetest.set_node({x=pos.x,y=pos.y+i,z=pos.z}, {name=nodes})
local scaffworked = 1
return ItemStack(tostring(itemstack:get_name().." "..tostring(itemstack:get_count()-1)))
elseif minetest.get_node({x=pos.x,y=pos.y+i,z=pos.z}).name == nodes then
else
local scaffworked = 0
end
end
if scaffworked == 1 then
return ItemStack(tostring(itemstack:get_name().." "..tostring(itemstack:get_count()-1)))
else
return itemstack
end
else return itemstack end
end,
})
end

View File

@ -5,12 +5,23 @@ dofile(minetest.get_modpath("illuna").."/crafting.lua")
dofile(minetest.get_modpath("illuna").."/commands.lua") dofile(minetest.get_modpath("illuna").."/commands.lua")
dofile(minetest.get_modpath("illuna").."/register.lua") dofile(minetest.get_modpath("illuna").."/register.lua")
dofile(minetest.get_modpath("illuna").."/aliases.lua") dofile(minetest.get_modpath("illuna").."/aliases.lua")
dofile(minetest.get_modpath("illuna").."/functions.lua")
dofile(minetest.get_modpath("illuna").."/craftitems.lua") dofile(minetest.get_modpath("illuna").."/craftitems.lua")
dofile(minetest.get_modpath("illuna").."/shop.lua") dofile(minetest.get_modpath("illuna").."/shop.lua")
if minetest.get_modpath("moreblocks") then if minetest.get_modpath("moreblocks") then
dofile(minetest.get_modpath("illuna").."/moreblocks.lua") dofile(minetest.get_modpath("illuna").."/moreblocks.lua")
end end
--[[
minetest.register_on_chat_message(function(name, message)
if message:sub(1,1) == "/" then
return false
else
minetest.chat_send_all(core.colorize("#A3B5CB", "<"..name.."> ") ..core.colorize("#66BEF5", message))
return true
end
return ""
end)
]]
-- Water mechanics from the ethereal mod -- Water mechanics from the ethereal mod
-- --
-- If Crystal Spike, Crystal Dirt, Snow near Water, change Water to Ice -- If Crystal Spike, Crystal Dirt, Snow near Water, change Water to Ice