Epic/mods/stations/station_anvil.lua

146 lines
4.5 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_rust.png', 'stations_anvil_default.png', 'stations_anvil_fire.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},
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_rust.png', 'stations_anvil_default.png', 'stations_anvil_fire.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},
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)
local is_uninv = minetest.global_exists("unified_inventory") or false
if is_uninv then
-- "anvil" from simplecrafting_lib.generate_table_functions('anvil') above...
-- the same name used to register recipes for the anvil station to simple crafting
--
-- register_craft_type sets up the icon shown in inventory GUI... such as furnace for cooking things
--
unified_inventory.register_craft_type("anvil", {
description = "Smithy Station",
icon = 'stations_anvil_icon.png', -- from the simple crafting definition above
width = 4, -- like when shown in station guide... 4 wide
height = 2, -- 1 high
uses_crafting_grid = false -- obviously not the normal crafting grid
})
end