1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-27 03:00:38 +01:00
server-nalc/mods/plantlife_modpack/molehills/init.lua

92 lines
3.3 KiB
Lua
Raw Normal View History

2014-10-28 18:01:32 +01:00
-----------------------------------------------------------------------------------------------
local title = "Mole Hills"
local version = "0.0.3"
local mname = "molehills"
-----------------------------------------------------------------------------------------------
-- Idea by Sokomine
-- Code & textures by Mossmanikin
abstract_molehills = {}
dofile(minetest.get_modpath("molehills").."/molehills_settings.txt")
-----------------------------------------------------------------------------------------------
-- NoDe
-----------------------------------------------------------------------------------------------
local mh_cbox = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, -0.125, 0.5}
}
2014-10-28 18:01:32 +01:00
minetest.register_node("molehills:molehill",{
drawtype = "mesh",
mesh = "molehill_molehill.obj",
2014-10-28 18:01:32 +01:00
description = "Mole Hill",
inventory_image = "molehills_side.png",
tiles = { "molehills_dirt.png" },
paramtype = "light",
selection_box = mh_cbox,
collision_box = mh_cbox,
2014-10-28 18:01:32 +01:00
groups = {crumbly=3},
sounds = default.node_sound_dirt_defaults(),
2014-10-28 18:01:32 +01: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)
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"
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
minetest.set_node(right_here, {name="molehills:molehill"})
end
end
biome_lib:register_generate_plant({
2014-10-28 18:01:32 +01:00
surface = {"default:dirt_with_grass"},
max_count = Molehills_Max_Count,
rarity = Molehills_Rarity,
min_elevation = 1,
max_elevation = 40,
avoid_nodes = {"group:tree","group:liquid","group:stone","group:falling_node"--[[,"air"]]},
avoid_radius = 4,
plantlife_limit = -0.3,
},
abstract_molehills.place_molehill
)
biome_lib:register_generate_plant({
2015-08-31 12:11:53 +02:00
surface = {"default:dirt_with_dry_grass"},
max_count = Molehills_Max_Count,
rarity = 97,
min_elevation = 1,
max_elevation = 40,
avoid_nodes = {"group:tree","group:liquid","group:stone","group:falling_node"--[[,"air"]]},
avoid_radius = 4,
plantlife_limit = -0.3,
},
abstract_molehills.place_molehill
)
2014-10-28 18:01:32 +01:00
-----------------------------------------------------------------------------------------------
minetest.log("action", "[Mod] "..title.." ["..version.."] ["..mname.."] Loaded...")
2014-10-28 18:01:32 +01:00
-----------------------------------------------------------------------------------------------