mirror of
https://github.com/minefaco/stripped_tree.git
synced 2024-12-12 00:43:25 +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.
|
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."
|
82
init.lua
82
init.lua
@ -1,71 +1,65 @@
|
|||||||
--Register nodes
|
--Register nodes
|
||||||
local trunk_names = {
|
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 = {
|
||||||
"stripped_"..name.."_top.png",
|
"stripped_"..name.."_top.png",
|
||||||
"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"},
|
|
||||||
stack_max = 1,
|
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
|
||||||
|
|
||||||
if pointed_thing.type ~= "node" then
|
for _, axe_name in ipairs(axe_types) do
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local pos = pointed_thing.under
|
minetest.override_item("default:axe_" .. axe_name, {
|
||||||
local pname = user:get_player_name()
|
on_place = function(itemstack, user, pointed_thing)
|
||||||
|
|
||||||
if minetest.is_protected(pos, pname) then
|
if pointed_thing.type ~= "node" then
|
||||||
minetest.record_protection_violation(pos, pname)
|
return
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local node = minetest.get_node(pos).name
|
|
||||||
|
|
||||||
for _, n in ipairs(trunk_names) do
|
|
||||||
|
|
||||||
local tree = "default:"..n
|
|
||||||
if tree==node then
|
|
||||||
minetest.swap_node(pos, {name = "default:stripped_"..n})
|
|
||||||
itemstack:add_wear(65535 / 299) -- 300 uses
|
|
||||||
return itemstack
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
end,
|
local pos = pointed_thing.under
|
||||||
})
|
local pname = user:get_player_name()
|
||||||
|
|
||||||
--Register craft
|
if minetest.is_protected(pos, pname) then
|
||||||
|
minetest.record_protection_violation(pos, pname)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_craft({
|
local node = minetest.get_node(pos).name
|
||||||
output = "chisel_tree:chisel",
|
|
||||||
recipe = {
|
for _, n in ipairs(trunk_names) do
|
||||||
{"", "default:steel_ingot", ""},
|
|
||||||
{"", "group:fence", ""},
|
local tree = "default:"..n
|
||||||
}
|
if tree==node then
|
||||||
})
|
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 alias to support old tool
|
||||||
|
minetest.register_alias("chisel_tree:chisel", "default:axe_steel")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user