Merge branch 'master' into doc-refactoring

This commit is contained in:
AFCMS 2021-03-30 22:28:48 +02:00
commit 0740854b5d
82 changed files with 458 additions and 373 deletions

View file

@ -175,3 +175,86 @@ minetest.craftitemdef_default.stack_max = 64
-- Set random seed for all other mods (Remember to make sure no other mod calls this function) -- Set random seed for all other mods (Remember to make sure no other mod calls this function)
math.randomseed(os.time()) math.randomseed(os.time())
local chunks = {} -- intervals of chunks generated
function mcl_vars.add_chunk(pos)
local n = mcl_vars.get_chunk_number(pos) -- unsigned int
local prev
for i, d in pairs(chunks) do
if n <= d[2] then -- we've found it
if (n == d[2]) or (n >= d[1]) then return end -- already here
if n == d[1]-1 then -- right before:
if prev and (prev[2] == n-1) then
prev[2] = d[2]
table.remove(chunks, i)
return
end
d[1] = n
return
end
if prev and (prev[2] == n-1) then --join to previous
prev[2] = n
return
end
table.insert(chunks, i, {n, n}) -- insert new interval before i
return
end
prev = d
end
chunks[#chunks+1] = {n, n}
end
function mcl_vars.is_generated(pos)
local n = mcl_vars.get_chunk_number(pos) -- unsigned int
for i, d in pairs(chunks) do
if n <= d[2] then
return (n >= d[1])
end
end
return false
end
-- "Trivial" (actually NOT) function to just read the node and some stuff to not just return "ignore", like mt 5.4 does.
-- p: Position, if it's wrong, {name="error"} node will return.
-- force: optional (default: false) - Do the maximum to still read the node within us_timeout.
-- us_timeout: optional (default: 244 = 0.000244 s = 1/80/80/80), set it at least to 3000000 to let mapgen to finish its job.
--
-- returns node definition, eg. {name="air"}. Unfortunately still can return {name="ignore"}.
function mcl_vars.get_node(p, force, us_timeout)
-- check initial circumstances
if not p or not p.x or not p.y or not p.z then return {name="error"} end
-- try common way
local node = minetest.get_node(p)
if node.name ~= "ignore" then
return node
end
-- copy table to get sure it won't changed by other threads
local pos = {x=p.x,y=p.y,z=p.z}
-- try LVM
minetest.get_voxel_manip():read_from_map(pos, pos)
node = minetest.get_node(pos)
if node.name ~= "ignore" or not force then
return node
end
-- all ways failed - need to emerge (or forceload if generated)
local us_timeout = us_timeout or 244
if mcl_vars.is_generated(pos) then
minetest.chat_send_all("IMPOSSIBLE! Please report this to MCL2 issue tracker!")
minetest.forceload_block(pos)
else
minetest.emerge_area(pos, pos)
end
local t = minetest.get_us_time()
node = minetest.get_node(pos)
while (not node or node.name == "ignore") and (minetest.get_us_time() - t < us_timeout) do
node = minetest.get_node(pos)
end
return node
-- it still can return "ignore", LOL, even if force = true, but only after time out
end

View file

@ -1,6 +1,6 @@
local S = minetest.get_translator("mcl_boats") local S = minetest.get_translator("mcl_boats")
local boat_visual_size = {x = 3, y = 3, z = 3} local boat_visual_size = {x = 1, y = 1, z = 1}
local paddling_speed = 22 local paddling_speed = 22
local boat_y_offset = 0.35 local boat_y_offset = 0.35
local boat_y_offset_ground = boat_y_offset + 0.6 local boat_y_offset_ground = boat_y_offset + 0.6
@ -12,9 +12,7 @@ local function is_group(pos, group)
return minetest.get_item_group(nn, group) ~= 0 return minetest.get_item_group(nn, group) ~= 0
end end
local function is_water(pos) local is_water = flowlib.is_water
return is_group(pos, "water")
end
local function is_ice(pos) local function is_ice(pos)
return is_group(pos, "ice") return is_group(pos, "ice")

View file

@ -1,7 +1,7 @@
name = mcl_boats name = mcl_boats
author = PilzAdam author = PilzAdam
description = Adds drivable boats. description = Adds drivable boats.
depends = mcl_player depends = mcl_player, flowlib
optional_depends = mcl_core, doc_identifier optional_depends = mcl_core, doc_identifier

View file

@ -2,7 +2,7 @@ local S = minetest.get_translator("mcl_falling_nodes")
local dmes = minetest.get_modpath("mcl_death_messages") ~= nil local dmes = minetest.get_modpath("mcl_death_messages") ~= nil
local has_mcl_armor = minetest.get_modpath("mcl_armor") local has_mcl_armor = minetest.get_modpath("mcl_armor")
local his_creative_enabled = minetest.is_creative_enabled local is_creative_enabled = minetest.is_creative_enabled
local get_falling_depth = function(self) local get_falling_depth = function(self)
if not self._startpos then if not self._startpos then
@ -53,7 +53,7 @@ local deal_falling_damage = function(self, dtime)
local helmet = inv:get_stack("armor", 2) local helmet = inv:get_stack("armor", 2)
if has_mcl_armor and not helmet:is_empty() then if has_mcl_armor and not helmet:is_empty() then
hp = hp/4*3 hp = hp/4*3
if not his_creative_enabled(name) then if not is_creative_enabled(name) then
helmet:add_wear(65535/helmet:get_definition().groups.mcl_armor_uses) --TODO: be sure damage is exactly like mc (informations are missing in the mc wiki) helmet:add_wear(65535/helmet:get_definition().groups.mcl_armor_uses) --TODO: be sure damage is exactly like mc (informations are missing in the mc wiki)
inv:set_stack("armor", 2, helmet) inv:set_stack("armor", 2, helmet)
end end

View file

@ -1,3 +1,7 @@
local has_awards = minetest.get_modpath("awards")
mcl_item_entity = {}
--basic settings --basic settings
local item_drop_settings = {} --settings table local item_drop_settings = {} --settings table
item_drop_settings.age = 1.0 --how old a dropped item (_insta_collect==false) has to be before collecting item_drop_settings.age = 1.0 --how old a dropped item (_insta_collect==false) has to be before collecting
@ -16,16 +20,33 @@ local get_gravity = function()
return tonumber(minetest.settings:get("movement_gravity")) or 9.81 return tonumber(minetest.settings:get("movement_gravity")) or 9.81
end end
local registered_pickup_achievement = {}
--TODO: remove limitation of 1 award per itemname
function mcl_item_entity.register_pickup_achievement(itemname, award)
if not has_awards then
minetest.log("warning", "[mcl_item_entity] Trying to register pickup achievement ["..award.."] for ["..itemname.."] while awards missing")
elseif registered_pickup_achievement[itemname] then
minetest.log("error", "[mcl_item_entity] Trying to register already existing pickup achievement ["..award.."] for ["..itemname.."]")
else
registered_pickup_achievement[itemname] = award
end
end
mcl_item_entity.register_pickup_achievement("tree", "mcl:mineWood")
mcl_item_entity.register_pickup_achievement("mcl_mobitems:blaze_rod", "mcl:blazeRod")
mcl_item_entity.register_pickup_achievement("mcl_mobitems:leather", "mcl:killCow")
mcl_item_entity.register_pickup_achievement("mcl_core:diamond", "mcl:diamonds")
local check_pickup_achievements = function(object, player) local check_pickup_achievements = function(object, player)
local itemname = ItemStack(object:get_luaentity().itemstring):get_name() if has_awards then
if minetest.get_item_group(itemname, "tree") ~= 0 then local itemname = ItemStack(object:get_luaentity().itemstring):get_name()
awards.unlock(player:get_player_name(), "mcl:mineWood") local playername = player:get_player_name()
elseif itemname == "mcl_mobitems:blaze_rod" then for name,award in pairs(registered_pickup_achievement) do
awards.unlock(player:get_player_name(), "mcl:blazeRod") if itemname == name or minetest.get_item_group(itemname, name) ~= 0 then
elseif itemname == "mcl_mobitems:leather" then awards.unlock(playername, award)
awards.unlock(player:get_player_name(), "mcl:killCow") end
elseif itemname == "mcl_core:diamond" then end
awards.unlock(player:get_player_name(), "mcl:diamonds")
end end
end end

View file

@ -1,5 +1,7 @@
local S = minetest.get_translator("mcl_minecarts") local S = minetest.get_translator("mcl_minecarts")
local has_mcl_wip = minetest.get_modpath("mcl_wip")
mcl_minecarts = {} mcl_minecarts = {}
mcl_minecarts.modpath = minetest.get_modpath("mcl_minecarts") mcl_minecarts.modpath = minetest.get_modpath("mcl_minecarts")
mcl_minecarts.speed_max = 10 mcl_minecarts.speed_max = 10
@ -662,8 +664,6 @@ register_minecart(
"mcl_minecarts_minecart_chest.png", "mcl_minecarts_minecart_chest.png",
{"mcl_minecarts:minecart", "mcl_chests:chest"}, {"mcl_minecarts:minecart", "mcl_chests:chest"},
nil, nil, false) nil, nil, false)
mcl_wip.register_wip_item("mcl_minecarts:chest_minecart")
-- Minecart with Furnace -- Minecart with Furnace
register_minecart( register_minecart(
@ -719,8 +719,6 @@ register_minecart(
end, nil, false end, nil, false
) )
mcl_wip.register_wip_item("mcl_minecarts:furnace_minecart")
-- Minecart with Command Block -- Minecart with Command Block
register_minecart( register_minecart(
"mcl_minecarts:command_block_minecart", "mcl_minecarts:command_block_minecart",
@ -742,8 +740,6 @@ register_minecart(
nil, nil, false nil, nil, false
) )
mcl_wip.register_wip_item("mcl_minecarts:command_block_minecart")
-- Minecart with Hopper -- Minecart with Hopper
register_minecart( register_minecart(
"mcl_minecarts:hopper_minecart", "mcl_minecarts:hopper_minecart",
@ -762,8 +758,6 @@ register_minecart(
nil, nil, false nil, nil, false
) )
mcl_wip.register_wip_item("mcl_minecarts:hopper_minecart")
-- Minecart with TNT -- Minecart with TNT
register_minecart( register_minecart(
"mcl_minecarts:tnt_minecart", "mcl_minecarts:tnt_minecart",
@ -824,29 +818,34 @@ minetest.register_craft({
-- TODO: Re-enable crafting of special minecarts when they have been implemented -- TODO: Re-enable crafting of special minecarts when they have been implemented
if false then if false then
minetest.register_craft({
output = "mcl_minecarts:furnace_minecart",
recipe = {
{"mcl_furnaces:furnace"},
{"mcl_minecarts:minecart"},
},
})
minetest.register_craft({ minetest.register_craft({
output = "mcl_minecarts:furnace_minecart", output = "mcl_minecarts:hopper_minecart",
recipe = { recipe = {
{"mcl_furnaces:furnace"}, {"mcl_hoppers:hopper"},
{"mcl_minecarts:minecart"}, {"mcl_minecarts:minecart"},
}, },
}) })
minetest.register_craft({
output = "mcl_minecarts:hopper_minecart",
recipe = {
{"mcl_hoppers:hopper"},
{"mcl_minecarts:minecart"},
},
})
minetest.register_craft({
output = "mcl_minecarts:chest_minecart",
recipe = {
{"mcl_chests:chest"},
{"mcl_minecarts:minecart"},
},
})
minetest.register_craft({
output = "mcl_minecarts:chest_minecart",
recipe = {
{"mcl_chests:chest"},
{"mcl_minecarts:minecart"},
},
})
end end
if has_mcl_wip then
mcl_wip.register_wip_item("mcl_minecarts:chest_minecart")
mcl_wip.register_wip_item("mcl_minecarts:furnace_minecart")
mcl_wip.register_wip_item("mcl_minecarts:command_block_minecart")
mcl_wip.register_wip_item("mcl_minecarts:hopper_minecart")
end

View file

@ -1,6 +1,6 @@
name = mcl_minecarts name = mcl_minecarts
author = Krock author = Krock
description = Minecarts are vehicles to move players quickly on rails. description = Minecarts are vehicles to move players quickly on rails.
depends = mcl_explosions, mcl_core, mcl_sounds, mcl_player, mcl_achievements, mcl_chests, mcl_furnaces, mesecons_commandblock, mcl_hoppers, mcl_tnt, mesecons, mcl_wip depends = mcl_explosions, mcl_core, mcl_sounds, mcl_player, mcl_achievements, mcl_chests, mcl_furnaces, mesecons_commandblock, mcl_hoppers, mcl_tnt, mesecons
optional_depends = doc_identifier optional_depends = doc_identifier, mcl_wip

View file

@ -521,7 +521,7 @@ if c("totem") then
-- Totem of Undying -- Totem of Undying
minetest.register_craftitem("mobs_mc:totem", { minetest.register_craftitem("mobs_mc:totem", {
description = S("Totem of Undying"), description = S("Totem of Undying"),
_tt_help = minetest.colorize("#00FF00", S("Protects you from death while wielding it")), _tt_help = minetest.colorize(mcl_colors.GREEN, S("Protects you from death while wielding it")),
_doc_items_longdesc = S("A totem of undying is a rare artifact which may safe you from certain death."), _doc_items_longdesc = S("A totem of undying is a rare artifact which may safe you from certain death."),
_doc_items_usagehelp = S("The totem only works while you hold it in your hand. If you receive fatal damage, you are saved from death and you get a second chance with 1 HP. The totem is destroyed in the process, however."), _doc_items_usagehelp = S("The totem only works while you hold it in your hand. If you receive fatal damage, you are saved from death and you get a second chance with 1 HP. The totem is destroyed in the process, however."),
inventory_image = "mcl_totems_totem.png", inventory_image = "mcl_totems_totem.png",

View file

@ -1,6 +1,6 @@
name = mobs_mc name = mobs_mc
author = maikerumine author = maikerumine
description = Adds Minecraft-like monsters and animals. description = Adds Minecraft-like monsters and animals.
depends = mcl_init, mcl_particles, mcl_mobs, mcl_wip depends = mcl_init, mcl_particles, mcl_mobs, mcl_wip, mcl_colors
optional_depends = default, mcl_tnt, mcl_bows, mcl_throwing, mcl_fishing, bones, mesecons_materials, mobs_mc_gameconfig, doc_items optional_depends = default, mcl_tnt, mcl_bows, mcl_throwing, mcl_fishing, bones, mesecons_materials, mobs_mc_gameconfig, doc_items

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -516,7 +516,7 @@ local function show_trade_formspec(playername, trader, tradenum)
"size[9,8.75]" "size[9,8.75]"
.."background[-0.19,-0.25;9.41,9.49;mobs_mc_trading_formspec_bg.png]" .."background[-0.19,-0.25;9.41,9.49;mobs_mc_trading_formspec_bg.png]"
..disabled_img ..disabled_img
.."label[4,0;"..F(minetest.colorize("#313131", S(profession))).."]" .."label[4,0;"..F(minetest.colorize(mcl_colors.DARK_GRAY, S(profession))).."]"
.."list[current_player;main;0,4.5;9,3;9]" .."list[current_player;main;0,4.5;9,3;9]"
.."list[current_player;main;0,7.74;9,1;]" .."list[current_player;main;0,7.74;9,1;]"
..b_prev..b_next ..b_prev..b_next

View file

@ -16,7 +16,7 @@ mobs:register_mob("mobs_mc:wither", {
hp_min = 300, hp_min = 300,
xp_min = 50, xp_min = 50,
xp_max = 50, xp_max = 50,
armor = {undead = 80, fleshy = 80}, armor = {undead = 80, fleshy = 100},
-- This deviates from MC Wiki's size, which makes no sense -- This deviates from MC Wiki's size, which makes no sense
collisionbox = {-0.9, 0.4, -0.9, 0.9, 2.45, 0.9}, collisionbox = {-0.9, 0.4, -0.9, 0.9, 2.45, 0.9},
visual = "mesh", visual = "mesh",
@ -66,6 +66,14 @@ mobs:register_mob("mobs_mc:wither", {
run_start = 0, run_end = 20, run_start = 0, run_end = 20,
}, },
harmed_by_heal = true, harmed_by_heal = true,
do_custom = function(self)
if self.health < (self.hp_max / 2) then
self.base_texture = "mobs_mc_wither_half_health.png"
self.fly = false
self.object:set_properties({textures={self.base_texture}})
self.armor = {undead = 80, fleshy = 80}
end
end,
on_spawn = function(self) on_spawn = function(self)
minetest.sound_play("mobs_mc_wither_spawn", {object=self.object, gain=1.0, max_hear_distance=64}) minetest.sound_play("mobs_mc_wither_spawn", {object=self.object, gain=1.0, max_hear_distance=64})
end, end,

View file

@ -1,13 +1,7 @@
local S = minetest.get_translator("doc") local S = minetest.get_translator("doc")
local F = function(f) return minetest.formspec_escape(S(f)) end local F = function(f) return minetest.formspec_escape(S(f)) end
-- Compability for 0.4.14 or earlier local colorize = minetest.colorize
local colorize
if minetest.colorize then
colorize = minetest.colorize
else
colorize = function(color, text) return text end
end
doc = {} doc = {}
@ -41,10 +35,10 @@ doc.FORMSPEC.ENTRY_HEIGHT = doc.FORMSPEC.ENTRY_END_Y - doc.FORMSPEC.ENTRY_START_
-- Internal helper variables -- Internal helper variables
local DOC_INTRO = S("This is the help.") local DOC_INTRO = S("This is the help.")
local COLOR_NOT_VIEWED = "#00FFFF" -- cyan local COLOR_NOT_VIEWED = mcl_colors.AQUA
local COLOR_VIEWED = "#FFFFFF" -- white local COLOR_VIEWED = mcl_colors.WHITE
local COLOR_HIDDEN = "#999999" -- gray local COLOR_HIDDEN = mcl_colors.GRAY
local COLOR_ERROR = "#FF0000" -- red local COLOR_ERROR = mcl_colors.RED
local CATEGORYFIELDSIZE = { local CATEGORYFIELDSIZE = {
WIDTH = math.ceil(doc.FORMSPEC.WIDTH / 4), WIDTH = math.ceil(doc.FORMSPEC.WIDTH / 4),
@ -776,7 +770,7 @@ function doc.generate_entry_list(cid, playername)
if name == nil or name == "" then if name == nil or name == "" then
name = S("Nameless entry (@1)", eid) name = S("Nameless entry (@1)", eid)
if doc.entry_viewed(playername, cid, eid) then if doc.entry_viewed(playername, cid, eid) then
viewedprefix = "#FF4444" viewedprefix = mcl_colors.RED
else else
viewedprefix = COLOR_ERROR viewedprefix = COLOR_ERROR
end end

View file

@ -2,3 +2,4 @@ name = doc
author = Wuzzy author = Wuzzy
description = A simple in-game documentation system which enables mods to add help entries based on templates. description = A simple in-game documentation system which enables mods to add help entries based on templates.
optional_depends = unified_inventory, sfinv_buttons, central_message, inventory_plus optional_depends = unified_inventory, sfinv_buttons, central_message, inventory_plus
depends = mcl_colors

View file

@ -410,7 +410,7 @@ local function get_tooltip(item, groups, cooktime, burntime)
local tooltip local tooltip
if groups then if groups then
local gcol = "#FFAAFF" local gcol = mcl_colors.LIGHT_PURPLE
if #groups == 1 then if #groups == 1 then
local g = group_names[groups[1]] local g = group_names[groups[1]]
local groupstr local groupstr
@ -446,12 +446,12 @@ local function get_tooltip(item, groups, cooktime, burntime)
if not groups and cooktime then if not groups and cooktime then
tooltip = tooltip .. "\n" .. tooltip = tooltip .. "\n" ..
S("Cooking time: @1", colorize("yellow", cooktime)) S("Cooking time: @1", colorize(mcl_colors.YELLOW, cooktime))
end end
if not groups and burntime then if not groups and burntime then
tooltip = tooltip .. "\n" .. tooltip = tooltip .. "\n" ..
S("Burning time: @1", colorize("yellow", burntime)) S("Burning time: @1", colorize(mcl_colors.YELLOW, burntime))
end end
return fmt(FMT.tooltip, item, ESC(tooltip)) return fmt(FMT.tooltip, item, ESC(tooltip))
@ -668,7 +668,7 @@ local function make_formspec(name)
fs[#fs + 1] = fmt("label[%f,%f;%s]", fs[#fs + 1] = fmt("label[%f,%f;%s]",
sfinv_only and 6.3 or data.iX - 2.2, sfinv_only and 6.3 or data.iX - 2.2,
0.22, 0.22,
ESC(colorize("#383838", fmt("%s / %u", data.pagenum, data.pagemax)))) ESC(colorize(mcl_colors.DARK_GRAY, fmt("%s / %u", data.pagenum, data.pagemax))))
fs[#fs + 1] = fmt([[ fs[#fs + 1] = fmt([[
image_button[%f,0.12;0.8,0.8;craftguide_prev_icon.png;prev;] image_button[%f,0.12;0.8,0.8;craftguide_prev_icon.png;prev;]

View file

@ -1,5 +1,5 @@
name = mcl_craftguide name = mcl_craftguide
author = kilbith author = kilbith
description = The most comprehensive Crafting Guide on Minetest. description = The most comprehensive Crafting Guide on Minetest.
depends = mcl_core, mcl_compass, mcl_clock, doc depends = mcl_core, mcl_compass, mcl_clock, doc, mcl_colors
optional_depends = sfinv, sfinv_buttons optional_depends = sfinv, sfinv_buttons

View file

@ -1,4 +1,4 @@
name = mcl_tt name = mcl_tt
author = Wuzzy author = Wuzzy
description = Add MCL2 tooltips description = Add MCL2 tooltips
depends = tt, mcl_enchanting depends = tt, mcl_enchanting, mcl_colors

View file

@ -77,7 +77,7 @@ end)
tt.register_snippet(function(itemstring) tt.register_snippet(function(itemstring)
local def = minetest.registered_items[itemstring] local def = minetest.registered_items[itemstring]
if minetest.get_item_group(itemstring, "crush_after_fall") == 1 then if minetest.get_item_group(itemstring, "crush_after_fall") == 1 then
return S("Deals damage when falling"), "#FFFF00" return S("Deals damage when falling"), mcl_colors.YELLOW
end end
end) end)

View file

@ -1,8 +1,8 @@
tt = {} tt = {}
tt.COLOR_DEFAULT = "#d0ffd0" tt.COLOR_DEFAULT = mcl_colors.GREEN
tt.COLOR_DANGER = "#ffff00" tt.COLOR_DANGER = mcl_colors.YELLOW
tt.COLOR_GOOD = "#00ff00" tt.COLOR_GOOD = mcl_colors.GREEN
tt.NAME_COLOR = "#FFFF4C" tt.NAME_COLOR = mcl_colors.YELLOW
-- API -- API
tt.registered_snippets = {} tt.registered_snippets = {}

View file

@ -1,3 +1,4 @@
name = tt name = tt
author = Wuzzy author = Wuzzy
description = Support for custom tooltip extensions for items description = Support for custom tooltip extensions for items
depends = mcl_colors

View file

@ -214,7 +214,7 @@ function awards.unlock(name, award)
-- Get award -- Get award
minetest.log("action", name.." has gotten award "..award) minetest.log("action", name.." has gotten award "..award)
minetest.chat_send_all(S("@1 has made the achievement @2", name, minetest.colorize("#51EF4E", "[" .. (awdef.title or award) .. "]"))) minetest.chat_send_all(S("@1 has made the achievement @2", name, minetest.colorize(mcl_colors.GREEN, "[" .. (awdef.title or award) .. "]")))
data.unlocked[award] = award data.unlocked[award] = award
awards.save() awards.save()
@ -447,7 +447,7 @@ function awards.getFormspec(name, to, sid)
first = false first = false
if def.secret and not award.got then if def.secret and not award.got then
formspec = formspec .. "#707070"..minetest.formspec_escape(S("(Secret Award)")) formspec = formspec .. mcl_colors.DARK_GRAY..minetest.formspec_escape(S("(Secret Award)"))
else else
local title = award.name local title = award.name
if def and def.title then if def and def.title then
@ -456,7 +456,7 @@ function awards.getFormspec(name, to, sid)
if award.got then if award.got then
formspec = formspec .. minetest.formspec_escape(title) formspec = formspec .. minetest.formspec_escape(title)
else else
formspec = formspec .. "#ACACAC".. minetest.formspec_escape(title) formspec = formspec .. mcl_colors.GRAY.. minetest.formspec_escape(title)
end end
end end
end end

View file

@ -6,3 +6,4 @@ license = LGPL 2.1 or later
forum = https://forum.minetest.net/viewtopic.php?t=4870 forum = https://forum.minetest.net/viewtopic.php?t=4870
version = 2.3.0 version = 2.3.0
optional_depends = sfinv, unified_inventory optional_depends = sfinv, unified_inventory
depends = mcl_colors

View file

@ -238,3 +238,20 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
awards.show_to(name, name, nil, false) awards.show_to(name, name, nil, false)
end end
end) end)
awards.register_achievement("mcl:stoneAge", {
title = S("Stone Age"),
description = S("Mine a stone with new pickaxe."),
icon = "default_cobble.png",
})
awards.register_achievement("mcl:hotStuff", {
title = S("Hot Stuff"),
description = S("Put lava in a bucket."),
icon = "bucket_lava.png",
})
awards.register_achievement("mcl:obsidian", {
title = S("Ice Bucket Challenge"),
description = S("Obtain an obsidian block."),
icon = "default_obsidian.png",
})

View file

@ -442,7 +442,7 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz
end end
local caption = "" local caption = ""
if name ~= "inv" and filtername[name] then if name ~= "inv" and filtername[name] then
caption = "label[0,1.2;"..F(minetest.colorize("#313131", filtername[name])).."]" caption = "label[0,1.2;"..F(minetest.colorize(mcl_colors.DARK_GRAY, filtername[name])).."]"
end end
formspec = "size[10,9.3]".. formspec = "size[10,9.3]"..

View file

@ -109,10 +109,10 @@ local function set_inventory(player, armor_change_only)
mcl_formspec.get_itemslot_bg(0,3,1,1).. mcl_formspec.get_itemslot_bg(0,3,1,1)..
armor_slot_imgs.. armor_slot_imgs..
-- craft and inventory -- craft and inventory
"label[0,4;"..F(minetest.colorize("#313131", S("Inventory"))).."]".. "label[0,4;"..F(minetest.colorize(mcl_colors.DARK_GRAY, S("Inventory"))).."]"..
"list[current_player;main;0,4.5;9,3;9]".. "list[current_player;main;0,4.5;9,3;9]"..
"list[current_player;main;0,7.74;9,1;]".. "list[current_player;main;0,7.74;9,1;]"..
"label[4,0.5;"..F(minetest.colorize("#313131", S("Crafting"))).."]".. "label[4,0.5;"..F(minetest.colorize(mcl_colors.DARK_GRAY, S("Crafting"))).."]"..
"list[current_player;craft;4,1;2,2]".. "list[current_player;craft;4,1;2,2]"..
"list[current_player;craftpreview;7,1.5;1,1;]".. "list[current_player;craftpreview;7,1.5;1,1;]"..
mcl_formspec.get_itemslot_bg(0,4.5,9,3).. mcl_formspec.get_itemslot_bg(0,4.5,9,3)..

View file

@ -1,6 +1,6 @@
name = mcl_inventory name = mcl_inventory
author = BlockMen author = BlockMen
description = Adds the player inventory and creative inventory. description = Adds the player inventory and creative inventory.
depends = mcl_init, mcl_formspec depends = mcl_init, mcl_formspec, mcl_colors
optional_depends = mcl_player, _mcl_autogroup, mcl_armor, mcl_brewing, mcl_potions, mcl_enchanting optional_depends = mcl_player, _mcl_autogroup, mcl_armor, mcl_brewing, mcl_potions, mcl_enchanting

View file

@ -13,12 +13,12 @@ local S = minetest.get_translator("mcl_dispensers")
local setup_dispenser = function(pos) local setup_dispenser = function(pos)
-- Set formspec and inventory -- Set formspec and inventory
local form = "size[9,8.75]".. local form = "size[9,8.75]"..
"label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]".. "label[0,4.0;"..minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Inventory"))).."]"..
"list[current_player;main;0,4.5;9,3;9]".. "list[current_player;main;0,4.5;9,3;9]"..
mcl_formspec.get_itemslot_bg(0,4.5,9,3).. mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
"list[current_player;main;0,7.74;9,1;]".. "list[current_player;main;0,7.74;9,1;]"..
mcl_formspec.get_itemslot_bg(0,7.74,9,1).. mcl_formspec.get_itemslot_bg(0,7.74,9,1)..
"label[3,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Dispenser"))).."]".. "label[3,0;"..minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Dispenser"))).."]"..
"list[current_name;main;3,0.5;3,3;]".. "list[current_name;main;3,0.5;3,3;]"..
mcl_formspec.get_itemslot_bg(3,0.5,3,3).. mcl_formspec.get_itemslot_bg(3,0.5,3,3)..
"listring[current_name;main]".. "listring[current_name;main]"..

View file

@ -1,3 +1,3 @@
name = mcl_dispensers name = mcl_dispensers
depends = mcl_init, mcl_formspec, mesecons, mcl_sounds, mcl_tnt, mcl_worlds, mcl_core, mcl_nether, mcl_armor_stand, mcl_armor depends = mcl_init, mcl_formspec, mesecons, mcl_sounds, mcl_tnt, mcl_worlds, mcl_core, mcl_nether, mcl_armor_stand, mcl_armor, mcl_colors
optional_depends = doc, screwdriver optional_depends = doc, screwdriver

View file

@ -14,12 +14,12 @@ local S = minetest.get_translator("mcl_droppers")
local setup_dropper = function(pos) local setup_dropper = function(pos)
-- Set formspec and inventory -- Set formspec and inventory
local form = "size[9,8.75]".. local form = "size[9,8.75]"..
"label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]".. "label[0,4.0;"..minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Inventory"))).."]"..
"list[current_player;main;0,4.5;9,3;9]".. "list[current_player;main;0,4.5;9,3;9]"..
mcl_formspec.get_itemslot_bg(0,4.5,9,3).. mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
"list[current_player;main;0,7.74;9,1;]".. "list[current_player;main;0,7.74;9,1;]"..
mcl_formspec.get_itemslot_bg(0,7.74,9,1).. mcl_formspec.get_itemslot_bg(0,7.74,9,1)..
"label[3,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Dropper"))).."]".. "label[3,0;"..minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Dropper"))).."]"..
"list[current_name;main;3,0.5;3,3;]".. "list[current_name;main;3,0.5;3,3;]"..
mcl_formspec.get_itemslot_bg(3,0.5,3,3).. mcl_formspec.get_itemslot_bg(3,0.5,3,3)..
"listring[current_name;main]".. "listring[current_name;main]"..

View file

@ -15,10 +15,10 @@ local setup_dropper = function(pos)
-- Set formspec and inventory -- Set formspec and inventory
local form = "size[9,8.75]".. local form = "size[9,8.75]"..
"background[-0.19,-0.25;9.41,9.49;crafting_inventory_9_slots.png]".. "background[-0.19,-0.25;9.41,9.49;crafting_inventory_9_slots.png]"..
"label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]".. "label[0,4.0;"..minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Inventory"))).."]"..
"list[current_player;main;0,4.5;9,3;9]".. "list[current_player;main;0,4.5;9,3;9]"..
"list[current_player;main;0,7.74;9,1;]".. "list[current_player;main;0,7.74;9,1;]"..
"label[3,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Dropper"))).."]".. "label[3,0;"..minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Dropper"))).."]"..
"list[current_name;main;3,0.5;3,3;]".. "list[current_name;main;3,0.5;3,3;]"..
"listring[current_name;main]".. "listring[current_name;main]"..
"listring[current_player;main]" "listring[current_player;main]"

