mirror of
https://github.com/minetest/minetest_game.git
synced 2024-12-22 23:10:17 +01:00
Clean/fix clay generation, update tool definitions to suit the latest engine
This commit is contained in:
parent
0b157335d1
commit
492e86050c
@ -27,10 +27,10 @@ minetest.register_item(":", {
|
||||
full_punch_interval = 1.0,
|
||||
max_drop_level = 0,
|
||||
groupcaps = {
|
||||
fleshy = {times={[2]=2.00, [3]=1.00}, maxwear=0, maxlevel=1},
|
||||
crumbly = {times={[2]=3.00, [3]=0.70}, maxwear=0, maxlevel=1},
|
||||
snappy = {times={[3]=0.40}, maxwear=0, maxlevel=1},
|
||||
oddly_breakable_by_hand = {times={[1]=3.50,[2]=2.00,[3]=0.70}, maxwear=0, maxlevel=3},
|
||||
fleshy = {times={[2]=2.00, [3]=1.00}, uses=0, maxlevel=1},
|
||||
crumbly = {times={[2]=3.00, [3]=0.70}, uses=0, maxlevel=1},
|
||||
snappy = {times={[3]=0.40}, uses=0, maxlevel=1},
|
||||
oddly_breakable_by_hand = {times={[1]=7.00,[2]=4.00,[3]=1.40}, uses=0, maxlevel=3},
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -41,7 +41,7 @@ minetest.register_tool("default:pick_wood", {
|
||||
tool_capabilities = {
|
||||
max_drop_level=0,
|
||||
groupcaps={
|
||||
cracky={times={[2]=2.00, [3]=1.20}, maxwear=0.1, maxlevel=1}
|
||||
cracky={times={[2]=2.00, [3]=1.20}, uses=10, maxlevel=1}
|
||||
}
|
||||
},
|
||||
})
|
||||
@ -51,7 +51,7 @@ minetest.register_tool("default:pick_stone", {
|
||||
tool_capabilities = {
|
||||
max_drop_level=0,
|
||||
groupcaps={
|
||||
cracky={times={[1]=2.00, [2]=1.20, [3]=0.80}, maxwear=0.05, maxlevel=1}
|
||||
cracky={times={[1]=3.00, [2]=1.20, [3]=0.80}, uses=20, maxlevel=1}
|
||||
}
|
||||
},
|
||||
})
|
||||
@ -61,7 +61,7 @@ minetest.register_tool("default:pick_steel", {
|
||||
tool_capabilities = {
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
cracky={times={[1]=1.20, [2]=0.80, [3]=0.50}, maxwear=0.1, maxlevel=2}
|
||||
cracky={times={[1]=4.00, [2]=1.60, [3]=1.00}, uses=10, maxlevel=2}
|
||||
}
|
||||
},
|
||||
})
|
||||
@ -72,9 +72,9 @@ minetest.register_tool("default:pick_mese", {
|
||||
full_punch_interval = 1.0,
|
||||
max_drop_level=3,
|
||||
groupcaps={
|
||||
cracky={times={[1]=0.2, [2]=0.2, [3]=0.2}, maxwear=0.05, maxlevel=3},
|
||||
crumbly={times={[1]=0.2, [2]=0.2, [3]=0.2}, maxwear=0.05, maxlevel=3},
|
||||
snappy={times={[1]=0.2, [2]=0.2, [3]=0.2}, maxwear=0.05, maxlevel=3}
|
||||
cracky={times={[1]=2.0, [2]=1.0, [3]=0.5}, uses=20, maxlevel=3},
|
||||
crumbly={times={[1]=2.0, [2]=1.0, [3]=0.5}, uses=20, maxlevel=3},
|
||||
snappy={times={[1]=2.0, [2]=1.0, [3]=0.5}, uses=20, maxlevel=3}
|
||||
}
|
||||
},
|
||||
})
|
||||
@ -84,7 +84,7 @@ minetest.register_tool("default:shovel_wood", {
|
||||
tool_capabilities = {
|
||||
max_drop_level=0,
|
||||
groupcaps={
|
||||
crumbly={times={[1]=1.50, [2]=0.80, [3]=0.50}, maxwear=0.1, maxlevel=1}
|
||||
crumbly={times={[1]=3.00, [2]=0.80, [3]=0.50}, uses=10, maxlevel=1}
|
||||
}
|
||||
},
|
||||
})
|
||||
@ -94,7 +94,7 @@ minetest.register_tool("default:shovel_stone", {
|
||||
tool_capabilities = {
|
||||
max_drop_level=0,
|
||||
groupcaps={
|
||||
crumbly={times={[1]=0.80, [2]=0.50, [3]=0.30}, maxwear=0.05, maxlevel=1}
|
||||
crumbly={times={[1]=1.50, [2]=0.50, [3]=0.30}, uses=20, maxlevel=1}
|
||||
}
|
||||
},
|
||||
})
|
||||
@ -104,7 +104,7 @@ minetest.register_tool("default:shovel_steel", {
|
||||
tool_capabilities = {
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
crumbly={times={[1]=0.50, [2]=0.35, [3]=0.30}, maxwear=0.1, maxlevel=2}
|
||||
crumbly={times={[1]=1.50, [2]=0.70, [3]=0.60}, uses=10, maxlevel=2}
|
||||
}
|
||||
},
|
||||
})
|
||||
@ -114,8 +114,8 @@ minetest.register_tool("default:axe_wood", {
|
||||
tool_capabilities = {
|
||||
max_drop_level=0,
|
||||
groupcaps={
|
||||
choppy={times={[2]=1.40, [3]=0.80}, maxwear=0.1, maxlevel=1},
|
||||
fleshy={times={[2]=1.50, [3]=0.80}, maxwear=0.1, maxlevel=1}
|
||||
choppy={times={[2]=1.40, [3]=0.80}, uses=10, maxlevel=1},
|
||||
fleshy={times={[2]=1.50, [3]=0.80}, uses=10, maxlevel=1}
|
||||
}
|
||||
},
|
||||
})
|
||||
@ -125,8 +125,8 @@ minetest.register_tool("default:axe_stone", {
|
||||
tool_capabilities = {
|
||||
max_drop_level=0,
|
||||
groupcaps={
|
||||
choppy={times={[1]=1.50, [2]=1.00, [3]=0.60}, maxwear=0.05, maxlevel=1},
|
||||
fleshy={times={[2]=1.30, [3]=0.70}, maxwear=0.05, maxlevel=1}
|
||||
choppy={times={[1]=3.00, [2]=1.00, [3]=0.60}, uses=20, maxlevel=1},
|
||||
fleshy={times={[2]=1.30, [3]=0.70}, uses=20, maxlevel=1}
|
||||
}
|
||||
},
|
||||
})
|
||||
@ -136,8 +136,8 @@ minetest.register_tool("default:axe_steel", {
|
||||
tool_capabilities = {
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
choppy={times={[1]=1.00, [2]=0.80, [3]=0.50}, maxwear=0.1, maxlevel=2},
|
||||
fleshy={times={[2]=1.10, [3]=0.60}, maxwear=0.03, maxlevel=1}
|
||||
choppy={times={[1]=3.00, [2]=1.60, [3]=1.00}, uses=10, maxlevel=2},
|
||||
fleshy={times={[2]=1.10, [3]=0.60}, uses=40, maxlevel=1}
|
||||
}
|
||||
},
|
||||
})
|
||||
@ -148,9 +148,9 @@ minetest.register_tool("default:sword_wood", {
|
||||
full_punch_interval = 1.0,
|
||||
max_drop_level=0,
|
||||
groupcaps={
|
||||
fleshy={times={[2]=1.10, [3]=0.60}, maxwear=0.1, maxlevel=1},
|
||||
snappy={times={[2]=1.00, [3]=0.50}, maxwear=0.1, maxlevel=1},
|
||||
choppy={times={[3]=1.00}, maxwear=0.05, maxlevel=0}
|
||||
fleshy={times={[2]=1.10, [3]=0.60}, uses=10, maxlevel=1},
|
||||
snappy={times={[2]=1.00, [3]=0.50}, uses=10, maxlevel=1},
|
||||
choppy={times={[3]=1.00}, uses=20, maxlevel=0}
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -161,9 +161,9 @@ minetest.register_tool("default:sword_stone", {
|
||||
full_punch_interval = 1.0,
|
||||
max_drop_level=0,
|
||||
groupcaps={
|
||||
fleshy={times={[2]=0.80, [3]=0.40}, maxwear=0.05, maxlevel=1},
|
||||
snappy={times={[2]=0.80, [3]=0.40}, maxwear=0.05, maxlevel=1},
|
||||
choppy={times={[3]=0.90}, maxwear=0.05, maxlevel=0}
|
||||
fleshy={times={[2]=0.80, [3]=0.40}, uses=20, maxlevel=1},
|
||||
snappy={times={[2]=0.80, [3]=0.40}, uses=20, maxlevel=1},
|
||||
choppy={times={[3]=0.90}, uses=20, maxlevel=0}
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -174,9 +174,9 @@ minetest.register_tool("default:sword_steel", {
|
||||
full_punch_interval = 1.0,
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
fleshy={times={[1]=1.00, [2]=0.40, [3]=0.20}, maxwear=0.1, maxlevel=2},
|
||||
snappy={times={[2]=0.70, [3]=0.30}, maxwear=0.03, maxlevel=1},
|
||||
choppy={times={[3]=0.70}, maxwear=0.03, maxlevel=0}
|
||||
fleshy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=10, maxlevel=2},
|
||||
snappy={times={[2]=0.70, [3]=0.30}, uses=40, maxlevel=1},
|
||||
choppy={times={[3]=0.70}, uses=40, maxlevel=0}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -9,17 +9,21 @@ local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume,
|
||||
local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1)
|
||||
local pr = PseudoRandom(seed)
|
||||
local num_chunks = math.floor(chunks_per_volume * volume)
|
||||
local inverse_chance = math.floor(27 / ore_per_chunk)
|
||||
local chunk_size = 3
|
||||
if ore_per_chunk <= 4 then
|
||||
chunk_size = 2
|
||||
end
|
||||
local inverse_chance = math.floor(chunk_size*chunk_size*chunk_size / ore_per_chunk)
|
||||
--print("generate_ore num_chunks: "..dump(num_chunks))
|
||||
for i=1,num_chunks do
|
||||
local y0 = pr:next(y_min, y_max)
|
||||
local y0 = pr:next(y_min, y_max-chunk_size+1)
|
||||
if y0 >= height_min and y0 <= height_max then
|
||||
local x0 = pr:next(minp.x, maxp.x)
|
||||
local z0 = pr:next(minp.z, maxp.z)
|
||||
local x0 = pr:next(minp.x, maxp.x-chunk_size+1)
|
||||
local z0 = pr:next(minp.z, maxp.z-chunk_size+1)
|
||||
local p0 = {x=x0, y=y0, z=z0}
|
||||
for x1=-1,1 do
|
||||
for y1=-1,1 do
|
||||
for z1=-1,1 do
|
||||
for x1=0,chunk_size-1 do
|
||||
for y1=0,chunk_size-1 do
|
||||
for z1=0,chunk_size-1 do
|
||||
if pr:next(1,inverse_chance) == 1 then
|
||||
local x2 = x0+x1
|
||||
local y2 = y0+y1
|
||||
@ -38,35 +42,42 @@ local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume,
|
||||
end
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
generate_ore("default:stone_with_coal", "default:stone", minp, maxp, seed, 1/8/8/8, 5, -64, 64)
|
||||
generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+1, 1/16/16/16, 5, 3, 7)
|
||||
generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+2, 1/12/12/12, 5, -16, 2)
|
||||
generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+3, 1/9/9/9, 5, -64, -17)
|
||||
generate_ore("default:stone_with_coal", "default:stone", minp, maxp, seed, 1/8/8/8, 5, -64, 64)
|
||||
generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+1, 1/16/16/16, 5, 3, 7)
|
||||
generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+2, 1/12/12/12, 5, -16, 2)
|
||||
generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+3, 1/9/9/9, 5, -64, -17)
|
||||
-- Generate clay
|
||||
if maxp.y >= 2 and minp.y <= 0 then
|
||||
-- Assume X and Z lengths are equal
|
||||
local divlen = 4
|
||||
local divs = (maxp.x-minp.x)/divlen+1;
|
||||
for divx=1,divs do
|
||||
for divz=1,divs do
|
||||
for divx=0+1,divs-1-1 do
|
||||
for divz=0+1,divs-1-1 do
|
||||
local cx = minp.x + math.floor((divx+0.5)*divlen)
|
||||
local cz = minp.z + math.floor((divz+0.5)*divlen)
|
||||
local is_shallow = true
|
||||
if minetest.env:get_node({x=cx-divlen*2,y=1,z=cz+0}).name == "default:water_source" or
|
||||
minetest.env:get_node({x=cx+divlen*2,y=1,z=cz+0}).name == "default:water_source" or
|
||||
minetest.env:get_node({x=cx,y=1,z=cz-divlen*2}).name == "default:water_source" or
|
||||
minetest.env:get_node({x=cx,y=1,z=cz+divlen*2}).name == "default:water_source" then
|
||||
is_shallow = false
|
||||
end
|
||||
if is_shallow and
|
||||
minetest.env:get_node({x=cx,y=1,z=cz}).name == "default:water_source" and
|
||||
if minetest.env:get_node({x=cx,y=1,z=cz}).name == "default:water_source" and
|
||||
minetest.env:get_node({x=cx,y=0,z=cz}).name == "default:sand" then
|
||||
for x1=-divlen,divlen do
|
||||
for z1=-divlen,divlen do
|
||||
if minetest.env:get_node({x=cx+x1,y=0,z=cz+z1}).name == "default:sand" then
|
||||
minetest.env:set_node({x=cx+x1,y=0,z=cz+z1}, {name="default:clay"})
|
||||
local is_shallow = true
|
||||
local num_water_around = 0
|
||||
if minetest.env:get_node({x=cx-divlen*2,y=1,z=cz+0}).name == "default:water_source" then
|
||||
num_water_around = num_water_around + 1 end
|
||||
if minetest.env:get_node({x=cx+divlen*2,y=1,z=cz+0}).name == "default:water_source" then
|
||||
num_water_around = num_water_around + 1 end
|
||||
if minetest.env:get_node({x=cx+0,y=1,z=cz-divlen*2}).name == "default:water_source" then
|
||||
num_water_around = num_water_around + 1 end
|
||||
if minetest.env:get_node({x=cx+0,y=1,z=cz+divlen*2}).name == "default:water_source" then
|
||||
num_water_around = num_water_around + 1 end
|
||||
if num_water_around >= 2 then
|
||||
is_shallow = false
|
||||
end
|
||||
if is_shallow then
|
||||
for x1=-divlen,divlen do
|
||||
for z1=-divlen,divlen do
|
||||
if minetest.env:get_node({x=cx+x1,y=0,z=cz+z1}).name == "default:sand" then
|
||||
minetest.env:set_node({x=cx+x1,y=0,z=cz+z1}, {name="default:clay"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user