Merge pull request 'Adds Lanterns' (#229) from PrairieAstronomer/MineClone5:master into master

Reviewed-on: MineClone5/MineClone5#229
This commit is contained in:
kay27 2022-02-27 22:56:39 +00:00
commit 6eb154c90b
16 changed files with 478 additions and 43 deletions

View File

@ -823,46 +823,4 @@ minetest.register_craft({
{ "mcl_nether:soul_sand" },
{ "mcl_core:stick" },
}
})
minetest.register_node("mcl_blackstone:soul_lantern", {
tiles = {
"lantern_top.png",
"lantern_bottom.png",
"lantern.png",
"lantern.png",
"lantern.png",
"lantern.png",
},
groups = {pickaxey=3},
inventory_image = "lantern.png",
light_source = 10,
description = S("Soul Lantern"),
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
_mcl_hardness = 1,
node_box = {
type = "fixed",
fixed = {
{-0.1875, -0.5000, -0.1875, 0.1875, -0.06250, 0.1875},
{-0.1250, -0.06250, -0.1250, 0.1250, 0.06250, 0.1250},
{-0.06250, 0.1250, -0.006250, 0.06250, 0.1875, 0.006250},
{-0.06250, 0.06250, -0.006250, -0.03125, 0.1250, 0.006250},
{0.03125, 0.06250, -0.006250, 0.06250, 0.1250, 0.006250},
}
},
stack_max = 64,
})
minetest.register_craft({
type = "shaped",
output = "mcl_blackstone:soul_lantern",
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"}
}
})
})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -0,0 +1,203 @@
local S = minetest.get_translator("mcl_lanterns")
local modpath = minetest.get_modpath("mcl_lanterns")
mcl_lanterns = {}
--[[
TODO:
- add lantern specific sounds
- remove the hack arround walmounted nodes
]]
function mcl_lanterns.register_lantern(name, def)
local itemstring_floor = "mcl_lanterns:"..name.."_floor"
local itemstring_ceiling = "mcl_lanterns:"..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_lanterns_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_lanterns_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
minetest.register_node("mcl_lanterns:chain", {
description = S("Chain"),
_doc_items_longdesc = S("Chains are metallic decoration blocks."),
inventory_image = "mcl_lanterns_chain_inv.png",
tiles = {"mcl_lanterns_chain.png"},
drawtype = "mesh",
paramtype = "light",
paramtype2 = "facedir",
use_texture_alpha = "clip",
mesh = "mcl_lanterns_chain.obj",
is_ground_content = false,
sunlight_propagates = true,
collision_box = {
type = "fixed",
fixed = {
{-0.0625, -0.5, -0.0625, 0.0625, 0.5, 0.0625},
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.0625, -0.5, -0.0625, 0.0625, 0.5, 0.0625},
}
},
groups = {pickaxey = 1, deco_block = 1},
sounds = mcl_sounds.node_sound_metal_defaults(),
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" then
return itemstack
end
local p0 = pointed_thing.under
local p1 = pointed_thing.above
local param2 = 0
local placer_pos = placer:get_pos()
if placer_pos then
local dir = {
x = p1.x - placer_pos.x,
y = p1.y - placer_pos.y,
z = p1.z - placer_pos.z
}
param2 = minetest.dir_to_facedir(dir)
end
if p0.y - 1 == p1.y then
param2 = 20
elseif p0.x - 1 == p1.x then
param2 = 16
elseif p0.x + 1 == p1.x then
param2 = 12
elseif p0.z - 1 == p1.z then
param2 = 8
elseif p0.z + 1 == p1.z then
param2 = 4
end
return minetest.item_place(itemstack, placer, pointed_thing, param2)
end,
_mcl_blast_resistance = 6,
_mcl_hardness = 5,
})
minetest.register_craft({
output = "mcl_lanterns:chain",
recipe = {
{"mcl_core:iron_nugget"},
{"mcl_core:iron_ingot"},
{"mcl_core:iron_nugget"},
},
})
dofile(modpath.."/register.lua")

View File

@ -0,0 +1,5 @@
name = mcl_lanterns
description = Add lanterns and chains to MineClone2
depends = mcl_sounds, mcl_blackstone
optional_depends =
author = AFCMS

View File

@ -0,0 +1,24 @@
# Blender v3.0.1 OBJ File: 'chain.blend'
# www.blender.org
o Plane
v 0.066291 0.500000 0.066291
v 0.066291 -0.500000 0.066291
v -0.066291 0.500000 -0.066291
v -0.066291 -0.500000 -0.066291
v -0.066291 0.500000 0.066291
v -0.066291 -0.500000 0.066291
v 0.066291 0.500000 -0.066291
v 0.066291 -0.500000 -0.066291
vt -0.000000 1.000000
vt 0.000000 -0.000000
vt 0.187500 0.000000
vt 0.187500 1.000000
vt 0.187500 1.000000
vt 0.187500 -0.000000
vt 0.375000 -0.000000
vt 0.375000 1.000000
vn 0.7071 0.0000 -0.7071
vn 0.7071 0.0000 0.7071
s off
f 1/1/1 2/2/1 4/3/1 3/4/1
f 5/5/2 6/6/2 8/7/2 7/8/2

