mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-25 20:11:06 +01:00
Add monster egg blocks
This commit is contained in:
parent
aa36edb0db
commit
598a2977b5
5 changed files with 115 additions and 5 deletions
|
@ -155,12 +155,13 @@ mobs_mc.replace = {
|
||||||
{ "mcl_flowers:tallgrass", "air", 0 },
|
{ "mcl_flowers:tallgrass", "air", 0 },
|
||||||
},
|
},
|
||||||
-- Silverfish populate stone, etc. with monster eggs
|
-- Silverfish populate stone, etc. with monster eggs
|
||||||
-- TODO: add nodes
|
|
||||||
silverfish = {
|
silverfish = {
|
||||||
{"mcl_core:stone", "mobs_mc:monster_egg_stone", -1},
|
{"mcl_core:stone", "mcl_monster_eggs:monster_egg_stone", -1},
|
||||||
{"mcl_core:cobble", "mobs_mc:monster_egg_cobble", -1},
|
{"mcl_core:cobble", "mcl_monster_eggs:monster_egg_cobble", -1},
|
||||||
{"mcl_core:stonebrick", "mobs_mc:monster_egg_stonebrick", -1},
|
{"mcl_core:stonebrick", "mcl_monster_eggs:monster_egg_stonebrick", -1},
|
||||||
{"mcl_core:mossystonebrick", "mobs_mc:monster_egg_mossystonebrick", -1},
|
{"mcl_core:stonebrickmossy", "mcl_monster_eggs:monster_egg_stonebrickmossy", -1},
|
||||||
|
{"mcl_core:stonebrickcracked", "mcl_monster_eggs:monster_egg_stonebrickcracked", -1},
|
||||||
|
{"mcl_core:stonebrickcarved", "mcl_monster_eggs:monster_egg_stonebrickcarved", -1},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
3
mods/ITEMS/mcl_monster_eggs/depends.txt
Normal file
3
mods/ITEMS/mcl_monster_eggs/depends.txt
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
mcl_sounds
|
||||||
|
mobs_mc
|
||||||
|
intllib?
|
41
mods/ITEMS/mcl_monster_eggs/init.lua
Normal file
41
mods/ITEMS/mcl_monster_eggs/init.lua
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
-- Monster eggs!
|
||||||
|
-- Blocks which spawn silverfish when destroyed.
|
||||||
|
|
||||||
|
-- Intllib
|
||||||
|
local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||||
|
local S, NS = dofile(MP .. "/intllib.lua")
|
||||||
|
|
||||||
|
local spawn_silverfish = function(pos, oldnode, oldmetadata, digger)
|
||||||
|
if not minetest.setting_getbool("creative_mode") then
|
||||||
|
minetest.add_entity(pos, "mobs_mc: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:monter_egg_"..subname, {
|
||||||
|
description = description,
|
||||||
|
tiles = tiles,
|
||||||
|
is_ground_content = is_ground_content,
|
||||||
|
groups = {handy = 1, spawns_silverfish = 1, deco_block = 1},
|
||||||
|
drop = '',
|
||||||
|
is_ground_content = false,
|
||||||
|
sounds = mcl_sounds.node_sound_stone_defaults(),
|
||||||
|
after_dig_node = spawn_silverfish,
|
||||||
|
_mcl_hardness = 0.75,
|
||||||
|
_mcl_blast_resistance = 3.75,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Register all the monster egg blocks
|
||||||
|
register_block("stone", S("Stone Monster Egg"), {"default_stone.png"}, true)
|
||||||
|
register_block("cobble", S("Cobblestone Monster Egg"), {"default_cobble.png"})
|
||||||
|
register_block("stonebrick", S("Stone Bricks Monster Egg"), {"default_stone_brick.png"})
|
||||||
|
register_block("stonebrickcracked", S("Cracked Stone Bricks Monster Egg"), {"mcl_core_stonebrick_cracked.png"})
|
||||||
|
register_block("stonebrickmossy", S("Mossy Stone Bricks Monster Egg"), {"mcl_core_stonebrick_mossy.png"})
|
||||||
|
register_block("stonebrickcarved", S("Chiseled Stone Bricks Monster Egg"), {"mcl_core_stonebrick_carved.png"})
|
||||||
|
|
||||||
|
|
45
mods/ITEMS/mcl_monster_eggs/intllib.lua
Normal file
45
mods/ITEMS/mcl_monster_eggs/intllib.lua
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
|
||||||
|
-- Fallback functions for when `intllib` is not installed.
|
||||||
|
-- Code released under Unlicense <http://unlicense.org>.
|
||||||
|
|
||||||
|
-- Get the latest version of this file at:
|
||||||
|
-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
|
||||||
|
|
||||||
|
local function format(str, ...)
|
||||||
|
local args = { ... }
|
||||||
|
local function repl(escape, open, num, close)
|
||||||
|
if escape == "" then
|
||||||
|
local replacement = tostring(args[tonumber(num)])
|
||||||
|
if open == "" then
|
||||||
|
replacement = replacement..close
|
||||||
|
end
|
||||||
|
return replacement
|
||||||
|
else
|
||||||
|
return "@"..open..num..close
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
|
||||||
|
end
|
||||||
|
|
||||||
|
local gettext, ngettext
|
||||||
|
if minetest.get_modpath("intllib") then
|
||||||
|
if intllib.make_gettext_pair then
|
||||||
|
-- New method using gettext.
|
||||||
|
gettext, ngettext = intllib.make_gettext_pair()
|
||||||
|
else
|
||||||
|
-- Old method using text files.
|
||||||
|
gettext = intllib.Getter()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Fill in missing functions.
|
||||||
|
|
||||||
|
gettext = gettext or function(msgid, ...)
|
||||||
|
return format(msgid, ...)
|
||||||
|
end
|
||||||
|
|
||||||
|
ngettext = ngettext or function(msgid, msgid_plural, n, ...)
|
||||||
|
return format(n==1 and msgid or msgid_plural, ...)
|
||||||
|
end
|
||||||
|
|
||||||
|
return gettext, ngettext
|
|
@ -580,6 +580,26 @@ minetest.register_ore({
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Rarely replace stone with stone monster eggs
|
||||||
|
local scarcity
|
||||||
|
if mg_name == "v6" then
|
||||||
|
monster_egg_scarcity = 28 * 28 * 28
|
||||||
|
else
|
||||||
|
monster_egg_scarcity = 22 * 22 * 22
|
||||||
|
end
|
||||||
|
minetest.register_ore({
|
||||||
|
ore_type = "scatter",
|
||||||
|
ore = "mcl_monster_eggs:monster_egg_stone",
|
||||||
|
wherein = "mcl_core:stone",
|
||||||
|
clust_scarcity = monster_egg_scarcity,
|
||||||
|
clust_num_ores = 3,
|
||||||
|
clust_size = 2,
|
||||||
|
y_min = -31000,
|
||||||
|
y_max = 31000,
|
||||||
|
-- TODO: Limit by biome
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
local function register_mgv6_decorations()
|
local function register_mgv6_decorations()
|
||||||
|
|
||||||
-- Sugar canes
|
-- Sugar canes
|
||||||
|
|
Loading…
Reference in a new issue