View file

@ -1,3 +1,3 @@
name = mcl_droppers name = mcl_droppers
depends = mcl_init, mcl_formspec, mesecons, mcl_util depends = mcl_init, mcl_formspec, mesecons, mcl_util, mcl_colors
optional_depends = doc, screwdriver optional_depends = doc, screwdriver

View file

@ -16,7 +16,7 @@ local function get_anvil_formspec(set_name)
end end
return "size[9,8.75]".. return "size[9,8.75]"..
"background[-0.19,-0.25;9.41,9.49;mcl_anvils_inventory.png]".. "background[-0.19,-0.25;9.41,9.49;mcl_anvils_inventory.png]"..
"label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]".. "label[0,4.0;"..minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Inventory"))).."]"..
"list[current_player;main;0,4.5;9,3;9]".. "list[current_player;main;0,4.5;9,3;9]"..
mcl_formspec.get_itemslot_bg(0,4.5,9,3).. mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
"list[current_player;main;0,7.74;9,1;]".. "list[current_player;main;0,7.74;9,1;]"..
@ -27,7 +27,7 @@ local function get_anvil_formspec(set_name)
mcl_formspec.get_itemslot_bg(4,2.5,1,1).. mcl_formspec.get_itemslot_bg(4,2.5,1,1)..
"list[context;output;8,2.5;1,1;]".. "list[context;output;8,2.5;1,1;]"..
mcl_formspec.get_itemslot_bg(8,2.5,1,1).. mcl_formspec.get_itemslot_bg(8,2.5,1,1)..
"label[3,0.1;"..minetest.formspec_escape(minetest.colorize("#313131", S("Repair and Name"))).."]".. "label[3,0.1;"..minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Repair and Name"))).."]"..
"field[3.25,1;4,1;name;;"..minetest.formspec_escape(set_name).."]".. "field[3.25,1;4,1;name;;"..minetest.formspec_escape(set_name).."]"..
"field_close_on_enter[name;false]".. "field_close_on_enter[name;false]"..
"button[7,0.7;2,1;name_button;"..minetest.formspec_escape(S("Set Name")).."]".. "button[7,0.7;2,1;name_button;"..minetest.formspec_escape(S("Set Name")).."]"..

