Merge pull request #5 from ShadMOrdre/lib_materials

Lib materials
This commit is contained in:
Shad MOrdre 2019-06-23 23:57:09 -07:00 committed by GitHub
commit fb65243100
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
581 changed files with 10453 additions and 478 deletions

View File

@ -1,2 +1,3 @@
default?
carpathian_mapgen?
stairs?
game?

209
init.lua
View File

@ -1,132 +1,103 @@
lib_materials = {}
lib_materials.version = "5.0"
lib_materials.path = minetest.get_modpath(minetest.get_current_modname())
lib_materials.gettext, lib_materials.ngettext = dofile(lib_materials.path.."/intllib.lua")
local S = lib_materials.gettext
local NS = lib_materials.ngettext
-- Intllib
local S
local NS
if minetest.get_modpath("game") then
S = game.intllib
else
if minetest.get_modpath("intllib") then
S = intllib.Getter()
else
S, NS = dofile(lib_materials.path.."/intllib.lua")
end
end
lib_materials.intllib = S
lib_materials.mgv7_mapgen_scale_factor = minetest.setting_get("lib_materials_mgv7_mapgen_scale_factor") or 8
lib_materials.biome_altitude_range = minetest.setting_get("lib_materials_biome_altitude_range") or 40
lib_materials.mg_params = minetest.get_mapgen_params()
lib_materials.mg_seed = lib_materials.mg_params.seed
--DEFAULTS
-- -192, -4, 0, 4, 30, 60, 90, 120, 150, 285, 485, 1250
-- -192, -4, 0, 4, 40, 80, 120, 160, 200, 380, 780, 1800
lib_materials.ocean_depth = -192
lib_materials.beach_depth = -4
lib_materials.sea_level = 0
lib_materials.maxheight_beach = 4
--lib_materials.maxheight_coastal = 30
--lib_materials.maxheight_lowland = 60
--lib_materials.maxheight_shelf = 90
--lib_materials.maxheight_highland = 120
--lib_materials.maxheight_mountain = 150
lib_materials.maxheight_coastal = lib_materials.sea_level + lib_materials.biome_altitude_range
lib_materials.maxheight_lowland = lib_materials.maxheight_coastal + lib_materials.biome_altitude_range
lib_materials.maxheight_shelf = lib_materials.maxheight_lowland + lib_materials.biome_altitude_range
lib_materials.maxheight_highland = lib_materials.maxheight_shelf + lib_materials.biome_altitude_range
lib_materials.maxheight_mountain = lib_materials.maxheight_highland + lib_materials.biome_altitude_range
lib_materials.minheight_snow = lib_materials.maxheight_mountain + lib_materials.biome_altitude_range
lib_materials.maxheight_snow = lib_materials.minheight_snow + (lib_materials.biome_altitude_range * 2)
lib_materials.maxheight_strato = lib_materials.maxheight_snow + (lib_materials.biome_altitude_range * (lib_materials.mgv7_mapgen_scale_factor / 2))
-- 100, 75, 50, 25, 0
-- 90, 75, 50, 25, 10
-- 90, 70, 50, 30, 10
lib_materials.temperature_hot = 100
lib_materials.temperature_warm = 75
lib_materials.temperature_temperate = 50
lib_materials.temperature_cool = 25
lib_materials.temperature_cold = 0
lib_materials.humidity_humid = 100
lib_materials.humidity_semihumid = 75
lib_materials.humidity_temperate = 50
lib_materials.humidity_semiarid = 25
lib_materials.humidity_arid = 0
-- 8, 4
--lib_materials.biome_vertical_blend = 4
lib_materials.biome_vertical_blend = lib_materials.biome_altitude_range / 5
minetest.clear_registered_biomes()
minetest.clear_registered_decorations()
minetest.clear_registered_ores()
minetest.log(S("[MOD] lib_materials: Loading..."))
dofile(lib_materials.path.."/lib_materials_sound_defaults.lua")
dofile(lib_materials.path.."/type_fluids.lua")
dofile(lib_materials.path.."/type_stone.lua")
dofile(lib_materials.path.."/type_stone_deco.lua")
dofile(lib_materials.path.."/type_dirt.lua")
dofile(lib_materials.path.."/type_sand.lua")
dofile(lib_materials.path.."/type_ice_snow.lua")
dofile(lib_materials.path.."/type_ore.lua")
dofile(lib_materials.path.."/type_glass.lua")
dofile(lib_materials.path.."/lib_materials_schematics.lua")
dofile(lib_materials.path.."/lib_materials_tools.lua")
dofile(lib_materials.path.."/lib_materials_biomes.lua")
dofile(lib_materials.path.."/lib_materials_lakes.lua")
dofile(lib_materials.path.."/lib_materials_ore_defs.lua")
dofile(lib_materials.path.."/lib_materials_utils.lua")
dofile(lib_materials.path.."/lib_materials_water.lua")
dofile(lib_materials.path.."/type_dirt.lua")
dofile(lib_materials.path.."/type_sand.lua")
dofile(lib_materials.path.."/type_ore.lua")
dofile(lib_materials.path.."/type_stone.lua")
dofile(lib_materials.path.."/lib_materials_ore_defs.lua")
--[[
lib_materials.register_materials = function()
local node_defs = {}
for node, def in pairs(minetest.registered_nodes) do
local node_name = node
local node_def = table.copy(def)
if not node_def then
return false
end
local node_groups = table.copy(node_def.groups) or {}
if not node_groups then
return false
end
if not node_groups.stone then
--node_def.density = 10
--node_def.mass = 10
--node_def.hardness = 10
--node_def.melting_point = 500
--node_groups.material = 3
--node_groups.inorganic = 3
end
if not node_groups.dirt then
end
if not node_groups.glass then
end
if not node_groups.tree then
end
if not node_groups.wood then
end
if not node_groups.plant then
end
if not node_groups.crumbly then
end
if not node_groups.cracky then
end
if not node_groups.snappy then
end
if not node_groups.choppy then
end
if not node_groups.oddly_breakable_by_hand then
end
if not node_groups.soil then
end
if not node_groups.fleshy then
end
if not node_groups.bouncy then
end
if not node_groups.explody then
end
end
nod_def.groups = node_groups
minetest.override_item(node_name, nod_def)
end
--]]
--lib_materials.register_material = function(material_name, {material_def})
--local def = minetest.registered_nodes["some:name"]
--local groups = table.copy(def.groups)
--groups.my_group = 123
--minetest.override_item("some:name", { groups=groups })
--end
dofile(lib_materials.path.."/lib_materials_abms.lua")
dofile(lib_materials.path.."/lib_materials_chatcommands.lua")
minetest.log(S("[MOD] lib_materials: Successfully loaded."))

186
lib_materials_abms.lua Normal file
View File

