Compare commits
5 Commits
texture-re
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 1e1c9a0fb4 | |||
| 97682b7df6 | |||
| 6f1d331771 | |||
| 880a60b7e0 | |||
| 52c4bc4391 |
@@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
Adds stripped tree trunks to minetest.
|
Adds stripped tree trunks to minetest.
|
||||||
|
|
||||||
Stripping is done with the Chisel tool (`stripped_tree:chisel`). If the setting `stripped_tree_strip_with_axe` is
|
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.
|
||||||
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.
|
||||||
|
|
||||||
|
|||||||
@@ -41,13 +41,6 @@ core.register_node(
|
|||||||
core.get_node_timer(pos):start(1.0)
|
core.get_node_timer(pos):start(1.0)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
can_dig = function(pos)
|
|
||||||
local meta = core.get_meta(pos)
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
|
|
||||||
return inv:is_empty("dst") and inv:is_empty("src")
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
local inv = core.get_meta(pos):get_inventory()
|
local inv = core.get_meta(pos):get_inventory()
|
||||||
local src_stack = inv:get_stack("src", 1)
|
local src_stack = inv:get_stack("src", 1)
|
||||||
|
|||||||
65
default.lua
@@ -1,19 +1,58 @@
|
|||||||
|
-- Register tree bark
|
||||||
|
core.register_craftitem(
|
||||||
|
":default:tree_bark",
|
||||||
|
{description = "Tree bark", inventory_image = "tree_bark.png", groups = {not_in_creative_inventory = 1}}
|
||||||
|
)
|
||||||
|
|
||||||
|
-- Register bark as fuel
|
||||||
|
core.register_craft({type = "fuel", recipe = "default:tree_bark", burntime = 15})
|
||||||
|
|
||||||
|
-- Register craft for string
|
||||||
|
if core.get_modpath("farming") then
|
||||||
|
core.register_craft(
|
||||||
|
{
|
||||||
|
output = "farming:string 4",
|
||||||
|
recipe = {
|
||||||
|
{"default:tree_bark", "default:tree_bark", "default:tree_bark"},
|
||||||
|
{"default:tree_bark", "default:tree_bark", "default:tree_bark"},
|
||||||
|
{"default:tree_bark", "default:tree_bark", "default:tree_bark"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Register craft for paper
|
||||||
|
core.register_craft(
|
||||||
|
{
|
||||||
|
output = "default:paper 8",
|
||||||
|
recipe = {
|
||||||
|
{"default:tree_bark", "default:tree_bark", "default:tree_bark"},
|
||||||
|
{"default:tree_bark", "bucket:bucket_water", "default:tree_bark"},
|
||||||
|
{"default:tree_bark", "default:tree_bark", "default:tree_bark"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
-- Register craft for mulch
|
||||||
|
if core.get_modpath("bonemeal") then
|
||||||
|
core.register_craft(
|
||||||
|
{
|
||||||
|
output = "bonemeal:mulch 4",
|
||||||
|
recipe = {
|
||||||
|
{"default:tree_bark", "default:tree_bark", "default:tree_bark"},
|
||||||
|
{"default:tree_bark", "default:tree_bark", "default:tree_bark"},
|
||||||
|
{"", "", ""},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
-- Register stripped trees
|
-- Register stripped trees
|
||||||
local mod_name = "default"
|
local mod_name = "default"
|
||||||
|
local trunk_names = {"tree", "jungletree", "aspen_tree", "acacia_tree", "pine_tree"}
|
||||||
|
|
||||||
stripped_tree.register_strippable_trunk("default:tree", "default:wood")
|
stripped_tree.register_trunk(mod_name, trunk_names)
|
||||||
stripped_tree.register_strippable_trunk("default:jungletree", "default:junglewood")
|
|
||||||
stripped_tree.register_strippable_trunk("default:aspen_tree", "default:aspen_wood")
|
|
||||||
stripped_tree.register_strippable_trunk("default:acacia_tree", "default:acacia_wood")
|
|
||||||
stripped_tree.register_strippable_trunk("default:pine_tree", "default:pine_wood")
|
|
||||||
|
|
||||||
-- Register aliases for legacy node names
|
|
||||||
core.register_alias("default:stripped_tree", "stripped_tree:default_stripped_tree")
|
|
||||||
core.register_alias("default:stripped_jungletree", "stripped_tree:default_stripped_jungletree")
|
|
||||||
core.register_alias("default:stripped_aspen_tree", "stripped_tree:default_stripped_aspen_tree")
|
|
||||||
core.register_alias("default:stripped_acacia_tree", "stripped_tree:default_stripped_acacia_tree")
|
|
||||||
core.register_alias("default:stripped_pine_tree", "stripped_tree:default_stripped_pine_tree")
|
|
||||||
|
|
||||||
-- 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"}
|
||||||
stripped_tree.register_axes(mod_name, axe_types)
|
if not stripped_tree.ENABLE_CHISEL then stripped_tree.register_axes(mod_name, axe_types) end
|
||||||
|
|||||||
34
ethereal.lua
@@ -1,27 +1,19 @@
|
|||||||
-- Register stripped trees
|
-- Register stripped trees
|
||||||
local mod_name = "ethereal"
|
local mod_name = "ethereal"
|
||||||
|
local trunk_names = {
|
||||||
|
"banana_trunk",
|
||||||
|
"birch_trunk",
|
||||||
|
"scorched_tree",
|
||||||
|
"yellow_trunk",
|
||||||
|
"willow_trunk",
|
||||||
|
"redwood_trunk",
|
||||||
|
"sakura_trunk",
|
||||||
|
"frost_tree",
|
||||||
|
"palm_trunk",
|
||||||
|
}
|
||||||
|
|
||||||
stripped_tree.register_strippable_trunk("ethereal:banana_trunk", "ethereal:banana_wood")
|
stripped_tree.register_trunk(mod_name, trunk_names)
|
||||||
stripped_tree.register_strippable_trunk("ethereal:birch_trunk", "ethereal:birch_wood")
|
|
||||||
stripped_tree.register_strippable_trunk("ethereal:scorched_tree", "ethereal:scorched_wood")
|
|
||||||
stripped_tree.register_strippable_trunk("ethereal:yellow_trunk", "ethereal:yellow_wood")
|
|
||||||
stripped_tree.register_strippable_trunk("ethereal:willow_trunk", "ethereal:willow_wood")
|
|
||||||
stripped_tree.register_strippable_trunk("ethereal:redwood_trunk", "ethereal:redwood_wood")
|
|
||||||
stripped_tree.register_strippable_trunk("ethereal:sakura_trunk", "ethereal:sakura_wood")
|
|
||||||
stripped_tree.register_strippable_trunk("ethereal:frost_tree", "ethereal:frost_wood")
|
|
||||||
stripped_tree.register_strippable_trunk("ethereal:palm_trunk", "ethereal:palm_wood")
|
|
||||||
|
|
||||||
-- Register aliases for legacy node names
|
|
||||||
core.register_alias("ethereal:stripped_banana_trunk", "stripped_tree:ethereal_stripped_banana_trunk")
|
|
||||||
core.register_alias("ethereal:stripped_birch_trunk", "stripped_tree:ethereal_stripped_birch_trunk")
|
|
||||||
core.register_alias("ethereal:stripped_scorched_tree", "stripped_tree:ethereal_stripped_scorched_tree")
|
|
||||||
core.register_alias("ethereal:stripped_yellow_trunk", "stripped_tree:ethereal_stripped_yellow_trunk")
|
|
||||||
core.register_alias("ethereal:stripped_willow_trunk", "stripped_tree:ethereal_stripped_willow_trunk")
|
|
||||||
core.register_alias("ethereal:stripped_redwood_trunk", "stripped_tree:ethereal_stripped_redwood_trunk")
|
|
||||||
core.register_alias("ethereal:stripped_sakura_trunk", "stripped_tree:ethereal_stripped_sakura_trunk")
|
|
||||||
core.register_alias("ethereal:stripped_frost_tree", "stripped_tree:ethereal_stripped_frost_tree")
|
|
||||||
core.register_alias("ethereal:stripped_palm_trunk", "stripped_tree:ethereal_stripped_palm_trunk")
|
|
||||||
|
|
||||||
-- Register axes
|
-- Register axes
|
||||||
local axe_types = {"axe_crystal"}
|
local axe_types = {"axe_crystal"}
|
||||||
stripped_tree.register_axes(mod_name, axe_types)
|
if not stripped_tree.ENABLE_CHISEL then stripped_tree.register_axes(mod_name, axe_types) end
|
||||||
|
|||||||
173
functions.lua
@@ -1,27 +1,32 @@
|
|||||||
local S = core.get_translator(core.get_current_modname())
|
local S = core.get_translator(core.get_current_modname())
|
||||||
|
|
||||||
stripped_tree.stripped_pairs = {}
|
stripped_tree = {}
|
||||||
|
|
||||||
function stripped_tree.has_stripped(pos)
|
-- Select between chisel tool or axes.
|
||||||
local node = core.get_node(pos).name
|
stripped_tree.ENABLE_CHISEL = core.settings:get_bool("stripped_tree_enable_chisel")
|
||||||
|
|
||||||
return stripped_tree.stripped_pairs[node]
|
-- Check if we are running on a creative server
|
||||||
|
local creative_mode = core.settings:get_bool("creative_mode")
|
||||||
|
|
||||||
|
-- Function to verify that stripped tree trunk exists
|
||||||
|
stripped_tree.has_stripped = function(pos)
|
||||||
|
local node = core.get_node(pos).name or pos
|
||||||
|
local mod_name, node_name = unpack(node:split(":"))
|
||||||
|
local has_stripped = core.registered_nodes[mod_name .. ":" .. "stripped_" .. node_name]
|
||||||
|
|
||||||
|
return has_stripped
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Function to swap nodes
|
-- Function to swap nodes
|
||||||
--
|
stripped_tree.swap_node = function(pos, user, in_creative_mode, tool)
|
||||||
-- The third parameter is a placeholder for backwards compatibility
|
local old_node = core.get_node(pos).name
|
||||||
stripped_tree.swap_node = function(pos, user, _, tool)
|
local mod_name, node_name = unpack(old_node:split(":"))
|
||||||
local old_node = core.get_node(pos)
|
local stripped = mod_name .. ":" .. "stripped_" .. node_name
|
||||||
local stripped_name = stripped_tree.stripped_pairs[old_node.name]
|
|
||||||
|
|
||||||
-- TODO: Maybe we could log an error here
|
core.swap_node(pos, {name = stripped, param2 = old_node.param2})
|
||||||
if not stripped_name then return end
|
|
||||||
|
|
||||||
core.swap_node(pos, {name = stripped_name, param2 = old_node.param2})
|
|
||||||
-- itemstack:add_wear(65535 / 299) this is not useful at moment.
|
-- itemstack:add_wear(65535 / 299) this is not useful at moment.
|
||||||
|
|
||||||
if not core.is_creative_enabled(user:get_player_name()) then
|
if not in_creative_mode then
|
||||||
local inv = user:get_inventory()
|
local inv = user:get_inventory()
|
||||||
|
|
||||||
-- If the player has room in their inventory for a bark, give them one; otherwise, drop the bark to the ground.
|
-- If the player has room in their inventory for a bark, give them one; otherwise, drop the bark to the ground.
|
||||||
@@ -35,92 +40,66 @@ stripped_tree.swap_node = function(pos, user, _, tool)
|
|||||||
return tool
|
return tool
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Function to register a single strippable trunk
|
-- Function to register nodes
|
||||||
function stripped_tree.register_strippable_trunk(trunk_name, plank_name, stripped_tiles)
|
|
||||||
-- If we have already registered this trunk there’s no need to do anything
|
|
||||||
if stripped_tree.stripped_pairs[trunk_name] then return end
|
|
||||||
|
|
||||||
local mod_name, trunk_node = unpack(trunk_name:split(":"))
|
|
||||||
local stripped_name = "stripped_tree:" .. mod_name .. "_stripped_" .. trunk_node
|
|
||||||
|
|
||||||
stripped_tree.stripped_pairs[trunk_name] = stripped_name
|
|
||||||
|
|
||||||
local trunk_def = core.registered_nodes[trunk_name]
|
|
||||||
local stripped_def = table.copy(trunk_def)
|
|
||||||
stripped_def.description = S("Stripped @1", trunk_def.description)
|
|
||||||
stripped_def.groups = table.copy(trunk_def.groups)
|
|
||||||
stripped_def.groups.not_in_creative_inventory = 1
|
|
||||||
stripped_def.tiles = stripped_tiles or {
|
|
||||||
mod_name .. "_" .. trunk_node .. "_top.png^stripped_trees_new_" .. mod_name .. "_" .. trunk_node .. "_top.png",
|
|
||||||
mod_name .. "_" .. trunk_node .. "_top.png^stripped_trees_new_" .. mod_name .. "_" .. trunk_node .. "_top.png",
|
|
||||||
"stripped_trees_new_" .. mod_name .. "_" .. trunk_node .. ".png",
|
|
||||||
}
|
|
||||||
|
|
||||||
core.register_node(stripped_name, stripped_def)
|
|
||||||
|
|
||||||
core.register_craft(
|
|
||||||
{
|
|
||||||
output = trunk_name,
|
|
||||||
recipe = {
|
|
||||||
{"", "default:tree_bark", ""},
|
|
||||||
{"default:tree_bark", stripped_name, "default:tree_bark"},
|
|
||||||
{"", "default:tree_bark", ""},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
if plank_name then core.register_craft({output = plank_name .. " 4", recipe = {{stripped_name}}}) end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Compatibility function from the previous version, able to register multiple stripped tree nodes at once
|
|
||||||
function stripped_tree.register_trunk(mod_name, trunk_names)
|
function stripped_tree.register_trunk(mod_name, trunk_names)
|
||||||
for _, name in ipairs(trunk_names) do stripped_tree.register_strippable_trunk(mod_name .. ":" .. name) end
|
for _, name in ipairs(trunk_names) do
|
||||||
end
|
core.register_node(
|
||||||
|
":" .. mod_name .. ":stripped_" .. name, {
|
||||||
|
description = S("Stripped @1", name),
|
||||||
|
tiles = {
|
||||||
|
"stripped_" .. mod_name .. "_" .. name .. "_top.png",
|
||||||
|
"stripped_" .. mod_name .. "_" .. name .. "_top.png",
|
||||||
|
"stripped_" .. mod_name .. "_" .. name .. ".png",
|
||||||
|
},
|
||||||
|
groups = {
|
||||||
|
tree = 1,
|
||||||
|
choppy = 2,
|
||||||
|
oddly_breakable_by_hand = 1,
|
||||||
|
flammable = 2,
|
||||||
|
not_in_creative_inventory = 1,
|
||||||
|
},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
on_place = core.rotate_node,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
function stripped_tree.maybe_strip_trunk(pos, player, tool, wear)
|
core.register_craft(
|
||||||
local player_name = player:get_player_name()
|
{
|
||||||
|
output = mod_name .. ":" .. name,
|
||||||
if core.is_protected(pos, player_name) then
|
recipe = {
|
||||||
core.record_protection_violation(pos, player_name)
|
{"", "default:tree_bark", ""},
|
||||||
|
{"default:tree_bark", mod_name .. ":stripped_" .. name, "default:tree_bark"},
|
||||||
return
|
{"", "default:tree_bark", ""},
|
||||||
end
|
},
|
||||||
|
|
||||||
wear = wear and tonumber(wear)
|
|
||||||
|
|
||||||
if stripped_tree.has_stripped(pos) then
|
|
||||||
stripped_tree.swap_node(pos, player, nil, tool)
|
|
||||||
|
|
||||||
if not core.is_creative_enabled(player_name) and wear and wear ~= 0 then tool:add_wear(wear) end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Function to override axes
|
|
||||||
function stripped_tree.register_axes(mod_n, axe_types)
|
|
||||||
if stripped_tree.axes_strip_trees ~= true then return end
|
|
||||||
|
|
||||||
for _, axe_name in ipairs(axe_types) do
|
|
||||||
core.override_item(
|
|
||||||
mod_n .. ":" .. axe_name, {
|
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
|
||||||
if pointed_thing.type ~= "node" then return end
|
|
||||||
|
|
||||||
local pos = pointed_thing.under
|
|
||||||
|
|
||||||
-- TODO: Add wear to the axe, but it should depend on the material maybe?
|
|
||||||
stripped_tree.maybe_strip_trunk(pos, user, itemstack)
|
|
||||||
|
|
||||||
-- Taken from VoxelGarden
|
|
||||||
local node = core.get_node_or_nil(pos)
|
|
||||||
if not node then return end
|
|
||||||
|
|
||||||
local node_def = core.registered_nodes[node.name]
|
|
||||||
|
|
||||||
if node_def and node_def.on_rightclick then
|
|
||||||
return node_def.on_rightclick(pos, node, user, itemstack, pointed_thing)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Function to override axes
|
||||||
|
if stripped_tree.ENABLE_CHISEL ~= true then
|
||||||
|
function stripped_tree.register_axes(mod_n, axe_types)
|
||||||
|
for _, axe_name in ipairs(axe_types) do
|
||||||
|
core.override_item(
|
||||||
|
mod_n .. ":" .. axe_name, {
|
||||||
|
on_place = function(itemstack, user, pointed_thing)
|
||||||
|
if pointed_thing.type ~= "node" then return end
|
||||||
|
|
||||||
|
local pos = pointed_thing.under
|
||||||
|
local pname = user:get_player_name()
|
||||||
|
|
||||||
|
if core.is_protected(pos, pname) then
|
||||||
|
core.record_protection_violation(pos, pname)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if stripped_tree.has_stripped(pos) then
|
||||||
|
stripped_tree.swap_node(pos, user, creative_mode, itemstack)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|||||||
69
init.lua
@@ -1,20 +1,77 @@
|
|||||||
-- Our own mod namespace
|
|
||||||
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")
|
||||||
|
|
||||||
|
local S = core.get_translator(core.get_current_modname())
|
||||||
|
|
||||||
-- Load functions
|
-- Load functions
|
||||||
dofile(mpath .. "/functions.lua")
|
dofile(mpath .. "/functions.lua")
|
||||||
|
|
||||||
-- Load our own recipes
|
|
||||||
dofile(mpath .. "/recipes.lua")
|
|
||||||
|
|
||||||
-- Load default (AKA the Minetest game)
|
-- Load default (AKA the Minetest game)
|
||||||
dofile(mpath .. "/default.lua")
|
dofile(mpath .. "/default.lua")
|
||||||
dofile(mpath .. "/chiseling_machine.lua")
|
dofile(mpath .. "/chiseling_machine.lua")
|
||||||
|
|
||||||
-- Load optional dependencies
|
-- Load optional dependencies
|
||||||
if core.get_modpath("moretrees") then dofile(mpath .. "/moretrees.lua") end
|
if core.get_modpath("moretrees") then dofile(mpath .. "/moretrees.lua") end
|
||||||
|
|
||||||
if core.get_modpath("ethereal") then dofile(mpath .. "/ethereal.lua") end
|
if core.get_modpath("ethereal") then dofile(mpath .. "/ethereal.lua") end
|
||||||
|
|
||||||
if core.get_modpath("moreores") then dofile(mpath .. "/moreores.lua") end
|
if core.get_modpath("moreores") then dofile(mpath .. "/moreores.lua") end
|
||||||
|
|
||||||
|
if stripped_tree.ENABLE_CHISEL then
|
||||||
|
core.register_tool(
|
||||||
|
"stripped_tree:chisel", {
|
||||||
|
description = S("Chisel for tree trunks"),
|
||||||
|
inventory_image = "chisel.png",
|
||||||
|
wield_image = "chisel.png",
|
||||||
|
sound = {breaks = "default_tool_breaks"},
|
||||||
|
stack_max = 1,
|
||||||
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
|
if pointed_thing.type ~= "node" then return end
|
||||||
|
|
||||||
|
local pos = pointed_thing.under
|
||||||
|
local pname = user:get_player_name()
|
||||||
|
|
||||||
|
if core.is_protected(pos, pname) then
|
||||||
|
core.record_protection_violation(pos, pname)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local node = core.get_node(pos).name
|
||||||
|
local mod_name, node_name = unpack(node:split(":"))
|
||||||
|
|
||||||
|
-- Before concatenating check for nil
|
||||||
|
if not mod_name then return end
|
||||||
|
if not node_name then return end
|
||||||
|
|
||||||
|
local has_stripped = core.registered_nodes[mod_name .. ":" .. "stripped_" .. node_name]
|
||||||
|
|
||||||
|
if has_stripped then
|
||||||
|
local stripped = mod_name .. ":" .. "stripped_" .. node_name
|
||||||
|
core.swap_node(pos, {name = stripped})
|
||||||
|
|
||||||
|
if not core.settings:get_bool("creative_mode") then
|
||||||
|
local inv = user:get_inventory()
|
||||||
|
|
||||||
|
-- Check for room in inv, if not, drop item
|
||||||
|
if inv:room_for_item("main", "default:tree_bark") then
|
||||||
|
inv:add_item("main", {name = "default:tree_bark"})
|
||||||
|
else
|
||||||
|
core.add_item(pos, "default:tree_bark")
|
||||||
|
end
|
||||||
|
|
||||||
|
itemstack:add_wear(65535 / 299) -- 300 uses
|
||||||
|
end
|
||||||
|
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
core.register_craft(
|
||||||
|
{
|
||||||
|
output = "stripped_tree:chisel",
|
||||||
|
recipe = {{"", "default:steel_ingot", ""}, {"", "screwdriver:screwdriver", ""}, {"", "", ""}},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|||||||
5
locale/stripped_tree.es.tr
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# textdomain: stripped_tree
|
||||||
|
Chiseling Machine=Cinceladora para troncos
|
||||||
|
Stripped @1=@1 cincelado
|
||||||
|
Tree bark=Corteza de árbol
|
||||||
|
Chisel for tree trunks=Cincel de tronco
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
-- Register axes
|
-- Register axes
|
||||||
local axe_types = {"axe_mithril", "axe_silver"}
|
local axe_types = {"axe_mithril", "axe_silver"}
|
||||||
|
|
||||||
stripped_tree.register_axes("moreores", axe_types)
|
if not stripped_tree.ENABLE_CHISEL then stripped_tree.register_axes("moreores", axe_types) end
|
||||||
|
|||||||
128
moretrees.lua
@@ -1,58 +1,82 @@
|
|||||||
-- Register stripped trees
|
-- Register stripped trees
|
||||||
stripped_tree.register_strippable_trunk("moretrees:beech_trunk", "moretrees:beech_planks")
|
local mod_name = "moretrees"
|
||||||
stripped_tree.register_strippable_trunk("moretrees:apple_tree_trunk", "moretrees:apple_tree_planks")
|
local trunk_names = {
|
||||||
stripped_tree.register_strippable_trunk("moretrees:oak_trunk", "moretrees:oak_planks")
|
"beech_trunk",
|
||||||
stripped_tree.register_strippable_trunk("moretrees:sequoia_trunk", "moretrees:sequoia_planks")
|
"apple_tree_trunk",
|
||||||
stripped_tree.register_strippable_trunk("moretrees:birch_trunk", "moretrees:birch_planks")
|
"oak_trunk",
|
||||||
stripped_tree.register_strippable_trunk("moretrees:palm_trunk", "moretrees:palm_planks")
|
"sequoia_trunk",
|
||||||
stripped_tree.register_strippable_trunk("moretrees:date_palm_trunk", "moretrees:date_palm_planks")
|
"birch_trunk",
|
||||||
stripped_tree.register_strippable_trunk("moretrees:spruce_trunk", "moretrees:spruce_planks")
|
"palm_trunk",
|
||||||
stripped_tree.register_strippable_trunk("moretrees:cedar_trunk", "moretrees:cedar_planks")
|
"date_palm_trunk",
|
||||||
stripped_tree.register_strippable_trunk("moretrees:poplar_trunk", "moretrees:poplar_planks")
|
"spruce_trunk",
|
||||||
stripped_tree.register_strippable_trunk("moretrees:willow_trunk", "moretrees:willow_planks")
|
"cedar_trunk",
|
||||||
stripped_tree.register_strippable_trunk("moretrees:rubber_tree_trunk", "moretrees:rubber_tree_planks")
|
"poplar_trunk",
|
||||||
stripped_tree.register_strippable_trunk("moretrees:fir_trunk", "moretrees:fir_planks")
|
"willow_trunk",
|
||||||
stripped_tree.register_strippable_trunk("moretrees:jungletree_trunk", "default:junglewood")
|
"rubber_tree_trunk",
|
||||||
|
"fir_trunk",
|
||||||
|
"jungletree_trunk",
|
||||||
|
}
|
||||||
|
|
||||||
|
stripped_tree.register_trunk(mod_name, trunk_names)
|
||||||
|
|
||||||
-- Register tree variations using the same texture as default moretree trunks
|
-- Register tree variations using the same texture as default moretree trunks
|
||||||
local date_palm_trunk_tiles = {
|
|
||||||
"stripped_moretrees_date_palm_trunk_top.png",
|
core.register_node(
|
||||||
"stripped_moretrees_date_palm_trunk_top.png",
|
":" .. mod_name .. ":stripped_date_palm_mfruit_trunk", {
|
||||||
"stripped_moretrees_date_palm_trunk.png",
|
description = "Stripped date_palm_fruit_trunk",
|
||||||
}
|
tiles = {
|
||||||
stripped_tree.register_strippable_trunk(
|
"stripped_" .. mod_name .. "_date_palm_trunk_top.png",
|
||||||
"moretrees:date_palm_mfruit_trunk", "moretrees:date_palm_planks", date_palm_trunk_tiles
|
"stripped_" .. mod_name .. "_date_palm_trunk_top.png",
|
||||||
)
|
"stripped_" .. mod_name .. "_date_palm_trunk.png",
|
||||||
stripped_tree.register_strippable_trunk(
|
},
|
||||||
"moretrees:date_palm_ffruit_trunk", "moretrees:date_palm_planks", date_palm_trunk_tiles
|
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2, not_in_creative_inventory = 1},
|
||||||
)
|
sounds = default.node_sound_wood_defaults(),
|
||||||
stripped_tree.register_strippable_trunk(
|
paramtype2 = "facedir",
|
||||||
"moretrees:date_palm_fruit_trunk", "moretrees:date_palm_planks", date_palm_trunk_tiles
|
on_place = core.rotate_node,
|
||||||
)
|
|
||||||
stripped_tree.register_strippable_trunk(
|
|
||||||
"moretrees:rubber_tree_trunk_empty", "moretrees:rubber_tree_planks", {
|
|
||||||
"stripped_moretrees_rubber_tree_trunk_top.png",
|
|
||||||
"stripped_moretrees_rubber_tree_trunk_top.png",
|
|
||||||
"stripped_moretrees_rubber_tree_trunk.png",
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
-- Register aliases for legacy node names
|
core.register_node(
|
||||||
core.register_alias("moretrees:stripped_beech_trunk", "stripped_tree:moretrees_stripped_beech_trunk")
|
":" .. mod_name .. ":stripped_date_palm_ffruit_trunk", {
|
||||||
core.register_alias("moretrees:stripped_apple_tree_trunk", "stripped_tree:moretrees_stripped_apple_tree_trunk")
|
description = "Stripped date_palm_fruit_trunk",
|
||||||
core.register_alias("moretrees:stripped_oak_trunk", "stripped_tree:moretrees_stripped_oak_trunk")
|
tiles = {
|
||||||
core.register_alias("moretrees:stripped_sequoia_trunk", "stripped_tree:moretrees_stripped_sequoia_trunk")
|
"stripped_" .. mod_name .. "_date_palm_trunk_top.png",
|
||||||
core.register_alias("moretrees:stripped_birch_trunk", "stripped_tree:moretrees_stripped_birch_trunk")
|
"stripped_" .. mod_name .. "_date_palm_trunk_top.png",
|
||||||
core.register_alias("moretrees:stripped_palm_trunk", "stripped_tree:moretrees_stripped_palm_trunk")
|
"stripped_" .. mod_name .. "_date_palm_trunk.png",
|
||||||
core.register_alias("moretrees:stripped_date_palm_trunk", "stripped_tree:moretrees_stripped_date_palm_trunk")
|
},
|
||||||
core.register_alias("moretrees:stripped_spruce_trunk", "stripped_tree:moretrees_stripped_spruce_trunk")
|
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2, not_in_creative_inventory = 1},
|
||||||
core.register_alias("moretrees:stripped_cedar_trunk", "stripped_tree:moretrees_stripped_cedar_trunk")
|
sounds = default.node_sound_wood_defaults(),
|
||||||
core.register_alias("moretrees:stripped_poplar_trunk", "stripped_tree:moretrees_stripped_poplar_trunk")
|
paramtype2 = "facedir",
|
||||||
core.register_alias("moretrees:stripped_willow_trunk", "stripped_tree:moretrees_stripped_willow_trunk")
|
on_place = core.rotate_node,
|
||||||
core.register_alias("moretrees:stripped_rubber_tree_trunk", "stripped_tree:moretrees_stripped_rubber_tree_trunk")
|
}
|
||||||
core.register_alias("moretrees:stripped_fir_trunk", "stripped_tree:moretrees_stripped_fir_trunk")
|
)
|
||||||
core.register_alias("moretrees:stripped_jungletree_trunk", "stripped_tree:moretrees_stripped_jungletree_trunk")
|
|
||||||
core.register_alias("moretrees:stripped_date_palm_mfruit_trunk", "stripped_tree:moretrees_stripped_date_palm_mfruit_trunk")
|
core.register_node(
|
||||||
core.register_alias("moretrees:stripped_date_palm_ffruit_trunk", "stripped_tree:moretrees_stripped_date_palm_ffruit_trunk")
|
":" .. mod_name .. ":stripped_date_palm_fruit_trunk", {
|
||||||
core.register_alias("moretrees:stripped_date_palm_fruit_trunk", "stripped_tree:moretrees_stripped_date_palm_fruit_trunk")
|
description = "Stripped date_palm_fruit_trunk",
|
||||||
core.register_alias("moretrees:stripped_rubber_tree_trunk_empty", "stripped_tree:moretrees_stripped_rubber_tree_trunk_empty")
|
tiles = {
|
||||||
|
"stripped_" .. mod_name .. "_date_palm_trunk_top.png",
|
||||||
|
"stripped_" .. mod_name .. "_date_palm_trunk_top.png",
|
||||||
|
"stripped_" .. mod_name .. "_date_palm_trunk.png",
|
||||||
|
},
|
||||||
|
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2, not_in_creative_inventory = 1},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
on_place = core.rotate_node,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
core.register_node(
|
||||||
|
":" .. mod_name .. ":stripped_rubber_tree_trunk_empty", {
|
||||||
|
description = "Stripped date_palm_fruit_trunk",
|
||||||
|
tiles = {
|
||||||
|
"stripped_" .. mod_name .. "_rubber_tree_trunk_top.png",
|
||||||
|
"stripped_" .. mod_name .. "_rubber_tree_trunk_top.png",
|
||||||
|
"stripped_" .. mod_name .. "_rubber_tree_trunk.png",
|
||||||
|
},
|
||||||
|
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2, not_in_creative_inventory = 1},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
on_place = core.rotate_node,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|||||||
79
recipes.lua
@@ -1,79 +0,0 @@
|
|||||||
local S = core.get_translator(core.get_current_modname())
|
|
||||||
|
|
||||||
-- Register tree bark
|
|
||||||
core.register_craftitem("stripped_tree:tree_bark", {description = S("Tree bark"), inventory_image = "tree_bark.png"})
|
|
||||||
core.register_alias("default:tree_bark", "stripped_tree:tree_bark")
|
|
||||||
|
|
||||||
-- Register bark as fuel
|
|
||||||
core.register_craft({type = "fuel", recipe = "stripped_tree:tree_bark", burntime = 15})
|
|
||||||
|
|
||||||
-- Register craft for paper
|
|
||||||
core.register_craft(
|
|
||||||
{
|
|
||||||
output = "default:paper 8",
|
|
||||||
recipe = {
|
|
||||||
{"stripped_tree:tree_bark", "stripped_tree:tree_bark", "stripped_tree:tree_bark"},
|
|
||||||
{"stripped_tree:tree_bark", "bucket:bucket_water", "stripped_tree:tree_bark"},
|
|
||||||
{"stripped_tree:tree_bark", "stripped_tree:tree_bark", "stripped_tree:tree_bark"},
|
|
||||||
},
|
|
||||||
replacements = {{"bucket:bucket_water", "bucket:bucket_empty"}},
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
-- Register the chisel tool if it’s enabled in the config
|
|
||||||
core.register_tool(
|
|
||||||
"stripped_tree:chisel", {
|
|
||||||
description = S("Chisel for tree trunks"),
|
|
||||||
inventory_image = "chisel.png",
|
|
||||||
wield_image = "chisel.png",
|
|
||||||
sound = {breaks = "default_tool_breaks"},
|
|
||||||
stack_max = 1,
|
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
|
||||||
if pointed_thing.type == "object" then
|
|
||||||
pointed_thing.ref:punch(user, 1.0, { full_punch_interval=1.0}, nil)
|
|
||||||
return user:get_wielded_item()
|
|
||||||
end
|
|
||||||
|
|
||||||
if pointed_thing.type ~= "node" then return end
|
|
||||||
|
|
||||||
local pos = pointed_thing.under
|
|
||||||
|
|
||||||
stripped_tree.maybe_strip_trunk(pos, user, itemstack, 65535 / 299)
|
|
||||||
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
core.register_craft({output = "stripped_tree:chisel", recipe = {{"default:steel_ingot"}, {"screwdriver:screwdriver"}}})
|
|
||||||
|
|
||||||
-- Recipes if the farming mod is loaded
|
|
||||||
|
|
||||||
-- Register craft for string
|
|
||||||
if core.get_modpath("farming") then
|
|
||||||
core.register_craft(
|
|
||||||
{
|
|
||||||
output = "farming:string 4",
|
|
||||||
recipe = {
|
|
||||||
{"stripped_tree:tree_bark", "stripped_tree:tree_bark", "stripped_tree:tree_bark"},
|
|
||||||
{"stripped_tree:tree_bark", "stripped_tree:tree_bark", "stripped_tree:tree_bark"},
|
|
||||||
{"stripped_tree:tree_bark", "stripped_tree:tree_bark", "stripped_tree:tree_bark"},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Recipes if the bonemeal mod is loaded
|
|
||||||
|
|
||||||
-- Register craft for mulch
|
|
||||||
if core.get_modpath("bonemeal") then
|
|
||||||
core.register_craft(
|
|
||||||
{
|
|
||||||
output = "bonemeal:mulch 4",
|
|
||||||
recipe = {
|
|
||||||
{"stripped_tree:tree_bark", "stripped_tree:tree_bark", "stripped_tree:tree_bark"},
|
|
||||||
{"stripped_tree:tree_bark", "stripped_tree:tree_bark", "stripped_tree:tree_bark"},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
)
|
|
||||||
end
|
|
||||||
@@ -1,4 +1,2 @@
|
|||||||
# 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 [deprecated]) bool true
|
stripped_tree_enable_chisel (Enable Chisel) bool true
|
||||||
# If axes should be able to strip trees
|
|
||||||
stripped_tree_strip_with_axe (Strip trees with axes) bool false
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 607 B |
|
Before Width: | Height: | Size: 374 B |
|
Before Width: | Height: | Size: 387 B |
|
Before Width: | Height: | Size: 229 B |
|
Before Width: | Height: | Size: 425 B |
|
Before Width: | Height: | Size: 299 B |
|
Before Width: | Height: | Size: 562 B |
|
Before Width: | Height: | Size: 350 B |
|
Before Width: | Height: | Size: 593 B |
|
Before Width: | Height: | Size: 375 B |
|
Before Width: | Height: | Size: 405 B |
|
Before Width: | Height: | Size: 301 B |
|
Before Width: | Height: | Size: 504 B |
|
Before Width: | Height: | Size: 353 B |
|
Before Width: | Height: | Size: 499 B |
|
Before Width: | Height: | Size: 299 B |
|
Before Width: | Height: | Size: 389 B |
|
Before Width: | Height: | Size: 307 B |
|
Before Width: | Height: | Size: 405 B |
|
Before Width: | Height: | Size: 286 B |
|
Before Width: | Height: | Size: 516 B |
|
Before Width: | Height: | Size: 291 B |
|
Before Width: | Height: | Size: 285 B |
|
Before Width: | Height: | Size: 229 B |
|
Before Width: | Height: | Size: 595 B |
|
Before Width: | Height: | Size: 381 B |
|
Before Width: | Height: | Size: 442 B |
|
Before Width: | Height: | Size: 274 B |
|
Before Width: | Height: | Size: 82 B |
|
Before Width: | Height: | Size: 106 B |
|
Before Width: | Height: | Size: 357 B |
|
Before Width: | Height: | Size: 223 B |
|
Before Width: | Height: | Size: 244 B |
|
Before Width: | Height: | Size: 245 B |
|
Before Width: | Height: | Size: 445 B |
|
Before Width: | Height: | Size: 362 B |
|
Before Width: | Height: | Size: 554 B |
|
Before Width: | Height: | Size: 360 B |
|
Before Width: | Height: | Size: 619 B |
|
Before Width: | Height: | Size: 378 B |
|
Before Width: | Height: | Size: 615 B |
|
Before Width: | Height: | Size: 301 B |
|
Before Width: | Height: | Size: 523 B |
|
Before Width: | Height: | Size: 363 B |
|
Before Width: | Height: | Size: 576 B |
|
Before Width: | Height: | Size: 325 B |
|
Before Width: | Height: | Size: 587 B |
|
Before Width: | Height: | Size: 383 B |
|
Before Width: | Height: | Size: 567 B |
|
Before Width: | Height: | Size: 373 B |
|
Before Width: | Height: | Size: 488 B |
|
Before Width: | Height: | Size: 331 B |
|
Before Width: | Height: | Size: 410 B |
|
Before Width: | Height: | Size: 307 B |
|
Before Width: | Height: | Size: 445 B |
|
Before Width: | Height: | Size: 308 B |
|
Before Width: | Height: | Size: 380 B |
|
Before Width: | Height: | Size: 361 B |
|
Before Width: | Height: | Size: 495 B |
|
Before Width: | Height: | Size: 369 B |
|
Before Width: | Height: | Size: 430 B |
|
Before Width: | Height: | Size: 362 B |