Make chisel always available

This commit is contained in:
2025-12-09 14:44:26 +01:00
parent 4b2ecbabfc
commit 8a2d735aa6
8 changed files with 26 additions and 32 deletions

View File

@@ -2,9 +2,8 @@
Adds stripped tree trunks to minetest. Adds stripped tree trunks to minetest.
You can choose between use axes or chisel to get the stripped trees, chisel is enabled by default but you can disable it using the `stripped_tree_enable_chisel` game setting. Stripping is done with the Chisel tool (`stripped_tree:chisel`). If the setting `stripped_tree_strip_with_axe` is
enabled, axes can also be used as their secondary use.
If you are using a chisel just left click on the trunk. if you are using axes you get the stripped log with right click.
You can get string and paper from bark. You can get string and paper from bark.

View File

@@ -9,4 +9,4 @@ stripped_tree.register_strippable_trunk("default:pine_tree", "default:pine_wood"
-- Register axes -- Register axes
local axe_types = {"axe_wood", "axe_stone", "axe_bronze", "axe_steel", "axe_mese", "axe_diamond"} local axe_types = {"axe_wood", "axe_stone", "axe_bronze", "axe_steel", "axe_mese", "axe_diamond"}
if not stripped_tree.enable_chisel then stripped_tree.register_axes(mod_name, axe_types) end if stripped_tree.axes_strip_trees then stripped_tree.register_axes(mod_name, axe_types) end

View File

@@ -13,4 +13,4 @@ stripped_tree.register_strippable_trunk("ethereal:palm_trunk", "ethereal:palm_wo
-- Register axes -- Register axes
local axe_types = {"axe_crystal"} local axe_types = {"axe_crystal"}
if not stripped_tree.enable_chisel then stripped_tree.register_axes(mod_name, axe_types) end if stripped_tree.axes_strip_trees then stripped_tree.register_axes(mod_name, axe_types) end

View File

@@ -1,8 +1,5 @@
local S = core.get_translator(core.get_current_modname()) local S = core.get_translator(core.get_current_modname())
-- Select between chisel tool or axes.
stripped_tree.enable_chisel = core.settings:get_bool("stripped_tree_enable_chisel")
-- Function to verify that stripped tree trunk exists -- Function to verify that stripped tree trunk exists
stripped_tree.has_stripped = function(pos) stripped_tree.has_stripped = function(pos)
local node = core.get_node(pos).name or pos local node = core.get_node(pos).name or pos
@@ -98,7 +95,7 @@ function stripped_tree.maybe_strip_trunk(pos, player, tool, wear)
end end
-- Function to override axes -- Function to override axes
if stripped_tree.enable_chisel ~= true then if stripped_tree.axes_strip_trees then
function stripped_tree.register_axes(mod_n, axe_types) function stripped_tree.register_axes(mod_n, axe_types)
for _, axe_name in ipairs(axe_types) do for _, axe_name in ipairs(axe_types) do
core.override_item( core.override_item(

View File

@@ -1,5 +1,5 @@
-- Our own mod namespace -- Our own mod namespace
stripped_tree = {} stripped_tree = {axes_strip_trees = core.settings:get_bool("stripped_tree_strip_with_axe")}
-- Get our own path -- Get our own path
local mpath = core.get_modpath("stripped_tree") local mpath = core.get_modpath("stripped_tree")

View File

@@ -1,4 +1,4 @@
-- Register axes -- Register axes
local axe_types = {"axe_mithril", "axe_silver"} local axe_types = {"axe_mithril", "axe_silver"}
if not stripped_tree.enable_chisel then stripped_tree.register_axes("moreores", axe_types) end if stripped_tree.axes_strip_trees then stripped_tree.register_axes("moreores", axe_types) end

View File

@@ -19,30 +19,26 @@ core.register_craft(
) )
-- Register the chisel tool if its enabled in the config -- Register the chisel tool if its enabled in the config
if stripped_tree.enable_chisel then core.register_tool(
core.register_tool( "stripped_tree:chisel", {
"stripped_tree:chisel", { description = S("Chisel for tree trunks"),
description = S("Chisel for tree trunks"), inventory_image = "chisel.png",
inventory_image = "chisel.png", wield_image = "chisel.png",
wield_image = "chisel.png", sound = {breaks = "default_tool_breaks"},
sound = {breaks = "default_tool_breaks"}, stack_max = 1,
stack_max = 1, on_use = function(itemstack, user, pointed_thing)
on_use = function(itemstack, user, pointed_thing) if pointed_thing.type ~= "node" then return end
if pointed_thing.type ~= "node" then return end
local pos = pointed_thing.under local pos = pointed_thing.under
stripped_tree.maybe_strip_trunk(pos, user, itemstack, 65535 / 299) stripped_tree.maybe_strip_trunk(pos, user, itemstack, 65535 / 299)
return itemstack return itemstack
end, end,
} }
) )
core.register_craft( core.register_craft({output = "stripped_tree:chisel", recipe = {{"default:steel_ingot"}, {"screwdriver:screwdriver"}}})
{output = "stripped_tree:chisel", recipe = {{"default:steel_ingot"}, {"screwdriver:screwdriver"}}}
)
end
-- Recipes if the farming mod is loaded -- Recipes if the farming mod is loaded

View File

@@ -1,2 +1,4 @@
# Choose between using axes or chisels to get the stripped trees # Choose between using axes or chisels to get the stripped trees
stripped_tree_enable_chisel (Enable Chisel) bool true stripped_tree_enable_chisel (Enable Chisel [deprecated]) bool true
# If axes should be able to strip trees
stripped_tree_strip_with_axe (Strip trees with axes) bool false