~fgaz/minetest-falling_nodes

e127f6d4b2637cc7a81a35504036050fe4bf4c68 — Francesco Gazzetta 3 months ago 45239a0
Add register_material()
1 files changed, 17 insertions(+), 0 deletions(-)

M mods/falling_nodes/materials.lua
M mods/falling_nodes/materials.lua => mods/falling_nodes/materials.lua +17 -0
@@ 2,6 2,23 @@ local modname = "falling_nodes"

local utils = dofile(minetest.get_modpath(modname) .. "/utils.lua")

falling_nodes.registered_materials = {}

function falling_nodes.register_material(name, original_def)
  local def = table.copy(original_def)
  falling_nodes.registered_materials[name] = {}
  -- TODO validation
  for _,field in ipairs {
  } do
    falling_nodes.registered_materials[name][field] = def[field]
    def[field] = nil
  end
  if not def.groups then def.groups = {} end
  def.groups["falling_nodes:material"] = 1
  def.groups.dig_immediate = 3
  minetest.register_node(name, def)
end

minetest.register_node("falling_nodes:sand", {
  description = "Sand",
  tiles = {"falling_nodes_sand.png"},