@ -0,0 +1,186 @@
local S = lib_materials.intllib
--
-- Lavacooling
--
lib_materials.cool_lava = function(pos, node)
if node.name == "lib_materials:lava_source" or node.name == "lib_materials:lava_flowing" then
local rnum = math.random(1,4)
if rnum == 1 then
if node.name == "lib_materials:lava_source" then
minetest.set_node(pos, {name = "lib_materials:lava_cooling_source"})
else
minetest.set_node(pos, {name = "lib_materials:lava_cooling_flowing"})
end
else
end
minetest.sound_play("default_cool_lava", {pos = pos, max_hear_distance = 16, gain = 0.25})
end
end
lib_materials.cool_lava2 = function(pos, node)
if node.name == "lib_materials:lava_cooling_source" or node.name == "lib_materials:lava_cooling_flowing" then
local rnum = math.random(1,2)
if rnum == 1 then
minetest.set_node(pos, {name = "lib_materials:stone_cobble_hot"})
else
end
minetest.sound_play("default_cool_lava", {pos = pos, max_hear_distance = 16, gain = 0.25})
end
end
lib_materials.cool_lava3 = function(pos, node)
if node.name == "lib_materials:stone_cobble_hot" then
local rnum = math.random(1,6)
if rnum == 1 then
minetest.set_node(pos, {name = "lib_materials:stone_obsidian"})
elseif rnum == 2 then
minetest.set_node(pos, {name = "lib_materials:stone_basalt_01"})
elseif rnum == 3 then
minetest.set_node(pos, {name = "lib_materials:stone_basalt_02"})
elseif rnum == 4 then
minetest.set_node(pos, {name = "lib_materials:stone_basalt_03"})
elseif rnum == 5 then
minetest.set_node(pos, {name = "lib_materials:stone"})
else
end
minetest.sound_play("default_cool_lava", {pos = pos, max_hear_distance = 16, gain = 0.25})
end
end
if minetest.settings:get_bool("enable_lavacooling") ~= false then
minetest.register_abm({
label = "Lava cooling",
nodenames = {"lib_materials:lava_source", "lib_materials:lava_flowing"},
neighbors = {"group:cools_lava", "group:water"},
interval = 2,
chance = 2,
catch_up = false,
action = function(...)
lib_materials.cool_lava(...)
end,
})
minetest.register_abm({
label = "Lava2 cooling",
nodenames = {"lava_cooling_source", "lib_materials:lava_cooling_flowing"},
neighbors = {"group:cools_lava", "group:water"},
interval = 2,
chance = 2,
catch_up = false,
action = function(...)
lib_materials.cool_lava2(...)
end,
})
minetest.register_abm({
label = "Lava3 cooling",
nodenames = {"lib_materials:stone_cobble_hot"},
neighbors = {"group:cools_lava", "group:water"},
interval = 2,
chance = 2,
catch_up = false,
action = function(...)
lib_materials.cool_lava3(...)
end,
})
end
--
-- Convert dirt to something that fits the environment
--
minetest.register_abm({
label = "Grass spread",
nodenames = {"default:dirt"},
neighbors = {
"air",
"group:grass",
"group:dry_grass",
"default:snow",
},
interval = 6,
chance = 50,
catch_up = false,
action = function(pos, node)
-- Check for darkness: night, shadow or under a light-blocking node
-- Returns if ignore above
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
if (minetest.get_node_light(above) or 0) < 13 then
return
end
-- Look for spreading dirt-type neighbours
local p2 = minetest.find_node_near(pos, 1, "group:spreading_dirt_type")
if p2 then
local n3 = minetest.get_node(p2)
minetest.set_node(pos, {name = n3.name})
return
end
-- Else, any seeding nodes on top?
local name = minetest.get_node(above).name
-- Snow check is cheapest, so comes first
if name == "default:snow" then
minetest.set_node(pos, {name = "default:dirt_with_snow"})
-- Most likely case first
elseif minetest.get_item_group(name, "grass") ~= 0 then
minetest.set_node(pos, {name = "default:dirt_with_grass"})
elseif minetest.get_item_group(name, "dry_grass") ~= 0 then
minetest.set_node(pos, {name = "default:dirt_with_dry_grass"})
end
end
})
--
-- Grass and dry grass removed in darkness
--
minetest.register_abm({
label = "Grass covered",
nodenames = {"group:spreading_dirt_type"},
interval = 8,
chance = 50,
catch_up = false,
action = function(pos, node)
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
local name = minetest.get_node(above).name
local nodedef = minetest.registered_nodes[name]
if name ~= "ignore" and nodedef and not ((nodedef.sunlight_propagates or
nodedef.paramtype == "light") and
nodedef.liquidtype == "none") then
minetest.set_node(pos, {name = "default:dirt"})
end
end
})
--
-- Moss growth on cobble near water
--
minetest.register_abm({
label = "Moss growth",
nodenames = {"default:cobble", "stairs:slab_cobble", "stairs:stair_cobble", "walls:cobble"},
neighbors = {"group:water"},
interval = 16,
chance = 200,
catch_up = false,
action = function(pos, node)
if node.name == "default:cobble" then
minetest.set_node(pos, {name = "default:mossycobble"})
elseif node.name == "stairs:slab_cobble" then
minetest.set_node(pos, {name = "stairs:slab_mossycobble", param2 = node.param2})
elseif node.name == "stairs:stair_cobble" then
minetest.set_node(pos, {name = "stairs:stair_mossycobble", param2 = node.param2})
elseif node.name == "walls:cobble" then
minetest.set_node(pos, {name = "walls:mossycobble", param2 = node.param2})
end
end
})

