2017-08-03 15:02:56 +02:00
|
|
|
-- support for i18n
|
2020-02-15 15:32:06 +01:00
|
|
|
local S = minetest.get_translator("cavestuff")
|
2017-08-03 15:02:56 +02:00
|
|
|
|
2014-08-12 21:08:11 +02:00
|
|
|
--Rocks
|
|
|
|
|
2015-01-17 16:46:22 +01:00
|
|
|
local cbox = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-5/16, -8/16, -6/16, 5/16, -1/32, 5/16},
|
|
|
|
}
|
|
|
|
|
2014-08-12 21:08:11 +02:00
|
|
|
minetest.register_node("cavestuff:pebble_1",{
|
2017-08-03 15:02:56 +02:00
|
|
|
description = S("Pebble"),
|
2015-01-17 06:14:32 +01:00
|
|
|
drawtype = "mesh",
|
|
|
|
mesh = "cavestuff_pebble.obj",
|
2021-06-07 19:04:31 +02:00
|
|
|
tiles = {"undergrowth_pebble.png"},
|
|
|
|
paramtype = "light",
|
2014-08-12 21:08:11 +02:00
|
|
|
paramtype2 = "facedir",
|
2021-06-21 06:36:14 +02:00
|
|
|
groups = {cracky=3, stone=1, attached_node=1},
|
2021-06-07 19:04:31 +02:00
|
|
|
selection_box = cbox,
|
|
|
|
collision_box = cbox,
|
|
|
|
on_place = function(itemstack, placer, pointed_thing)
|
2014-08-12 21:08:11 +02:00
|
|
|
-- place a random pebble node
|
|
|
|
local stack = ItemStack("cavestuff:pebble_"..math.random(1,2))
|
|
|
|
local ret = minetest.item_place(stack, placer, pointed_thing)
|
|
|
|
return ItemStack("cavestuff:pebble_1 "..itemstack:get_count()-(1-ret:get_count()))
|
|
|
|
end,
|
2021-06-07 19:04:31 +02:00
|
|
|
sounds = default.node_sound_stone_defaults(),
|
2014-08-12 21:08:11 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_node("cavestuff:pebble_2",{
|
2015-01-17 06:14:32 +01:00
|
|
|
drawtype = "mesh",
|
|
|
|
mesh = "cavestuff_pebble.obj",
|
2021-06-07 19:04:31 +02:00
|
|
|
tiles = {"undergrowth_pebble.png"},
|
2014-08-12 21:08:11 +02:00
|
|
|
drop = "cavestuff:pebble_1",
|
2021-06-07 19:04:31 +02:00
|
|
|
paramtype = "light",
|
2014-08-12 21:08:11 +02:00
|
|
|
paramtype2 = "facedir",
|
2021-06-21 06:36:14 +02:00
|
|
|
groups = {cracky=3, stone=1, attached_node=1, not_in_creative_inventory=1},
|
2015-01-17 16:46:22 +01:00
|
|
|
selection_box = cbox,
|
|
|
|
collision_box = cbox,
|
2021-06-07 19:04:31 +02:00
|
|
|
sounds = default.node_sound_stone_defaults(),
|
2014-08-12 21:08:11 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_node("cavestuff:desert_pebble_1",{
|
2017-08-03 15:02:56 +02:00
|
|
|
description = S("Desert Pebble"),
|
2015-01-17 06:14:32 +01:00
|
|
|
drawtype = "mesh",
|
|
|
|
mesh = "cavestuff_pebble.obj",
|
2021-06-07 19:04:31 +02:00
|
|
|
tiles = {"default_desert_stone.png"},
|
|
|
|
paramtype = "light",
|
2014-08-12 21:08:11 +02:00
|
|
|
paramtype2 = "facedir",
|
2021-06-21 06:36:14 +02:00
|
|
|
groups = {cracky=3, stone=1, attached_node=1},
|
2015-01-17 16:46:22 +01:00
|
|
|
selection_box = cbox,
|
|
|
|
collision_box = cbox,
|
2021-06-07 19:04:31 +02:00
|
|
|
on_place = function(itemstack, placer, pointed_thing)
|
2014-08-12 21:08:11 +02:00
|
|
|
-- place a random pebble node
|
|
|
|
local stack = ItemStack("cavestuff:desert_pebble_"..math.random(1,2))
|
|
|
|
local ret = minetest.item_place(stack, placer, pointed_thing)
|
|
|
|
return ItemStack("cavestuff:desert_pebble_1 "..itemstack:get_count()-(1-ret:get_count()))
|
|
|
|
end,
|
2021-06-07 19:04:31 +02:00
|
|
|
sounds = default.node_sound_stone_defaults(),
|
2014-08-12 21:08:11 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_node("cavestuff:desert_pebble_2",{
|
2015-01-17 06:14:32 +01:00
|
|
|
drawtype = "mesh",
|
|
|
|
mesh = "cavestuff_pebble.obj",
|
2014-08-12 21:08:11 +02:00
|
|
|
drop = "cavestuff:desert_pebble_1",
|
2021-06-07 19:04:31 +02:00
|
|
|
tiles = {"default_desert_stone.png"},
|
|
|
|
paramtype = "light",
|
2014-08-12 21:08:11 +02:00
|
|
|
paramtype2 = "facedir",
|
2021-06-21 06:36:14 +02:00
|
|
|
groups = {cracky=3, stone=1, attached_node=1, not_in_creative_inventory=1},
|
2015-01-17 16:46:22 +01:00
|
|
|
selection_box = cbox,
|
|
|
|
collision_box = cbox,
|
2021-06-07 19:04:31 +02:00
|
|
|
sounds = default.node_sound_stone_defaults(),
|
2014-08-12 21:08:11 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
--Staclactites
|
|
|
|
|
|
|
|
minetest.register_node("cavestuff:stalactite_1",{
|
|
|
|
drawtype="nodebox",
|
|
|
|
tiles = {"undergrowth_pebble.png"},
|
|
|
|
groups = {cracky=3,attached_node=1},
|
2017-08-03 15:02:56 +02:00
|
|
|
description = S("Stalactite"),
|
2014-08-12 21:08:11 +02:00
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "wallmounted",
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
2021-06-07 19:04:31 +02:00
|
|
|
{-0.187500,-0.425000,-0.150003,0.162500,-0.500000,0.162500},
|
|
|
|
{-0.112500,-0.162500,-0.100000,0.087500,-0.475000,0.087500},
|
|
|
|
{-0.062500,0.275000,-0.062500,0.062500,-0.500000,0.062500},
|
|
|
|
{-0.037500,0.837500,0.037500,0.037500,-0.500000,-0.025000},
|
2014-08-12 21:08:11 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
on_place = function(itemstack, placer, pointed_thing)
|
2021-06-07 19:04:31 +02:00
|
|
|
local dir = vector.subtract(pointed_thing.above, pointed_thing.under)
|
|
|
|
local base = pointed_thing.under
|
|
|
|
local place = vector.add(base, dir)
|
|
|
|
local above = vector.add(place, dir)
|
|
|
|
|
|
|
|
if not placer then return end
|
|
|
|
local playername = placer:get_player_name()
|
|
|
|
if minetest.is_protected(place, playername)
|
2021-12-27 06:11:37 +01:00
|
|
|
or minetest.is_protected(above, playername) then
|
2021-06-07 19:04:31 +02:00
|
|
|
minetest.record_protection_violation(place, playername)
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
if minetest.get_node(base).name == "default:stone"
|
|
|
|
and minetest.get_node(place).name == "air"
|
|
|
|
and minetest.get_node(above).name == "air"
|
|
|
|
then
|
|
|
|
minetest.swap_node(place, {
|
|
|
|
name = "cavestuff:stalactite_"..math.random(1,3),
|
|
|
|
param2 = minetest.dir_to_wallmounted(vector.multiply(dir, -1))
|
|
|
|
})
|
2014-08-12 21:08:11 +02:00
|
|
|
if not minetest.setting_getbool("creative_mode") then
|
|
|
|
itemstack:take_item()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return itemstack
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_node("cavestuff:stalactite_2",{
|
|
|
|
drawtype="nodebox",
|
|
|
|
tiles = {"undergrowth_pebble.png"},
|
|
|
|
groups = {cracky=3,attached_node=1,not_in_creative_inventory=1},
|
|
|
|
drop = "cavestuff:stalactite_1",
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "wallmounted",
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
2021-06-07 19:04:31 +02:00
|
|
|
{-0.187500,-0.387500,-0.150003,0.162500,-0.500000,0.162500},
|
|
|
|
{-0.112500,-0.112500,-0.100000,0.087500,-0.475000,0.087500},
|
|
|
|
{-0.062500,0.675000,-0.062500,0.062500,-0.500000,0.062500},
|
|
|
|
{-0.037500,0.975000,0.037500,0.037500,-0.500000,-0.025000},
|
2014-08-12 21:08:11 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_node("cavestuff:stalactite_3",{
|
|
|
|
drawtype="nodebox",
|
|
|
|
tiles = {"undergrowth_pebble.png"},
|
|
|
|
groups = {cracky=3,attached_node=1,not_in_creative_inventory=1},
|
|
|
|
drop = "cavestuff:stalactite_1",
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "wallmounted",
|
|
|
|
node_box = {
|
2021-06-07 19:04:31 +02:00
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
|
|
|
{-0.187500,-0.387500,-0.150003,0.162500,-0.500000,0.162500},
|
|
|
|
{-0.112500,-0.037500,-0.100000,0.087500,-0.475000,0.087500},
|
|
|
|
{-0.062500,0.437500,-0.062500,0.062500,-0.500000,0.062500},
|
|
|
|
{-0.037500,1.237500,0.037500,0.037500,-0.500000,-0.025000},
|
|
|
|
}
|
|
|
|
},
|
2014-08-12 21:08:11 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
--Stalagmites
|