Epic/mods/stations/station_anvil.lua

140 lines
3.9 KiB
Lua

local anvil_table_functions = simplecrafting_lib.generate_table_functions('anvil', {
show_guides = true,
alphabetize_items = true,
--active_node = 'stations:anvil1',
})
--[[local anvil_multifurnace0_def = { --off furnace
description = 'Tool Repair Station',
drawtype = 'mesh',
mesh = 'stations_anvil.obj',
tiles = {'stations_anvil_rust.png', 'stations_anvil_default.png', 'stations_anvil.png'},
sounds = default.node_sound_wood_defaults(),
paramtype2 = 'facedir',
paramtype = 'light',
selection_box = {
type = 'fixed',
fixed = {
{1.5, -.5, -.375, -.44, 0, .4},
{1.1, .1, 0, .38, .5, .38},
}
},
collision_box = {
type = 'fixed',
fixed = {
{1.5, -.5, -.375, -.44, 0, .4},
{1.1, .1, 0, .38, .5, .38},
}
},
groups = {oddly_breakable_by_hand = 1, choppy=3},
}
--]]
local anvil_multifurnace_def = { --on furnace
description = 'Smithy Station',
drawtype = 'mesh',
mesh = 'stations_anvil.obj',
tiles = {'stations_anvil.png'},
use_texture_alpha = 'opaque',
sounds = default.node_sound_wood_defaults(),
paramtype2 = 'facedir',
paramtype = 'light',
selection_box = {
type = 'fixed',
fixed = {
{1.5, -.5, -.375, -.44, 0, .4},
{1.1, .1, 0, .38, .5, .38},
}
},
collision_box = {
type = 'fixed',
fixed = {
{1.5, -.5, -.375, -.44, 0, .4},
{1.1, .1, 0, .38, .5, .38},
}
},
groups = {oddly_breakable_by_hand = 1, choppy=3},
after_place_node = function(pos, placer, itemstack)
if not epic.space_to_side(pos) then
minetest.remove_node(pos)
return itemstack
end
local meta = minetest.get_meta(pos)
meta:set_string('infotext', 'Smithy Station')
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
epic.remove_side_node(pos, oldnode)
end,
on_rotate = function(pos, node)
return false
end,
}
for k, v in pairs(anvil_table_functions) do
--anvil_multifurnace0_def[k] = v
anvil_multifurnace_def[k] = v
end
--minetest.register_node('stations:anvil0', anvil_multifurnace0_def)
minetest.register_node('stations:anvil1', anvil_multifurnace_def)
local anvil_locked_table_functions = simplecrafting_lib.generate_table_functions('anvil', {
show_guides = true,
alphabetize_items = true,
protect_inventory = true,
})
local anvil_locked_multifurnace_def = {
description = 'Smithy Station (locked)',
drawtype = 'mesh',
mesh = 'stations_anvil.obj',
tiles = {'stations_anvil.png'},
use_texture_alpha = 'opaque',
sounds = default.node_sound_wood_defaults(),
paramtype2 = 'facedir',
paramtype = 'light',
selection_box = {
type = 'fixed',
fixed = {
{1.5, -.5, -.375, -.44, 0, .4},
{1.1, .1, 0, .38, .5, .38},
}
},
collision_box = {
type = 'fixed',
fixed = {
{1.5, -.5, -.375, -.44, 0, .4},
{1.1, .1, 0, .38, .5, .38},
}
},
groups = {oddly_breakable_by_hand = 1, choppy=3},
after_place_node = function(pos, placer, itemstack)
if not epic.space_to_side(pos) then
minetest.remove_node(pos)
return itemstack
end
local meta = minetest.get_meta(pos)
meta:set_string('infotext', 'Smithy Station (locked)')
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
epic.remove_side_node(pos, oldnode)
end,
on_rotate = function(pos, node)
return false
end,
}
for k, v in pairs(anvil_locked_table_functions) do
anvil_locked_multifurnace_def[k] = v
end
--minetest.register_node('stations:anvil0', anvil_multifurnace0_def)
minetest.register_node('stations:anvil_locked', anvil_locked_multifurnace_def)
unified_inventory.register_craft_type("anvil", {
description = "Smithy Station",
icon = 'stations_anvil_icon.png',
width = 4,
height = 2,
uses_crafting_grid = false
})