195 lines
3.7 KiB
Lua
Raw Normal View History

-- LUALOCALS < ---------------------------------------------------------
local ipairs, minetest, pairs
= ipairs, minetest, pairs
-- LUALOCALS > ---------------------------------------------------------
local modname = minetest.get_current_modname()
local function regterrain(def)
def.name = def.name or def.description:gsub("%W", "_"):lower()
def.fullname = modname .. ":" .. def.name
def.tiles = def.tiles or { def.fullname:gsub("%W", "_") .. ".png" }
def.is_ground_content = true
if def.liquidtype then
def.liquid_alternative_flowing = def.fullname .. "_flowing"
def.liquid_alternative_source = def.fullname .. "_source"
def.fullname = def.fullname .. "_" .. def.liquidtype
def.special_tiles = def.special_tiles or { def.tiles[1], def.tiles[1] }
end
2018-11-01 21:53:55 -04:00
def.mapgen = def.mapgen or { def.name }
minetest.register_node(def.fullname, def)
for k, v in pairs(def.mapgen) do
minetest.register_alias("mapgen_" .. v, def.fullname)
end
end
local function clone(t) return minetest.deserialize(minetest.serialize(t)) end
local function regliquid(def)
local t = clone(def)
t.drawtype = "liquid"
t.liquidtype = "source"
regterrain(t)
t = clone(def)
2018-11-01 21:53:55 -04:00
t.mapgen = { }
t.drawtype = "flowingliquid"
t.liquidtype = "flowing"
t.paramtype2 = "flowingliquid"
regterrain(t)
end
-- Register standard mapgen node types.
regterrain({
2018-10-30 10:18:38 -04:00
description = "Stone",
mapgen = {
"stone",
"stone_with_coal",
"stone_with_iron",
"desert_stone",
"sandstone",
"mese",
},
groups = {
cracky = 3
},
drop_in_place = modname .. ":cobble",
})
regterrain({
description = "Cobble",
mapgen = {
2018-10-30 10:18:38 -04:00
"sandstonebrick",
"stair_sandstone_block",
"cobble",
"stair_cobble",
"stair_desert_stone",
"mossycobble"
},
groups = {
cracky = 3
},
alternate_loose = {
repack_level = 2,
groups = {
crumbly = 2,
falling_repose = 3
}
},
2018-10-30 10:18:38 -04:00
})
for _, v in ipairs({
"snow",
"snowblock",
"junglegrass",
"tree",
"jungletree",
"pine_tree",
"leaves",
"apple",
"jungleleaves",
"pine_needles"
}) do
minetest.register_alias("mapgen_" .. v, "air")
end
2018-10-30 10:18:38 -04:00
regterrain({
description = "Dirt",
alternate_loose = {
groups = {
crumbly = 3,
falling_repose = 2
}
},
2018-10-30 10:18:38 -04:00
mapgen = {
"dirt",
"ice",
},
groups = {
crumbly = 3
2018-10-30 10:18:38 -04:00
}
})
regterrain({
2018-10-30 10:18:38 -04:00
description = "Dirt with Grass",
tiles = {
modname .. "_grass_top.png",
modname .. "_dirt.png",
modname .. "_dirt.png^" .. modname .. "_grass_side.png"
},
mapgen = {
"dirt_with_grass",
"dirt_with_snow"
},
groups = {
crumbly = 3
},
drop_in_place = modname .. ":dirt"
2018-10-30 10:18:38 -04:00
})
regterrain({
2018-10-30 10:18:38 -04:00
description = "Gravel",
alternate_loose = {
groups = {
crumbly = 2,
falling_repose = 2
}
},
groups = {
crumbly = 1,
falling_node = 1
},
2018-10-30 10:18:38 -04:00
})
regterrain({
2018-10-30 10:18:38 -04:00
description = "Sand",
alternate_loose = {
groups = {
crumbly = 3,
falling_repose = 1
}
},
groups = {
crumbly = 3,
falling_node = 1
},
2018-10-30 10:18:38 -04:00
mapgen = {
"sand",
"clay",
"desert_sand"
},
})
regliquid({
2018-10-30 10:18:38 -04:00
description = "Water",
mapgen = { "river_water_source", "water_source" },
paramtype = "light",
liquid_viscosity = 1,
liquid_renewable = true,
2018-10-30 10:18:38 -04:00
alpha = 160,
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
drowning = 1,
drop = "",
post_effect_color = {a = 103, r = 30, g = 76, b = 90}
2018-10-30 10:18:38 -04:00
})
regliquid({
2018-10-30 10:18:38 -04:00
description = "Lava",
mapgen = { "lava_source" },
paramtype = "light",
liquid_viscosity = 7,
liquid_renewable = false,
2018-10-30 10:18:38 -04:00
light_source = 13,
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
drowning = 1,
damage_per_second = 8,
drop = "",
post_effect_color = {a = 191, r = 255, g = 64, b = 0}
2018-10-30 10:18:38 -04:00
})