mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-05-21 14:53:16 -04:00
Applying ShadowNinja recommendation
See https://github.com/minetest/minetest_game/pull/307#issuecomment-53363617
This commit is contained in:
parent
af80fe2293
commit
4eb2873dab
1 changed files with 20 additions and 12 deletions
|
@ -1,27 +1,33 @@
|
||||||
|
-- Carpet API
|
||||||
carpet = {}
|
carpet = {}
|
||||||
|
|
||||||
-- Carpet API
|
-- Registering carpet ( carpet.register() )
|
||||||
--[[
|
--[[
|
||||||
|
def is a table that contains:
|
||||||
name : itemstring "carpet:name"
|
name : itemstring "carpet:name"
|
||||||
desc : node description
|
description : node description (optional)
|
||||||
images : node tiles
|
images : node tiles
|
||||||
recipeitem : node crafting recipeitem {recipeitem,recipeitem}
|
recipeitem : node crafting recipeitem {recipeitem,recipeitem}
|
||||||
groups : node groups
|
groups : node groups
|
||||||
sounds : node sounds
|
sounds : node sounds (optional)
|
||||||
--]]
|
--]]
|
||||||
-- Carpet will be named carpet:name
|
-- Carpet will be named carpet:name
|
||||||
function carpet.add(name, desc, images, recipeitem, groups, sounds)
|
function carpet.register(def)
|
||||||
|
local name = def.name
|
||||||
|
local desc = def.description or ""
|
||||||
|
local recipeitem = def.recipeitem
|
||||||
|
local sounds = def.sounds or default.node_sound_defaults()
|
||||||
-- Node Definition
|
-- Node Definition
|
||||||
minetest.register_node("carpet:"..name, {
|
minetest.register_node("carpet:"..name, {
|
||||||
description = desc,
|
description = desc,
|
||||||
tiles = images,
|
tiles = def.images,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-0.5, -0.5, -0.5, 0.5, -7/16, 0.5},
|
fixed = {-0.5, -0.5, -0.5, 0.5, -7/16, 0.5},
|
||||||
},
|
},
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
groups = groups,
|
groups = def.groups,
|
||||||
sounds = sounds,
|
sounds = sounds,
|
||||||
})
|
})
|
||||||
-- Crafting Definition
|
-- Crafting Definition
|
||||||
|
@ -55,10 +61,12 @@ carpet.wool = {
|
||||||
for _, row in ipairs(carpet.wool) do
|
for _, row in ipairs(carpet.wool) do
|
||||||
local name = row[1]
|
local name = row[1]
|
||||||
local desc = row[2]
|
local desc = row[2]
|
||||||
carpet.add(
|
carpet.register({
|
||||||
name, desc..' Carpet',
|
name = name,
|
||||||
{'wool_'..name..'.png'}, 'wool:'..name,
|
description = desc..' Carpet',
|
||||||
{snappy=2,choppy=2,oddly_breakable_by_hand=3,flammable=3,falling_node=1,carpet=1},
|
images = {'wool_'..name..'.png'},
|
||||||
default.node_sound_defaults()
|
recipeitem = 'wool:'..name,
|
||||||
)
|
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=3,flammable=3,falling_node=1,carpet=1},
|
||||||
|
sounds = default.node_sound_defaults()
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue