Update 'mods/ITEMS/mcl_blackstone/init.lua'

This commit is contained in:
PrairieWind 2022-02-25 17:39:53 +00:00
parent 9eacc00df3
commit 43ff5377c3
1 changed files with 139 additions and 0 deletions

View File

@ -825,3 +825,142 @@ minetest.register_craft({
}
})
mcl_blackstone = {}
function mcl_blackstone.register_lantern(name, def)
local itemstring_floor = "mcl_blackstone:"..name.."_floor"
local itemstring_ceiling = "mcl_blackstone:"..name.."_ceiling"
local sounds = mcl_sounds.node_sound_metal_defaults()
minetest.register_node(itemstring_floor, {
description = def.description,
_doc_items_longdesc = def.longdesc,
drawtype = "mesh",
mesh = "mcl_blackstone_lantern_floor.obj",
inventory_image = def.texture_inv,
wield_image = def.texture_inv,
tiles = {
{
name = def.texture,
animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3}
}
},
use_texture_alpha = "clip",
paramtype = "light",
paramtype2 = "wallmounted",
place_param2 = 1,
node_placement_prediction = "",
sunlight_propagates = true,
light_source = def.light_level,
groups = {pickaxey = 1, attached_node = 1, deco_block = 1, lantern = 1},
selection_box = {
type = "fixed",
fixed = {
{-0.1875, -0.5, -0.1875, 0.1875, -0.0625, 0.1875},
{-0.125, -0.0625, -0.125, 0.125, 0.0625, 0.125},
{-0.0625, -0.5, -0.0625, 0.0625, 0.1875, 0.0625},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.1875, -0.5, -0.1875, 0.1875, -0.0625, 0.1875},
{-0.125, -0.0625, -0.125, 0.125, 0.0625, 0.125},
{-0.0625, -0.5, -0.0625, 0.0625, 0.1875, 0.0625},
},
},
sounds = sounds,
on_place = function(itemstack, placer, pointed_thing)
local new_stack = mcl_util.call_on_rightclick(itemstack, placer, pointed_thing)
if new_stack then
return new_stack
end
local under = pointed_thing.under
local above = pointed_thing.above
local wdir = minetest.dir_to_wallmounted(vector.subtract(under, above))
local fakestack = itemstack
if wdir == 0 then
fakestack:set_name(itemstring_ceiling)
elseif wdir == 1 then
fakestack:set_name(itemstring_floor)
end
local success
itemstack, success = minetest.item_place(fakestack, placer, pointed_thing, wdir)
itemstack:set_name(itemstring_floor)
if success then
minetest.sound_play(sounds.place, {pos = under, gain = 1}, true)
end
return itemstack
end,
on_rotate = false,
_mcl_hardness = 3.5,
_mcl_blast_resistance = 3.5,
})
minetest.register_node(itemstring_ceiling, {
description = def.description,
_doc_items_create_entry = false,
drawtype = "mesh",
mesh = "mcl_blackstone_lantern_ceiling.obj",
tiles = {
{
name = def.texture,
animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3}
}
},
use_texture_alpha = "clip",
paramtype = "light",
paramtype2 = "wallmounted",
place_param2 = 0,
node_placement_prediction = "",
sunlight_propagates = true,
light_source = def.light_level,
groups = {pickaxey = 1, attached_node = 1, deco_block = 1, lantern = 1, not_in_creative_inventory = 1},
drop = itemstring_floor,
selection_box = {
type = "fixed",
fixed = {
{-0.1875, 0, -0.1875, 0.1875, 0.4375, 0.1875},
{-0.125, -0.125, -0.125, 0.125, 0, 0.125},
{-0.0625, -0.5, -0.0625, 0.0625, -0.125, 0.0625},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.1875, 0, -0.1875, 0.1875, 0.4375, 0.1875},
{-0.125, -0.125, -0.125, 0.125, 0, 0.125},
{-0.0625, -0.5, -0.0625, 0.0625, -0.125, 0.0625},
},
},
sounds = sounds,
on_rotate = false,
_mcl_hardness = 3.5,
_mcl_blast_resistance = 3.5,
})
end
mcl_blackstone.register_lantern("soul_lantern", {
description = S("Soul Lantern"),
longdesc = S("Lanterns are light sources which can be placed on the top or the bottom of most blocks."),
texture = "mcl_blackstone_soul_lantern.png",
texture_inv = "mcl_blackstone_soul_lantern_inv.png",
light_level = 10,
})
minetest.register_craft({
output = "mcl_blackstone:soul_lantern_floor",
recipe = {
{"mcl_core:iron_nugget", "mcl_core:iron_nugget", "mcl_core:iron_nugget"},
{"mcl_core:iron_nugget", "mcl_blackstone:soul_torch", "mcl_core:iron_nugget"},
{"mcl_core:iron_nugget", "mcl_core:iron_nugget", "mcl_core:iron_nugget"},
},
})
minetest.register_alias("mcl_blackstone:soul_lantern", "mcl_blackstone:soul_lantern_floor")