minetest-mm/mods/wool/init.lua

79 lines
1.7 KiB
Lua
Raw Normal View History

2024-12-19 12:55:40 +01:00
-- wool/init.lua
2020-10-26 17:38:53 +01:00
2024-12-19 12:55:40 +01:00
-- Translation support
local S = minetest.get_translator("wool")
2020-10-26 17:38:53 +01:00
2024-12-19 12:55:40 +01:00
-- new sound for wool
function default.node_wool_defaults(tbl)
2020-10-26 17:38:53 +01:00
2024-12-19 12:55:40 +01:00
tbl = tbl or {}
2020-10-26 17:38:53 +01:00
2024-12-19 12:55:40 +01:00
tbl.footstep = tbl.footstep or {name = "wool_coat_movement", gain = 1.0}
tbl.dug = tbl.dug or {name = "wool_coat_movement", gain = 0.25}
tbl.place = tbl.place or {name = "default_place_node", gain = 1.0}
2020-10-26 17:38:53 +01:00
2024-12-19 12:55:40 +01:00
return tbl
2020-10-26 17:38:53 +01:00
end
2024-12-19 12:55:40 +01:00
local dyes = dye.dyes
for i = 1, #dyes do
local name, desc = unpack(dyes[i])
local color_group = "color_" .. name
minetest.register_node("wool:" .. name, {
description = S(desc .. " Wool"),
tiles = {"wool_" .. name .. ".png"},
is_ground_content = false,
2020-10-26 17:38:53 +01:00
groups = {
snappy = 2, choppy = 2, oddly_breakable_by_hand = 3,
2024-12-19 12:55:40 +01:00
flammable = 3, wool = 1, [color_group] = 1
2020-10-26 17:38:53 +01:00
},
2024-12-19 12:55:40 +01:00
sounds = default.node_wool_defaults()
2020-10-26 17:38:53 +01:00
})
2024-12-19 12:55:40 +01:00
minetest.register_craft{
output = "wool:" .. name,
recipe = {
{"group:wool", "group:dye," .. color_group}
}
}
2020-10-26 17:38:53 +01:00
end
2024-12-19 12:55:40 +01:00
-- Legacy (Backwards compatibility with jordach's 16-color wool mod)
minetest.register_alias("wool:dark_blue", "wool:blue")
minetest.register_alias("wool:gold", "wool:yellow")
-- use wool as fuel
2020-10-26 17:38:53 +01:00
minetest.register_craft({
type = "fuel",
recipe = "group:wool",
2024-12-19 12:55:40 +01:00
burntime = 2
2020-10-26 17:38:53 +01:00
})
2024-12-19 12:55:40 +01:00
-- Dummy calls to S() to allow translation scripts to detect the strings.
-- To update this run:
-- for _,e in ipairs(dye.dyes) do print(("S(%q)"):format(e[2].." Wool")) end
--[[
S("White Wool")
S("Grey Wool")
S("Dark Grey Wool")
S("Black Wool")
S("Violet Wool")
S("Blue Wool")
S("Cyan Wool")
S("Dark Green Wool")
S("Green Wool")
S("Yellow Wool")
S("Brown Wool")
S("Orange Wool")
S("Red Wool")
S("Magenta Wool")
S("Pink Wool")
--]]
print ("[MOD] Wool loaded")