2014-08-12 21:08:11 +02:00
|
|
|
-----------------------------------------------------------------------------------------------
|
|
|
|
-- Idea by Sokomine
|
|
|
|
-- Code & textures by Mossmanikin
|
|
|
|
|
|
|
|
abstract_molehills = {}
|
|
|
|
|
2021-12-24 09:31:30 +01:00
|
|
|
local molehills_rarity = tonumber(minetest.settings:get("molehills_rarity")) or 99.5
|
|
|
|
local molehills_rarity_fertility = tonumber(minetest.settings:get("molehills_rarity_fertility")) or 1
|
|
|
|
local molehills_fertility = tonumber(minetest.settings:get("molehills_fertility")) or -0.6
|
|
|
|
|
2014-08-12 21:08:11 +02:00
|
|
|
|
2017-08-03 15:02:56 +02:00
|
|
|
-- support for i18n
|
2020-02-15 15:32:06 +01:00
|
|
|
local S = minetest.get_translator("molehills")
|
2014-08-12 21:08:11 +02:00
|
|
|
-----------------------------------------------------------------------------------------------
|
|
|
|
-- NoDe
|
|
|
|
-----------------------------------------------------------------------------------------------
|
2015-08-14 20:50:31 +02:00
|
|
|
|
|
|
|
local mh_cbox = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = { -0.5, -0.5, -0.5, 0.5, -0.125, 0.5}
|
|
|
|
}
|
|
|
|
|
2014-08-12 21:08:11 +02:00
|
|
|
minetest.register_node("molehills:molehill",{
|
2015-08-14 20:50:31 +02:00
|
|
|
drawtype = "mesh",
|
|
|
|
mesh = "molehill_molehill.obj",
|
2017-08-03 15:02:56 +02:00
|
|
|
description = S("Mole Hill"),
|
2014-08-12 21:08:11 +02:00
|
|
|
inventory_image = "molehills_side.png",
|
2015-08-14 20:50:31 +02:00
|
|
|
tiles = { "molehills_dirt.png" },
|
2023-01-21 21:48:24 +01:00
|
|
|
use_texture_alpha = "clip",
|
2015-08-14 20:50:31 +02:00
|
|
|
paramtype = "light",
|
|
|
|
selection_box = mh_cbox,
|
|
|
|
collision_box = mh_cbox,
|
2014-08-12 21:08:11 +02:00
|
|
|
groups = {crumbly=3},
|
2015-08-14 20:50:31 +02:00
|
|
|
sounds = default.node_sound_dirt_defaults(),
|
2014-08-12 21:08:11 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------------------------------
|
|
|
|
-- CRaFTiNG
|
|
|
|
-----------------------------------------------------------------------------------------------
|
|
|
|
minetest.register_craft({ -- molehills --> dirt
|
|
|
|
output = "default:dirt",
|
|
|
|
recipe = {
|
|
|
|
{"molehills:molehill","molehills:molehill"},
|
|
|
|
{"molehills:molehill","molehills:molehill"},
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------------------------------
|
|
|
|
-- GeNeRaTiNG
|
|
|
|
-----------------------------------------------------------------------------------------------
|
|
|
|
abstract_molehills.place_molehill = function(pos)
|
2021-12-24 09:31:30 +01:00
|
|
|
local right_here = {x=pos.x , y=pos.y+1, z=pos.z }
|
|
|
|
if minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z }).name ~= "air"
|
|
|
|
and minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z }).name ~= "air"
|
|
|
|
and minetest.get_node({x=pos.x , y=pos.y, z=pos.z+1}).name ~= "air"
|
|
|
|
and minetest.get_node({x=pos.x , y=pos.y, z=pos.z-1}).name ~= "air"
|
2014-08-12 21:08:11 +02:00
|
|
|
and minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z+1}).name ~= "air"
|
|
|
|
and minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z-1}).name ~= "air"
|
|
|
|
and minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z+1}).name ~= "air"
|
|
|
|
and minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z-1}).name ~= "air" then
|
2018-10-25 16:27:54 +02:00
|
|
|
minetest.swap_node(right_here, {name="molehills:molehill"})
|
2014-08-12 21:08:11 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-07-19 20:18:01 +02:00
|
|
|
biome_lib.register_on_generate({
|
2021-12-24 09:31:30 +01:00
|
|
|
surface = {"default:dirt_with_grass"},
|
|
|
|
rarity = molehills_rarity,
|
|
|
|
rarity_fertility = molehills_rarity_fertility,
|
|
|
|
plantlife_limit = molehills_fertility,
|
|
|
|
min_elevation = 1,
|
|
|
|
max_elevation = 40,
|
|
|
|
avoid_nodes = {"group:tree","group:liquid","group:stone","group:falling_node"--[[,"air"]]},
|
|
|
|
avoid_radius = 4,
|
|
|
|
},
|
|
|
|
abstract_molehills.place_molehill
|
2014-08-12 21:08:11 +02:00
|
|
|
)
|