mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-05-21 06:43:17 -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 API
|
||||
-- Registering carpet ( carpet.register() )
|
||||
--[[
|
||||
def is a table that contains:
|
||||
name : itemstring "carpet:name"
|
||||
desc : node description
|
||||
description : node description (optional)
|
||||
images : node tiles
|
||||
recipeitem : node crafting recipeitem {recipeitem,recipeitem}
|
||||
groups : node groups
|
||||
sounds : node sounds
|
||||
sounds : node sounds (optional)
|
||||
--]]
|
||||
-- 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
|
||||
minetest.register_node("carpet:"..name, {
|
||||
description = desc,
|
||||
tiles = images,
|
||||
tiles = def.images,
|
||||
paramtype = "light",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -7/16, 0.5},
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
groups = groups,
|
||||
groups = def.groups,
|
||||
sounds = sounds,
|
||||
})
|
||||
-- Crafting Definition
|
||||
|
@ -55,10 +61,12 @@ carpet.wool = {
|
|||
for _, row in ipairs(carpet.wool) do
|
||||
local name = row[1]
|
||||
local desc = row[2]
|
||||
carpet.add(
|
||||
name, desc..' Carpet',
|
||||
{'wool_'..name..'.png'}, 'wool:'..name,
|
||||
{snappy=2,choppy=2,oddly_breakable_by_hand=3,flammable=3,falling_node=1,carpet=1},
|
||||
default.node_sound_defaults()
|
||||
)
|
||||
carpet.register({
|
||||
name = name,
|
||||
description = desc..' Carpet',
|
||||
images = {'wool_'..name..'.png'},
|
||||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue