VoxeLibre/mods/ITEMS/mcl_monster_eggs/init.lua
Elias Fleckenstein 0b27b6bec3 Mob API: Merge mobs_mc and mcl_mobs into one mod
DO NOT USE IN PRODUCTION, DO NOT START OLD WORLDS WITHOUT A BACKUP
These are the first steps of the new mob API. The game does actually start, but mobs do not work yet.
You will also get some warnings about mob spawners, but don't worry about that.
This is really just some 'first impression' of how the mob API is gonna look like. Some things are already complete, like the agression system.
AI and attacking have not been worked on yet.
mobs_mc and mcl_mobs have actually been merged into one piece but I will probably change that again in the future actually, and split the different mobs into different mods.
There are also a few usefull things like the universal mount API and a more general purpose smoke API, but all of this is still far from complete.
I'll put some work into the API this week but probably not next week, then I'll see but don't expect this to be done before 2022.
I'll work on it, but I'll do it slowly and progressively to not get burned out again and to still have enough time to graduate from school in the meantime.
2021-09-01 23:27:47 +02:00

43 lines
1.7 KiB
Lua

-- Monster eggs!
-- Blocks which spawn silverfish when destroyed.
local S = minetest.get_translator("mcl_monster_eggs")
local spawn_silverfish = function(pos, oldnode, oldmetadata, digger)
if not minetest.is_creative_enabled("") then
minetest.add_entity(pos, "mcl_mobs:silverfish")
end
end
-- Template function for registering monster egg blocks
local register_block = function(subname, description, tiles, is_ground_content)
if is_ground_content == nil then
is_ground_content = false
end
minetest.register_node("mcl_monster_eggs:monster_egg_"..subname, {
description = description,
tiles = tiles,
is_ground_content = is_ground_content,
groups = {dig_immediate = 3, spawns_silverfish = 1, deco_block = 1},
drop = '',
sounds = mcl_sounds.node_sound_stone_defaults(),
after_dig_node = spawn_silverfish,
_tt_help = S("Hides a silverfish"),
_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.
]]),
_mcl_hardness = 0,
_mcl_blast_resistance = 0.5,
})
end
-- Register all the monster egg blocks
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"})