Added Fence API and fences in all wood types
parent
a4aa5b2c4a
commit
b25477b315
26
game_api.txt
26
game_api.txt
|
@ -230,7 +230,7 @@ stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair,
|
|||
|
||||
Xpanes API
|
||||
----------
|
||||
Creates panes that automatically connect to each other
|
||||
Creates panes that automatically connect to each other.
|
||||
|
||||
xpanes.register_pane(subname, def)
|
||||
-> subname: used for nodename. Result: "xpanes:subname" and "xpanes:subname_{2..15}"
|
||||
|
@ -249,6 +249,30 @@ xpanes.register_pane(subname, def)
|
|||
^ Recipe field only
|
||||
}
|
||||
|
||||
Fence API
|
||||
---------
|
||||
Creates fences of given material.
|
||||
|
||||
default.register_fence(itemstring, def)
|
||||
-> itemstring: used for nodename and crafting recipes.
|
||||
-> def: See [#Fence deinition]
|
||||
|
||||
#Fence definition
|
||||
-----------------
|
||||
{
|
||||
description = "Wooden Fence",
|
||||
^ The name / description of the fence
|
||||
texture = "default_wood.png",
|
||||
^ The texture for the node. It is used to create the inventory texture too.
|
||||
material = "default:wood",
|
||||
^ The material which you need to craft the fence.
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, fuel = 4},
|
||||
^ The groups of the fence. If it isn't defined it equals {choppy = 2,
|
||||
oddly_breakable_by_hand = 2, flammable = 2, fuel = 4}.
|
||||
sounds = default.node_sound_wood_defaults()
|
||||
^ The sounds of the fence. If it isn't defined it equals default.node_sound_wood_defaults().
|
||||
}
|
||||
|
||||
Raillike definitions
|
||||
--------------------
|
||||
The following nodes use the group `connect_to_raillike` and will only connect to
|
||||
|
|
|
@ -49,7 +49,7 @@ dofile(modpath .. "/nodes/food.lua")
|
|||
dofile(modpath .. "/nodes/latter.lua")
|
||||
dofile(modpath .. "/nodes/rails.lua")
|
||||
dofile(modpath .. "/nodes/signs.lua")
|
||||
dofile(modpath .. "/nodes/fence.lua")
|
||||
dofile(modpath .. "/nodes/fences.lua")
|
||||
|
||||
dofile(modpath .. "/nodes/nyancat.lua")
|
||||
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
local fence_texture =
|
||||
"default_fence_overlay.png^default_wood.png^default_fence_overlay.png^[makealpha:255,126,126"
|
||||
minetest.register_node("default:fence_wood", {
|
||||
description = "Wooden Fence",
|
||||
drawtype = "fencelike",
|
||||
tiles = {"default_wood.png"},
|
||||
inventory_image = fence_texture,
|
||||
wield_image = fence_texture,
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
|
||||
},
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, fuel = 4},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
|
@ -0,0 +1,61 @@
|
|||
function default.register_fence(itemstring, def)
|
||||
local fence_texture_1 = "default_fence_overlay.png^"
|
||||
local fence_texture_2 = "^default_fence_overlay.png^[makealpha:255,126,126"
|
||||
|
||||
if not def.groups then
|
||||
def.groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, fuel = 4}
|
||||
end
|
||||
if not def.sounds then
|
||||
def.sounds = default.node_sound_wood_defaults()
|
||||
end
|
||||
|
||||
minetest.register_node(itemstring, {
|
||||
description = def.description,
|
||||
drawtype = "fencelike",
|
||||
tiles = {def.texture},
|
||||
inventory_image = fence_texture_1 .. def.texture .. fence_texture_2,
|
||||
wield_image = fence_texture_1 .. def.texture .. fence_texture_2,
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
|
||||
},
|
||||
groups = def.groups,
|
||||
sounds = def.sounds,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = itemstring .. ' 4',
|
||||
recipe = {
|
||||
{'group:stick', def.material, 'group:stick'},
|
||||
{'group:stick', def.material, 'group:stick'},
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
default.register_fence("default:fence_wood", {
|
||||
description = "Wooden Fence",
|
||||
texture = "default_wood.png",
|
||||
material = "default:wood"
|
||||
})
|
||||
|
||||
default.register_fence("default:fence_junglewood", {
|
||||
description = "Junglewood Fence",
|
||||
texture = "default_junglewood.png",
|
||||
material = "default:junglewood"
|
||||
})
|
||||
|
||||
default.register_fence("default:fence_pinewood", {
|
||||
description = "Pine Wood Fence",
|
||||
texture = "default_pine_wood.png",
|
||||
material = "default:pinewood"
|
||||
})
|
||||
|
||||
default.register_fence("default:fence_acaciawood", {
|
||||
description = "Acacia Wood Fence",
|
||||
texture = "default_acacia_wood.png",
|
||||
material = "default:acacia_wood"
|
||||
})
|
Loading…
Reference in New Issue