lib_materials/init.lua

242 lines
8.8 KiB
Lua
Raw Normal View History

2019-09-07 00:27:34 +02:00
lib_materials = {}
2019-08-30 23:05:56 +02:00
lib_materials.name = "lib_materials"
2019-09-07 00:27:34 +02:00
lib_materials.ver_max = 5
lib_materials.ver_min = 0
lib_materials.ver_rev = 2
lib_materials.path_mod = minetest.get_modpath(minetest.get_current_modname())
2019-08-30 23:05:56 +02:00
lib_materials.path_world = minetest.get_worldpath()
lib_materials.path = lib_materials.path_mod
2019-09-07 00:27:34 +02:00
2018-01-19 21:24:59 +01:00
-- Intllib
2019-08-30 23:05:56 +02:00
--local S = minetest.get_translator(lib_materials.name)
2019-09-07 00:27:34 +02:00
local S
local NS
2019-09-04 18:59:44 +02:00
--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")
2019-09-04 18:59:44 +02:00
-- end
--end
2019-09-07 00:27:34 +02:00
lib_materials.intllib = S or minetest.get_translator(lib_materials.name)
lib_materials.mgv7_mapgen_scale_factor = minetest.setting_get("lib_materials_mgv7_mapgen_scale_factor") or 8
2019-09-07 00:27:34 +02:00
lib_materials.biome_altitude_range = minetest.setting_get("lib_materials_biome_altitude_range") or 40
lib_materials.clear_biomes = minetest.setting_get("lib_materials_clear_biomes") or true
lib_materials.clear_decos = minetest.setting_get("lib_materials_clear_decos") or true
lib_materials.clear_ores = minetest.setting_get("lib_materials_clear_ores") or true
lib_materials.color_grass_reg = minetest.setting_get("lib_materials_color_grass_reg") or false
lib_materials.color_grass_use = minetest.setting_get("lib_materials_color_grass_use") or false
lib_materials.mg_params = minetest.get_mapgen_params()
lib_materials.mg_seed = lib_materials.mg_params.seed
--DEFAULTS
2019-09-07 00:27:34 +02:00
-- -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
2019-09-07 00:27:34 +02:00
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
2019-06-13 21:20:42 +02:00
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))
2019-09-07 00:27:34 +02:00
-- 100, 75, 50, 25, 0
-- 90, 75, 50, 25, 10
-- 90, 70, 50, 30, 10
2019-06-13 21:20:42 +02:00
lib_materials.temperature_hot = 100
lib_materials.temperature_warm = 75
lib_materials.temperature_temperate = 50
2019-06-13 21:20:42 +02:00
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
2019-06-13 21:20:42 +02:00
lib_materials.humidity_semiarid = 25
lib_materials.humidity_arid = 0
2019-09-07 00:27:34 +02:00
-- 8, 4
lib_materials.biome_vertical_blend = lib_materials.biome_altitude_range / 5
2019-08-30 23:05:56 +02:00
lib_materials.liquids = {}
2019-09-07 00:27:34 +02:00
2019-08-30 23:05:56 +02:00
if lib_materials.clear_biomes then
2019-09-07 00:27:34 +02:00
minetest.clear_registered_biomes()
end
if lib_materials.clear_decos then
minetest.clear_registered_decorations()
end
if lib_materials.clear_ores then
minetest.clear_registered_ores()
end
minetest.log(S("[MOD] lib_materials: Loading..."))
2019-09-07 00:27:34 +02:00
2019-08-30 23:05:56 +02:00
2019-08-31 00:57:55 +02:00
lib_materials.read_csv = dofile(lib_materials.path .. "/csv.lua")
2019-08-31 00:57:55 +02:00
dofile(lib_materials.path.."/lib_materials_sound_defaults.lua")
2018-01-19 21:24:59 +01:00
2019-08-31 00:57:55 +02:00
dofile(lib_materials.path.."/lib_materials_nodeio.lua")
2019-09-07 00:27:34 +02:00
dofile(lib_materials.path.."/lib_materials_fluid_lib.lua")
2019-09-24 00:31:31 +02:00
--dofile(lib_materials.path.."/lib_materials_toolcap_modifier.lua")
--dofile(lib_materials.path.."/lib_materials_tool_ranks.lua")
2019-09-07 00:27:34 +02:00
dofile(lib_materials.path.."/lib_materials_node_registration.lua")
2019-08-31 00:57:55 +02:00
--game.lib.node.register_csv("|", lib_materials.path.."/nodes.csv")
2019-09-07 00:27:34 +02:00
2019-08-31 00:57:55 +02:00
--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")
2019-09-07 00:27:34 +02:00
--dofile(lib_materials.path.."/type_glass.lua")
dofile(lib_materials.path.."/lib_materials_liquid_containers.lua")
dofile(lib_materials.path.."/lib_materials_vessels.lua")
2019-09-24 00:31:31 +02:00
dofile(lib_materials.path.."/lib_materials_water_dynamics.lua")
2019-09-07 00:27:34 +02:00
dofile(lib_materials.path.."/lib_materials_fire.lua")
dofile(lib_materials.path.."/lib_materials_craftitems.lua")
--dofile(lib_materials.path.."/lib_materials_tools.lua")
--dofile(lib_materials.path.."/lib_materials_craftfire.lua")
2019-08-31 00:57:55 +02:00
dofile(lib_materials.path.."/lib_materials_craftrecipes.lua")
2018-01-19 21:24:59 +01:00
2019-09-07 00:27:34 +02:00
dofile(lib_materials.path.."/lib_materials_schematics.lua")
dofile(lib_materials.path.."/lib_materials_biomes.lua")
2018-01-19 21:24:59 +01:00
2019-08-31 00:57:55 +02:00
--game.lib.biomes.register_csv("|", lib_materials.path.."/biomes.csv")
2019-09-07 00:27:34 +02:00
--dofile(lib_materials.path.."/lib_materials_ore_defs_ORIG.lua")
dofile(lib_materials.path.."/lib_materials_ore_defs.lua")
dofile(lib_materials.path.."/lib_materials_ecosystems.lua")
--dofile(lib_materials.path.."/voxel_BAK.lua")
2019-09-24 00:31:31 +02:00
dofile(lib_materials.path.."/lib_materials_lakes.lua")
2019-09-07 00:27:34 +02:00
----dofile(lib_materials.path.."/lib_materials_ore_defs_ORIG.lua")
----dofile(lib_materials.path.."/lib_materials_ecosystems.lua")
2019-08-31 00:57:55 +02:00
--dofile(lib_materials.path.."/lvm_voxel.lua")
--dofile(lib_materials.path.."/burli_voxel.lua")
--dofile(lib_materials.path.."/lib_materials_lakes.lua")
2019-09-07 00:27:34 +02:00
2019-08-31 08:41:37 +02:00
dofile(lib_materials.path.."/lib_materials_caves.lua")
2019-08-31 00:57:55 +02:00
dofile(lib_materials.path.."/lib_materials_utils.lua")
2018-01-19 21:24:59 +01:00
2019-09-07 00:27:34 +02:00
--dofile(lib_materials.path.."/lib_materials_rivers.lua")
2019-08-30 23:05:56 +02:00
2019-08-31 00:57:55 +02:00
dofile(lib_materials.path.."/lib_materials_abms.lua")
2018-01-19 21:24:59 +01:00
2019-08-31 00:57:55 +02:00
dofile(lib_materials.path.."/lib_materials_chatcommands.lua")
2019-09-07 00:27:34 +02:00
2019-09-24 00:31:31 +02:00
--
-- Aliases for map generators
--
minetest.register_alias("mapgen_stone", "lib_materials:stone")
minetest.register_alias("mapgen_dirt", "lib_materials:dirt")
minetest.register_alias("mapgen_dirt_with_grass", "lib_materials:dirt_with_grass")
minetest.register_alias("mapgen_sand", "lib_materials:sand")
minetest.register_alias("mapgen_water_source", "lib_materials:liquid_water_source")
minetest.register_alias("mapgen_river_water_source", "lib_materials:liquid_water_river_source")
minetest.register_alias("mapgen_lava_source", "lib_materials:liquid_lava_source")
--minetest.register_alias("mapgen_gravel", "lib_materials:stone_gravel")
--minetest.register_alias("mapgen_desert_stone", "lib_materials:stone_desert")
--minetest.register_alias("mapgen_desert_sand", "lib_materials:sand_desert")
--minetest.register_alias("mapgen_dirt_with_snow", "lib_materials:dirt_with_snow")
--minetest.register_alias("mapgen_snowblock", "lib_materials:snowblock")
--minetest.register_alias("mapgen_snow", "lib_materials:snow")
--minetest.register_alias("mapgen_ice", "lib_materials:ice")
--minetest.register_alias("mapgen_sandstone", "lib_materials:stone_sandstone")
-- Flora
--minetest.register_alias("mapgen_tree", "default:tree")
--minetest.register_alias("mapgen_leaves", "default:leaves")
--minetest.register_alias("mapgen_apple", "default:apple")
--minetest.register_alias("mapgen_jungletree", "default:jungletree")
--minetest.register_alias("mapgen_jungleleaves", "default:jungleleaves")
--minetest.register_alias("mapgen_junglegrass", "default:junglegrass")
--minetest.register_alias("mapgen_pine_tree", "default:pine_tree")
--minetest.register_alias("mapgen_pine_needles", "default:pine_needles")
-- Dungeons
--minetest.register_alias("mapgen_cobble", "lib_materials:stone_cobble")
--minetest.register_alias("mapgen_stair_cobble", "lib_materials:stone_cobble_stairs")
--minetest.register_alias("mapgen_mossycobble", "lib_materials:stone_cobble_mossy")
--minetest.register_alias("mapgen_stair_desert_stone", "lib_materials:stone_desert_stairs")
--minetest.register_alias("mapgen_sandstonebrick", "lib_materials:stone_sandstone_brick")
--minetest.register_alias("mapgen_stair_sandstone_block", "lib_materials:stone_sandstone_block_stairs")
2019-09-07 00:27:34 +02:00
if not minetest.global_exists("default") then
default = {}
end
default.node_sound_stone_defaults = lib_materials.node_sound_stone_defaults
default.node_sound_dirt_defaults = lib_materials.node_sound_dirt_defaults
default.node_sound_gravel_defaults = lib_materials.node_sound_gravel_defaults
default.node_sound_sand_defaults = lib_materials.node_sound_sand_defaults
default.node_sound_snow_defaults = lib_materials.node_sound_snow_defaults
default.node_sound_leaves_defaults = lib_materials.node_sound_leaves_defaults
default.node_sound_wood_defaults = lib_materials.node_sound_wood_defaults
default.node_sound_metal_defaults = lib_materials.node_sound_metal_defaults
default.node_sound_glass_defaults = lib_materials.node_sound_glass_defaults
default.node_sound_water_defaults = lib_materials.node_sound_water_defaults
2018-01-19 21:24:59 +01:00
2019-06-13 21:20:42 +02:00
minetest.log(S("[MOD] lib_materials: Successfully loaded."))
2018-01-19 21:24:59 +01:00