forked from VoxeLibre/VoxeLibre
Merge branch 'master' of https://git.minetest.land/Wuzzy/MineClone2 into crossbow
This commit is contained in:
commit
914e59dfb3
|
@ -178,6 +178,10 @@ end
|
||||||
-- Add the groupcaps from a field in "_mcl_diggroups" to the groupcaps of a
|
-- Add the groupcaps from a field in "_mcl_diggroups" to the groupcaps of a
|
||||||
-- tool.
|
-- tool.
|
||||||
local function add_groupcaps(toolname, groupcaps, groupcaps_def, efficiency)
|
local function add_groupcaps(toolname, groupcaps, groupcaps_def, efficiency)
|
||||||
|
if not groupcaps_def then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
for g, capsdef in pairs(groupcaps_def) do
|
for g, capsdef in pairs(groupcaps_def) do
|
||||||
local mult = capsdef.speed or 1
|
local mult = capsdef.speed or 1
|
||||||
local uses = capsdef.uses
|
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)
|
groupcaps[g .. "_dig"] = get_groupcap(g, level > 0, mult, efficiency, uses)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return groupcaps
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Checks if the given node would drop its useful drop if dug by a given tool.
|
-- Checks if the given node would drop its useful drop if dug by a given tool.
|
||||||
|
|
|
@ -2,6 +2,7 @@ tt = {}
|
||||||
tt.COLOR_DEFAULT = "#d0ffd0"
|
tt.COLOR_DEFAULT = "#d0ffd0"
|
||||||
tt.COLOR_DANGER = "#ffff00"
|
tt.COLOR_DANGER = "#ffff00"
|
||||||
tt.COLOR_GOOD = "#00ff00"
|
tt.COLOR_GOOD = "#00ff00"
|
||||||
|
tt.NAME_COLOR = "#FFFF4C"
|
||||||
|
|
||||||
-- API
|
-- API
|
||||||
tt.registered_snippets = {}
|
tt.registered_snippets = {}
|
||||||
|
@ -63,12 +64,15 @@ tt.reload_itemstack_description = function(itemstack)
|
||||||
local meta = itemstack:get_meta()
|
local meta = itemstack:get_meta()
|
||||||
if def and def._mcl_generate_description then
|
if def and def._mcl_generate_description then
|
||||||
def._mcl_generate_description(itemstack)
|
def._mcl_generate_description(itemstack)
|
||||||
elseif should_change(itemstring, def) and meta:get_string("name") == "" then
|
elseif should_change(itemstring, def) then
|
||||||
local toolcaps
|
local toolcaps
|
||||||
if def.tool_capabilities then
|
if def.tool_capabilities then
|
||||||
toolcaps = itemstack:get_tool_capabilities()
|
toolcaps = itemstack:get_tool_capabilities()
|
||||||
end
|
end
|
||||||
local orig_desc = def._tt_original_description or def.description
|
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)
|
local desc = apply_snippets(orig_desc, itemstring, toolcaps or def.tool_capabilities, itemstack)
|
||||||
if desc ~= orig_desc then
|
if desc ~= orig_desc then
|
||||||
meta:set_string("description", desc)
|
meta:set_string("description", desc)
|
||||||
|
|
|
@ -9,7 +9,6 @@ local MATERIAL_TOOL_REPAIR_BOOST = {
|
||||||
math.ceil(MAX_WEAR * 0.75), -- 75%
|
math.ceil(MAX_WEAR * 0.75), -- 75%
|
||||||
MAX_WEAR, -- 100%
|
MAX_WEAR, -- 100%
|
||||||
}
|
}
|
||||||
local NAME_COLOR = "#FFFF4C"
|
|
||||||
|
|
||||||
local function get_anvil_formspec(set_name)
|
local function get_anvil_formspec(set_name)
|
||||||
if not set_name then
|
if not set_name then
|
||||||
|
@ -172,14 +171,8 @@ local function update_anvil_slots(meta)
|
||||||
if new_name ~= old_name then
|
if new_name ~= old_name then
|
||||||
-- Save the raw name internally
|
-- Save the raw name internally
|
||||||
meta:set_string("name", new_name)
|
meta:set_string("name", new_name)
|
||||||
-- Rename item
|
-- Rename item handled by tt
|
||||||
if new_name == "" then
|
|
||||||
tt.reload_itemstack_description(name_item)
|
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
|
|
||||||
new_output = name_item
|
new_output = name_item
|
||||||
elseif just_rename then
|
elseif just_rename then
|
||||||
new_output = ""
|
new_output = ""
|
||||||
|
|
|
@ -45,7 +45,7 @@ end
|
||||||
-- To make it more efficient it will first check a hash value to determine if
|
-- To make it more efficient it will first check a hash value to determine if
|
||||||
-- the tool needs to be updated.
|
-- the tool needs to be updated.
|
||||||
function mcl_enchanting.update_groupcaps(itemstack)
|
function mcl_enchanting.update_groupcaps(itemstack)
|
||||||
if not itemstack:get_tool_capabilities() then
|
if not itemstack:get_meta():get("tool_capabilities") then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -436,6 +436,21 @@ 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 --
|
||||||
|
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"})
|
local nodes = find_nodes_in_area_under_air(pos1, pos2, {"group:building_block"})
|
||||||
if nodes then
|
if nodes then
|
||||||
local nc = #nodes
|
local nc = #nodes
|
||||||
|
@ -592,6 +607,11 @@ function mcl_portals.light_nether_portal(pos)
|
||||||
local orientation = random(0, 1)
|
local orientation = random(0, 1)
|
||||||
for orientation_iteration = 1, 2 do
|
for orientation_iteration = 1, 2 do
|
||||||
if check_and_light_shape(pos, orientation) then
|
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
|
return true
|
||||||
end
|
end
|
||||||
orientation = 1 - orientation
|
orientation = 1 - orientation
|
||||||
|
|
|
@ -252,13 +252,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:surface", 0.4)
|
playerphysics.add_physics_factor(player, "speed", "mcl_playerplus:surface", 0.4)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
elseif get_item_group(node_feet, "liquid") ~= 0 and mcl_enchanting.get_enchantment(player:get_inventory():get_stack("armor", 5), "depth_strider") then
|
||||||
-- 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
|
|
||||||
local boots = player:get_inventory():get_stack("armor", 5)
|
local boots = player:get_inventory():get_stack("armor", 5)
|
||||||
local depth_strider = mcl_enchanting.get_enchantment(boots, "depth_strider")
|
local depth_strider = mcl_enchanting.get_enchantment(boots, "depth_strider")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue