8000 compatibility with other mods (mainly pipeworks) by mazes-80 · Pull Request #10 · joe7575/lumberjack · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

compatibility with other mods (mainly pipeworks) #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ local function chopper_tool(digger)
if tool then
local caps = tool:get_tool_capabilities()
if caps.groupcaps and caps.groupcaps.choppy and caps.groupcaps.choppy.maxlevel then
return caps.groupcaps.choppy.maxlevel < 3
-- diamond axe returns 3
return caps.groupcaps.choppy.maxlevel <= 3
end
end
end
Expand Down Expand Up @@ -125,6 +126,11 @@ end

local function get_points(player)
if player and player.is_player and player:is_player() then
-- Test if we got an automatised tool like nodebreaker from pipeworks
-- always allow lumberjack point with this workaroud
if not player.get_meta then
return -1,-1
end
local meta = player:get_meta()

if not meta:contains("lumberjack_tree_points") then
Expand Down Expand Up @@ -163,7 +169,7 @@ end
--
local function after_dig_tree(digger)
local tree_points, sapl_points = get_points(digger)
if tree_points then
if tree_points and digger.get_meta then
tree_points = tree_points - 1
local meta = digger:get_meta()
meta:set_int("lumberjack_tree_points", tree_points)
Expand All @@ -177,7 +183,7 @@ end
--
local function after_place_sapling(pos, placer)
local tree_points, sapl_points = get_points(placer)
if sapl_points then
if sapl_points and placer.get_meta then
sapl_points = sapl_points - 1
local meta = placer:get_meta()
meta:set_int("lumberjack_sapl_points", sapl_points)
Expand Down
0