mirror of
https://github.com/minefaco/stripped_tree.git
synced 2024-11-19 22:13:50 +01:00
commit
ee79703cce
17
.github/workflows/build.yml
vendored
Normal file
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
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
|
||||
}
|
21
README.md
21
README.md
@ -1,2 +1,21 @@
|
||||
# chisel_tree
|
||||
# Minetest Chisel_Tree Mod
|
||||
|
||||
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."
|
44
init.lua
44
init.lua
@ -1,34 +1,33 @@
|
||||
--Register nodes
|
||||
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
|
||||
|
||||
minetest.register_node(":default:stripped_"..name, {
|
||||
minetest.register_node(":default:stripped_" .. name, {
|
||||
description = "Stripped "..name,
|
||||
tiles = {
|
||||
"stripped_"..name.."_top.png",
|
||||
"stripped_"..name.."_top.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(),
|
||||
paramtype2 = "facedir",
|
||||
on_place = minetest.rotate_node,
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
--Register tool
|
||||
minetest.register_tool("chisel_tree:chisel", {
|
||||
description = "A chisel for wood",
|
||||
inventory_image = "chisel.png",
|
||||
wield_image = "chisel.png",
|
||||
sound = {breaks = "default_tool_breaks"},
|
||||
stack_max = 1,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
--list of axes to override
|
||||
local axe_types = {
|
||||
"wood", "stone", "bronze", "steel", "mese", "diamond",
|
||||
}
|
||||
|
||||
for _, axe_name in ipairs(axe_types) do
|
||||
|
||||
minetest.override_item("default:axe_" .. axe_name, {
|
||||
on_place = function(itemstack, user, pointed_thing)
|
||||
|
||||
if pointed_thing.type ~= "node" then
|
||||
return
|
||||
@ -48,24 +47,19 @@ minetest.register_tool("chisel_tree:chisel", {
|
||||
|
||||
local tree = "default:"..n
|
||||
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
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
|
||||
end,
|
||||
})
|
||||
})
|
||||
end
|
||||
|
||||
--Register craft
|
||||
|
||||
minetest.register_craft({
|
||||
output = "chisel_tree:chisel",
|
||||
recipe = {
|
||||
{"", "default:steel_ingot", ""},
|
||||
{"", "group:fence", ""},
|
||||
}
|
||||
})
|
||||
--register alias to support old tool
|
||||
minetest.register_alias("chisel_tree:chisel", "default:axe_steel")
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user