1119
lib_materials_biomes.lua Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,161 @@
local S = lib_materials.intllib
minetest.register_chatcommand("emerge_area", {
params = "x1 y1 z1 x2 y2 z2",
description = S("Generate map in a square box from pos1(x1,y1,z1) to pos2(x2,y2,z2)./nUsage: /emerge_area x1 y1 z1 x2 y2 z2"),
func = function(name, params)
-- local found, _, s_x1, s_y1, s_z1, s_x2, s_y2, s_z2 = params:find("^%s*(%d+)%s*(-?%d*)%s*$")
local found, _, s_x1, s_y1, s_z1, s_x2, s_y2, s_z2 = params:find("^([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+)[ ] *([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+)$")
if found == nil then
minetest.chat_send_player(name, "Usage: /mapgen x1 y1 z1 x2 y2 z2")
return
end
local pos1 = {x=tonumber(s_x1), y=tonumber(s_y1), z=tonumber(s_z1)}
local pos2 = {x=tonumber(s_x2), y=tonumber(s_y2), z=tonumber(s_z2)}
local start_time = minetest.get_us_time()
minetest.emerge_area(pos1, pos2, function(blockpos, action, remaining)
local dt = math.floor((minetest.get_us_time() - start_time) / 1000)
local block = (blockpos.x * 16)..","..(blockpos.y * 16)..","..(blockpos.z * 16)
local info = "(mapgen-"..remaining.."-"..dt.."ms) "
if action==core.EMERGE_GENERATED then
minetest.chat_send_player(name, info.."Generated new block at "..block)
elseif (action==core.EMERGE_CANCELLED) or (action==core.EMERGE_ERRORED) then
minetest.chat_send_player(name, info.."Block at "..block.." did not emerge")
else
--minetest.chat_send_player(name, "(mapgen-"..remaining.."-"..dt.."s) Visited block at "..(blockpos.x)..","..(blockpos.y)..","..(blockpos.z))
end
if remaining<=0 then
minetest.chat_send_player(name, "(mapgen-"..dt.."ms) Generation done.")
end
end
)
end
})
minetest.register_chatcommand("emerge_radius", {
params = "radius [max_height]",
description = S("Generate map in a square box of size 2*radius centered at your current position."),
func = function(name, params)
local found, _, s_radius, s_height = params:find("^%s*(%d+)%s*(-?%d*)%s*$")
if found == nil then
minetest.chat_send_player(name, "Usage: /mapgen radius max_height")
return
end
local player = minetest.get_player_by_name(name)
local pos = player:getpos()
local radius = tonumber(s_radius)
local max_height = tonumber(s_height)
if max_height == nil then
max_height = pos.y+1
end
if radius == 0 then
radius = 1
end
local start_pos = {
x = pos.x - radius,
y = pos.y,
z = pos.z - radius
}
local end_pos = {
x = pos.x + radius,
y = max_height,
z = pos.z + radius
}
local start_time = minetest.get_us_time()
minetest.emerge_area(start_pos, end_pos, function(blockpos, action, remaining)
local dt = math.floor((minetest.get_us_time() - start_time) / 1000)
local block = (blockpos.x * 16)..","..(blockpos.y * 16)..","..(blockpos.z * 16)
local info = "(mapgen-"..remaining.."-"..dt.."ms) "
if action==core.EMERGE_GENERATED then
minetest.chat_send_player(name, info.."Generated new block at "..block)
elseif (action==core.EMERGE_CANCELLED) or (action==core.EMERGE_ERRORED) then
minetest.chat_send_player(name, info.."Block at "..block.." did not emerge")
else
--minetest.chat_send_player(name, "(mapgen-"..remaining.."-"..dt.."s) Visited block at "..(blockpos.x)..","..(blockpos.y)..","..(blockpos.z))
end
if remaining<=0 then
minetest.chat_send_player(name, "(mapgen-"..dt.."ms) Generation done.")
end
end
)
end
})
minetest.register_chatcommand("biomes_get", {
params = "",
description = S("List all biomes."),
_doc_items_longdesc = S("List all biomes as registered with minetest.registered_biomes"),
_doc_items_usagehelp = S("Type /biomes_get in the console."),
func = function(name)
local list_biomes = "REGISTERED BIOMES:\n"
local filename = "biomes_list.txt";
local path = minetest.get_worldpath()..'/'..filename;
local file = io.open( path, 'w' );
for biome_name, biome_def in pairs(minetest.registered_biomes) do
list_biomes = list_biomes .. "\t" .. biome_name .. "\n"
end
if( file ) then
if list_biomes ~= nil then
minetest.chat_send_player(name, S(list_biomes))
file:write(list_biomes)
file:close();
end
else
print("[listitems] Error: listToFile '"..tostring( path ).."' could not be written.");
end
end
})
minetest.register_chatcommand("decorations_get", {
params = "",
description = S("List all decorations."),
_doc_items_longdesc = S("List all decorations as registered with minetest.registered_decorations"),
_doc_items_usagehelp = S("Type /decorations_get in the console."),
func = function(name)
local list_decorations = ""
local filename = "decorations_list.txt";
local path = minetest.get_worldpath()..'/'..filename;
local file = io.open( path, 'w' );
minetest.chat_send_player(name, S("Start Decorations List"))
for _, deco_def in pairs(minetest.registered_decorations) do
list_decorations = list_decorations .. dump(deco_def, " ") .. "\n"
--dump(deco_def, list_decorations)
-- if deco_def.deco_type ~= "schematic" then
-- list_decorations = list_decorations .. "\t" .. tostring(deco_def.decoration) .. "\n"
-- end
end
minetest.chat_send_player(name, S("End Decorations List"))
file:write(list_decorations)
file:close();
--minetest.chat_send_player(name, S(list_decorations))
end
})

253
lib_materials_lakes.lua Normal file
View File

