2 -- Blocks which spawn silverfish when destroyed.
5 local MP
= minetest
.get_modpath(minetest
.get_current_modname())
6 local S
, NS
= dofile(MP
.. "/intllib.lua")
8 local spawn_silverfish
= function(pos
, oldnode
, oldmetadata
, digger
)
9 if not minetest
.settings
:get_bool("creative_mode") then
10 minetest
.add_entity(pos
, "mobs_mc:silverfish")
14 -- Template function for registering monster egg blocks
15 local register_block
= function(subname
, description
, tiles
, is_ground_content
)
16 if is_ground_content
== nil then
17 is_ground_content
= false
19 minetest
.register_node("mcl_monster_eggs:monster_egg_"..subname
, {
20 description
= description
,
22 is_ground_content
= is_ground_content
,
23 groups
= {dig_immediate
= 3, spawns_silverfish
= 1, deco_block
= 1},
25 is_ground_content
= false,
26 sounds
= mcl_sounds
.node_sound_stone_defaults(),
27 after_dig_node
= spawn_silverfish
,
28 _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."),
30 _mcl_blast_resistance
= 3.75,
34 -- Register all the monster egg blocks
35 register_block("stone", S("Infested Stone"), {"default_stone.png"}, true)
36 register_block("cobble", S("Infested Cobblestone"), {"default_cobble.png"})
37 register_block("stonebrick", S("Infested Stone Bricks"), {"default_stone_brick.png"})
38 register_block("stonebrickcracked", S("Infested Cracked Stone Bricks"), {"mcl_core_stonebrick_cracked.png"})
39 register_block("stonebrickmossy", S("Infested Mossy Stone Bricks"), {"mcl_core_stonebrick_mossy.png"})
40 register_block("stonebrickcarved", S("Infested Chiseled Stone Bricks"), {"mcl_core_stonebrick_carved.png"})