Add hardness support for fences and fence gates
This commit is contained in:
parent
d8eb91f988
commit
9552c4472e
|
@ -10,6 +10,8 @@ Adds a fence without crafting recipe. A single node is created.
|
||||||
* `fence_name`: User-visible name (`description`)
|
* `fence_name`: User-visible name (`description`)
|
||||||
* `texture`: Texture to apply on the fence (all sides)
|
* `texture`: Texture to apply on the fence (all sides)
|
||||||
* `groups`: Table of groups to which the fence belongs to
|
* `groups`: Table of groups to which the fence belongs to
|
||||||
|
* `hardness`: Hardness (if unsure, pick the hardness of the material node)
|
||||||
|
* `blast_resistance`: Blast resistance (if unsure, pick the blast resistance of the material node)
|
||||||
* `connects_to`: Table of nodes (itemstrings) to which the fence will connect to. Use `group:<groupname>` for all members of the group `<groupname>`
|
* `connects_to`: Table of nodes (itemstrings) to which the fence will connect to. Use `group:<groupname>` for all members of the group `<groupname>`
|
||||||
* `sounds`: Node sound table for the fence
|
* `sounds`: Node sound table for the fence
|
||||||
|
|
||||||
|
@ -26,6 +28,8 @@ Adds a fence gate without crafting recipe. This will create 2 nodes.
|
||||||
* `fence_gate_name`: User-visible name (`description`)
|
* `fence_gate_name`: User-visible name (`description`)
|
||||||
* `texture`: Texture to apply on the fence gate (all sides)
|
* `texture`: Texture to apply on the fence gate (all sides)
|
||||||
* `groups`: Table of groups to which the fence gate belongs to
|
* `groups`: Table of groups to which the fence gate belongs to
|
||||||
|
* `hardness`: Hardness (if unsure, pick the hardness of the material node)
|
||||||
|
* `blast_resistance`: Blast resistance (if unsure, pick the blast resistance of the material node)
|
||||||
* `sounds`: Node sound table for the fence gate
|
* `sounds`: Node sound table for the fence gate
|
||||||
* `sound_open`: Sound to play when opening fence gate (optional, default is wooden sound)
|
* `sound_open`: Sound to play when opening fence gate (optional, default is wooden sound)
|
||||||
* `sound_close`: Sound to play when closing fence gate (optional, default is wooden sound)
|
* `sound_close`: Sound to play when closing fence gate (optional, default is wooden sound)
|
||||||
|
@ -49,6 +53,8 @@ This will register 3 nodes in total without crafting recipes.
|
||||||
* `fence_gate_name`: User-visible name (`description`) of the fence gate
|
* `fence_gate_name`: User-visible name (`description`) of the fence gate
|
||||||
* `texture`: Texture to apply on the fence and fence gate (all sides)
|
* `texture`: Texture to apply on the fence and fence gate (all sides)
|
||||||
* `groups`: Table of groups to which the fence and fence gate belong to
|
* `groups`: Table of groups to which the fence and fence gate belong to
|
||||||
|
* `hardness`: Hardness (if unsure, pick the hardness of the material node)
|
||||||
|
* `blast_resistance`: Blast resistance (if unsure, pick the blast resistance of the material node)
|
||||||
* `connects_to`: Table of nodes (itemstrings) to which the fence will connect to. Use `group:<groupname>` for all members of the group `<groupname>`
|
* `connects_to`: Table of nodes (itemstrings) to which the fence will connect to. Use `group:<groupname>` for all members of the group `<groupname>`
|
||||||
* `sounds`: Node sound table for the fence and the fence gate
|
* `sounds`: Node sound table for the fence and the fence gate
|
||||||
* `sound_open`: Sound to play when opening fence gate (optional, default is wooden sound)
|
* `sound_open`: Sound to play when opening fence gate (optional, default is wooden sound)
|
||||||
|
|
|
@ -20,7 +20,7 @@ local cz2 = {-2/16, -1/2+6/16, 2/16, 2/16, 1, 1/2} --unten(quer) z
|
||||||
|
|
||||||
mcl_fences = {}
|
mcl_fences = {}
|
||||||
|
|
||||||
mcl_fences.register_fence = function(id, fence_name, texture, groups, connects_to, sounds)
|
mcl_fences.register_fence = function(id, fence_name, texture, groups, hardness, blast_resistance, connects_to, sounds)
|
||||||
if groups == nil then groups = {} end
|
if groups == nil then groups = {} end
|
||||||
groups.fence = 1
|
groups.fence = 1
|
||||||
groups.deco_block = 1
|
groups.deco_block = 1
|
||||||
|
@ -59,12 +59,14 @@ mcl_fences.register_fence = function(id, fence_name, texture, groups, connects_t
|
||||||
connect_right = {cx2},
|
connect_right = {cx2},
|
||||||
},
|
},
|
||||||
sounds = sounds,
|
sounds = sounds,
|
||||||
|
_mcl_blast_resistance = blast_resistance,
|
||||||
|
_mcl_hardness = hardness,
|
||||||
})
|
})
|
||||||
|
|
||||||
return fence_id
|
return fence_id
|
||||||
end
|
end
|
||||||
|
|
||||||
mcl_fences.register_fence_gate = function(id, fence_gate_name, texture, groups, sounds, sound_open, sound_close, sound_gain_open, sound_gain_close)
|
mcl_fences.register_fence_gate = function(id, fence_gate_name, texture, groups, hardness, blast_resistance, sounds, sound_open, sound_close, sound_gain_open, sound_gain_close)
|
||||||
local meta2
|
local meta2
|
||||||
local state2 = 0
|
local state2 = 0
|
||||||
|
|
||||||
|
@ -149,6 +151,8 @@ mcl_fences.register_fence_gate = function(id, fence_gate_name, texture, groups,
|
||||||
end),
|
end),
|
||||||
}},
|
}},
|
||||||
sounds = sounds,
|
sounds = sounds,
|
||||||
|
_mcl_blast_resistance = blast_resistance,
|
||||||
|
_mcl_hardness = hardness,
|
||||||
})
|
})
|
||||||
|
|
||||||
groups.mesecon_effector_on = nil
|
groups.mesecon_effector_on = nil
|
||||||
|
@ -205,14 +209,16 @@ mcl_fences.register_fence_gate = function(id, fence_gate_name, texture, groups,
|
||||||
punch_gate(pos, node)
|
punch_gate(pos, node)
|
||||||
end,
|
end,
|
||||||
sounds = sounds,
|
sounds = sounds,
|
||||||
|
_mcl_blast_resistance = blast_resistance,
|
||||||
|
_mcl_hardness = hardness,
|
||||||
})
|
})
|
||||||
|
|
||||||
return gate_id, open_gate_id
|
return gate_id, open_gate_id
|
||||||
end
|
end
|
||||||
|
|
||||||
mcl_fences.register_fence_and_fence_gate = function(id, fence_name, fence_gate_name, texture, groups, connects_to, sounds, sound_open, sound_close, sound_gain_open, sound_gain_close)
|
mcl_fences.register_fence_and_fence_gate = function(id, fence_name, fence_gate_name, texture, groups, hardness, blast_reistance, connects_to, sounds, sound_open, sound_close, sound_gain_open, sound_gain_close)
|
||||||
local fence_id = mcl_fences.register_fence(id, fence_name, texture, groups, connects_to, sounds)
|
local fence_id = mcl_fences.register_fence(id, fence_name, texture, groups, hardness, blast_resistance, connects_to, sounds)
|
||||||
local gate_id, open_gate_id = mcl_fences.register_fence_gate(id, fence_gate_name, texture, groups, sounds, sound_open, sound_close, sound_gain_open, sound_gain_close)
|
local gate_id, open_gate_id = mcl_fences.register_fence_gate(id, fence_gate_name, texture, groups, hardness, blast_resistance, sounds, sound_open, sound_close, sound_gain_open, sound_gain_close)
|
||||||
return fence_id, gate_id, open_gate_id
|
return fence_id, gate_id, open_gate_id
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -239,7 +245,7 @@ for w=1, #woods do
|
||||||
id = wood[1].."_fence"
|
id = wood[1].."_fence"
|
||||||
id_gate = wood[1].."_fence_gate"
|
id_gate = wood[1].."_fence_gate"
|
||||||
end
|
end
|
||||||
mcl_fences.register_fence_and_fence_gate(id, wood[2], wood[3], wood[4], wood_groups, wood_connect, wood_sounds)
|
mcl_fences.register_fence_and_fence_gate(id, wood[2], wood[3], wood[4], wood_groups, 2, 15, wood_connect, wood_sounds)
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'mcl_fences:'..id..' 3',
|
output = 'mcl_fences:'..id..' 3',
|
||||||
|
@ -259,7 +265,7 @@ end
|
||||||
|
|
||||||
|
|
||||||
-- Nether Brick Fence (without fence gate!)
|
-- Nether Brick Fence (without fence gate!)
|
||||||
mcl_fences.register_fence("nether_brick_fence", "Nether Brick Fence", "mcl_nether_nether_brick.png", {pickaxey=1, deco_block=1, fence_nether_brick=1}, {"group:fence_nether_brick"}, mcl_sounds.node_sound_stone_defaults())
|
mcl_fences.register_fence("nether_brick_fence", "Nether Brick Fence", "mcl_nether_nether_brick.png", {pickaxey=1, deco_block=1, fence_nether_brick=1}, 2, 30, {"group:fence_nether_brick"}, mcl_sounds.node_sound_stone_defaults())
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'mcl_fences:nether_brick_fence 6',
|
output = 'mcl_fences:nether_brick_fence 6',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user