@ -0,0 +1,253 @@
--[[
1. We choose a random position in the same way plants are placed. That's the root for our lake.
2. From there we go lx in the x direction and lz in the z direction. That gives us a rectangle.
3. We check the sides of the rectangle for air and itterate down until the rectangle is closed.
4. Now we repeat this itteration, but search for the opposite, not for solid nodes but for air.
5. As soon as we found the lower limit, we check if the bottom is sealed. Now we have some jar.
6. Now as we made sure no water can escape we can replace all air inside the volume with water.
--]]
--lib_lakes = {}
local c_air = minetest.get_content_id("air")
local c_ignore = minetest.get_content_id("ignore")
local c_lava = minetest.get_content_id("default:lava_source")
local c_water = minetest.get_content_id("lib_materials:fluid_water_source")
local c_ice = minetest.get_content_id("lib_materials:ice_default")
local c_murky = minetest.get_content_id("lib_materials:fluid_water_murky_source")
local c_dirty = minetest.get_content_id("lib_materials:fluid_water_dirty_source")
local c_muddy = minetest.get_content_id("lib_materials:fluid_water_river_muddy_source")
local c_quick_source = minetest.get_content_id("lib_materials:fluid_quicksand_source")
local c_quick = minetest.get_content_id("lib_materials:quicksand")
local c_mud_wet = minetest.get_content_id("lib_materials:mud_wet")
local c_mud_dried = minetest.get_content_id("lib_materials:dirt_mud_dried")
local c_fluid_id
--
-- Find position
--
minetest.register_on_generated(function(minp, maxp, seed)
if maxp.y <= 1024 and minp.y >= -32 then
local perlin1 = minetest.get_perlin(318, 3, 0.6, 100)
-- Lua Voxel Machine
local vm = minetest.get_voxel_manip()
local vm_minp, vm_maxp = vm:read_from_map({x=minp.x, y=minp.y, z=minp.z-16}, {x=maxp.x+16, y=maxp.y+16, z=maxp.z+16})
local a = VoxelArea:new{MinEdge=vm_minp, MaxEdge=vm_maxp}
local data = vm:get_data()
-- Assume X and Z lengths are equal
local divlen = 32
local divs = (maxp.x-minp.x)/divlen+1;
for divx=0,divs-1 do
for divz=0,divs-1 do
local x0 = minp.x + math.floor((divx+0)*divlen)
local z0 = minp.z + math.floor((divz+0)*divlen)
local x1 = minp.x + math.floor((divx+1)*divlen)
local z1 = minp.z + math.floor((divz+1)*divlen)
-- Determine amount from perlin noise
local amount = math.floor(perlin1:get2d({x=x0, y=z0}) * 5 + 10)
-- Find random positions based on this random
local pr = PseudoRandom(seed+486)
for i=0,amount do
local x = pr:next(x0, x1)
local z = pr:next(z0, z1)
local ground_y = nil
-- Prevent from starting underground
local nn = minetest.get_node({x=x,y=maxp.y,z=z}).name
if nn ~= "air" and nn ~= "ignore" then
return
end
-- Find groundlevel
for y=maxp.y,minp.y,-1 do
local nn = minetest.get_node({x=x,y=y,z=z}).name
if nn ~= "air" and nn~= "ignore" then
--local is_leaves = minetest.registered_nodes[nn].groups.leaves
--if is_leaves == nil or is_leaves == 0 then
-- ground_y = y
-- break
--end
local is_leaves = minetest.registered_nodes[nn].groups.leaves
local is_plant = minetest.registered_nodes[nn].groups.plant
local is_le_plant = minetest.registered_nodes[nn].groups.lib_ecology_plant
local is_flora = minetest.registered_nodes[nn].groups.flora
local is_flower = minetest.registered_nodes[nn].groups.flower
local is_growing = minetest.registered_nodes[nn].groups.growing
if is_leaves == nil or is_leaves == 0 then
ground_y = y
break
end
-- or is_plant == nil or is_plant == 0 or is_le_plant == nil or is_le_plant == 0 or is_flora == nil or is_flora == 0 or is_flower == nil or is_flower == 0 or is_growing == nil or is_growing == 0 then
end
end
if ground_y and ground_y >= 2 then
local p = {x=x,y=ground_y,z=z}
local ground_name = minetest.get_node(p)
local node_name = minetest.get_node(p).name
if ground_name == "default:water_source" or ground_name == "lib_materials:fluid_water_source" then
return
end
local ground_name = minetest.get_node(p)
local node_name = minetest.get_node(p).name
if ground_name == "default:water_source" or ground_name == "lib_materials:fluid_water_source" then
return
end
local lx = pr:next(10,30)
local lz = pr:next(10,30)
--if string.match(node_name, "lib_materials:dirt_sandy") then
-- c_fluid_id = c_quick_source
--end
--if string.match(node_name, "lib_materials:sand") then
-- c_fluid_id = c_quick
--end
if string.match(node_name, "lib_materials:dirt_with_rainforest_litter") then
c_fluid_id = c_murky
end
if string.match(node_name, "lib_materials:dirt_mud_01") then
c_fluid_id = c_muddy
end
if string.match(node_name, "lib_materials:dirt_clayey") then
c_fluid_id = c_muddy
end
if string.match(node_name, "lib_materials:sand_desert") then
c_fluid_id = c_mud_dried
end
if string.match(node_name, "lib_materials:sand") then
c_fluid_id = c_mud_dried
end
--if string.match(node_name, "lib_materials:dirt_with_grass_warm_semihumid_coastal") or string.match(node_name, "lib_materials:dirt_with_grass_temperate_semihumid_coastal") then
-- c_fluid_id = c_dirty
--end
--if string.match(node_name, "lib_materials:dirt_with_grass_warm_semihumid_lowland") or string.match(node_name, "lib_materials:dirt_with_grass_temperate_semihumid_lowland") then
-- c_fluid_id = c_dirty
--end
--if string.match(node_name, "lib_materials:dirt_with_grass_warm_semihumid_shelf") or string.match(node_name, "lib_materials:dirt_with_grass_temperate_semihumid_shelf") then
-- c_fluid_id = c_dirty
--end
--if string.match(node_name, "lib_materials:dirt_with_grass_warm_semihumid_highland") or string.match(node_name, "lib_materials:dirt_with_grass_temperate_semihumid_highland") then
-- c_fluid_id = c_dirty
--end
if string.match(node_name, "lib_materials:stone_greenstone") then
c_fluid_id = c_lava
end
if string.match(node_name, "snow") then
c_fluid_id = c_ice
end
if ground_y >= lib_materials.minheight_snow then
c_fluid_id = c_ice
end
-- if c_water == "" then
-- else
-- c_water = minetest.get_content_id("default:river_water_source")
-- end
lib_materials.lakes_fill(data, a, p, lx, lz)
--c_fluid_id = ""
end
end
end
end
-- Write to map
vm:set_data(data)
vm:write_to_map(data)
vm:update_map()
end
end)
--
-- Make lake
--
-- TODO: combine functions into one
local function check_x(data, a, x, y, z, lx, lz)
for xi = 0, lx do
local vi = a:index(x+xi, y, z)
if data[vi] == c_air or data[vi] == c_ignore then
return true
end
local vii = a:index(x+xi, y, z+lz)
if data[vii] == c_air or data[vii] == c_ignore then
return true
end
end
end
local function check_z(data, a, x, y, z, lx, lz)
for zi = 0, lz do
local vi = a:index(x, y, z+zi)
if data[vi] == c_air or data[vi] == c_ignore then
return true
end
local vii = a:index(x+lx, y, z+zi)
if data[vii] == c_air or data[vii] == c_ignore then
return true
end
end
end
local function leak(data, a, j, lx, lz)
for xi = 0, lx do
for zi = 0, lz do
local vi = a:index(xi, -j, zi)
if data[vi] == c_air or data[vi] == c_ignore then
return true
end
end
end
end
function lib_materials.lakes_fill(data, a, pos, lx, lz)
local x, y, z = pos.x, pos.y, pos.z
local water_a = VoxelArea:new{MinEdge={x=0, y=-32, z=0}, MaxEdge={x=lx, y=0, z=lz}}
local water_buffer = {}
-- Find upper start
local i = 0
while i <= 16 do
if check_x(data, a, x, y-i, z, lx, lz) or check_z(data, a, x, y-i, z, lx, lz) then
i = i + 1
else
break
end
end
if i >= 16 then return end
-- Itterate downwards
local j = i
while j <= (i+16) do
if check_x(data, a, x, y-j, z, lx, lz) or check_z(data, a, x, y-j, z, lx, lz) then
j = j - 1
break
else
j = j + 1
end
end
if j >= i+16 then return end
-- print ('[lib_lakes] i = '.. i ..'')
-- print ('[lib_lakes] j = '.. j ..'')
-- Check bottom
if leak(data, a, j, lx, lz) then return end
-- Add volume to buffer
for xi = 0, lx do
for yi = -i, -j, -1 do
for zi = 0, lz do
water_buffer[water_a:index(xi, yi, zi)] = true
end
end
end
-- Add the water
for xi = water_a.MinEdge.x, water_a.MaxEdge.x do
for yi = water_a.MinEdge.y, water_a.MaxEdge.y do
for zi = water_a.MinEdge.z, water_a.MaxEdge.z do
if a:contains(x+xi, y+yi, z+zi) then
local vi = a:index(x+xi, y+yi, z+zi)
if data[vi] == c_air or data[vi] == c_ignore then
if water_buffer[water_a:index(xi, yi, zi)] then
data[vi] = c_fluid_id
-- print ('[lib_lakes] Wasser auf (' .. x+xi .. ',' .. y+yi .. ',' .. z+zi .. ')')
end
end
end
end
end
end
end

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,614 @@
local S = lib_materials.intllib
local __ = {name = "air",param2 = 0,prob = 0}
local S0 = {name = "lib_materials:stone_desert", param2 = 0, prob = 254}
local S1 = {name = "lib_materials:stone_desert", param2 = 0, prob = 192}
local S2 = {name = "lib_materials:stone_desert", param2 = 0, prob = 128}
local S0 = {name = "lib_materials:stone_desert", param2 = 0, prob = 96}
local D0 = {name = "lib_materials:dirt", param2 = 0, prob = 254}
lib_materials.schem_rock_desert_01 = {
size = {x = 3,y = 3,z = 3},
data = {
S0, S0, S0,
S0, S0, __,
__, __, __,
S0, S0, S0,
S0, S0, S0,
S0, S0, __,
S0, S0, S0,
S0, S0, S0,
__, S0, S0
},
yslice_prob = {
{prob = 254, ypos = 0},
{prob = 254, ypos = 1},
{prob = 254, ypos = 2}
}
}
lib_materials.schem_rock_desert_02 = {
size = {x = 3,y = 3,z = 3},
data = {
S0, S0, S0,
__, S0, S0,
__, __, __,
S0, S0, S0,
S0, S0, S0,
S0, S0, __,
S0, S0, S0,
S0, S0, S0,
__, S0, __
},
yslice_prob = {
{prob = 254, ypos = 0},
{prob = 254, ypos = 1},
{prob = 254, ypos = 2}
}
}
lib_materials.schem_rock_desert_03 = {
size = {x = 3,y = 3,z = 3},
data = {
S0, S0, S0,
S0, S0, S0,
__, S0, __,
S0, S0, S0,
S0, S0, S0,
S0, S0, S0,
S0, S0, S0,
__, S0, S0,
__, S0, __
},
yslice_prob = {
{prob = 254, ypos = 0},
{prob = 254, ypos = 1},
{prob = 254, ypos = 2}
}
}
lib_materials.schem_rock_desert_04 = {
size = {x = 3,y = 3,z = 3},
data = {
S0, S0, S0,
S0, S0, S0,
__, S0, __,
S0, S0, S0,
S0, S0, S0,
S0, S0, S0,
S0, S0, S0,
__, S0, S0,
__, __, __
},
yslice_prob = {
{prob = 254, ypos = 0},
{prob = 254, ypos = 1},
{prob = 254, ypos = 2}
}
}
lib_materials.schem_rock_desert_05 = {
size = {x = 3,y = 3,z = 3},
data = {
S0, S0, S0,
__, S0, S0,
__, __, S0,
S0, S0, S0,
S0, S0, S0,
S0, S0, S0,
S0, S0, S0,
S0, S0, S0,
__, S0, __
},
yslice_prob = {
{prob = 254, ypos = 0},
{prob = 254, ypos = 1},
{prob = 254, ypos = 2}
}
}
lib_materials.schem_rock_desert_02_01 = {
size = {x = 4,y = 5,z = 3},
data = {
S0, S0, __, __,
__, S0, __, __,
__, __, __, __,
__, __, __, __,
__, __, __, __,
S0, S0, S0, S0,
S0, S0, S0, __,
S0, S0, __, __,
__, S0, __, __,
__, S0, __, __,
__, S0, __, __,
__, S0, __, __,
__, __, __, __,
__, __, __, __,
__, __, __, __
},
yslice_prob = {
{prob = 254, ypos = 0},
{prob = 254, ypos = 1},
{prob = 254, ypos = 2},
{prob = 254, ypos = 3},
{prob = 254, ypos = 4}
}
}
lib_materials.schem_rock_desert_02_02 = {
size = {x = 5,y = 6,z = 5},
data = {
__, S0, __, __, __,
__, __, __, __, __,
__, __, __, __, __,
__, __, __, __, __,
__, __, __, __, __,
__, __, __, __, __,
S0, S0, S0, S0, __,
__, S0, S0, __, __,
__, __, S0, __, __,
__, __, __, __, __,
__, __, __, __, __,
__, __, __, __, __,
S0, S0, S0, S0, S0,
S0, S0, S0, S0, S0,
__, S0, S0, S0, __,
__, S0, S0, __, __,
__, __, S0, __, __,
__, __, S0, __, __,
S0, S0, S0, S0, __,
__, S0, S0, S0, __,
__, __, S0, __, __,
__, __, S0, __, __,
__, __, __, __, __,
__, __, __, __, __,
__, __, S0, __, __,
__, __, S0, __, __,
__, __, __, __, __,
__, __, __, __, __,
__, __, __, __, __,
__, __, __, __, __
},
yslice_prob = {
{prob = 254, ypos = 0},
{prob = 254, ypos = 1},
{prob = 254, ypos = 2},
{prob = 254, ypos = 3},
{prob = 254, ypos = 4},
{prob = 254, ypos = 5}
}
}
lib_materials.schem_rock_desert_02_03 = {
size = {x = 5,y = 4,z = 5},
data = {
__, __, S0, __, __,
__, __, __, __, __,
__, __, __, __, __,
__, __, __, __, __,
__, S0, S0, S0, __,
__, __, S0, S0, __,
__, __, S0, __, __,
__, __, __, __, __,
S0, S0, S0, S0, S0,
S0, S0, S0, S0, S0,
__, S0, S0, S0, __,
__, __, S0, __, __,
__, S0, S0, S0, __,
__, S0, S0, __, __,
__, __, S0, __, __,
__, __, __, __, __,
__, __, S0, __, __,
__, __, __, __, __,
__, __, __, __, __,
__, __, __, __, __
},
yslice_prob = {
{prob = 254, ypos = 0},
{prob = 254, ypos = 1},
{prob = 254, ypos = 2},
{prob = 254, ypos = 3}
}
}
lib_materials.schem_rock_desert_03_01 = {
size = {x = 9,y = 13,z = 9},
data = {
__, S0, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, S0, S0, __, __, __, S0, S0, __,
__, __, S0, __, __, __, S0, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
S0, S0, S0, S0, __, __, S0, __, __,
__, S0, S0, __, __, __, __, __, __,
__, S0, S0, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
S0, S0, S0, S0, __, __, __, __, __,
__, S0, S0, __, __, __, __, __, __,
__, S0, S0, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
S0, S0, S0, S0, S0, S0, __, S0, __,
S0, S0, S0, S0, S0, __, __, __, __,
__, S0, S0, S0, __, __, __, __, __,
__, S0, S0, S0, __, __, __, __, __,
__, __, S0, __, __, __, __, __, __,
__, __, S0, __, __, __, __, __, __,
__, __, S0, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
S0, S0, S0, S0, S0, __, S0, S0, __,
__, S0, S0, S0, __, __, __, __, __,
__, __, S0, __, __, __, __, __, __,
__, __, S0, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
S0, S0, S0, S0, __, S0, S0, __, __,
S0, S0, S0, S0, __, __, __, __, __,
__, __, S0, __, __, __, __, __, __,
__, __, S0, __, __, __, __, __, __,
__, __, S0, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, S0, S0, __, __, S0, __, __, __,
__, __, S0, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, S0, S0, S0, __, __, __, __, __,
__, __, S0, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __
},
yslice_prob = {
{prob = 254, ypos = 0},
{prob = 254, ypos = 1},
{prob = 254, ypos = 2},
{prob = 254, ypos = 3},
{prob = 254, ypos = 4},
{prob = 254, ypos = 5},
{prob = 254, ypos = 6},
{prob = 254, ypos = 7},
{prob = 254, ypos = 8},
{prob = 254, ypos = 9},
{prob = 254, ypos = 10},
{prob = 254, ypos = 11},
{prob = 254, ypos = 12}
}
}
lib_materials.schem_rock_01 = {
size = {x = 3,y = 3,z = 3},
data = {
S0, S0, S0,
S0, S0, __,
__, __, __,
S0, S0, S0,
S0, S0, S0,
S0, S0, __,
S0, S0, S0,
S0, S0, S0,
__, S0, S0
},
yslice_prob = {
{prob = 254, ypos = 0},
{prob = 254, ypos = 1},
{prob = 254, ypos = 2}
}
}
lib_materials.schem_rock_02 = {
size = {x = 3,y = 3,z = 3},
data = {
S0, S0, S0,
__, S0, S0,
__, __, __,
S0, S0, S0,
S0, S0, S0,
S0, S0, __,
S0, S0, S0,
S0, S0, S0,
__, S0, __
},
yslice_prob = {
{prob = 254, ypos = 0},
{prob = 254, ypos = 1},
{prob = 254, ypos = 2}
}
}
lib_materials.schem_rock_03 = {
size = {x = 3,y = 3,z = 3},
data = {
S0, S0, S0,
S0, S0, S0,
__, S0, __,
S0, S0, S0,
S0, S0, S0,
S0, S0, S0,
S0, S0, S0,
__, S0, S0,
__, S0, __
},
yslice_prob = {
{prob = 254, ypos = 0},
{prob = 254, ypos = 1},
{prob = 254, ypos = 2}
}
}
lib_materials.schem_rock_04 = {
size = {x = 3,y = 3,z = 3},
data = {
S0, S0, S0,
S0, S0, S0,
__, S0, __,
S0, S0, S0,
S0, S0, S0,
S0, S0, S0,
S0, S0, S0,
__, S0, S0,
__, __, __
},
yslice_prob = {
{prob = 254, ypos = 0},
{prob = 254, ypos = 1},
{prob = 254, ypos = 2}
}
}
lib_materials.schem_rock_05 = {
size = {x = 3,y = 3,z = 3},
data = {
S0, S0, S0,
__, S0, S0,
__, __, S0,
S0, S0, S0,
S0, S0, S0,
S0, S0, S0,
S0, S0, S0,
S0, S0, S0,
__, S0, __
},
yslice_prob = {
{prob = 254, ypos = 0},
{prob = 254, ypos = 1},
{prob = 254, ypos = 2}
}
}
lib_materials.schem_rock_savanna_01 = {
size = {x = 3,y = 3,z = 3},
data = {
S0, S0, S0,
__, S0, S0,
__, __, S0,
S0, S0, S0,
S0, S0, S0,
S0, S0, S0,
S0, S0, S0,
S0, S0, S0,
__, S0, __
},
yslice_prob = {
{prob = 254, ypos = 0},
{prob = 254, ypos = 1},
{prob = 254, ypos = 2}
}
}
lib_materials.schem_rock_savanna_02 = {
size = {x = 3,y = 3,z = 3},
data = {
S0, S0, S0,
S0, S0, S0,
__, S0, __,
S0, S0, S0,
S0, S0, S0,
S0, S0, S0,
S0, S0, S0,
__, S0, S0,
__, __, __
},
yslice_prob = {
{prob = 254, ypos = 0},
{prob = 254, ypos = 1},
{prob = 254, ypos = 2}
}
}
lib_materials.schem_rock_savanna_03 = {
size = {x = 3,y = 3,z = 3},
data = {
S0, S0, S0,
S0, S0, S0,
__, S0, __,
S0, S0, S0,
S0, S0, S0,
S0, S0, S0,
S0, S0, S0,
__, S0, S0,
__, S0, __
},
yslice_prob = {
{prob = 254, ypos = 0},
{prob = 254, ypos = 1},
{prob = 254, ypos = 2}
}
}
lib_materials.schem_rock_savanna_04 = {
size = {x = 3,y = 3,z = 3},
data = {
S0, S0, S0,
__, S0, S0,
__, __, __,
S0, S0, S0,
S0, S0, S0,
S0, S0, __,
S0, S0, S0,
S0, S0, S0,
__, S0, __
},
yslice_prob = {
{prob = 254, ypos = 0},
{prob = 254, ypos = 1},
{prob = 254, ypos = 2}
}
}
lib_materials.schem_rock_savanna_05 = {
size = {x = 3,y = 3,z = 3},
data = {
S0, S0, S0,
S0, S0, __,
__, __, __,
S0, S0, S0,
S0, S0, S0,
S0, S0, __,
S0, S0, S0,
S0, S0, S0,
__, S0, S0
},
yslice_prob = {
{prob = 254, ypos = 0},
{prob = 254, ypos = 1},
{prob = 254, ypos = 2}
}
}