View file

@ -1,5 +1,5 @@
name = mcl_anvils name = mcl_anvils
author = Wuzzy author = Wuzzy
description = Anvils mods for MCL2 description = Anvils mods for MCL2
depends = mcl_init, mcl_formspec, mcl_sounds, tt, mcl_enchanting depends = mcl_init, mcl_formspec, mcl_sounds, tt, mcl_enchanting, mcl_colors
optional_depends = mcl_core, screwdriver optional_depends = mcl_core, screwdriver

View file

@ -367,6 +367,7 @@ mcl_player.player_register_model("mcl_armor_character.b3d", {
run_walk = {x=440, y=459}, run_walk = {x=440, y=459},
run_walk_mine = {x=461, y=480}, run_walk_mine = {x=461, y=480},
sit_mount = {x=484, y=484}, sit_mount = {x=484, y=484},
die = {x=498, y=498},
}, },
}) })

View file

@ -1,4 +1,5 @@
name = mcl_banners name = mcl_banners
author = 22i author = 22i
description = Adds decorative banners in different colors which can be emblazoned with patterns, offering a countless number of combinations. description = Adds decorative banners in different colors which can be emblazoned with patterns, offering a countless number of combinations.
depends = mcl_colors
optional_depends = mcl_sounds, mcl_core, mcl_wool, mcl_cauldrons, doc, screwdriver optional_depends = mcl_sounds, mcl_core, mcl_wool, mcl_cauldrons, doc, screwdriver

View file

@ -281,7 +281,7 @@ mcl_banners.make_advanced_banner_description = function(description, layers)
-- Final string concatenations: Just a list of strings -- Final string concatenations: Just a list of strings
local append = table.concat(layerstrings, "\n") local append = table.concat(layerstrings, "\n")
description = description .. "\n" .. minetest.colorize("#8F8F8F", append) description = description .. "\n" .. minetest.colorize(mcl_colors.GRAY, append)
return description return description
end end
end end

View file

@ -89,6 +89,7 @@ function mcl_beds.register_bed(name, def)
selection_box = selection_box_bottom, selection_box = selection_box_bottom,
collision_box = collision_box_bottom, collision_box = collision_box_bottom,
drop = "", drop = "",
node_placement_prediction = "",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local under = pointed_thing.under local under = pointed_thing.under

View file

@ -1,4 +1,4 @@
local S =minetest.get_translator("mcl_books") local S = minetest.get_translator("mcl_books")
local max_text_length = 4500 -- TODO: Increase to 12800 when scroll bar was added to written book local max_text_length = 4500 -- TODO: Increase to 12800 when scroll bar was added to written book
local max_title_length = 64 local max_title_length = 64
@ -67,7 +67,7 @@ local make_description = function(title, author, generation)
else else
desc = S("Tattered Book") desc = S("Tattered Book")
end end
desc = desc .. "\n" .. minetest.colorize("#AAAAAA", S("by @1", author)) desc = desc .. "\n" .. minetest.colorize(mcl_colors.GRAY, S("by @1", author))
return desc return desc
end end
@ -147,8 +147,8 @@ minetest.register_on_player_receive_fields(function ( player, formname, fields )
local formspec = "size[8,9]".. local formspec = "size[8,9]"..
header.. header..
"background[-0.5,-0.5;9,10;mcl_books_book_bg.png]".. "background[-0.5,-0.5;9,10;mcl_books_book_bg.png]"..
"field[0.75,1;7.25,1;title;"..minetest.formspec_escape(minetest.colorize("#000000", S("Enter book title:")))..";]".. "field[0.75,1;7.25,1;title;"..minetest.formspec_escape(minetest.colorize(mcl_colors.BLACK, S("Enter book title:")))..";]"..
"label[0.75,1.5;"..minetest.formspec_escape(minetest.colorize("#404040", S("by @1", name))).."]".. "label[0.75,1.5;"..minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("by @1", name))).."]"..
"button_exit[0.75,7.95;3,1;sign;"..minetest.formspec_escape(S("Sign and Close")).."]".. "button_exit[0.75,7.95;3,1;sign;"..minetest.formspec_escape(S("Sign and Close")).."]"..
"tooltip[sign;"..minetest.formspec_escape(S("Note: The book will no longer be editable after signing")).."]".. "tooltip[sign;"..minetest.formspec_escape(S("Note: The book will no longer be editable after signing")).."]"..
"button[4.25,7.95;3,1;cancel;"..minetest.formspec_escape(S("Cancel")).."]" "button[4.25,7.95;3,1;cancel;"..minetest.formspec_escape(S("Cancel")).."]"

View file

@ -1,4 +1,4 @@
name = mcl_books name = mcl_books
author = celeron55 author = celeron55
description = Books mod for MCL2 description = Books mod for MCL2
optional_depends = mcl_init, mcl_core, mcl_sounds, mcl_mobitems, mcl_dye optional_depends = mcl_init, mcl_core, mcl_sounds, mcl_mobitems, mcl_dye, mcl_colors

View file

@ -4,8 +4,8 @@ local function active_brewing_formspec(fuel_percent, brew_percent)
return "size[9,8.75]".. return "size[9,8.75]"..
"background[-0.19,-0.25;9.5,9.5;mcl_brewing_inventory.png]".. "background[-0.19,-0.25;9.5,9.5;mcl_brewing_inventory.png]"..
"label[4,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Brewing Stand"))).."]".. "label[4,0;"..minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Brewing Stand"))).."]"..
"label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]".. "label[0,4.0;"..minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Inventory"))).."]"..
"list[current_player;main;0,4.5;9,3;9]".. "list[current_player;main;0,4.5;9,3;9]"..
mcl_formspec.get_itemslot_bg(0,4.5,9,3).. mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
"list[current_player;main;0,7.75;9,1;]".. "list[current_player;main;0,7.75;9,1;]"..
@ -35,8 +35,8 @@ end
local brewing_formspec = "size[9,8.75]".. local brewing_formspec = "size[9,8.75]"..
"background[-0.19,-0.25;9.5,9.5;mcl_brewing_inventory.png]".. "background[-0.19,-0.25;9.5,9.5;mcl_brewing_inventory.png]"..
"label[4,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Brewing Stand"))).."]".. "label[4,0;"..minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Brewing Stand"))).."]"..
"label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]".. "label[0,4.0;"..minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Inventory"))).."]"..
"list[current_player;main;0,4.5;9,3;9]".. "list[current_player;main;0,4.5;9,3;9]"..
mcl_formspec.get_itemslot_bg(0,4.5,9,3).. mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
"list[current_player;main;0,7.75;9,1;]".. "list[current_player;main;0,7.75;9,1;]"..

View file

@ -1,4 +1,4 @@
name = mcl_brewing name = mcl_brewing
author = bzoss author = bzoss
depends = mcl_init, mcl_formspec, mcl_sounds, mcl_potions, mcl_mobitems depends = mcl_init, mcl_formspec, mcl_sounds, mcl_potions, mcl_mobitems, mcl_colors
optional_depends = mcl_core, doc, screwdriver optional_depends = mcl_core, doc, screwdriver

View file

@ -5,17 +5,17 @@ Add an API to register buckets to mcl
Register a new liquid Register a new liquid
Accept folowing params: Accept folowing params:
* source_place = a string or function. * source_place: a string or function.
* string: name of the node to place * string: name of the node to place
* function(pos): will returns name of the node to place with pos being the placement position * function(pos): will returns name of the node to place with pos being the placement position
* source_take = table of liquid source node names to take * source_take: table of liquid source node names to take
* itemname = itemstring of the new bucket item (or nil if liquid is not takeable) * itemname: itemstring of the new bucket item (or nil if liquid is not takeable)
* inventory_image = texture of the new bucket item (ignored if itemname == nil) * inventory_image: texture of the new bucket item (ignored if itemname == nil)
* name = user-visible bucket description * name: user-visible bucket description
* longdesc = long explanatory description (for help) * longdesc: long explanatory description (for help)
* usagehelp = short usage explanation (for help) * usagehelp: short usage explanation (for help)
* tt_help = very short tooltip help * tt_help: very short tooltip help
* extra_check(pos, placer) = optional function(pos) which can returns false to avoid placing the liquid. Placer is object/player who is placing the liquid, can be nil. * extra_check(pos, placer): (optional) function(pos) which can returns false to avoid placing the liquid. Placer is object/player who is placing the liquid, can be nil.
* groups = optional list of item groups * groups: optional list of item groups
This function can be called from any mod (which depends on this one) This function can be called from any mod (which depends on this one)

View file

