0
0
Fork 0

Merge branch 'master' into damage

This commit is contained in:
Lizzy 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
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)
if pointed_thing.type == "node" then
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())
return itemstack
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
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
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
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
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
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
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
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
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
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
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
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
minetest.swap_node(pointed_thing.under, {name="mcl_core:stripped_jungle_bark"})
make_stripped_trunk_add_wear(itemstack, placer)
end
end
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_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
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
else
-- minetest.log("action", "somehow player got of loaded areas")
local pos = player:get_pos()
local node = minetest.get_node_or_nil({x = pos.x, y = pos.y - 0.5, z = pos.z})
if node then
node_stand_return = node.name
end
local chestplate = player:get_inventory():get_stack("armor", 3)