Merge remote-tracking branch 'origin/master' into mineclone5

This commit is contained in:
kay27 2021-04-15 15:50:38 +04:00
commit 93429549b8
12 changed files with 195 additions and 79 deletions

View file

@ -30,13 +30,14 @@ local skeleton = {
"mcl_bows_bow_0.png", -- bow "mcl_bows_bow_0.png", -- bow
"mobs_mc_skeleton.png", -- skeleton "mobs_mc_skeleton.png", -- skeleton
} }, } },
visual_size = {x=3, y=3}, visual_size = {x=1, y=1},
makes_footstep_sound = true, makes_footstep_sound = true,
sounds = { textures = {
random = "mobs_mc_skeleton_random", {
death = "mobs_mc_skeleton_death", "mobs_mc_empty.png", -- armor
damage = "mobs_mc_skeleton_hurt", "mobs_mc_skeleton.png", -- texture
distance = 16, "mcl_bows_bow_0.png", -- wielded_item
}
}, },
walk_velocity = 1.2, walk_velocity = 1.2,
run_velocity = 2.4, run_velocity = 2.4,
@ -111,9 +112,9 @@ local stray = table.copy(skeleton)
stray.mesh = "mobs_mc_stray.b3d" stray.mesh = "mobs_mc_stray.b3d"
stray.textures = { stray.textures = {
{ {
"mcl_bows_bow_0.png",
"mobs_mc_stray.png",
"mobs_mc_stray_overlay.png", "mobs_mc_stray_overlay.png",
"mobs_mc_stray.png",
"mcl_bows_bow_0.png",
}, },
} }
-- TODO: different sound (w/ echo) -- TODO: different sound (w/ echo)

View file

