Skip to content

Commit

Permalink
Chainsaw: new setting to disable safe cutting
Browse files Browse the repository at this point in the history
Some trees might generate with param2 != 0, which makes the
chainsaw appear blunt/useless. This safety feature is now
customizable.
  • Loading branch information
SmallJoker committed Aug 26, 2023
1 parent 0921c32 commit dfcf64c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 9 additions & 0 deletions settingtypes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Safety feature for the chainsaw tool aimed to prevent cutting structures
# built by players.
#
# Trunk nodes generated by mapgen have a rotation of '0' whereas manually
# placed trunks usually have another value. However, some mods might generate
# trees with rotation != 0, which renders the chainsaw useless on them.
#
# Disabling this feature will sacrifice safety for convenience.
technic_safe_chainsaw (Chainsaw safety feature) bool true
3 changes: 2 additions & 1 deletion technic/tools/chainsaw.lua
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ local cutter = {
-- See function cut_tree()
}

local safe_cut = minetest.settings:get_bool("technic_safe_chainsaw") ~= false
local c_air = minetest.get_content_id("air")
local function dig_recursive(x, y, z)
local i = cutter.area:index(x, y, z)
Expand All @@ -124,7 +125,7 @@ local function dig_recursive(x, y, z)
end
cutter.seen[i] = 1 -- Mark as visited

if cutter.param2[i] ~= 0 then
if safe_cut and cutter.param2[i] ~= 0 then
-- Do not dig manually placed nodes
-- Problem: moretrees' generated jungle trees use param2 = 2
return
Expand Down

0 comments on commit dfcf64c

Please sign in to comment.