Merge branch 'master' of https://git.minetest.land/Wuzzy/MineClone2 into crossbow

This commit is contained in:
Lizzy Fleckenstein 2021-03-24 08:23:51 +01:00
commit 914e59dfb3
6 changed files with 33 additions and 19 deletions

View File

@ -178,6 +178,10 @@ end
-- Add the groupcaps from a field in "_mcl_diggroups" to the groupcaps of a
-- tool.
local function add_groupcaps(toolname, groupcaps, groupcaps_def, efficiency)
if not groupcaps_def then
return
end
for g, capsdef in pairs(groupcaps_def) do
local mult = capsdef.speed or 1
local uses = capsdef.uses
@ -196,7 +200,6 @@ local function add_groupcaps(toolname, groupcaps, groupcaps_def, efficiency)
groupcaps[g .. "_dig"] = get_groupcap(g, level > 0, mult, efficiency, uses)
end
end
return groupcaps
end
-- Checks if the given node would drop its useful drop if dug by a given tool.

View File

@ -2,6 +2,7 @@ tt = {}
tt.COLOR_DEFAULT = "#d0ffd0"
tt.COLOR_DANGER = "#ffff00"
tt.COLOR_GOOD = "#00ff00"
tt.NAME_COLOR = "#FFFF4C"
-- API
tt.registered_snippets = {}
@ -63,12 +64,15 @@ tt.reload_itemstack_description = function(itemstack)
local meta = itemstack:get_meta()
if def and def._mcl_generate_description then
def._mcl_generate_description(itemstack)
elseif should_change(itemstring, def) and meta:get_string("name") == "" then
elseif should_change(itemstring, def) then
local toolcaps
if def.tool_capabilities then
toolcaps = itemstack:get_tool_capabilities()
end
local orig_desc = def._tt_original_description or def.description
if meta:get_string("name") ~= "" then
orig_desc = minetest.colorize(tt.NAME_COLOR, meta:get_string("name"))
end
local desc = apply_snippets(orig_desc, itemstring, toolcaps or def.tool_capabilities, itemstack)
if desc ~= orig_desc then
meta:set_string("description", desc)

View File

@ -9,7 +9,6 @@ local MATERIAL_TOOL_REPAIR_BOOST = {
math.ceil(MAX_WEAR * 0.75), -- 75%
MAX_WEAR, -- 100%
}
local NAME_COLOR = "#FFFF4C"
local function get_anvil_formspec(set_name)
if not set_name then
@ -172,14 +171,8 @@ local function update_anvil_slots(meta)
if new_name ~= old_name then
-- Save the raw name internally
meta:set_string("name", new_name)
-- Rename item
if new_name == "" then
tt.reload_itemstack_description(name_item)
else
-- Custom name set. Colorize it!
-- This makes the name visually different from unnamed items
meta:set_string("description", minetest.colorize(NAME_COLOR, new_name))
end
-- Rename item handled by tt
tt.reload_itemstack_description(name_item)
new_output = name_item
elseif just_rename then
new_output = ""

View File

@ -45,7 +45,7 @@ end
-- To make it more efficient it will first check a hash value to determine if
-- the tool needs to be updated.
function mcl_enchanting.update_groupcaps(itemstack)
if not itemstack:get_tool_capabilities() then
if not itemstack:get_meta():get("tool_capabilities") then
return
end

View File

@ -436,6 +436,21 @@ local function ecb_scan_area_2(blockpos, action, calls_remaining, param)
local pos0, distance
local lava = get_lava_level(pos, pos1, pos2)
-- THIS IS A TEMPORATY CODE SECTION FOR COMPATIBILITY REASONS --
local portals = find_nodes_in_area(pos1, pos2, {PORTAL})
if portals and #portals>0 then
for _, p in pairs(portals) do
add_exit(p)
end
local exit = find_exit(pos)
if exit then
finalize_teleport(obj, exit)
end
return
end
-- TEMPORATY CODE SECTION ENDS HERE --
local nodes = find_nodes_in_area_under_air(pos1, pos2, {"group:building_block"})
if nodes then
local nc = #nodes
@ -592,6 +607,11 @@ function mcl_portals.light_nether_portal(pos)
local orientation = random(0, 1)
for orientation_iteration = 1, 2 do
if check_and_light_shape(pos, orientation) then
minetest.after(0.2, function(pos) -- generate target map chunk
local pos1 = add(mul(mcl_vars.pos_to_chunk(pos), mcl_vars.chunk_size_in_nodes), mcl_vars.central_chunk_offset_in_nodes)
local pos2 = add(pos1, mcl_vars.chunk_size_in_nodes - 1)
minetest.emerge_area(pos1, pos2)
end, vector.new(pos))
return true
end
orientation = 1 - orientation

View File

@ -252,13 +252,7 @@ minetest.register_globalstep(function(dtime)
playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:surface", 0.4)
end
end
else
-- Reset speed decrease
playerphysics.remove_physics_factor(player, "speed", "mcl_playerplus:surface")
end
-- Swimming? Check if boots are enchanted with depth strider
if get_item_group(node_feet, "liquid") ~= 0 and mcl_enchanting.get_enchantment(player:get_inventory():get_stack("armor", 5), "depth_strider") then
elseif get_item_group(node_feet, "liquid") ~= 0 and mcl_enchanting.get_enchantment(player:get_inventory():get_stack("armor", 5), "depth_strider") then
local boots = player:get_inventory():get_stack("armor", 5)
local depth_strider = mcl_enchanting.get_enchantment(boots, "depth_strider")