Adjust tree nodes. Return bucket from sap.

This commit is contained in:
Duane 2016-07-06 00:46:36 -05:00
parent 5763c4888e
commit 2e978e540c
3 changed files with 71 additions and 7 deletions

View file

@ -158,6 +158,7 @@ dofile(fun_caves.path .. "/fungal_tree.lua")
dofile(fun_caves.path .. "/elixir.lua")
dofile(fun_caves.path .. "/wallhammer.lua")
dofile(fun_caves.path .. "/mapgen.lua")
dofile(fun_caves.path .. "/spec_bomb.lua")
dofile(fun_caves.path .. "/chat.lua")
if mobs and mobs.mod == "redo" then

42
spec_bomb.lua Normal file
View file

@ -0,0 +1,42 @@
local function disintigrate(pos, radius, node_name, user)
local p1 = vector.subtract(pos, radius)
local p2 = vector.add(pos, radius)
local nodes = minetest.find_nodes_in_area(p1, p2, node_name)
for _, node in pairs(nodes) do
if not minetest.is_protected(node, user) then
minetest.remove_node(node)
end
end
end
local nodes = {{'fun_caves:pyramid_1', 'default:sandstone_block'},}
for _, node in pairs(nodes) do
local node_name = node[1]
local comp = node[2] or node_name
local node_texture = minetest.registered_items[node_name].tiles
if type(node_texture) == 'table' then
node_texture = node_texture[1]
end
local newnode = fun_caves.clone_node(node_name)
local _, d_name = node_name:match('(.*:)(.*)')
local d_name_u = d_name:gsub("(%l)(%w*)", function(a,b) return string.upper(a)..b end)
newnode.description = d_name_u.." Bomb"
newnode.inventory_image = '[inventorycube{tnt_top.png{'..node_texture..'{tnt_side.png'
newnode.on_punch = function(pos, node, puncher, pointed_thing)
minetest.after(5, function()
disintigrate(pos, 5, node_name, puncher)
minetest.remove_node(pos)
end)
end
minetest.register_node("fun_caves:"..d_name..'_bomb', newnode)
minetest.register_craft({
output = "fun_caves:"..d_name..'_bomb',
recipe = {
{"", comp, ""},
{comp, "tnt:gunpowder", comp},
{"", comp, ""}
}
})
end

View file

@ -166,6 +166,27 @@ minetest.register_node("fun_caves:syrup", {
sounds = default.node_sound_glass_defaults(),
})
minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv)
local name = itemstack:get_name()
if not (name and name == 'fun_caves:syrup') then
return
end
local bucket
local index
for i = 1, player:get_inventory():get_size("craft") do
if (old_craft_grid[i]:get_name()):find('^fun_caves:bucket') then
bucket = old_craft_grid[i]
index = i
end
end
if not bucket then
return
end
craft_inv:set_stack("craft", index, 'bucket:bucket_empty')
end)
newnode = fun_caves.clone_node("default:tree")
newnode.description = "Glowing Fungal Wood"
newnode.tiles = {"fun_caves_tree.png^vmg_glowing_fungal.png",}
@ -290,24 +311,24 @@ fun_caves.treegen = function(minp, maxp, data, p2data, area, node)
if distance < r then
if distance % 8 == 7 and wood_1[index3d] < 0.3 then
data[ivm] = node['fun_caves:petrified_wood']
elseif wood_1[index3d] < -0.98 then
elseif wood_1[index3d] < -1.1 then
data[ivm] = node['fun_caves:weightless_water']
elseif wood_1[index3d] < -0.8 then
elseif wood_1[index3d] < -0.9 then
data[ivm] = node['air']
elseif wood_1[index3d] < -0.05 then
elseif wood_1[index3d] < -0.1 then
data[ivm] = node['fun_caves:tree']
elseif wood_1[index3d] < 0.05 then
elseif wood_1[index3d] < 0.1 then
data[ivm] = node['air']
elseif wood_1[index3d] < 0.6 then
elseif wood_1[index3d] < 0.9 then
data[ivm] = node['fun_caves:tree']
elseif wood_1[index3d] < 0.97 then
elseif wood_1[index3d] < 1.3 then
data[ivm] = node['fun_caves:ironwood']
else
data[ivm] = node['fun_caves:diamondwood']
end
if data[ivm] ~= node['air'] and data[ivm] ~= node['fun_caves:weightless_water'] then
if math_random(500) == 1 then
if math_random(100) == 1 then
data[ivm] = node['fun_caves:sap']
elseif math_random(1000) == 1 then
data[ivm] = node['fun_caves:tree_mineral']