Merge branch 'master' into damage

This commit is contained in:
Elias Fleckenstein 2021-04-17 18:39:00 +02:00
commit 7c7af7d664
2 changed files with 25 additions and 11 deletions

View file

@ -352,7 +352,14 @@ minetest.register_tool("mcl_tools:shovel_diamond", {
}) })
-- Axes -- Axes
local make_stripped_trunk_add_wear = function(itemstack, placer)
if not minetest.is_creative_enabled(placer:get_player_name()) then
-- Add wear (as if digging a axey node)
local toolname = itemstack:get_name()
local wear = mcl_autogroup.get_wear(toolname, "axey")
itemstack:add_wear(wear)
end
end
local make_stripped_trunk = function(itemstack, placer, pointed_thing) local make_stripped_trunk = function(itemstack, placer, pointed_thing)
if pointed_thing.type == "node" then if pointed_thing.type == "node" then
local pos = minetest.get_pointed_thing_position(pointed_thing) local pos = minetest.get_pointed_thing_position(pointed_thing)
@ -367,36 +374,42 @@ local make_stripped_trunk = function(itemstack, placer, pointed_thing)
minetest.record_protection_violation(pointed_thing.under, placer:get_player_name()) minetest.record_protection_violation(pointed_thing.under, placer:get_player_name())
return itemstack return itemstack
end end
if not minetest.is_creative_enabled(placer:get_player_name()) then
-- Add wear (as if digging a axey node)
local toolname = itemstack:get_name()
local wear = mcl_autogroup.get_wear(toolname, "axey")
itemstack:add_wear(wear)
end
if node_name == "mcl_core:tree" then if node_name == "mcl_core:tree" then
minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_oak"}) minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_oak"})
make_stripped_trunk_add_wear(itemstack, placer)
elseif node_name == "mcl_core:darktree" then elseif node_name == "mcl_core:darktree" then
minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_dark_oak"}) minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_dark_oak"})
make_stripped_trunk_add_wear(itemstack, placer)
elseif node_name == "mcl_core:acaciatree" then elseif node_name == "mcl_core:acaciatree" then
minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_acacia"}) minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_acacia"})
make_stripped_trunk_add_wear(itemstack, placer)
elseif node_name == "mcl_core:birchtree" then elseif node_name == "mcl_core:birchtree" then
minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_birch"}) minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_birch"})
make_stripped_trunk_add_wear(itemstack, placer)
elseif node_name == "mcl_core:sprucetree" then elseif node_name == "mcl_core:sprucetree" then
minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_spruce"}) minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_spruce"})
make_stripped_trunk_add_wear(itemstack, placer)
elseif node_name == "mcl_core:jungletree" then elseif node_name == "mcl_core:jungletree" then
minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_jungle"}) minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_jungle"})
make_stripped_trunk_add_wear(itemstack, placer)
elseif node_name == "mcl_core:tree_bark" then elseif node_name == "mcl_core:tree_bark" then
minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_oak_bark"}) minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_oak_bark"})
make_stripped_trunk_add_wear(itemstack, placer)
elseif node_name == "mcl_core:darktree_bark" then elseif node_name == "mcl_core:darktree_bark" then
minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_dark_oak_bark"}) minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_dark_oak_bark"})
make_stripped_trunk_add_wear(itemstack, placer)
elseif node_name == "mcl_core:acaciatree_bark" then elseif node_name == "mcl_core:acaciatree_bark" then
minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_acacia_bark"}) minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_acacia_bark"})
make_stripped_trunk_add_wear(itemstack, placer)
elseif node_name == "mcl_core:birchtree_bark" then elseif node_name == "mcl_core:birchtree_bark" then
minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_birch_bark"}) minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_birch_bark"})
make_stripped_trunk_add_wear(itemstack, placer)
elseif node_name == "mcl_core:sprucetree_bark" then elseif node_name == "mcl_core:sprucetree_bark" then
minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_spruce_bark"}) minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_spruce_bark"})
make_stripped_trunk_add_wear(itemstack, placer)
elseif node_name == "mcl_core:jungletree_bark" then elseif node_name == "mcl_core:jungletree_bark" then
minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_jungle_bark"}) minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_jungle_bark"})
make_stripped_trunk_add_wear(itemstack, placer)
end end
end end
return itemstack return itemstack

View file

@ -185,10 +185,11 @@ minetest.register_globalstep(function(dtime)
player_vel_yaw = limit_vel_yaw(player_vel_yaw, yaw) player_vel_yaw = limit_vel_yaw(player_vel_yaw, yaw)
player_vel_yaws[name] = player_vel_yaw player_vel_yaws[name] = player_vel_yaw
if minetest.get_node_or_nil({x=player:get_pos().x, y=player:get_pos().y - 0.5, z=player:get_pos().z}) then local pos = player:get_pos()
node_stand_return = minetest.get_node_or_nil({x=player:get_pos().x, y=player:get_pos().y - 0.1, z=player:get_pos().z}).name local node = minetest.get_node_or_nil({x = pos.x, y = pos.y - 0.5, z = pos.z})
else
-- minetest.log("action", "somehow player got of loaded areas") if node then
node_stand_return = node.name
end end
local chestplate = player:get_inventory():get_stack("armor", 3) local chestplate = player:get_inventory():get_stack("armor", 3)