View File

@ -0,0 +1,132 @@
--
-- Sounds
--
function lib_materials.node_sound_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "", gain = 1.0}
table.dug = table.dug or
{name = "default_dug_node", gain = 0.25}
table.place = table.place or
{name = "default_place_node_hard", gain = 1.0}
return table
end
function lib_materials.node_sound_stone_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_hard_footstep", gain = 0.3}
table.dug = table.dug or
{name = "default_hard_footstep", gain = 1.0}
lib_materials.node_sound_defaults(table)
return table
end
function lib_materials.node_sound_dirt_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_dirt_footstep", gain = 0.4}
table.dug = table.dug or
{name = "default_dirt_footstep", gain = 1.0}
table.place = table.place or
{name = "default_place_node", gain = 1.0}
lib_materials.node_sound_defaults(table)
return table
end
function lib_materials.node_sound_sand_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_sand_footstep", gain = 0.12}
table.dug = table.dug or
{name = "default_sand_footstep", gain = 0.24}
table.place = table.place or
{name = "default_place_node", gain = 1.0}
lib_materials.node_sound_defaults(table)
return table
end
function lib_materials.node_sound_gravel_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_gravel_footstep", gain = 0.4}
table.dug = table.dug or
{name = "default_gravel_footstep", gain = 1.0}
table.place = table.place or
{name = "default_place_node", gain = 1.0}
lib_materials.node_sound_defaults(table)
return table
end
function lib_materials.node_sound_wood_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_wood_footstep", gain = 0.3}
table.dug = table.dug or
{name = "default_wood_footstep", gain = 1.0}
lib_materials.node_sound_defaults(table)
return table
end
function lib_materials.node_sound_leaves_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_grass_footstep", gain = 0.45}
table.dug = table.dug or
{name = "default_grass_footstep", gain = 0.7}
table.place = table.place or
{name = "default_place_node", gain = 1.0}
lib_materials.node_sound_defaults(table)
return table
end
function lib_materials.node_sound_glass_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_glass_footstep", gain = 0.3}
table.dig = table.dig or
{name = "default_glass_footstep", gain = 0.5}
table.dug = table.dug or
{name = "default_break_glass", gain = 1.0}
lib_materials.node_sound_defaults(table)
return table
end
function lib_materials.node_sound_metal_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_metal_footstep", gain = 0.4}
table.dig = table.dig or
{name = "default_dig_metal", gain = 0.5}
table.dug = table.dug or
{name = "default_dug_metal", gain = 0.5}
table.place = table.place or
{name = "default_place_node_metal", gain = 0.5}
lib_materials.node_sound_defaults(table)
return table
end
function lib_materials.node_sound_water_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_water_footstep", gain = 0.2}
lib_materials.node_sound_defaults(table)
return table
end
function lib_materials.node_sound_snow_defaults(table)
table = table or {}
table.footstep = table.footstep or
{name = "default_snow_footstep", gain = 0.2}
table.dig = table.dig or
{name = "default_snow_footstep", gain = 0.3}
table.dug = table.dug or
{name = "default_snow_footstep", gain = 0.3}
table.place = table.place or
{name = "default_place_node", gain = 1.0}
lib_materials.node_sound_defaults(table)
return table
end

