Epic/mods/stations/station_stone_carving.lua

96 lines
2.8 KiB
Lua

local stone_carving_table_functions = simplecrafting_lib.generate_table_functions('stone_carving', {
show_guides = true,
alphabetize_items = true,}
)
local stone_carving_table_def = {
description = 'Stone Carving',
drawtype = 'mesh',
mesh = 'stations_stone_carving.obj',
tiles = {'stations_stone_carving.png'},
use_texture_alpha = 'opaque',
sounds = default.node_sound_wood_defaults(),
paramtype2 = 'facedir',
paramtype = 'light',
selection_box = {
type = 'fixed',
fixed = {-.4, -.5, -.4, .4, 1.25, .4},
},
collision_box = {
type = 'fixed',
fixed = {-.4, -.5, -.4, .4, 1.25, .4},
},
groups = {oddly_breakable_by_hand = 1, cracky=3},
after_place_node = function(pos, placer, itemstack)
if not epic.space_on_top(pos) then
minetest.remove_node(pos)
return itemstack
end
local meta = minetest.get_meta(pos)
meta:set_string('infotext', 'Stone Carving')
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
epic.remove_top_node(pos, oldnode)
end,
}
for k, v in pairs(stone_carving_table_functions) do
stone_carving_table_def[k] = v
end
minetest.register_node('stations:stone_carving', stone_carving_table_def)
local stone_carving_locked_functions = simplecrafting_lib.generate_table_functions('stone_carving', {
show_guides = true,
alphabetize_items = true,
protect_inventory = true,}
)
local stone_carving_locked_def = {
description = 'Stone Carving (locked)',
drawtype = 'mesh',
mesh = 'stations_stone_carving.obj',
tiles = {'stations_stone_carving.png'},
use_texture_alpha = 'opaque',
sounds = default.node_sound_wood_defaults(),
paramtype2 = 'facedir',
paramtype = 'light',
selection_box = {
type = 'fixed',
fixed = {-.4, -.5, -.4, .4, 1.25, .4},
},
collision_box = {
type = 'fixed',
fixed = {-.4, -.5, -.4, .4, 1.25, .4},
},
groups = {oddly_breakable_by_hand = 1, cracky=3},
after_place_node = function(pos, placer, itemstack)
if not epic.space_on_top(pos) then
minetest.remove_node(pos)
return itemstack
end
local meta = minetest.get_meta(pos)
meta:set_string('infotext', 'Stone Carving (Locked)')
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
epic.remove_top_node(pos, oldnode)
end,
}
for k, v in pairs(stone_carving_locked_functions) do
stone_carving_locked_def[k] = v
end
minetest.register_node('stations:stone_carving_locked', stone_carving_locked_def)
local is_uninv = minetest.global_exists("unified_inventory") or false
if is_uninv then
unified_inventory.register_craft_type("stone_carving", {
description = "Stone Carving",
icon = 'stations_stone_carving_icon.png',
width = 4,
height = 2,
uses_crafting_grid = false
})
end