View File

@ -0,0 +1,104 @@
# Blender v3.0.1 OBJ File: 'lantern.blend'
# www.blender.org
o Lantern_Ceiling
v 0.187500 -0.000000 0.187500
v 0.187500 0.437500 0.187500
v 0.187500 0.000000 -0.187500
v 0.187500 0.437500 -0.187500
v -0.187500 -0.000000 0.187500
v -0.187500 0.437500 0.187500
v -0.187500 0.000000 -0.187500
v -0.187500 0.437500 -0.187500
v 0.125000 -0.125000 0.125000
v 0.125000 -0.000000 0.125000
v 0.125000 -0.125000 -0.125000
v 0.125000 0.000000 -0.125000
v -0.125000 -0.125000 0.125000
v -0.125000 -0.000000 0.125000
v -0.125000 -0.125000 -0.125000
v -0.125000 0.000000 -0.125000
v 0.066291 -0.500000 -0.066291
v 0.066291 -0.125000 -0.066291
v -0.066291 -0.500000 0.066291
v -0.066291 -0.125000 0.066291
v -0.066291 -0.500000 -0.066291
v -0.066291 -0.125000 -0.066291
v 0.066291 -0.500000 0.066291
v 0.066291 -0.125000 0.066291
vt 0.000000 0.062500
vt 0.375000 0.062500
vt 0.375000 0.437500
vt 0.000000 0.437500
vt 0.375000 0.437500
vt 0.375000 0.875000
vt -0.000000 0.875000
vt -0.000000 0.437500
vt 0.375000 0.437500
vt 0.375000 0.875000
vt -0.000000 0.875000
vt 0.000000 0.437500
vt 0.000000 0.062500
vt 0.375000 0.062500
vt 0.375000 0.437500
vt 0.375000 0.875000
vt -0.000000 0.875000
vt 0.000000 0.437500
vt 0.375000 0.437500
vt 0.375000 0.875000
vt -0.000000 0.875000
vt -0.000000 0.437500
vt 0.062500 0.125000
vt 0.312500 0.125000
vt 0.312500 0.375000
vt 0.062500 0.375000
vt 0.312500 0.875000
vt 0.312500 1.000000
vt 0.062500 1.000000
vt 0.062500 0.875000
vt 0.312500 0.875000
vt 0.312500 1.000000
vt 0.062500 1.000000
vt 0.062500 0.875000
vt 0.500000 0.770833
vt 0.500000 0.770833
vt 0.500000 0.770833
vt 0.500000 0.770833
vt 0.312500 0.875000
vt 0.312500 1.000000
vt 0.062500 1.000000
vt 0.062500 0.875000
vt 0.312500 0.875000
vt 0.312500 1.000000
vt 0.062500 1.000000
vt 0.062500 0.875000
vt 0.687500 0.625000
vt 0.687500 0.250000
vt 0.875000 0.250000
vt 0.875000 0.625000
vt 0.687500 1.000000
vt 0.687500 0.625000
vt 0.875000 0.625000
vt 0.875000 1.000000
vn 0.0000 -1.0000 -0.0000
vn 0.0000 0.0000 -1.0000
vn -1.0000 -0.0000 0.0000
vn 0.0000 1.0000 0.0000
vn 1.0000 0.0000 0.0000
vn 0.0000 -0.0000 1.0000
vn 0.7071 -0.0000 0.7071
vn 0.7071 0.0000 -0.7071
s off
f 1/1/1 5/2/1 7/3/1 3/4/1
f 4/5/2 3/6/2 7/7/2 8/8/2
f 8/9/3 7/10/3 5/11/3 6/12/3
f 6/13/4 2/14/4 4/5/4 8/8/4
f 2/15/5 1/16/5 3/17/5 4/18/5
f 6/19/6 5/20/6 1/21/6 2/22/6
f 9/23/1 13/24/1 15/25/1 11/26/1
f 12/27/2 11/28/2 15/29/2 16/30/2
f 16/31/3 15/32/3 13/33/3 14/34/3
f 14/35/4 10/36/4 12/37/4 16/38/4
f 10/39/5 9/40/5 11/41/5 12/42/5
f 14/43/6 13/44/6 9/45/6 10/46/6
f 17/47/7 18/48/7 20/49/7 19/50/7
f 21/51/8 22/52/8 24/53/8 23/54/8

View File