210
lib_materials_tools.lua Normal file
View File

@ -0,0 +1,210 @@
local S = lib_materials.intllib
minetest.register_tool("lib_materials:tool_club_stone", {
description = S("Stone Club"),
_doc_items_longdesc = S("Stone club for clubbing things."),
_doc_items_usagehelp = S("Use this club to club."),
image = "lib_materials_tool_club_stone.png",
inventory_image = "lib_materials_tool_club_stone.png",
tool_capabilities = {
full_punch_interval = 0.8,
max_drop_level=1,
groupcaps={
-- about equal to a stone pick (it's not intended as a tool)
diggy={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
prying={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
pokey={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
snappy={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
},
damage_groups = {fleshy=6},
}
})
minetest.register_tool("lib_materials:tool_rock_biface", {
description = S("Tool - Biface Rock"),
_doc_items_longdesc = S("Tool - Biface Rock."),
_doc_items_usagehelp = S("Tool - Biface Rock. Used to carve sticks, and to craft stone tools."),
image = "lib_materials_tool_rock_biface.png",
inventory_image = "lib_materials_tool_rock_biface.png",
tool_capabilities = {
full_punch_interval = 0.8,
max_drop_level=1,
groupcaps={
-- about equal to a stone pick (it's not intended as a tool)
diggy={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
prying={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
pokey={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
snappy={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
},
damage_groups = {fleshy=6},
}
})
minetest.register_tool("lib_materials:tool_rock_chipper", {
description = S("Stone Chipper"),
_doc_items_longdesc = S("Stone Chipper."),
_doc_items_usagehelp = S("Stone Chipper."),
image = "lib_materials_tool_rock_chipper.png",
inventory_image = "lib_materials_tool_rock_chipper.png",
tool_capabilities = {
full_punch_interval = 0.8,
max_drop_level=1,
groupcaps={
-- about equal to a stone pick (it's not intended as a tool)
diggy={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
prying={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
pokey={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
snappy={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
},
damage_groups = {fleshy=6},
}
})
minetest.register_tool("lib_materials:tool_rock_flint", {
description = S("Flint"),
_doc_items_longdesc = S("Flint."),
_doc_items_usagehelp = S("Flint."),
image = "lib_materials_tool_rock_flint.png",
inventory_image = "lib_materials_tool_rock_flint.png",
tool_capabilities = {
full_punch_interval = 0.8,
max_drop_level=1,
groupcaps={
-- about equal to a stone pick (it's not intended as a tool)
diggy={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
prying={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
pokey={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
snappy={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
},
damage_groups = {fleshy=6},
}
})
minetest.register_tool("lib_materials:tool_rock_large", {
description = S("Tool - Large Rock"),
_doc_items_longdesc = S("Tool - Large Rock."),
_doc_items_usagehelp = S("Tool - Large Rock."),
image = "lib_materials_tool_rock_large.png",
inventory_image = "lib_materials_tool_rock_large.png",
tool_capabilities = {
full_punch_interval = 0.8,
max_drop_level=1,
groupcaps={
-- about equal to a stone pick (it's not intended as a tool)
diggy={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
prying={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
pokey={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
snappy={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
chippy={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
flakey={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
knappy={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
},
damage_groups = {fleshy=6},
}
})
minetest.register_tool("lib_materials:tool_rock_pebble", {
description = S("Tool - Pebble"),
_doc_items_longdesc = S("Tool - Pebble."),
_doc_items_usagehelp = S("Tool - Pebble."),
image = "lib_materials_tool_rock_pebble.png",
inventory_image = "lib_materials_tool_rock_pebble.png",
tool_capabilities = {
full_punch_interval = 0.8,
max_drop_level=1,
groupcaps={
-- about equal to a stone pick (it's not intended as a tool)
diggy={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
prying={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
pokey={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
snappy={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
chippy={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
flakey={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
knappy={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
},
damage_groups = {fleshy=6},
}
})
minetest.register_tool("lib_materials:tool_rock_pebbles", {
description = S("Tool - Pebbles"),
_doc_items_longdesc = S("Tool - Pebbles."),
_doc_items_usagehelp = S("Tool - Pebbles."),
image = "lib_materials_tool_rock_pebbles.png",
inventory_image = "lib_materials_tool_rock_pebbles.png",
tool_capabilities = {
full_punch_interval = 0.8,
max_drop_level=1,
groupcaps={
-- about equal to a stone pick (it's not intended as a tool)
diggy={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
prying={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
pokey={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
snappy={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
chippy={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
flakey={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
knappy={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
},
damage_groups = {fleshy=6},
}
})
minetest.register_tool("lib_materials:tool_rock_pebbles_large", {
description = S("Tool - Pebbles Large"),
_doc_items_longdesc = S("Tool - Pebbles Large."),
_doc_items_usagehelp = S("Tool - Pebbles Large."),
image = "lib_materials_tool_rock_pebbles_large.png",
inventory_image = "lib_materials_tool_rock_pebbles_large.png",
tool_capabilities = {
full_punch_interval = 0.8,
max_drop_level=1,
groupcaps={
-- about equal to a stone pick (it's not intended as a tool)
diggy={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
prying={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
pokey={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
snappy={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
chippy={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
flakey={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
knappy={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
},
damage_groups = {fleshy=6},
}
})
minetest.register_tool("lib_materials:tool_rock_small", {
description = S("Tool - Small Rock"),
_doc_items_longdesc = S("Tool - Small Rock."),
_doc_items_usagehelp = S("Tool - Small Rock."),
image = "lib_materials_tool_rock_small.png",
inventory_image = "lib_materials_tool_rock_small.png",
tool_capabilities = {
full_punch_interval = 0.8,
max_drop_level=1,
groupcaps={
-- about equal to a stone pick (it's not intended as a tool)
diggy={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
prying={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
pokey={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
snappy={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
chippy={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
flakey={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
knappy={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
},
damage_groups = {fleshy=6},
}
})

View File

@ -1,19 +1,88 @@
function table.contains_substring(t, s)
if type(s) ~= "string" then
return nil
end
for key, value in pairs(t) do
if type(value) == 'string' and s:find(value) then
if key then
return key
else
return true
end
end
end
return false
end
local S = lib_materials.intllib
minetest.register_node("lib_materials:ground_pebble", {
description = S("Ground - Pebble"),
drawtype = "nodebox",
waving = 1,
tiles = {"lib_materials_ground_pebble.png"},
sunlight_propagates = true,
paramtype = "light",
paramtype2 = "facedir",
walkable = false,
buildable_to = true,
stack_max = 99,
floodable = true,
groups = {chippy = 1, flakey = 1, knappy = 1},
sounds = lib_materials.node_sound_stone_defaults(),
drop = {
max_items = 1,
items = {
{items = {"lib_materials:tool_rock_large"}},
{items = {"lib_materials:tool_rock_small"}},
{items = {"lib_materials:tool_rock_chipper"}, rarity = 20},
{items = {"lib_materials:tool_rock_flint"}, rarity = 20},
}
},
node_box = {
type = "fixed",
fixed = {
{-0.5,-0.5,-0.5,0.5,-0.49,0.5}
}
},
})
minetest.register_node("lib_materials:ground_pebbles_large", {
description = S("Ground - Pebbles Large"),
drawtype = "nodebox",
waving = 1,
tiles = {"lib_materials_ground_pebbles_large.png"},
sunlight_propagates = true,
paramtype = "light",
paramtype2 = "facedir",
walkable = false,
buildable_to = true,
stack_max = 99,
floodable = true,
groups = {chippy = 1, flakey = 1, knappy = 1},
sounds = lib_materials.node_sound_stone_defaults(),
drop = {
max_items = 1,
items = {
{items = {"lib_materials:tool_rock_large"}},
{items = {"lib_materials:tool_rock_small"}},
{items = {"lib_materials:tool_rock_chipper"}, rarity = 20},
{items = {"lib_materials:tool_rock_flint"}, rarity = 20},
}
},
node_box = {
type = "fixed",
fixed = {
{-0.5,-0.5,-0.5,0.5,-0.49,0.5}
}
},
})
minetest.register_decoration({
deco_type = "simple",
decoration = "lib_materials:ground_pebble",
sidelen = 80,
place_on = {"group:soil", "group:sand", "group:stone"},
fill_ratio = 0.002,
flags = "place_center_x, place_center_z",
rotation = "random",
})
minetest.register_decoration({
deco_type = "simple",
decoration = "lib_materials:ground_pebbles_large",
sidelen = 80,
place_on = {"group:soil", "group:sand", "group:stone"},
fill_ratio = 0.002,
flags = "place_center_x, place_center_z",
rotation = "random",
})

4
mod.conf Normal file
View File

@ -0,0 +1,4 @@
name=lib_materials
description=A collection of naturally occuring materials, including: sand, clay, dirt, stone, ore, metals, glass, various water types, oil, lava, grease, liquid soils, and decorative stones.
depends=
optional_depends=default,stairs

BIN
screenshot.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 KiB

17
settingtypes.txt Normal file
View File

@ -0,0 +1,17 @@
#lib_materials settings
#[mgv7 Mapgen Scale Factor (Integer. Recommended Values between 1 and 8) - Defines the scale factor for mgv7 based maps.]
#Scales mgv7 Terrain_Base and Terrain_Alt spread values.
lib_materials_mgv7_mapgen_scale_factor (Defines the scale factor for mgv7 based maps) int 8
#[Biome Altitude Range (Integer. Recommended Value greater than +10) - Defines the height range for biomes based on altitude.]
#Each Temperature/Humidy range is subdivided by altitude, (height), to further refine biome definitions. This value is used to determine
#the altitude range for these biomes.
lib_materials_biome_altitude_range (Defines the height range for biomes based on altitude) int 40

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

1
sounds/license.txt Normal file
View File

@ -0,0 +1 @@

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

BIN
textures/bucket_mud.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

BIN
textures/bucket_oil.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 B

View File

@ -0,0 +1,21 @@
--------------------------------------------
License Textures: Philipner - CC-BY-SA 3.0
-castle_corner_stonewall_tb.png
-castle_corner_stonewall1.png
-castle_corner_stonewall2.png
--------------------------------------------
16 px textures based on Castle mod
original textures by Philipner
License Textures: Napiophelios - CC-BY-SA 3.0
-castle_pavement_brick.png
-castle_rubble.png
-castle_slate.png
-castle_stonewall.png
--------------------------------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 696 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 682 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 691 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 700 B

BIN
textures/castle_rubble.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B

BIN
textures/castle_slate.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 660 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 431 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 601 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 980 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 837 B

17
textures/decoblocks.txt Normal file
View File

@ -0,0 +1,17 @@
Theese files were copied from minetest decoblocks mod. Original files were
in "default/textures" and with "default_" prefix instead of "rocks_".
rocks_bb.png
rocks_blkgr.png
rocks_brgr.png
rocks_gls.png
rocks_mrbrownstone.png
rocks_obs.png
rocks_pgr.png
rocks_rss.png
rocks_serp.png
rocks_sod.png
rocks_trav.png
rocks_wgr.png
rocks_wm.png
rocks_yss.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 738 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 712 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 832 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 823 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 825 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 829 B

BIN
textures/default_clay.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 B

Some files were not shown because too many files have changed in this diff Show More