@ -207,6 +207,9 @@ minetest.register_craftitem("mcl_buckets:bucket_empty", {
-- Fill bucket, but not in Creative Mode -- Fill bucket, but not in Creative Mode
if not minetest.is_creative_enabled(user:get_player_name()) then if not minetest.is_creative_enabled(user:get_player_name()) then
new_bucket = ItemStack({name = liquiddef.itemname}) new_bucket = ItemStack({name = liquiddef.itemname})
if liquiddef.itemname == "mcl_buckets:bucket_lava" and awards and awards.unlock and user and user:is_player() then
awards.unlock(user:get_player_name(), "mcl:hotStuff")
end
end end
minetest.add_node(pointed_thing.under, {name="air"}) minetest.add_node(pointed_thing.under, {name="air"})

View file

@ -475,10 +475,10 @@ minetest.register_node(small_name, {
minetest.show_formspec(clicker:get_player_name(), minetest.show_formspec(clicker:get_player_name(),
"mcl_chests:"..canonical_basename.."_"..pos.x.."_"..pos.y.."_"..pos.z, "mcl_chests:"..canonical_basename.."_"..pos.x.."_"..pos.y.."_"..pos.z,
"size[9,8.75]".. "size[9,8.75]"..
"label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", name)).."]".. "label[0,0;"..minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, name)).."]"..
"list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,0.5;9,3;]".. "list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,0.5;9,3;]"..
mcl_formspec.get_itemslot_bg(0,0.5,9,3).. mcl_formspec.get_itemslot_bg(0,0.5,9,3)..
"label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]".. "label[0,4.0;"..minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Inventory"))).."]"..
"list[current_player;main;0,4.5;9,3;9]".. "list[current_player;main;0,4.5;9,3;9]"..
mcl_formspec.get_itemslot_bg(0,4.5,9,3).. mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
"list[current_player;main;0,7.74;9,1;]".. "list[current_player;main;0,7.74;9,1;]"..
@ -624,12 +624,12 @@ minetest.register_node(left_name, {
minetest.show_formspec(clicker:get_player_name(), minetest.show_formspec(clicker:get_player_name(),
"mcl_chests:"..canonical_basename.."_"..pos.x.."_"..pos.y.."_"..pos.z, "mcl_chests:"..canonical_basename.."_"..pos.x.."_"..pos.y.."_"..pos.z,
"size[9,11.5]".. "size[9,11.5]"..
"label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", name)).."]".. "label[0,0;"..minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, name)).."]"..
"list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,0.5;9,3;]".. "list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,0.5;9,3;]"..
mcl_formspec.get_itemslot_bg(0,0.5,9,3).. mcl_formspec.get_itemslot_bg(0,0.5,9,3)..
"list[nodemeta:"..pos_other.x..","..pos_other.y..","..pos_other.z..";main;0,3.5;9,3;]".. "list[nodemeta:"..pos_other.x..","..pos_other.y..","..pos_other.z..";main;0,3.5;9,3;]"..
mcl_formspec.get_itemslot_bg(0,3.5,9,3).. mcl_formspec.get_itemslot_bg(0,3.5,9,3)..
"label[0,7;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]".. "label[0,7;"..minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Inventory"))).."]"..
"list[current_player;main;0,7.5;9,3;9]".. "list[current_player;main;0,7.5;9,3;9]"..
mcl_formspec.get_itemslot_bg(0,7.5,9,3).. mcl_formspec.get_itemslot_bg(0,7.5,9,3)..
"list[current_player;main;0,10.75;9,1;]".. "list[current_player;main;0,10.75;9,1;]"..
@ -773,12 +773,12 @@ minetest.register_node("mcl_chests:"..basename.."_right", {
"mcl_chests:"..canonical_basename.."_"..pos.x.."_"..pos.y.."_"..pos.z, "mcl_chests:"..canonical_basename.."_"..pos.x.."_"..pos.y.."_"..pos.z,
"size[9,11.5]".. "size[9,11.5]"..
"label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", name)).."]".. "label[0,0;"..minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, name)).."]"..
"list[nodemeta:"..pos_other.x..","..pos_other.y..","..pos_other.z..";main;0,0.5;9,3;]".. "list[nodemeta:"..pos_other.x..","..pos_other.y..","..pos_other.z..";main;0,0.5;9,3;]"..
mcl_formspec.get_itemslot_bg(0,0.5,9,3).. mcl_formspec.get_itemslot_bg(0,0.5,9,3)..
"list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,3.5;9,3;]".. "list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,3.5;9,3;]"..
mcl_formspec.get_itemslot_bg(0,3.5,9,3).. mcl_formspec.get_itemslot_bg(0,3.5,9,3)..
"label[0,7;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]".. "label[0,7;"..minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Inventory"))).."]"..
"list[current_player;main;0,7.5;9,3;9]".. "list[current_player;main;0,7.5;9,3;9]"..
mcl_formspec.get_itemslot_bg(0,7.5,9,3).. mcl_formspec.get_itemslot_bg(0,7.5,9,3)..
"list[current_player;main;0,10.75;9,1;]".. "list[current_player;main;0,10.75;9,1;]"..
@ -986,10 +986,10 @@ minetest.register_node("mcl_chests:ender_chest", {
}) })
local formspec_ender_chest = "size[9,8.75]".. local formspec_ender_chest = "size[9,8.75]"..
"label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Ender Chest"))).."]".. "label[0,0;"..minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Ender Chest"))).."]"..
"list[current_player;enderchest;0,0.5;9,3;]".. "list[current_player;enderchest;0,0.5;9,3;]"..
mcl_formspec.get_itemslot_bg(0,0.5,9,3).. mcl_formspec.get_itemslot_bg(0,0.5,9,3)..
"label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]".. "label[0,4.0;"..minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Inventory"))).."]"..
"list[current_player;main;0,4.5;9,3;9]".. "list[current_player;main;0,4.5;9,3;9]"..
mcl_formspec.get_itemslot_bg(0,4.5,9,3).. mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
"list[current_player;main;0,7.74;9,1;]".. "list[current_player;main;0,7.74;9,1;]"..
@ -1104,10 +1104,10 @@ local function formspec_shulker_box(name)
name = S("Shulker Box") name = S("Shulker Box")
end end
return "size[9,8.75]".. return "size[9,8.75]"..
"label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", name)).."]".. "label[0,0;"..minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, name)).."]"..
"list[current_name;main;0,0.5;9,3;]".. "list[current_name;main;0,0.5;9,3;]"..
mcl_formspec.get_itemslot_bg(0,0.5,9,3).. mcl_formspec.get_itemslot_bg(0,0.5,9,3)..
"label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]".. "label[0,4.0;"..minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Inventory"))).."]"..
"list[current_player;main;0,4.5;9,3;9]".. "list[current_player;main;0,4.5;9,3;9]"..
mcl_formspec.get_itemslot_bg(0,4.5,9,3).. mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
"list[current_player;main;0,7.74;9,1;]".. "list[current_player;main;0,7.74;9,1;]"..

View file

@ -1,3 +1,3 @@
name = mcl_chests name = mcl_chests
depends = mcl_init, mcl_formspec, mcl_core, mcl_sounds, mcl_end, mesecons depends = mcl_init, mcl_formspec, mcl_core, mcl_sounds, mcl_end, mesecons, mcl_colors
optional_depends = doc, screwdriver optional_depends = doc, screwdriver

View file

@ -1,4 +1,4 @@
name = mcl_core name = mcl_core
description = Core items of MineClone 2: Basic biome blocks (dirt, sand, stones, etc.), derived items, glass, sugar cane, cactus, barrier, mining tools, hand, craftitems, and misc. items which don't really fit anywhere else. description = Core items of MineClone 2: Basic biome blocks (dirt, sand, stones, etc.), derived items, glass, sugar cane, cactus, barrier, mining tools, hand, craftitems, and misc. items which don't really fit anywhere else.
depends = mcl_autogroup, mcl_init, mcl_sounds, mcl_particles, mcl_util, mcl_worlds, doc_items, mcl_enchanting depends = mcl_autogroup, mcl_init, mcl_sounds, mcl_particles, mcl_util, mcl_worlds, doc_items, mcl_enchanting, mcl_colors
optional_depends = doc optional_depends = doc

View file

