Register plates with functions
This commit is contained in:
parent
cb70c37765
commit
628f5e0579
@ -44,36 +44,42 @@ function plate.timer(pos)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, m in pairs({"wooden", "stone"}) do
|
function plate.register(material, desc, def)
|
||||||
local sound = default.node_sound_wood_defaults()
|
local sound, groups = def.sounds, def.groups
|
||||||
if m == "stone" then
|
xdecor.register("pressure_"..material.."_off", {
|
||||||
sound = default.node_sound_stone_defaults()
|
description = desc.." Pressure Plate",
|
||||||
end
|
tiles = {"xdecor_pressure_"..material..".png"},
|
||||||
xdecor.register("pressure_"..m.."_off", {
|
|
||||||
description = m:gsub("^%l", string.upper).." Pressure Plate",
|
|
||||||
tiles = {"xdecor_pressure_"..m..".png"},
|
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
node_box = xdecor.pixelbox(16, {{1, 0, 1, 14, 1, 14}}),
|
node_box = xdecor.pixelbox(16, {{1, 0, 1, 14, 1, 14}}),
|
||||||
groups = {snappy=3},
|
groups = groups,
|
||||||
sounds = sound,
|
sounds = sound,
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
on_rotate = screwdriver.rotate_simple,
|
on_rotate = screwdriver.rotate_simple,
|
||||||
on_construct = plate.construct,
|
on_construct = plate.construct,
|
||||||
on_timer = plate.timer
|
on_timer = plate.timer
|
||||||
})
|
})
|
||||||
|
xdecor.register("pressure_"..material.."_on", {
|
||||||
xdecor.register("pressure_"..m.."_on", {
|
tiles = {"xdecor_pressure_"..material..".png"},
|
||||||
tiles = {"xdecor_pressure_"..m..".png"},
|
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
node_box = xdecor.pixelbox(16, {{1, 0, 1, 14, 0.4, 14}}),
|
node_box = xdecor.pixelbox(16, {{1, 0, 1, 14, 0.4, 14}}),
|
||||||
groups = {snappy=3, not_in_creative_inventory=1},
|
groups = groups,
|
||||||
sounds = sound,
|
sounds = sound,
|
||||||
drop = "xdecor:pressure_"..m.."_off",
|
drop = "xdecor:pressure_"..material.."_off",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
on_rotate = screwdriver.rotate_simple
|
on_rotate = screwdriver.rotate_simple
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
plate.register("wood", "Wooden", {
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
groups = {choppy=3, flammable=2}
|
||||||
|
})
|
||||||
|
|
||||||
|
plate.register("stone", "Stone", {
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
groups = {cracky=3}
|
||||||
|
})
|
||||||
|
|
||||||
xdecor.register("lever_off", {
|
xdecor.register("lever_off", {
|
||||||
description = "Lever",
|
description = "Lever",
|
||||||
tiles = {"xdecor_lever_off.png"},
|
tiles = {"xdecor_lever_off.png"},
|
||||||
|
Before Width: | Height: | Size: 407 B After Width: | Height: | Size: 407 B |
Loading…
Reference in New Issue
Block a user