Merge pull request #1 from wsor4035/main

new features + bug fix
This commit is contained in:
minefaco 2020-11-05 21:11:16 -05:00 committed by GitHub
commit ee79703cce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 98 additions and 45 deletions

17
.github/workflows/build.yml vendored Normal file

@ -0,0 +1,17 @@
name: build
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: apt
run: sudo apt-get install -y luarocks
- name: luacheck install
run: luarocks install --local luacheck
- name: luacheck run
run: $HOME/.luarocks/bin/luacheck ./

23
.luacheckrc Normal file

@ -0,0 +1,23 @@
unused_args = false
allow_defined_top = true
exclude_files = {".luacheckrc"}
globals = {
"minetest",
}
read_globals = {
string = {fields = {"split"}},
table = {fields = {"copy", "getn"}},
-- Builtin
"vector", "ItemStack",
"dump", "DIR_DELIM", "VoxelArea", "Settings",
-- MTG
"default", "sfinv", "creative",
--depends
--none in this case/yet
}

@ -1,2 +1,21 @@
# chisel_tree # Minetest Chisel_Tree Mod
Adds stripped tree trunks to minetest. Adds stripped tree trunks to minetest.
## Links
* [Github](https://github.com/minefaco/chisel_tree)
* [Contentdb](not avaible yet)
* [forums](https://forum.minetest.net/viewtopic.php?p=383571#p383571)
## License
__Code__
by minefacto GPLv3.0
contributed to by wsor4035
__Assets__
> "are the textures GPL-3.0 as well?"
> "no, but it's free to use and share."

@ -3,9 +3,8 @@ local trunk_names = {
"tree", "jungletree", "aspen_tree", "acacia_tree", "pine_tree", "tree", "jungletree", "aspen_tree", "acacia_tree", "pine_tree",
} }
-- Register all trees -- Register all stripped trees
for _, name in ipairs(trunk_names) do for _, name in ipairs(trunk_names) do
minetest.register_node(":default:stripped_" .. name, { minetest.register_node(":default:stripped_" .. name, {
description = "Stripped "..name, description = "Stripped "..name,
tiles = { tiles = {
@ -13,22 +12,22 @@ for _, name in ipairs(trunk_names) do
"stripped_"..name.."_top.png", "stripped_"..name.."_top.png",
"stripped_"..name..".png" "stripped_"..name..".png"
}, },
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2}, groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2, not_in_creative_inventory = 1},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
paramtype2 = "facedir", paramtype2 = "facedir",
on_place = minetest.rotate_node, on_place = minetest.rotate_node,
}) })
end end
--Register tool --list of axes to override
minetest.register_tool("chisel_tree:chisel", { local axe_types = {
description = "A chisel for wood", "wood", "stone", "bronze", "steel", "mese", "diamond",
inventory_image = "chisel.png", }
wield_image = "chisel.png",
sound = {breaks = "default_tool_breaks"}, for _, axe_name in ipairs(axe_types) do
stack_max = 1,
on_use = function(itemstack, user, pointed_thing) minetest.override_item("default:axe_" .. axe_name, {
on_place = function(itemstack, user, pointed_thing)
if pointed_thing.type ~= "node" then if pointed_thing.type ~= "node" then
return return
@ -48,7 +47,8 @@ minetest.register_tool("chisel_tree:chisel", {
local tree = "default:"..n local tree = "default:"..n
if tree==node then if tree==node then
minetest.swap_node(pos, {name = "default:stripped_"..n}) local old_node = minetest.get_node(pos)
minetest.swap_node(pos, {name = "default:stripped_"..n, param2 = old_node.param2})
itemstack:add_wear(65535 / 299) -- 300 uses itemstack:add_wear(65535 / 299) -- 300 uses
return itemstack return itemstack
end end
@ -56,16 +56,10 @@ minetest.register_tool("chisel_tree:chisel", {
end, end,
}) })
end
--Register craft --register alias to support old tool
minetest.register_alias("chisel_tree:chisel", "default:axe_steel")
minetest.register_craft({
output = "chisel_tree:chisel",
recipe = {
{"", "default:steel_ingot", ""},
{"", "group:fence", ""},
}
})