@ -33,6 +33,11 @@ minetest.register_node("mcl_core:stone", {
_mcl_blast_resistance = 6, _mcl_blast_resistance = 6,
_mcl_hardness = 1.5, _mcl_hardness = 1.5,
_mcl_silk_touch_drop = true, _mcl_silk_touch_drop = true,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
if awards and awards.unlock and digger and digger:is_player() then
awards.unlock(digger:get_player_name(), "mcl:stoneAge")
end
end,
}) })
minetest.register_node("mcl_core:stone_with_coal", { minetest.register_node("mcl_core:stone_with_coal", {
@ -814,6 +819,11 @@ minetest.register_node("mcl_core:obsidian", {
groups = {pickaxey=5, building_block=1, material_stone=1}, groups = {pickaxey=5, building_block=1, material_stone=1},
_mcl_blast_resistance = 1200, _mcl_blast_resistance = 1200,
_mcl_hardness = 50, _mcl_hardness = 50,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
if awards and awards.unlock and digger and digger:is_player() then
awards.unlock(digger:get_player_name(), "mcl:obsidian")
end
end,
}) })
minetest.register_node("mcl_core:ice", { minetest.register_node("mcl_core:ice", {

View file

@ -4,7 +4,7 @@ local S = minetest.get_translator("mcl_core")
minetest.register_node("mcl_core:cactus", { minetest.register_node("mcl_core:cactus", {
description = S("Cactus"), description = S("Cactus"),
_tt_help = S("Grows on sand").."\n"..minetest.colorize("#FFFF00", S("Contact damage: @1 per half second", 1)), _tt_help = S("Grows on sand").."\n"..minetest.colorize(mcl_colors.YELLOW, S("Contact damage: @1 per half second", 1)),
_doc_items_longdesc = S("This is a piece of cactus commonly found in dry areas, especially deserts. Over time, cacti will grow up to 3 blocks high on sand or red sand. A cactus hurts living beings touching it with a damage of 1 HP every half second. When a cactus block is broken, all cactus blocks connected above it will break as well."), _doc_items_longdesc = S("This is a piece of cactus commonly found in dry areas, especially deserts. Over time, cacti will grow up to 3 blocks high on sand or red sand. A cactus hurts living beings touching it with a damage of 1 HP every half second. When a cactus block is broken, all cactus blocks connected above it will break as well."),
_doc_items_usagehelp = S("A cactus can only be placed on top of another cactus or any sand."), _doc_items_usagehelp = S("A cactus can only be placed on top of another cactus or any sand."),
drawtype = "nodebox", drawtype = "nodebox",

View file

@ -236,7 +236,7 @@ minetest.register_node("mcl_core:realm_barrier", {
-- Prevent placement to protect player from screwing up the world, because the node is not pointable and hard to get rid of. -- Prevent placement to protect player from screwing up the world, because the node is not pointable and hard to get rid of.
node_placement_prediction = "", node_placement_prediction = "",
on_place = function(pos, placer, itemstack, pointed_thing) on_place = function(pos, placer, itemstack, pointed_thing)
minetest.chat_send_player(placer:get_player_name(), minetest.colorize("#FF0000", "You can't just place a realm barrier by hand!")) minetest.chat_send_player(placer:get_player_name(), minetest.colorize(mcl_colors.RED, "You can't just place a realm barrier by hand!"))
return return
end, end,
}) })
@ -266,7 +266,7 @@ minetest.register_node("mcl_core:void", {
-- Prevent placement to protect player from screwing up the world, because the node is not pointable and hard to get rid of. -- Prevent placement to protect player from screwing up the world, because the node is not pointable and hard to get rid of.
node_placement_prediction = "", node_placement_prediction = "",
on_place = function(pos, placer, itemstack, pointed_thing) on_place = function(pos, placer, itemstack, pointed_thing)
minetest.chat_send_player(placer:get_player_name(), minetest.colorize("#FF0000", "You can't just place the void by hand!")) minetest.chat_send_player(placer:get_player_name(), minetest.colorize(mcl_colors.RED, "You can't just place the void by hand!"))
return return
end, end,
drop = "", drop = "",

View file

@ -2,7 +2,7 @@ local S = minetest.get_translator("mcl_crafting_table")
local formspec_escape = minetest.formspec_escape local formspec_escape = minetest.formspec_escape
local show_formspec = minetest.show_formspec local show_formspec = minetest.show_formspec
local C = minetest.colorize local C = minetest.colorize
local text_color = mcl_colors.BLACK or "#313131" local text_color = mcl_colors.DARK_GRAY
local itemslot_bg = mcl_formspec.get_itemslot_bg local itemslot_bg = mcl_formspec.get_itemslot_bg
mcl_crafting_table = {} mcl_crafting_table = {}
@ -13,7 +13,7 @@ function mcl_crafting_table.show_crafting_form(player)
show_formspec(player:get_player_name(), "main", show_formspec(player:get_player_name(), "main",
"size[9,8.75]".. "size[9,8.75]"..
"image[4.7,1.5;1.5,1;gui_crafting_arrow.png]".. "image[4.7,1.5;1.5,1;gui_crafting_arrow.png]"..
"label[0,4;"..formspec_escape(C(text_color, S("Inventory"))).."]".. --"#313131" "label[0,4;"..formspec_escape(C(text_color, S("Inventory"))).."]"..
"list[current_player;main;0,4.5;9,3;9]".. "list[current_player;main;0,4.5;9,3;9]"..
itemslot_bg(0,4.5,9,3).. itemslot_bg(0,4.5,9,3)..
"list[current_player;main;0,7.74;9,1;]".. "list[current_player;main;0,7.74;9,1;]"..

View file

@ -1,4 +1,3 @@
name = mcl_crafting_table name = mcl_crafting_table
description = Adds a crafting table. description = Adds a crafting table.
depends = mcl_init, mcl_formspec, mcl_sounds depends = mcl_init, mcl_formspec, mcl_sounds, mcl_colors
optional_depends = mcl_colors

View file

@ -52,7 +52,7 @@ function mcl_enchanting.get_enchantment_description(enchantment, level)
end end
function mcl_enchanting.get_colorized_enchantment_description(enchantment, level) function mcl_enchanting.get_colorized_enchantment_description(enchantment, level)
return minetest.colorize(mcl_enchanting.enchantments[enchantment].curse and "#FC5454" or "#A8A8A8", mcl_enchanting.get_enchantment_description(enchantment, level)) return minetest.colorize(mcl_enchanting.enchantments[enchantment].curse and mcl_colors.RED or mcl_colors.GRAY, mcl_enchanting.get_enchantment_description(enchantment, level))
end end
function mcl_enchanting.get_enchanted_itemstring(itemname) function mcl_enchanting.get_enchanted_itemstring(itemname)
@ -468,13 +468,13 @@ function mcl_enchanting.show_enchanting_formspec(player)
local formspec = "" local formspec = ""
.. "size[9.07,8.6;]" .. "size[9.07,8.6;]"
.. "formspec_version[3]" .. "formspec_version[3]"
.. "label[0,0;" .. C("#313131") .. F(table_name) .. "]" .. "label[0,0;" .. C(mcl_colors.DARK_GRAY) .. F(table_name) .. "]"
.. mcl_formspec.get_itemslot_bg(0.2, 2.4, 1, 1) .. mcl_formspec.get_itemslot_bg(0.2, 2.4, 1, 1)
.. "list[current_player;enchanting_item;0.2,2.4;1,1]" .. "list[current_player;enchanting_item;0.2,2.4;1,1]"
.. mcl_formspec.get_itemslot_bg(1.1, 2.4, 1, 1) .. mcl_formspec.get_itemslot_bg(1.1, 2.4, 1, 1)
.. "image[1.1,2.4;1,1;mcl_enchanting_lapis_background.png]" .. "image[1.1,2.4;1,1;mcl_enchanting_lapis_background.png]"
.. "list[current_player;enchanting_lapis;1.1,2.4;1,1]" .. "list[current_player;enchanting_lapis;1.1,2.4;1,1]"
.. "label[0,4;" .. C("#313131") .. F(S("Inventory")).."]" .. "label[0,4;" .. C(mcl_colors.DARK_GRAY) .. F(S("Inventory")).."]"
.. mcl_formspec.get_itemslot_bg(0, 4.5, 9, 3) .. mcl_formspec.get_itemslot_bg(0, 4.5, 9, 3)
.. mcl_formspec.get_itemslot_bg(0, 7.74, 9, 1) .. mcl_formspec.get_itemslot_bg(0, 7.74, 9, 1)
.. "list[current_player;main;0,4.5;9,3;9]" .. "list[current_player;main;0,4.5;9,3;9]"
@ -501,11 +501,11 @@ function mcl_enchanting.show_enchanting_formspec(player)
local hover_ending = (can_enchant and "_hovered" or "_off") local hover_ending = (can_enchant and "_hovered" or "_off")
formspec = formspec formspec = formspec
.. "container[3.2," .. y .. "]" .. "container[3.2," .. y .. "]"
.. (slot and "tooltip[button_" .. i .. ";" .. C("#818181") .. F(slot.description) .. " " .. C("#FFFFFF") .. " . . . ?\n\n" .. (enough_levels and C(enough_lapis and "#818181" or "#FC5454") .. F(S("@1 Lapis Lazuli", i)) .. "\n" .. C("#818181") .. F(S("@1 Enchantment Levels", i)) or C("#FC5454") .. F(S("Level requirement: @1", slot.level_requirement))) .. "]" or "") .. (slot and "tooltip[button_" .. i .. ";" .. C(mcl_colors.GRAY) .. F(slot.description) .. " " .. C(mcl_colors.WHITE) .. " . . . ?\n\n" .. (enough_levels and C(enough_lapis and mcl_colors.GRAY or mcl_colors.RED) .. F(S("@1 Lapis Lazuli", i)) .. "\n" .. C(mcl_colors.GRAY) .. F(S("@1 Enchantment Levels", i)) or C(mcl_colors.RED) .. F(S("Level requirement: @1", slot.level_requirement))) .. "]" or "")
.. "style[button_" .. i .. ";bgimg=mcl_enchanting_button" .. ending .. ".png;bgimg_hovered=mcl_enchanting_button" .. hover_ending .. ".png;bgimg_pressed=mcl_enchanting_button" .. hover_ending .. ".png]" .. "style[button_" .. i .. ";bgimg=mcl_enchanting_button" .. ending .. ".png;bgimg_hovered=mcl_enchanting_button" .. hover_ending .. ".png;bgimg_pressed=mcl_enchanting_button" .. hover_ending .. ".png]"
.. "button[0,0;7.5,1.3;button_" .. i .. ";]" .. "button[0,0;7.5,1.3;button_" .. i .. ";]"
.. (slot and "image[0,0;1.3,1.3;mcl_enchanting_number_" .. i .. ending .. ".png]" or "") .. (slot and "image[0,0;1.3,1.3;mcl_enchanting_number_" .. i .. ending .. ".png]" or "")
.. (slot and "label[7.2,1.1;" .. C(can_enchant and "#80FF20" or "#407F10") .. slot.level_requirement .. "]" or "") .. (slot and "label[7.2,1.1;" .. C(can_enchant and mcl_colors.GREEN or mcl_colors.DARK_GREEN) .. slot.level_requirement .. "]" or "")
.. (slot and slot.glyphs or "") .. (slot and slot.glyphs or "")
.. "container_end[]" .. "container_end[]"
y = y + 1.35 y = y + 1.35

View file

@ -1,5 +1,5 @@
name = mcl_enchanting name = mcl_enchanting
description = Enchanting for MineClone2 description = Enchanting for MineClone2
depends = tt, walkover, mcl_sounds depends = tt, walkover, mcl_sounds, mcl_colors
optional_depends = screwdriver optional_depends = screwdriver
author = Fleckenstein author = Fleckenstein

View file

@ -1,3 +1,3 @@
name = mcl_farming name = mcl_farming
depends = mcl_core, mcl_sounds, mcl_wool, mcl_torches, mcl_weather, mobs_mc depends = mcl_core, mcl_sounds, mcl_wool, mcl_torches, mcl_weather, mobs_mc, mcl_colors
optional_depends = mcl_armor, doc optional_depends = mcl_armor, doc

View file

@ -118,7 +118,7 @@ minetest.register_craftitem("mcl_farming:potato_item_baked", {
minetest.register_craftitem("mcl_farming:potato_item_poison", { minetest.register_craftitem("mcl_farming:potato_item_poison", {
description = S("Poisonous Potato"), description = S("Poisonous Potato"),
_tt_help = minetest.colorize("#FFFF00", S("60% chance of poisoning")), _tt_help = minetest.colorize(mcl_colors.YELLOW, S("60% chance of poisoning")),
_doc_items_longdesc = S("This potato doesn't look too healthy. You can eat it to restore hunger points, but there's a 60% chance it will poison you briefly."), _doc_items_longdesc = S("This potato doesn't look too healthy. You can eat it to restore hunger points, but there's a 60% chance it will poison you briefly."),
stack_max = 64, stack_max = 64,
inventory_image = "farming_potato_poison.png", inventory_image = "farming_potato_poison.png",

View file

@ -9,12 +9,12 @@ local LIGHT_ACTIVE_FURNACE = 13
local function active_formspec(fuel_percent, item_percent) local function active_formspec(fuel_percent, item_percent)
return "size[9,8.75]".. return "size[9,8.75]"..
"label[0,4;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]".. "label[0,4;"..minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Inventory"))).."]"..
"list[current_player;main;0,4.5;9,3;9]".. "list[current_player;main;0,4.5;9,3;9]"..
mcl_formspec.get_itemslot_bg(0,4.5,9,3).. mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
"list[current_player;main;0,7.74;9,1;]".. "list[current_player;main;0,7.74;9,1;]"..
mcl_formspec.get_itemslot_bg(0,7.74,9,1).. mcl_formspec.get_itemslot_bg(0,7.74,9,1)..
"label[2.75,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Furnace"))).."]".. "label[2.75,0;"..minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Furnace"))).."]"..
"list[current_name;src;2.75,0.5;1,1;]".. "list[current_name;src;2.75,0.5;1,1;]"..
mcl_formspec.get_itemslot_bg(2.75,0.5,1,1).. mcl_formspec.get_itemslot_bg(2.75,0.5,1,1)..
"list[current_name;fuel;2.75,2.5;1,1;]".. "list[current_name;fuel;2.75,2.5;1,1;]"..
@ -38,12 +38,12 @@ local function active_formspec(fuel_percent, item_percent)
end end
local inactive_formspec = "size[9,8.75]".. local inactive_formspec = "size[9,8.75]"..
"label[0,4;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]".. "label[0,4;"..minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Inventory"))).."]"..
"list[current_player;main;0,4.5;9,3;9]".. "list[current_player;main;0,4.5;9,3;9]"..
mcl_formspec.get_itemslot_bg(0,4.5,9,3).. mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
"list[current_player;main;0,7.74;9,1;]".. "list[current_player;main;0,7.74;9,1;]"..
mcl_formspec.get_itemslot_bg(0,7.74,9,1).. mcl_formspec.get_itemslot_bg(0,7.74,9,1)..
"label[2.75,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Furnace"))).."]".. "label[2.75,0;"..minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Furnace"))).."]"..
"list[current_name;src;2.75,0.5;1,1;]".. "list[current_name;src;2.75,0.5;1,1;]"..
mcl_formspec.get_itemslot_bg(2.75,0.5,1,1).. mcl_formspec.get_itemslot_bg(2.75,0.5,1,1)..
"list[current_name;fuel;2.75,2.5;1,1;]".. "list[current_name;fuel;2.75,2.5;1,1;]"..

View file

@ -1,3 +1,3 @@
name = mcl_furnaces name = mcl_furnaces
depends = mcl_init, mcl_formspec, mcl_core, mcl_sounds, mcl_craftguide, mcl_achievements, mcl_particles depends = mcl_init, mcl_formspec, mcl_core, mcl_sounds, mcl_craftguide, mcl_achievements, mcl_particles, mcl_colors
optional_depends = doc, screwdriver optional_depends = doc, screwdriver

View file

@ -4,10 +4,10 @@ local S = minetest.get_translator("mcl_hoppers")
local mcl_hoppers_formspec = local mcl_hoppers_formspec =
"size[9,7]".. "size[9,7]"..
"label[2,0;"..minetest.formspec_escape(minetest.colorize("#313131", S("Hopper"))).."]".. "label[2,0;"..minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Hopper"))).."]"..
"list[current_name;main;2,0.5;5,1;]".. "list[current_name;main;2,0.5;5,1;]"..
mcl_formspec.get_itemslot_bg(2,0.5,5,1).. mcl_formspec.get_itemslot_bg(2,0.5,5,1)..
"label[0,2;"..minetest.formspec_escape(minetest.colorize("#313131", S("Inventory"))).."]".. "label[0,2;"..minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Inventory"))).."]"..
"list[current_player;main;0,2.5;9,3;9]".. "list[current_player;main;0,2.5;9,3;9]"..
mcl_formspec.get_itemslot_bg(0,2.5,9,3).. mcl_formspec.get_itemslot_bg(0,2.5,9,3)..
"list[current_player;main;0,5.74;9,1;]".. "list[current_player;main;0,5.74;9,1;]"..

View file

@ -1,4 +1,4 @@
name = mcl_hoppers name = mcl_hoppers
description = It's just a clone of Minecraft hoppers, functions nearly identical to them minus mesecons making them stop and the way they're placed. description = It's just a clone of Minecraft hoppers, functions nearly identical to them minus mesecons making them stop and the way they're placed.
depends = mcl_core, mcl_formspec, mcl_sounds, mcl_util depends = mcl_core, mcl_formspec, mcl_sounds, mcl_util, mcl_colors
optional_depends = doc, screwdriver optional_depends = doc, screwdriver

View file

@ -20,8 +20,8 @@ function mcl_jukebox.register_record(title, author, identifier, image, sound)
local usagehelp = S("Place a music disc into an empty jukebox to play the music. Use the jukebox again to retrieve the music disc. The music can only be heard by you, not by other players.") local usagehelp = S("Place a music disc into an empty jukebox to play the music. Use the jukebox again to retrieve the music disc. The music can only be heard by you, not by other players.")
minetest.register_craftitem(":mcl_jukebox:record_"..identifier, { minetest.register_craftitem(":mcl_jukebox:record_"..identifier, {
description = description =
core.colorize("#55FFFF", S("Music Disc")) .. "\n" .. core.colorize(mcl_colors.AQUA, S("Music Disc")) .. "\n" ..
core.colorize("#989898", S("@1—@2", author, title)), core.colorize(mcl_colors.GRAY, S("@1—@2", author, title)),
_doc_items_create_entry = true, _doc_items_create_entry = true,
_doc_items_entry_name = entryname, _doc_items_entry_name = entryname,
_doc_items_longdesc = longdesc, _doc_items_longdesc = longdesc,

View file

@ -1,3 +1,3 @@
name = mcl_jukebox name = mcl_jukebox
description = Jukebox and music discs are used to play background music on a per-player basis. description = Jukebox and music discs are used to play background music on a per-player basis.
depends = mcl_core, mcl_sounds depends = mcl_core, mcl_sounds, mcl_colors

View file

@ -2,7 +2,7 @@ local S = minetest.get_translator("mcl_mobitems")
minetest.register_craftitem("mcl_mobitems:rotten_flesh", { minetest.register_craftitem("mcl_mobitems:rotten_flesh", {
description = S("Rotten Flesh"), description = S("Rotten Flesh"),
_tt_help = minetest.colorize("#FFFF00", S("80% chance of food poisoning")), _tt_help = minetest.colorize(mcl_colors.YELLOW, S("80% chance of food poisoning")),
_doc_items_longdesc = S("Yuck! This piece of flesh clearly has seen better days. If you're really desperate, you can eat it to restore a few hunger points, but there's a 80% chance it causes food poisoning, which increases your hunger for a while."), _doc_items_longdesc = S("Yuck! This piece of flesh clearly has seen better days. If you're really desperate, you can eat it to restore a few hunger points, but there's a 80% chance it causes food poisoning, which increases your hunger for a while."),
inventory_image = "mcl_mobitems_rotten_flesh.png", inventory_image = "mcl_mobitems_rotten_flesh.png",
wield_image = "mcl_mobitems_rotten_flesh.png", wield_image = "mcl_mobitems_rotten_flesh.png",
@ -63,7 +63,7 @@ minetest.register_craftitem("mcl_mobitems:cooked_beef", {
minetest.register_craftitem("mcl_mobitems:chicken", { minetest.register_craftitem("mcl_mobitems:chicken", {
description = S("Raw Chicken"), description = S("Raw Chicken"),
_tt_help = minetest.colorize("#FFFF00", S("30% chance of food poisoning")), _tt_help = minetest.colorize(mcl_colors.YELLOW, S("30% chance of food poisoning")),
_doc_items_longdesc = S("Raw chicken is a food item which is not safe to consume. You can eat it to restore a few hunger points, but there's a 30% chance to suffer from food poisoning, which increases your hunger rate for a while. Cooking raw chicken will make it safe to eat and increases its nutritional value."), _doc_items_longdesc = S("Raw chicken is a food item which is not safe to consume. You can eat it to restore a few hunger points, but there's a 30% chance to suffer from food poisoning, which increases your hunger rate for a while. Cooking raw chicken will make it safe to eat and increases its nutritional value."),
inventory_image = "mcl_mobitems_chicken_raw.png", inventory_image = "mcl_mobitems_chicken_raw.png",
wield_image = "mcl_mobitems_chicken_raw.png", wield_image = "mcl_mobitems_chicken_raw.png",
@ -147,7 +147,7 @@ end
minetest.register_craftitem("mcl_mobitems:milk_bucket", { minetest.register_craftitem("mcl_mobitems:milk_bucket", {
description = S("Milk"), description = S("Milk"),
_tt_help = minetest.colorize("#00FF00", S("Removes all status effects")), _tt_help = minetest.colorize(mcl_colors.GREEN, S("Removes all status effects")),
_doc_items_longdesc = S("Milk is very refreshing and can be obtained by using a bucket on a cow. Drinking it will remove all status effects, but restores no hunger points."), _doc_items_longdesc = S("Milk is very refreshing and can be obtained by using a bucket on a cow. Drinking it will remove all status effects, but restores no hunger points."),
_doc_items_usagehelp = S("Use the placement key to drink the milk."), _doc_items_usagehelp = S("Use the placement key to drink the milk."),
inventory_image = "mcl_mobitems_bucket_milk.png", inventory_image = "mcl_mobitems_bucket_milk.png",
@ -160,7 +160,7 @@ minetest.register_craftitem("mcl_mobitems:milk_bucket", {
minetest.register_craftitem("mcl_mobitems:spider_eye", { minetest.register_craftitem("mcl_mobitems:spider_eye", {
description = S("Spider Eye"), description = S("Spider Eye"),
_tt_help = minetest.colorize("#FFFF00", S("Poisonous")), _tt_help = minetest.colorize(mcl_colors.YELLOW, S("Poisonous")),
_doc_items_longdesc = S("Spider eyes are used mainly in crafting. If you're really desperate, you can eat a spider eye, but it will poison you briefly."), _doc_items_longdesc = S("Spider eyes are used mainly in crafting. If you're really desperate, you can eat a spider eye, but it will poison you briefly."),
inventory_image = "mcl_mobitems_spider_eye.png", inventory_image = "mcl_mobitems_spider_eye.png",
wield_image = "mcl_mobitems_spider_eye.png", wield_image = "mcl_mobitems_spider_eye.png",

View file

@ -1,2 +1,2 @@
name = mcl_mobitems name = mcl_mobitems
depends = mcl_core, mcl_hunger depends = mcl_core, mcl_hunger, mcl_colors

View file

@ -95,7 +95,7 @@ minetest.register_node("mcl_nether:netherrack", {
minetest.register_node("mcl_nether:magma", { minetest.register_node("mcl_nether:magma", {
description = S("Magma Block"), description = S("Magma Block"),
_tt_help = minetest.colorize("#FFFF00", S("Burns your feet")), _tt_help = minetest.colorize(mcl_colors.YELLOW, S("Burns your feet")),
_doc_items_longdesc = S("Magma blocks are hot solid blocks which hurt anyone standing on it, unless they have fire resistance. Starting a fire on this block will create an eternal fire."), _doc_items_longdesc = S("Magma blocks are hot solid blocks which hurt anyone standing on it, unless they have fire resistance. Starting a fire on this block will create an eternal fire."),
stack_max = 64, stack_max = 64,
tiles = {{name="mcl_nether_magma.png", animation={type="vertical_frames", aspect_w=32, aspect_h=32, length=1.5}}}, tiles = {{name="mcl_nether_magma.png", animation={type="vertical_frames", aspect_w=32, aspect_h=32, length=1.5}}},

View file

@ -1,3 +1,3 @@
name = mcl_nether name = mcl_nether
depends = mcl_core, mcl_sounds, mcl_util, walkover, doc_items depends = mcl_core, mcl_sounds, mcl_util, walkover, doc_items, mcl_colors
optional_depends = mcl_death_messages, doc, screwdriver optional_depends = mcl_death_messages, doc, screwdriver

View file

@ -66,12 +66,7 @@ minetest.register_on_shutdown(function()
storage:set_string("nether_exits_keys", minetest.serialize(keys)) storage:set_string("nether_exits_keys", minetest.serialize(keys))
end) end)
mcl_portals.get_node = function(pos) local get_node = mcl_vars.get_node
if mcl_mapgen_core and mcl_mapgen_core.get_node then
mcl_portals.get_node = mcl_mapgen_core.get_node
end
return minetest.get_node(pos)
end
local set_node = minetest.set_node local set_node = minetest.set_node
local registered_nodes = minetest.registered_nodes local registered_nodes = minetest.registered_nodes
local is_protected = minetest.is_protected local is_protected = minetest.is_protected
@ -97,7 +92,6 @@ local limits = {
-- Incoming verification performed: two nodes must be portal nodes, and an obsidian below them. -- Incoming verification performed: two nodes must be portal nodes, and an obsidian below them.
-- If the verification passes - position adds to the table and saves to mod storage on exit. -- If the verification passes - position adds to the table and saves to mod storage on exit.
local function add_exit(p) local function add_exit(p)
local get_node = mcl_portals.get_node
if not p or not p.y or not p.z or not p.x then return end if not p or not p.y or not p.z or not p.x then return end
local x, y, z = floor(p.x), floor(p.y), floor(p.z) local x, y, z = floor(p.x), floor(p.y), floor(p.z)
local p = {x = x, y = y, z = z} local p = {x = x, y = y, z = z}
@ -109,7 +103,7 @@ local function add_exit(p)
local e = exits[k] local e = exits[k]
for i = 1, #e do for i = 1, #e do
local t = e[i] local t = e[i]
if t.x == p.x and t.y == p.y and t.z == p.z then if t and t.x == p.x and t.y == p.y and t.z == p.z then
return return
end end
end end
@ -202,7 +196,6 @@ local function destroy_nether_portal(pos, node)
local nn, orientation = node.name, node.param2 local nn, orientation = node.name, node.param2
local obsidian = nn == OBSIDIAN local obsidian = nn == OBSIDIAN
local get_node = mcl_portals.get_node
local check_remove = function(pos, orientation) local check_remove = function(pos, orientation)
local node = get_node(pos) local node = get_node(pos)
if node and (node.name == PORTAL and (orientation == nil or (node.param2 == orientation))) then if node and (node.name == PORTAL and (orientation == nil or (node.param2 == orientation))) then
@ -285,12 +278,14 @@ minetest.register_node(PORTAL, {
_mcl_blast_resistance = 0, _mcl_blast_resistance = 0,
}) })
local function light_frame(x1, y1, z1, x2, y2, z2, name) local function light_frame(x1, y1, z1, x2, y2, z2, name, node, node_frame)
local orientation = 0 local orientation = 0
if x1 == x2 then if x1 == x2 then
orientation = 1 orientation = 1
end end
local pos = {} local pos = {}
local node = node or {name = PORTAL, param2 = orientation}
local node_frame = node_frame or {name = OBSIDIAN}
for x = x1 - 1 + orientation, x2 + 1 - orientation do for x = x1 - 1 + orientation, x2 + 1 - orientation do
pos.x = x pos.x = x
for z = z1 - orientation, z2 + orientation do for z = z1 - orientation, z2 + orientation do
@ -299,9 +294,9 @@ local function light_frame(x1, y1, z1, x2, y2, z2, name)
pos.y = y pos.y = y
local frame = (x < x1) or (x > x2) or (y < y1) or (y > y2) or (z < z1) or (z > z2) local frame = (x < x1) or (x > x2) or (y < y1) or (y > y2) or (z < z1) or (z > z2)
if frame then if frame then
set_node(pos, {name = OBSIDIAN}) set_node(pos, node_frame)
else else
set_node(pos, {name = PORTAL, param2 = orientation}) set_node(pos, node)
add_exit({x=pos.x, y=pos.y-1, z=pos.z}) add_exit({x=pos.x, y=pos.y-1, z=pos.z})
end end
end end
@ -310,12 +305,13 @@ local function light_frame(x1, y1, z1, x2, y2, z2, name)
end end
--Build arrival portal --Build arrival portal
function build_nether_portal(pos, width, height, orientation, name) function build_nether_portal(pos, width, height, orientation, name, clear_before_build)
local width, height, orientation = width or W_MIN - 2, height or H_MIN - 2, orientation or random(0, 1) local width, height, orientation = width or W_MIN - 2, height or H_MIN - 2, orientation or random(0, 1)
light_frame(pos.x, pos.y, pos.z, pos.x + (1 - orientation) * (width - 1), pos.y + height - 1, pos.z + orientation * (width - 1)) if clear_before_build then
light_frame(pos.x, pos.y, pos.z, pos.x + (1 - orientation) * (width - 1), pos.y + height - 1, pos.z + orientation * (width - 1), name, {name="air"}, {name="air"})
local get_node = mcl_portals.get_node end
light_frame(pos.x, pos.y, pos.z, pos.x + (1 - orientation) * (width - 1), pos.y + height - 1, pos.z + orientation * (width - 1), name)
-- Build obsidian platform: -- Build obsidian platform:
for x = pos.x - orientation, pos.x + orientation + (width - 1) * (1 - orientation), 1 + orientation do for x = pos.x - orientation, pos.x + orientation + (width - 1) * (1 - orientation), 1 + orientation do
@ -345,7 +341,7 @@ function mcl_portals.spawn_nether_portal(pos, rot, pr, name)
o = random(0,1) o = random(0,1)
end end
end end
build_nether_portal(pos, nil, nil, o, name) build_nether_portal(pos, nil, nil, o, name, true)
end end
-- Teleportation cooloff for some seconds, to prevent back-and-forth teleportation -- Teleportation cooloff for some seconds, to prevent back-and-forth teleportation
@ -379,7 +375,13 @@ local function finalize_teleport(obj, exit)
-- If player stands, player is at ca. something+0.5 which might cause precision problems, so we used ceil for objpos.y -- If player stands, player is at ca. something+0.5 which might cause precision problems, so we used ceil for objpos.y
objpos = {x = floor(objpos.x+0.5), y = ceil(objpos.y), z = floor(objpos.z+0.5)} objpos = {x = floor(objpos.x+0.5), y = ceil(objpos.y), z = floor(objpos.z+0.5)}
if mcl_portals.get_node(objpos).name ~= PORTAL then return end if get_node(objpos).name ~= PORTAL then return end
-- THIS IS A TEMPORATY CODE SECTION FOR COMPATIBILITY REASONS -- 1 of 2 -- TODO: Remove --
-- Old worlds have no exits indexed - adding the exit to return here:
add_exit(objpos)
-- TEMPORATY CODE SECTION ENDS HERE --
-- Enable teleportation cooloff for some seconds, to prevent back-and-forth teleportation -- Enable teleportation cooloff for some seconds, to prevent back-and-forth teleportation
teleport_cooloff(obj) teleport_cooloff(obj)
@ -436,7 +438,8 @@ local function ecb_scan_area_2(blockpos, action, calls_remaining, param)
local pos0, distance local pos0, distance
local lava = get_lava_level(pos, pos1, pos2) local lava = get_lava_level(pos, pos1, pos2)
-- THIS IS A TEMPORATY CODE SECTION FOR COMPATIBILITY REASONS -- -- THIS IS A TEMPORATY CODE SECTION FOR COMPATIBILITY REASONS -- 2 of 2 -- TODO: Remove --
-- Find portals for old worlds (new worlds keep them all in the table):
local portals = find_nodes_in_area(pos1, pos2, {PORTAL}) local portals = find_nodes_in_area(pos1, pos2, {PORTAL})
if portals and #portals>0 then if portals and #portals>0 then
for _, p in pairs(portals) do for _, p in pairs(portals) do
@ -463,7 +466,6 @@ local function ecb_scan_area_2(blockpos, action, calls_remaining, param)
local nodes2 = find_nodes_in_area(node1, node2, {"air"}) local nodes2 = find_nodes_in_area(node1, node2, {"air"})
if nodes2 then if nodes2 then
local nc2 = #nodes2 local nc2 = #nodes2
log("action", "[mcl_portals] nc2=" .. tostring(nc2))
if nc2 == 27 and not is_area_protected(node, node2, name) then if nc2 == 27 and not is_area_protected(node, node2, name) then
local distance0 = dist(pos, node) local distance0 = dist(pos, node)
if distance0 < 2 then if distance0 < 2 then
@ -522,7 +524,7 @@ local function create_portal(pos, limit1, limit2, name, obj)
end end
local function available_for_nether_portal(p) local function available_for_nether_portal(p)
local nn = mcl_portals.get_node(p).name local nn = get_node(p).name
local obsidian = nn == OBSIDIAN local obsidian = nn == OBSIDIAN
if nn ~= "air" and minetest.get_item_group(nn, "fire") ~= 1 then if nn ~= "air" and minetest.get_item_group(nn, "fire") ~= 1 then
return false, obsidian return false, obsidian
@ -629,7 +631,7 @@ local function teleport_no_delay(obj, pos)
-- If player stands, player is at ca. something+0.5 which might cause precision problems, so we used ceil for objpos.y -- If player stands, player is at ca. something+0.5 which might cause precision problems, so we used ceil for objpos.y
objpos = {x = floor(objpos.x+0.5), y = ceil(objpos.y), z = floor(objpos.z+0.5)} objpos = {x = floor(objpos.x+0.5), y = ceil(objpos.y), z = floor(objpos.z+0.5)}
if mcl_portals.get_node(objpos).name ~= PORTAL then return end if get_node(objpos).name ~= PORTAL then return end
local target, dim = get_target(objpos) local target, dim = get_target(objpos)
if not target then return end if not target then return end

View file

@ -12,6 +12,8 @@ end
local min_y = math.max(mcl_vars.mg_overworld_min, mcl_vars.mg_bedrock_overworld_max) + 1 local min_y = math.max(mcl_vars.mg_overworld_min, mcl_vars.mg_bedrock_overworld_max) + 1
local max_y = mcl_vars.mg_overworld_max - 1 local max_y = mcl_vars.mg_overworld_max - 1
local get_node = mcl_vars.get_node
-- Calculate the number of dungeon spawn attempts -- Calculate the number of dungeon spawn attempts
-- In Minecraft, there 8 dungeon spawn attempts Minecraft chunk (16*256*16 = 65536 blocks). -- In Minecraft, there 8 dungeon spawn attempts Minecraft chunk (16*256*16 = 65536 blocks).
-- Minetest chunks don't have this size, so scale the number accordingly. -- Minetest chunks don't have this size, so scale the number accordingly.
@ -49,8 +51,8 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param)
local y_floor = y local y_floor = y
local y_ceiling = y + dim.y + 1 local y_ceiling = y + dim.y + 1
if check then for tx = x+1, x+dim.x do for tz = z+1, z+dim.z do if check then for tx = x+1, x+dim.x do for tz = z+1, z+dim.z do
if not minetest.registered_nodes[mcl_mapgen_core.get_node({x = tx, y = y_floor , z = tz}).name].walkable if not minetest.registered_nodes[get_node({x = tx, y = y_floor , z = tz}).name].walkable
or not minetest.registered_nodes[mcl_mapgen_core.get_node({x = tx, y = y_ceiling, z = tz}).name].walkable then return false end or not minetest.registered_nodes[get_node({x = tx, y = y_ceiling, z = tz}).name].walkable then return false end
end end end end end end
-- Check for air openings (2 stacked air at ground level) in wall positions -- Check for air openings (2 stacked air at ground level) in wall positions
@ -63,25 +65,25 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param)
local x2,z2 = x+dim.x+1, z+dim.z+1 local x2,z2 = x+dim.x+1, z+dim.z+1
if mcl_mapgen_core.get_node({x=x, y=y+1, z=z}).name == "air" and mcl_mapgen_core.get_node({x=x, y=y+2, z=z}).name == "air" then if get_node({x=x, y=y+1, z=z}).name == "air" and get_node({x=x, y=y+2, z=z}).name == "air" then
openings_counter = openings_counter + 1 openings_counter = openings_counter + 1
if not openings[x] then openings[x]={} end if not openings[x] then openings[x]={} end
openings[x][z] = true openings[x][z] = true
table.insert(corners, {x=x, z=z}) table.insert(corners, {x=x, z=z})
end end
if mcl_mapgen_core.get_node({x=x2, y=y+1, z=z}).name == "air" and mcl_mapgen_core.get_node({x=x2, y=y+2, z=z}).name == "air" then if get_node({x=x2, y=y+1, z=z}).name == "air" and get_node({x=x2, y=y+2, z=z}).name == "air" then
openings_counter = openings_counter + 1 openings_counter = openings_counter + 1
if not openings[x2] then openings[x2]={} end if not openings[x2] then openings[x2]={} end
openings[x2][z] = true openings[x2][z] = true
table.insert(corners, {x=x2, z=z}) table.insert(corners, {x=x2, z=z})
end end
if mcl_mapgen_core.get_node({x=x, y=y+1, z=z2}).name == "air" and mcl_mapgen_core.get_node({x=x, y=y+2, z=z2}).name == "air" then if get_node({x=x, y=y+1, z=z2}).name == "air" and get_node({x=x, y=y+2, z=z2}).name == "air" then
openings_counter = openings_counter + 1 openings_counter = openings_counter + 1
if not openings[x] then openings[x]={} end if not openings[x] then openings[x]={} end
openings[x][z2] = true openings[x][z2] = true
table.insert(corners, {x=x, z=z2}) table.insert(corners, {x=x, z=z2})
end end
if mcl_mapgen_core.get_node({x=x2, y=y+1, z=z2}).name == "air" and mcl_mapgen_core.get_node({x=x2, y=y+2, z=z2}).name == "air" then if get_node({x=x2, y=y+1, z=z2}).name == "air" and get_node({x=x2, y=y+2, z=z2}).name == "air" then
openings_counter = openings_counter + 1 openings_counter = openings_counter + 1
if not openings[x2] then openings[x2]={} end if not openings[x2] then openings[x2]={} end
openings[x2][z2] = true openings[x2][z2] = true
@ -89,13 +91,13 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param)
end end
for wx = x+1, x+dim.x do for wx = x+1, x+dim.x do
if mcl_mapgen_core.get_node({x=wx, y=y+1, z=z}).name == "air" and mcl_mapgen_core.get_node({x=wx, y=y+2, z=z}).name == "air" then if get_node({x=wx, y=y+1, z=z}).name == "air" and get_node({x=wx, y=y+2, z=z}).name == "air" then
openings_counter = openings_counter + 1 openings_counter = openings_counter + 1
if check and openings_counter > 5 then return end if check and openings_counter > 5 then return end
if not openings[wx] then openings[wx]={} end if not openings[wx] then openings[wx]={} end
openings[wx][z] = true openings[wx][z] = true
end end
if mcl_mapgen_core.get_node({x=wx, y=y+1, z=z2}).name == "air" and mcl_mapgen_core.get_node({x=wx, y=y+2, z=z2}).name == "air" then if get_node({x=wx, y=y+1, z=z2}).name == "air" and get_node({x=wx, y=y+2, z=z2}).name == "air" then
openings_counter = openings_counter + 1 openings_counter = openings_counter + 1
if check and openings_counter > 5 then return end if check and openings_counter > 5 then return end
if not openings[wx] then openings[wx]={} end if not openings[wx] then openings[wx]={} end
@ -103,13 +105,13 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param)
end end
end end
for wz = z+1, z+dim.z do for wz = z+1, z+dim.z do
if mcl_mapgen_core.get_node({x=x, y=y+1, z=wz}).name == "air" and mcl_mapgen_core.get_node({x=x, y=y+2, z=wz}).name == "air" then if get_node({x=x, y=y+1, z=wz}).name == "air" and get_node({x=x, y=y+2, z=wz}).name == "air" then
openings_counter = openings_counter + 1 openings_counter = openings_counter + 1
if check and openings_counter > 5 then return end if check and openings_counter > 5 then return end
if not openings[x] then openings[x]={} end if not openings[x] then openings[x]={} end
openings[x][wz] = true openings[x][wz] = true
end end
if mcl_mapgen_core.get_node({x=x2, y=y+1, z=wz}).name == "air" and mcl_mapgen_core.get_node({x=x2, y=y+2, z=wz}).name == "air" then if get_node({x=x2, y=y+1, z=wz}).name == "air" and get_node({x=x2, y=y+2, z=wz}).name == "air" then
openings_counter = openings_counter + 1 openings_counter = openings_counter + 1
if check and openings_counter > 5 then return end if check and openings_counter > 5 then return end
if not openings[x2] then openings[x2]={} end if not openings[x2] then openings[x2]={} end
@ -185,7 +187,7 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param)
-- Calculate the mob spawner position, to be re-used for later -- Calculate the mob spawner position, to be re-used for later
local sp = {x = x + math.ceil(dim.x/2), y = y+1, z = z + math.ceil(dim.z/2)} local sp = {x = x + math.ceil(dim.x/2), y = y+1, z = z + math.ceil(dim.z/2)}
local rn = minetest.registered_nodes[mcl_mapgen_core.get_node(sp).name] local rn = minetest.registered_nodes[get_node(sp).name]
if rn and rn.is_ground_content then if rn and rn.is_ground_content then
table.insert(spawner_posses, sp) table.insert(spawner_posses, sp)
end end
@ -200,7 +202,7 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param)
-- Do not overwrite nodes with is_ground_content == false (e.g. bedrock) -- Do not overwrite nodes with is_ground_content == false (e.g. bedrock)
-- Exceptions: cobblestone and mossy cobblestone so neighborings dungeons nicely connect to each other -- Exceptions: cobblestone and mossy cobblestone so neighborings dungeons nicely connect to each other
local name = mcl_mapgen_core.get_node(p).name local name = get_node(p).name
if minetest.registered_nodes[name].is_ground_content or name == "mcl_core:cobble" or name == "mcl_core:mossycobble" then if minetest.registered_nodes[name].is_ground_content or name == "mcl_core:cobble" or name == "mcl_core:mossycobble" then
-- Floor -- Floor
if ty == y then if ty == y then
@ -245,7 +247,7 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param)
if forChest and (currentChest < totalChests + 1) and (chestSlots[currentChest] == chestSlotCounter) then if forChest and (currentChest < totalChests + 1) and (chestSlots[currentChest] == chestSlotCounter) then
currentChest = currentChest + 1 currentChest = currentChest + 1
table.insert(chests, {x=tx, y=ty, z=tz}) table.insert(chests, {x=tx, y=ty, z=tz})
else -- else
--minetest.swap_node(p, {name = "air"}) --minetest.swap_node(p, {name = "air"})
end end
if forChest then if forChest then
@ -263,8 +265,8 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param)
-- Detect the 4 horizontal neighbors -- Detect the 4 horizontal neighbors
local spos = vector.add(pos, surround_vectors[s]) local spos = vector.add(pos, surround_vectors[s])
local wpos = vector.subtract(pos, surround_vectors[s]) local wpos = vector.subtract(pos, surround_vectors[s])
local nodename = minetest.get_node(spos).name local nodename = get_node(spos).name
local nodename2 = minetest.get_node(wpos).name local nodename2 = get_node(wpos).name
local nodedef = minetest.registered_nodes[nodename] local nodedef = minetest.registered_nodes[nodename]
local nodedef2 = minetest.registered_nodes[nodename2] local nodedef2 = minetest.registered_nodes[nodename2]
-- The chest needs an open space in front of it and a walkable node (except chest) behind it -- The chest needs an open space in front of it and a walkable node (except chest) behind it
@ -345,6 +347,7 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param)
}) })
end end
minetest.log("action", "[mcl_dungeons] Filling chest " .. tostring(c) .. " at " .. minetest.pos_to_string(pos))
mcl_loot.fill_inventory(meta:get_inventory(), "main", mcl_loot.get_multi_loot(loottable, pr), pr) mcl_loot.fill_inventory(meta:get_inventory(), "main", mcl_loot.get_multi_loot(loottable, pr), pr)
end end

View file

@ -1,45 +1,8 @@
mcl_mapgen_core = {} mcl_mapgen_core = {}
mcl_mapgen_core.registered_generators = {} local registered_generators = {}
local lvm, nodes, param2 = 0, 0, 0 local lvm, nodes, param2 = 0, 0, 0
local lvm_buffer = {}
local generating = {} -- generating chunks
local chunks = {} -- intervals of chunks generated
local function add_chunk(pos)
local n = mcl_vars.get_chunk_number(pos) -- unsigned int
local prev
for i, d in pairs(chunks) do
if n <= d[2] then -- we've found it
if (n == d[2]) or (n >= d[1]) then return end -- already here
if n == d[1]-1 then -- right before:
if prev and (prev[2] == n-1) then
prev[2] = d[2]
table.remove(chunks, i)
return
end
d[1] = n
return
end
if prev and (prev[2] == n-1) then --join to previous
prev[2] = n
return
end
table.insert(chunks, i, {n, n}) -- insert new interval before i
return
end
prev = d
end
chunks[#chunks+1] = {n, n}
end
function mcl_mapgen_core.is_generated(pos)
local n = mcl_vars.get_chunk_number(pos) -- unsigned int
for i, d in pairs(chunks) do
if n <= d[2] then
return (n >= d[1])
end
end
return false
end
-- --
-- Aliases for map generator outputs -- Aliases for map generator outputs
@ -1850,24 +1813,22 @@ end
minetest.register_on_generated(function(minp, maxp, blockseed) minetest.register_on_generated(function(minp, maxp, blockseed)
minetest.log("action", "[mcl_mapgen_core] Generating chunk " .. minetest.pos_to_string(minp) .. " ... " .. minetest.pos_to_string(maxp)) minetest.log("action", "[mcl_mapgen_core] Generating chunk " .. minetest.pos_to_string(minp) .. " ... " .. minetest.pos_to_string(maxp))
add_chunk(minp)
local p1, p2 = {x=minp.x, y=minp.y, z=minp.z}, {x=maxp.x, y=maxp.y, z=maxp.z} local p1, p2 = {x=minp.x, y=minp.y, z=minp.z}, {x=maxp.x, y=maxp.y, z=maxp.z}
if lvm > 0 then if lvm > 0 then
local lvm_used, shadow = false, false local lvm_used, shadow = false, false
local lb = {} -- buffer
local lb2 = {} -- param2 local lb2 = {} -- param2
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip") local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local e1, e2 = {x=emin.x, y=emin.y, z=emin.z}, {x=emax.x, y=emax.y, z=emax.z} local e1, e2 = {x=emin.x, y=emin.y, z=emin.z}, {x=emax.x, y=emax.y, z=emax.z}
local data2 local data2
local data = vm:get_data(lb) local data = vm:get_data(lvm_buffer)
if param2 > 0 then if param2 > 0 then
data2 = vm:get_param2_data(lb2) data2 = vm:get_param2_data(lb2)
end end
local area = VoxelArea:new({MinEdge=e1, MaxEdge=e2}) local area = VoxelArea:new({MinEdge=e1, MaxEdge=e2})
for _, rec in pairs(mcl_mapgen_core.registered_generators) do for _, rec in pairs(registered_generators) do
if rec.vf then if rec.vf then
local lvm_used0, shadow0 = rec.vf(vm, data, data2, p1, p2, area, p1, p2, blockseed) local lvm_used0, shadow0 = rec.vf(vm, data, data2, e1, e2, area, p1, p2, blockseed)
if lvm_used0 then if lvm_used0 then
lvm_used = true lvm_used = true
end end
@ -1890,18 +1851,18 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
end end
if nodes > 0 then if nodes > 0 then
for _, rec in pairs(mcl_mapgen_core.registered_generators) do for _, rec in pairs(registered_generators) do
if rec.nf then if rec.nf then
rec.nf(p1, p2, blockseed) rec.nf(p1, p2, blockseed)
end end
end end
end end
-- add_chunk(minp) mcl_vars.add_chunk(minp)
end) end)
minetest.register_on_generated=function(node_function) minetest.register_on_generated=function(node_function)
mcl_mapgen_core.register_generator("mod_"..tostring(#mcl_mapgen_core.registered_generators+1), nil, node_function) mcl_mapgen_core.register_generator("mod_"..tostring(#registered_generators+1), nil, node_function)
end end
function mcl_mapgen_core.register_generator(id, lvm_function, node_function, priority, needs_param2) function mcl_mapgen_core.register_generator(id, lvm_function, node_function, priority, needs_param2)
@ -1920,18 +1881,18 @@ function mcl_mapgen_core.register_generator(id, lvm_function, node_function, pri
needs_param2 = needs_param2, needs_param2 = needs_param2,
} }
mcl_mapgen_core.registered_generators[id] = new_record registered_generators[id] = new_record
table.sort( table.sort(
mcl_mapgen_core.registered_generators, registered_generators,
function(a, b) function(a, b)
return (a.i < b.i) or ((a.i == b.i) and (a.vf ~= nil) and (b.vf == nil)) return (a.i < b.i) or ((a.i == b.i) and (a.vf ~= nil) and (b.vf == nil))
end) end)
end end
function mcl_mapgen_core.unregister_generator(id) function mcl_mapgen_core.unregister_generator(id)
if not mcl_mapgen_core.registered_generators[id] then return end if not registered_generators[id] then return end
local rec = mcl_mapgen_core.registered_generators[id] local rec = registered_generators[id]
mcl_mapgen_core.registered_generators[id] = nil registered_generators[id] = nil
if rec.vf then lvm = lvm - 1 end if rec.vf then lvm = lvm - 1 end
if rev.nf then nodes = nodes - 1 end if rev.nf then nodes = nodes - 1 end
if rec.needs_param2 then param2 = param2 - 1 end if rec.needs_param2 then param2 = param2 - 1 end
@ -2134,9 +2095,9 @@ local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
-- Nether block fixes: -- Nether block fixes:
-- * Replace water with Nether lava. -- * Replace water with Nether lava.
-- * Replace stone, sand dirt in v6 so the Nether works in v6. -- * Replace stone, sand dirt in v6 so the Nether works in v6.
elseif minp.y <= mcl_vars.mg_nether_max and maxp.y >= mcl_vars.mg_nether_min then elseif emin.y <= mcl_vars.mg_nether_max and emax.y >= mcl_vars.mg_nether_min then
if mg_name == "v6" then if mg_name == "v6" then
local nodes = minetest.find_nodes_in_area(minp, maxp, {"mcl_core:water_source", "mcl_core:stone", "mcl_core:sand", "mcl_core:dirt"}) local nodes = minetest.find_nodes_in_area(emin, emax, {"mcl_core:water_source", "mcl_core:stone", "mcl_core:sand", "mcl_core:dirt"})
for n=1, #nodes do for n=1, #nodes do
local p_pos = area:index(nodes[n].x, nodes[n].y, nodes[n].z) local p_pos = area:index(nodes[n].x, nodes[n].y, nodes[n].z)
if data[p_pos] == c_water then if data[p_pos] == c_water then
@ -2151,16 +2112,10 @@ local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
end end
end end
else else
minetest.emerge_area(minp, maxp, function(blockpos, action, calls_remaining, param) local nodes = minetest.find_nodes_in_area(emin, emax, {"group:water"})
if calls_remaining > 0 then return end for _, n in pairs(nodes) do
-- local nodes = minetest.find_nodes_in_area(param.minp, param.maxp, {"mcl_core:water_source"}) data[area:index(n.x, n.y, n.z)] = c_nether_lava
local nodes = minetest.find_nodes_in_area(param.minp, param.maxp, {"group:water"}) end
local sn=(mcl_observers and mcl_observers.swap_node) or minetest.swap_node
local l = {name="mcl_nether:nether_lava_source"}
for _, n in pairs(nodes) do
sn(n, l)
end
end, {minp=vector.new(minp), maxp=vector.new(maxp)})
end end
-- End block fixes: -- End block fixes:
@ -2168,17 +2123,16 @@ local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
-- * Remove stone, sand, dirt in v6 so our End map generator works in v6. -- * Remove stone, sand, dirt in v6 so our End map generator works in v6.
-- * Generate spawn platform (End portal destination) -- * Generate spawn platform (End portal destination)
elseif minp.y <= mcl_vars.mg_end_max and maxp.y >= mcl_vars.mg_end_min then elseif minp.y <= mcl_vars.mg_end_max and maxp.y >= mcl_vars.mg_end_min then
local nodes, node local nodes, n
if mg_name == "v6" then if mg_name == "v6" then
nodes = minetest.find_nodes_in_area(minp, maxp, {"mcl_core:water_source", "mcl_core:stone", "mcl_core:sand", "mcl_core:dirt"}) nodes = minetest.find_nodes_in_area(emin, emax, {"mcl_core:water_source", "mcl_core:stone", "mcl_core:sand", "mcl_core:dirt"})
else else
nodes = minetest.find_nodes_in_area(minp, maxp, {"mcl_core:water_source"}) nodes = minetest.find_nodes_in_area(emin, emax, {"mcl_core:water_source"})
end end
if #nodes > 0 then if #nodes > 0 then
lvm_used = true lvm_used = true
for n=1, #nodes do for _, n in pairs(nodes) do
node = nodes[n] data[area:index(n.x, n.y, n.z)] = c_air
data[area:index(node.x, node.y, node.z)] = c_air
end end
end end
@ -2231,48 +2185,3 @@ end
mcl_mapgen_core.register_generator("main", basic, nil, 1, true) mcl_mapgen_core.register_generator("main", basic, nil, 1, true)
-- "Trivial" (actually NOT) function to just read the node and some stuff to not just return "ignore", like 5.3.0 does.
-- p: Position, if it's wrong, {name="error"} node will return.
-- force: optional (default: false) - Do the maximum to still read the node within us_timeout.
-- us_timeout: optional (default: 244 = 0.000244 s = 1/80/80/80), set it at least to 3000000 to let mapgen to finish its job.
--
-- returns node definition, eg. {name="air"}. Unfortunately still can return {name="ignore"}.
function mcl_mapgen_core.get_node(p, force, us_timeout)
-- check initial circumstances
if not p or not p.x or not p.y or not p.z then return {name="error"} end
-- try common way
local node = minetest.get_node(p)
if node.name ~= "ignore" then
return node
end
-- copy table to get sure it won't changed by other threads
local pos = {x=p.x,y=p.y,z=p.z}
-- try LVM
minetest.get_voxel_manip():read_from_map(pos, pos)
node = minetest.get_node(pos)
if node.name ~= "ignore" or not force then
return node
end
-- all ways failed - need to emerge (or forceload if generated)
local us_timeout = us_timeout or 244
if mcl_mapgen_core.is_generated(pos) then
minetest.forceload_block(pos)
else
minetest.emerge_area(pos, pos)
end
local t = minetest.get_us_time()
node = minetest.get_node(pos)
while (not node or node.name == "ignore") and (minetest.get_us_time() - t < us_timeout) do
node = minetest.get_node(pos)
end
return node
-- it still can return "ignore", LOL, even if force = true, but only after time out
end

View file

@ -272,7 +272,7 @@ local function hut_placement_callback(p1, p2, size, orientation, pr)
if not p1 or not p2 then return end if not p1 or not p2 then return end
local legs = minetest.find_nodes_in_area(p1, p2, "mcl_core:tree") local legs = minetest.find_nodes_in_area(p1, p2, "mcl_core:tree")
for i = 1, #legs do for i = 1, #legs do
while minetest.get_item_group(mcl_mapgen_core.get_node({x=legs[i].x, y=legs[i].y-1, z=legs[i].z}, true, 333333).name, "water") ~= 0 do while minetest.get_item_group(mcl_vars.get_node({x=legs[i].x, y=legs[i].y-1, z=legs[i].z}, true, 333333).name, "water") ~= 0 do
legs[i].y = legs[i].y - 1 legs[i].y = legs[i].y - 1
minetest.swap_node(legs[i], {name = "mcl_core:tree", param2 = 2}) minetest.swap_node(legs[i], {name = "mcl_core:tree", param2 = 2})
end end

View file

@ -4,7 +4,7 @@
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
function settlements.build_schematic(vm, data, va, pos, building, replace_wall, name) function settlements.build_schematic(vm, data, va, pos, building, replace_wall, name)
-- get building node material for better integration to surrounding -- get building node material for better integration to surrounding
local platform_material = mcl_mapgen_core.get_node(pos) local platform_material = mcl_vars.get_node(pos)
if not platform_material or (platform_material.name == "air" or platform_material.name == "ignore") then if not platform_material or (platform_material.name == "air" or platform_material.name == "ignore") then
return return
end end

View file

@ -52,7 +52,7 @@ function settlements.terraform(settlement_info, pr)
else else
-- write ground -- write ground
-- local p = {x=pos.x+xi, y=pos.y+yi, z=pos.z+zi} -- local p = {x=pos.x+xi, y=pos.y+yi, z=pos.z+zi}
-- local node = mcl_mapgen_core.get_node(p) -- local node = mcl_vars.get_node(p)
-- if node and node.name ~= "air" then -- if node and node.name ~= "air" then
-- minetest.swap_node(p,{name="air"}) -- minetest.swap_node(p,{name="air"})
-- end -- end

View file

@ -1,28 +1,5 @@
local c_dirt_with_grass = minetest.get_content_id("mcl_core:dirt_with_grass") local get_node = mcl_vars.get_node
local c_dirt_with_snow = minetest.get_content_id("mcl_core:dirt_with_grass_snow")
--local c_dirt_with_dry_grass = minetest.get_content_id("mcl_core:dirt_with_dry_grass")
local c_podzol = minetest.get_content_id("mcl_core:podzol")
local c_sand = minetest.get_content_id("mcl_core:sand")
local c_desert_sand = minetest.get_content_id("mcl_core:redsand")
--local c_silver_sand = minetest.get_content_id("mcl_core:silver_sand")
--
local c_air = minetest.get_content_id("air")
local c_snow = minetest.get_content_id("mcl_core:snow")
local c_fern_1 = minetest.get_content_id("mcl_flowers:fern")
local c_fern_2 = minetest.get_content_id("mcl_flowers:fern")
local c_fern_3 = minetest.get_content_id("mcl_flowers:fern")
local c_rose = minetest.get_content_id("mcl_flowers:poppy")
local c_viola = minetest.get_content_id("mcl_flowers:blue_orchid")
local c_geranium = minetest.get_content_id("mcl_flowers:allium")
local c_tulip = minetest.get_content_id("mcl_flowers:tulip_orange")
local c_dandelion_y = minetest.get_content_id("mcl_flowers:dandelion")
local c_dandelion_w = minetest.get_content_id("mcl_flowers:oxeye_daisy")
local c_bush_leaves = minetest.get_content_id("mcl_core:leaves")
local c_bush_stem = minetest.get_content_id("mcl_core:tree")
local c_a_bush_leaves = minetest.get_content_id("mcl_core:acacialeaves")
local c_a_bush_stem = minetest.get_content_id("mcl_core:acaciatree")
local c_water_source = minetest.get_content_id("mcl_core:water_source")
local c_water_flowing = minetest.get_content_id("mcl_core:water_flowing")
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
-- function to copy tables -- function to copy tables
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@ -53,9 +30,9 @@ function settlements.find_surface(pos, wait)
-- check, in which direction to look for surface -- check, in which direction to look for surface
local surface_node local surface_node
if wait then if wait then
surface_node = mcl_mapgen_core.get_node(p6, true, 10000000) surface_node = get_node(p6, true, 10000000)
else else
surface_node = mcl_mapgen_core.get_node(p6) surface_node = get_node(p6)
end end
if surface_node.name=="air" or surface_node.name=="ignore" then if surface_node.name=="air" or surface_node.name=="ignore" then
itter = -1 itter = -1
@ -65,7 +42,7 @@ function settlements.find_surface(pos, wait)
-- Check Surface_node and Node above -- Check Surface_node and Node above
-- --
if settlements.surface_mat[surface_node.name] then if settlements.surface_mat[surface_node.name] then
local surface_node_plus_1 = mcl_mapgen_core.get_node({ x=p6.x, y=p6.y+1, z=p6.z}) local surface_node_plus_1 = get_node({ x=p6.x, y=p6.y+1, z=p6.z})
if surface_node_plus_1 and surface_node and if surface_node_plus_1 and surface_node and
(string.find(surface_node_plus_1.name,"air") or (string.find(surface_node_plus_1.name,"air") or
string.find(surface_node_plus_1.name,"snow") or string.find(surface_node_plus_1.name,"snow") or
@ -90,7 +67,7 @@ function settlements.find_surface(pos, wait)
return nil return nil
end end
cnt = cnt+1 cnt = cnt+1
surface_node = mcl_mapgen_core.get_node(p6) surface_node = get_node(p6)
end end
settlements.debug("find_surface5: cnt_max overflow") settlements.debug("find_surface5: cnt_max overflow")
return nil return nil

View file

@ -0,0 +1,14 @@
# mcl_death_drop
Drop registered inventories on player death.
## mcl_death_drop.register_dropped_list(inv, listname, drop)
* inv: can be:
* "PLAYER": will be interpreted like player inventory (to avoid multiple calling to get_inventory())
* function(player): must return inventory
* listname: string
* drop: bool
* true: the entire list will be dropped
* false: items with curse_of_vanishing enchantement will be broken.
## mcl_death_drop.registered_dropped_lists
Table containing dropped list inventory, name and drop state.

View file

@ -1,26 +1,40 @@
local random = math.random
mcl_death_drop = {}
mcl_death_drop.registered_dropped_lists = {}
function mcl_death_drop.register_dropped_list(inv, listname, drop)
table.insert(mcl_death_drop.registered_dropped_lists, {inv=inv, listname=listname, drop=drop})
end
mcl_death_drop.register_dropped_list("PLAYER", "main", true)
mcl_death_drop.register_dropped_list("PLAYER", "craft", true)
mcl_death_drop.register_dropped_list("PLAYER", "armor", true)
mcl_death_drop.register_dropped_list(function(player) return select(3, armor:get_valid_player(player)) end , "armor", false)
minetest.register_on_dieplayer(function(player) minetest.register_on_dieplayer(function(player)
local keep = minetest.settings:get_bool("mcl_keepInventory", false) local keep = minetest.settings:get_bool("mcl_keepInventory", false)
if keep == false then if keep == false then
-- Drop inventory, crafting grid and armor -- Drop inventory, crafting grid and armor
local inv = player:get_inventory() local playerinv = player:get_inventory()
local pos = player:get_pos() local pos = player:get_pos()
local name, player_armor_inv, armor_armor_inv, pos = armor:get_valid_player(player, "[on_dieplayer]")
-- No item drop if in deep void -- No item drop if in deep void
local void, void_deadly = mcl_worlds.is_in_void(pos) local void, void_deadly = mcl_worlds.is_in_void(pos)
local lists = {
{ inv = inv, listname = "main", drop = true }, for l=1,#mcl_death_drop.registered_dropped_lists do
{ inv = inv, listname = "craft", drop = true }, local inv = mcl_death_drop.registered_dropped_lists[l].inv
{ inv = player_armor_inv, listname = "armor", drop = true }, if inv == "PLAYER" then
{ inv = armor_armor_inv, listname = "armor", drop = false }, inv = playerinv
} elseif type(inv) == "function" then
for l=1,#lists do inv = inv(player)
local inv = lists[l].inv end
local listname = lists[l].listname local listname = mcl_death_drop.registered_dropped_lists[l].listname
local drop = lists[l].drop local drop = mcl_death_drop.registered_dropped_lists[l].drop
if inv ~= nil then if inv ~= nil then
for i, stack in ipairs(inv:get_list(listname)) do for i, stack in ipairs(inv:get_list(listname)) do
local x = math.random(0, 9)/3 local x = random(0, 9)/3
local z = math.random(0, 9)/3 local z = random(0, 9)/3
pos.x = pos.x + x pos.x = pos.x + x
pos.z = pos.z + z pos.z = pos.z + z
if not void_deadly and drop and not mcl_enchanting.has_enchantment(stack, "curse_of_vanishing") then if not void_deadly and drop and not mcl_enchanting.has_enchantment(stack, "curse_of_vanishing") then

View file

@ -178,7 +178,7 @@ minetest.register_globalstep(function(dtime)
-- Apply animations based on what the player is doing -- Apply animations based on what the player is doing
if player:get_hp() == 0 then if player:get_hp() == 0 then
player_set_animation(player, "lay") player_set_animation(player, "die")
elseif walking and velocity.x > 0.35 or walking and velocity.x < -0.35 or walking and velocity.z > 0.35 or walking and velocity.z < -0.35 then elseif walking and velocity.x > 0.35 or walking and velocity.x < -0.35 or walking and velocity.z > 0.35 or walking and velocity.z < -0.35 then
if player_sneak[name] ~= controls.sneak then if player_sneak[name] ~= controls.sneak then
player_anim[name] = nil player_anim[name] = nil
@ -253,3 +253,28 @@ minetest.register_on_player_hpchange(function(player, hp_change, reason)
end end
return hp_change return hp_change
end, true) end, true)
minetest.register_on_respawnplayer(function(player)
local pos = player:get_pos()
minetest.add_particlespawner({
amount = 50,
time = 0.001,
minpos = vector.add(pos, 0),
maxpos = vector.add(pos, 0),
minvel = vector.new(-5,-5,-5),
maxvel = vector.new(5,5,5),
minexptime = 1.1,
maxexptime = 1.5,
minsize = 1,
maxsize = 2,
collisiondetection = false,
vertical = false,
texture = "mcl_particles_mob_death.png^[colorize:#000000:255",
})
minetest.sound_play("mcl_mobs_mob_poof", {
pos = pos,
gain = 1.0,
max_hear_distance = 8,
}, true)
end)

View file

@ -227,6 +227,9 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
if mcl_skins.skin_count <= 6 then if mcl_skins.skin_count <= 6 then
-- Change skin immediately if there are not many skins -- Change skin immediately if there are not many skins
mcl_skins.cycle_skin(player) mcl_skins.cycle_skin(player)
if player:get_attach() ~= nil then
mcl_player.player_set_animation(player, "sit")
end
else else
-- Show skin selection formspec otherwise -- Show skin selection formspec otherwise
mcl_skins.show_formspec(player:get_player_name()) mcl_skins.show_formspec(player:get_player_name())
@ -237,7 +240,7 @@ end)
mcl_skins.show_formspec = function(playername) mcl_skins.show_formspec = function(playername)
local formspec = "size[7,8.5]" local formspec = "size[7,8.5]"
formspec = formspec .. "label[2,2;" .. minetest.formspec_escape(minetest.colorize("#383838", S("Select player skin:"))) .. "]" formspec = formspec .. "label[2,2;" .. minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Select player skin:"))) .. "]"
.. "textlist[0,2.5;6.8,6;skins_set;" .. "textlist[0,2.5;6.8,6;skins_set;"
local meta local meta
@ -265,7 +268,7 @@ mcl_skins.show_formspec = function(playername)
if meta then if meta then
if meta.name and meta.name ~= "" then if meta.name and meta.name ~= "" then
formspec = formspec .. "label[2,0.5;" .. minetest.formspec_escape(minetest.colorize("#383838", S("Name: @1", meta.name))) .. "]" formspec = formspec .. "label[2,0.5;" .. minetest.formspec_escape(minetest.colorize(mcl_colors.DARK_GRAY, S("Name: @1", meta.name))) .. "]"
end end
end end
@ -294,4 +297,3 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end) end)
minetest.log("action", "[mcl_skins] Mod initialized with "..mcl_skins.skin_count.." custom skin(s)") minetest.log("action", "[mcl_skins] Mod initialized with "..mcl_skins.skin_count.." custom skin(s)")

View file

@ -81,13 +81,7 @@ local dir_step = storage:get_int("mcl_spawn_dir_step") or 0
local dir_ind = storage:get_int("mcl_spawn_dir_ind") or 1 local dir_ind = storage:get_int("mcl_spawn_dir_ind") or 1
local emerge_pos1, emerge_pos2 local emerge_pos1, emerge_pos2
-- Get world 'mapgen_limit' and 'chunksize' to calculate 'spawn_limit'. local spawn_limit = mcl_vars.mapgen_edge_max
-- This accounts for how mapchunks are not generated if they or their shell exceed
-- 'mapgen_limit'.
local mapgen_limit = tonumber(minetest.get_mapgen_setting("mapgen_limit"))
local chunksize = tonumber(minetest.get_mapgen_setting("chunksize"))
local spawn_limit = math.max(mapgen_limit - (chunksize + 1) * 16, 0)
--Functions --Functions
@ -503,10 +497,17 @@ function mcl_spawn.shadow_worker()
mcl_spawn.search() mcl_spawn.search()
minetest.log("action", "[mcl_spawn] Started world spawn point search") minetest.log("action", "[mcl_spawn] Started world spawn point search")
end end
if success and ((not good_for_respawn(wsp)) or (not can_find_tree(wsp))) then
success = false if success then
minetest.log("action", "[mcl_spawn] World spawn position isn't safe anymore: "..minetest.pos_to_string(wsp)) local wsp_node = minetest.get_node(wsp)
mcl_spawn.search() if wsp_node and wsp_node.name == "ignore" then
-- special case - respawn area unloaded from memory - it's okay, skip for now
elseif ((not good_for_respawn(wsp)) or ((no_trees_area_counter >= 0) and not can_find_tree(wsp))) then
success = false
minetest.log("action", "[mcl_spawn] World spawn position isn't safe anymore: "..minetest.pos_to_string(wsp))
mcl_spawn.search()
end
end end
minetest.after(respawn_search_interval, mcl_spawn.shadow_worker) minetest.after(respawn_search_interval, mcl_spawn.shadow_worker)