@ -0,0 +1,104 @@
# Blender v3.0.1 OBJ File: 'lantern.blend'
# www.blender.org
o Lantern_Floor
v 0.187500 -0.062500 -0.187500
v 0.187500 -0.500000 -0.187500
v 0.187500 -0.062500 0.187500
v 0.187500 -0.500000 0.187500
v -0.187500 -0.062500 -0.187500
v -0.187500 -0.500000 -0.187500
v -0.187500 -0.062500 0.187500
v -0.187500 -0.500000 0.187500
v 0.125000 0.062500 -0.125000
v 0.125000 -0.062500 -0.125000
v 0.125000 0.062500 0.125000
v 0.125000 -0.062500 0.125000
v -0.125000 0.062500 -0.125000
v -0.125000 -0.062500 -0.125000
v -0.125000 0.062500 0.125000
v -0.125000 -0.062500 0.125000
v 0.066291 0.187500 0.066291
v 0.066291 0.062500 0.066291
v -0.066291 0.187500 -0.066291
v -0.066291 0.062500 -0.066291
v -0.066291 0.187500 0.066291
v -0.066291 0.062500 0.066291
v 0.066291 0.187500 -0.066291
v 0.066291 0.062500 -0.066291
vt 0.000000 0.062500
vt 0.375000 0.062500
vt 0.375000 0.437500
vt 0.000000 0.437500
vt 0.375000 0.437500
vt 0.375000 0.875000
vt -0.000000 0.875000
vt -0.000000 0.437500
vt 0.375000 0.437500
vt 0.375000 0.875000
vt -0.000000 0.875000
vt 0.000000 0.437500
vt 0.000000 0.062500
vt 0.375000 0.062500
vt 0.375000 0.437500
vt 0.375000 0.875000
vt -0.000000 0.875000
vt 0.000000 0.437500
vt 0.375000 0.437500
vt 0.375000 0.875000
vt -0.000000 0.875000
vt -0.000000 0.437500
vt 0.062500 0.125000
vt 0.312500 0.125000
vt 0.312500 0.375000
vt 0.062500 0.375000
vt 0.312500 0.875000
vt 0.312500 1.000000
vt 0.062500 1.000000
vt 0.062500 0.875000
vt 0.312500 0.875000
vt 0.312500 1.000000
vt 0.062500 1.000000
vt 0.062500 0.875000
vt 0.500000 0.770833
vt 0.500000 0.770833
vt 0.500000 0.770833
vt 0.500000 0.770833
vt 0.312500 0.875000
vt 0.312500 1.000000
vt 0.062500 1.000000
vt 0.062500 0.875000
vt 0.312500 0.875000
vt 0.312500 1.000000
vt 0.062500 1.000000
vt 0.062500 0.875000
vt 0.687500 0.937500
vt 0.687500 0.812500
vt 0.875000 0.812500
vt 0.875000 0.937500
vt 0.687500 0.937500
vt 0.687500 0.812500
vt 0.875000 0.812500
vt 0.875000 0.937500
vn 0.0000 1.0000 0.0000
vn 0.0000 0.0000 1.0000
vn -1.0000 0.0000 0.0000
vn 0.0000 -1.0000 0.0000
vn 1.0000 0.0000 0.0000
vn 0.0000 0.0000 -1.0000
vn 0.7071 0.0000 -0.7071
vn 0.7071 0.0000 0.7071
s off
f 1/1/1 5/2/1 7/3/1 3/4/1
f 4/5/2 3/6/2 7/7/2 8/8/2
f 8/9/3 7/10/3 5/11/3 6/12/3
f 6/13/4 2/14/4 4/5/4 8/8/4
f 2/15/5 1/16/5 3/17/5 4/18/5
f 6/19/6 5/20/6 1/21/6 2/22/6
f 9/23/1 13/24/1 15/25/1 11/26/1
f 12/27/2 11/28/2 15/29/2 16/30/2
f 16/31/3 15/32/3 13/33/3 14/34/3
f 14/35/4 10/36/4 12/37/4 16/38/4
f 10/39/5 9/40/5 11/41/5 12/42/5
f 14/43/6 13/44/6 9/45/6 10/46/6
f 17/47/7 18/48/7 20/49/7 19/50/7
f 21/51/8 22/52/8 24/53/8 23/54/8

View File

@ -0,0 +1,37 @@
local S = minetest.get_translator("mcl_lanterns")
mcl_lanterns.register_lantern("lantern", {
description = S("Lantern"),
longdesc = S("Lanterns are light sources which can be placed on the top or the bottom of most blocks."),
texture = "mcl_lanterns_lantern.png",
texture_inv = "mcl_lanterns_lantern_inv.png",
light_level = 14,
})
minetest.register_craft({
output = "mcl_lanterns:lantern_floor",
recipe = {
{"mcl_core:iron_nugget", "mcl_core:iron_nugget", "mcl_core:iron_nugget"},
{"mcl_core:iron_nugget", "mcl_torches:torch" , "mcl_core:iron_nugget"},
{"mcl_core:iron_nugget", "mcl_core:iron_nugget", "mcl_core:iron_nugget"},
},
})
mcl_lanterns.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_lanterns_soul_lantern.png",
texture_inv = "mcl_lanterns_soul_lantern_inv.png",
light_level = 10,
})
minetest.register_craft({
output = "mcl_lanterns: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_lanterns:soul_lantern_floor")

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB