From dfcf64c1d07f4006045af37b0b01dbfc82dbb1d1 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Sat, 26 Aug 2023 10:57:03 +0200 Subject: [PATCH] Chainsaw: new setting to disable safe cutting Some trees might generate with param2 != 0, which makes the chainsaw appear blunt/useless. This safety feature is now customizable. --- settingtypes.txt | 9 +++++++++ technic/tools/chainsaw.lua | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 settingtypes.txt diff --git a/settingtypes.txt b/settingtypes.txt new file mode 100644 index 0000000..4764c88 --- /dev/null +++ b/settingtypes.txt @@ -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 diff --git a/technic/tools/chainsaw.lua b/technic/tools/chainsaw.lua index 2e12614..d2ee966 100644 --- a/technic/tools/chainsaw.lua +++ b/technic/tools/chainsaw.lua @@ -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) @@ -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