2017-07-06 00:48:48 +03:00
|
|
|
-- Monster eggs!
|
|
|
|
-- Blocks which spawn silverfish when destroyed.
|
|
|
|
|
2021-05-29 17:12:33 +03:00
|
|
|
local S = minetest.get_translator(minetest.get_current_modname())
|
2017-07-06 00:48:48 +03:00
|
|
|
|
2021-05-29 17:12:33 +03:00
|
|
|
local function spawn_silverfish(pos, oldnode, oldmetadata, digger)
|
2020-07-10 17:08:40 +03:00
|
|
|
if not minetest.is_creative_enabled("") then
|
2017-07-06 00:48:48 +03:00
|
|
|
minetest.add_entity(pos, "mobs_mc:silverfish")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Template function for registering monster egg blocks
|
2021-05-29 17:12:33 +03:00
|
|
|
local function register_block(subname, description, tiles, is_ground_content)
|
2017-07-06 00:48:48 +03:00
|
|
|
if is_ground_content == nil then
|
|
|
|
is_ground_content = false
|
|
|
|
end
|
2017-07-06 01:00:26 +03:00
|
|
|
minetest.register_node("mcl_monster_eggs:monster_egg_"..subname, {
|
2017-07-06 00:48:48 +03:00
|
|
|
description = description,
|
|
|
|
tiles = tiles,
|
|
|
|
is_ground_content = is_ground_content,
|
2017-12-11 03:43:01 +03:00
|
|
|
groups = {dig_immediate = 3, spawns_silverfish = 1, deco_block = 1},
|
2021-05-29 17:12:33 +03:00
|
|
|
drop = "",
|
2017-07-06 00:48:48 +03:00
|
|
|
sounds = mcl_sounds.node_sound_stone_defaults(),
|
|
|
|
after_dig_node = spawn_silverfish,
|
2020-02-19 06:54:17 +03:00
|
|
|
_tt_help = S("Hides a silverfish"),
|
2021-04-16 00:41:34 +03:00
|
|
|
_doc_items_longdesc = S([[
|
|
|
|
An infested block is a block from which a silverfish will pop out when it is broken.
|
|
|
|
It looks identical to its normal counterpart.
|
|
|
|
]]),
|
2017-12-11 03:43:01 +03:00
|
|
|
_mcl_hardness = 0,
|
2020-04-17 22:40:13 +03:00
|
|
|
_mcl_blast_resistance = 0.5,
|
2017-07-06 00:48:48 +03:00
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Register all the monster egg blocks
|
2017-12-11 03:28:53 +03:00
|
|
|
register_block("stone", S("Infested Stone"), {"default_stone.png"}, true)
|
|
|
|
register_block("cobble", S("Infested Cobblestone"), {"default_cobble.png"})
|
|
|
|
register_block("stonebrick", S("Infested Stone Bricks"), {"default_stone_brick.png"})
|
|
|
|
register_block("stonebrickcracked", S("Infested Cracked Stone Bricks"), {"mcl_core_stonebrick_cracked.png"})
|
|
|
|
register_block("stonebrickmossy", S("Infested Mossy Stone Bricks"), {"mcl_core_stonebrick_mossy.png"})
|
|
|
|
register_block("stonebrickcarved", S("Infested Chiseled Stone Bricks"), {"mcl_core_stonebrick_carved.png"})
|
2017-07-06 00:48:48 +03:00
|
|
|
|
|
|
|
|