@ -25,11 +25,12 @@ mobs:register_mob("mobs_mc:witherskeleton", {
mesh = "mobs_mc_witherskeleton.b3d", mesh = "mobs_mc_witherskeleton.b3d",
textures = { textures = {
{ {
"default_tool_stonesword.png", -- sword "mobs_mc_empty.png", -- armor
"mobs_mc_wither_skeleton.png", -- wither skeleton "mobs_mc_wither_skeleton.png", -- wither skeleton
"default_tool_stonesword.png", -- sword
} }
}, },
visual_size = {x=3.6, y=3.6}, visual_size = {x=1.2, y=1.2},
makes_footstep_sound = true, makes_footstep_sound = true,
sounds = { sounds = {
random = "mobs_mc_skeleton_random", random = "mobs_mc_skeleton_random",

View file

@ -58,7 +58,11 @@ local zombie = {
visual = "mesh", visual = "mesh",
mesh = "mobs_mc_zombie.b3d", mesh = "mobs_mc_zombie.b3d",
textures = { textures = {
{"mobs_mc_zombie.png"}, {
"mobs_mc_empty.png", -- armor
"mobs_mc_zombie.png", -- texture
"mobs_mc_empty.png", -- wielded_item
}
}, },
visual_size = {x=3, y=3}, visual_size = {x=3, y=3},
makes_footstep_sound = true, makes_footstep_sound = true,
@ -111,7 +115,13 @@ mobs:register_mob("mobs_mc:baby_zombie", baby_zombie)
-- Husk. -- Husk.
-- Desert variant of the zombie -- Desert variant of the zombie
local husk = table.copy(zombie) local husk = table.copy(zombie)
husk.textures = {{"mobs_mc_husk.png"}} husk.textures = {
{
"mobs_mc_empty.png", -- armor
"mobs_mc_husk.png", -- texture
"mobs_mc_empty.png", -- wielded_item
}
}
husk.ignited_by_sunlight = false husk.ignited_by_sunlight = false
husk.sunlight_damage = 0 husk.sunlight_damage = 0
husk.drops = drops_common husk.drops = drops_common

Binary file not shown.

Before

Width:  |  Height:  |  Size: 746 B

After

Width:  |  Height:  |  Size: 271 B

View file

@ -35,6 +35,49 @@ mcl_banners.colors = {
["unicolor_light_blue"] = {"light_blue", S("Light Blue Banner"), "mcl_wool:light_blue", "#4040CF", "mcl_dye:lightblue", N("Light Blue") }, ["unicolor_light_blue"] = {"light_blue", S("Light Blue Banner"), "mcl_wool:light_blue", "#4040CF", "mcl_dye:lightblue", N("Light Blue") },
} }
local pattern_names = {
"",
"border",
"bricks",
"circle",
"creeper",
"cross",
"curly_border",
"diagonal_up_left",
"diagonal_up_right",
"diagonal_right",
"diagonal_left",
"flower",
"gradient",
"gradient_up",
"half_horizontal_bottom",
"half_horizontal",
"half_vertical",
"half_vertical_right",
"thing",
"rhombus",
"skull",
"small_stripes",
"square_bottom_left",
"square_bottom_right",
"square_top_left",
"square_top_right",
"straight_cross",
"stripe_bottom",
"stripe_center",
"stripe_downleft",
"stripe_downright",
"stripe_left",
"stripe_middle",
"stripe_right",
"stripe_top",
"triangle_bottom",
"triangle_top",
"triangles_bottom",
"triangles_top",
}
local colors_reverse = {} local colors_reverse = {}
for k,v in pairs(mcl_banners.colors) do for k,v in pairs(mcl_banners.colors) do
colors_reverse["mcl_banners:banner_item_"..v[1]] = k colors_reverse["mcl_banners:banner_item_"..v[1]] = k
@ -300,24 +343,72 @@ minetest.register_node("mcl_banners:hanging_banner", {
end, end,
}) })
-- for pattern_name, pattern in pairs(patterns) do
for colorid, colortab in pairs(mcl_banners.colors) do for colorid, colortab in pairs(mcl_banners.colors) do
for i, pattern_name in ipairs(pattern_names) do
local itemid = colortab[1] local itemid = colortab[1]
local desc = colortab[2] local desc = colortab[2]
local wool = colortab[3] local wool = colortab[3]
local colorize = colortab[4] local colorize = colortab[4]
local itemstring = "mcl_banners:banner_item_"..itemid local itemstring
local inv if pattern_name == "" then
if colorize then itemstring = "mcl_banners:banner_item_" .. itemid
inv = "mcl_banners_item_base.png^(mcl_banners_item_overlay.png^[colorize:"..colorize..")"
else else
inv = "mcl_banners_item_base.png^mcl_banners_item_overlay.png" itemstring = "mcl_banners:banner_preview" .. "_" .. pattern_name .. "_" .. itemid
end end
local inv
local base
local finished_banner
if pattern_name == "" then
if colorize then
-- Base texture with base color
base = "mcl_banners_item_base.png^(mcl_banners_item_overlay.png^[colorize:"..colorize..")^[resize:32x32"
else
base = "mcl_banners_item_base.png^mcl_banners_item_overlay.png^[resize:32x32"
end
finished_banner = base
else
-- Banner item preview background
base = "mcl_banners_item_base.png^(mcl_banners_item_overlay.png^[colorize:#CCCCCC)^[resize:32x32"
desc = S("Preview Banner")
local pattern = "mcl_banners_" .. pattern_name .. ".png"
local color = colorize
-- Generate layer texture
-- TODO: The layer texture in the icon is squished
-- weirdly because the width/height aspect ratio of
-- the banner icon is 1:1.5, whereas the aspect ratio
-- of the banner entity is 1:2. A solution would be to
-- redraw the pattern textures as low-resolution pixel
-- art and use that instead.
local layer = "(([combine:20x40:-2,-2="..pattern.."^[resize:16x24^[colorize:"..color..":"..layer_ratio.."))"
function escape(text)
return text:gsub("%^", "\\%^"):gsub(":", "\\:") -- :gsub("%(", "\\%("):gsub("%)", "\\%)")
end
finished_banner = "[combine:32x32:0,0=" .. escape(base) .. ":8,4=" .. escape(layer)
end
inv = finished_banner
-- Banner items. -- Banner items.
-- This is the player-visible banner item. It comes in 16 base colors. -- This is the player-visible banner item. It comes in 16 base colors with a lot of patterns.
-- The multiple items are really only needed for the different item images. -- The multiple items are really only needed for the different item images.
-- TODO: Combine the items into only 1 item. -- TODO: Combine the items into only 1 item.
local groups
if pattern_name == "" then
groups = { banner = 1, deco_block = 1, flammable = -1 }
else
groups = { not_in_creative_inventory = 1 }
end
minetest.register_craftitem(itemstring, { minetest.register_craftitem(itemstring, {
description = desc, description = desc,
_tt_help = S("Paintable decoration"), _tt_help = S("Paintable decoration"),
@ -326,7 +417,7 @@ for colorid, colortab in pairs(mcl_banners.colors) do
wield_image = inv, wield_image = inv,
-- Banner group groups together the banner items, but not the nodes. -- Banner group groups together the banner items, but not the nodes.
-- Used for crafting. -- Used for crafting.
groups = { banner = 1, deco_block = 1, flammable = -1 }, groups = groups,
stack_max = 16, stack_max = 16,
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
@ -492,6 +583,7 @@ for colorid, colortab in pairs(mcl_banners.colors) do
-- Add item to node alias -- Add item to node alias
doc.add_entry_alias("nodes", "mcl_banners:standing_banner", "craftitems", itemstring) doc.add_entry_alias("nodes", "mcl_banners:standing_banner", "craftitems", itemstring)
end end
end
end end
if minetest.get_modpath("doc") then if minetest.get_modpath("doc") then

View file

@ -253,6 +253,11 @@ for colorid, colortab in pairs(mcl_banners.colors) do
dye_to_colorid_mapping[colortab[5]] = colorid dye_to_colorid_mapping[colortab[5]] = colorid
end end
local dye_to_itemid_mapping = {}
for colorid, colortab in pairs(mcl_banners.colors) do
dye_to_itemid_mapping[colortab[5]] = colortab[1]
end
-- Create a banner description containing all the layer names -- Create a banner description containing all the layer names
mcl_banners.make_advanced_banner_description = function(description, layers) mcl_banners.make_advanced_banner_description = function(description, layers)
if layers == nil or #layers == 0 then if layers == nil or #layers == 0 then
@ -491,7 +496,14 @@ local banner_pattern_craft = function(itemstack, player, old_craft_grid, craft_i
imeta:set_string("description", ometa:get_string("description")) imeta:set_string("description", ometa:get_string("description"))
imeta:set_string("name", mname) imeta:set_string("name", mname)
end end
if craft_predict then
local itemid_prefix = "mcl_banners:banner_preview"
local coloritemid = dye_to_itemid_mapping[dye]
return ItemStack(itemid_prefix .. "_" .. matching_pattern .. "_" .. coloritemid)
else
return itemstack return itemstack
end
end end
minetest.register_craft_predict(function(itemstack, player, old_craft_grid, craft_inv) minetest.register_craft_predict(function(itemstack, player, old_craft_grid, craft_inv)