mirror of
https://github.com/joe7575/lumberjack.git
synced 2024-07-04 15:05:19 +02:00
stem steps added
This commit is contained in:
parent
6020a1372e
commit
97a36e2c04
@ -37,3 +37,5 @@ Sound is taken from Hybrid Dog (TreeCapitator)
|
||||
v0.1 - 07/Apr/2018 - Mod initial created
|
||||
v0.2 - 08/Apr/2018 - Priv 'lumberjack' added, digging of trees from the top only added, tool wearing added
|
||||
v0.3 - 09/Apr/2018 - Harvesting points for placing saplings and destroying tree blocks added to reach lumberjack privs
|
||||
v0.4 - 16/Apr/2018 - Stem steps added
|
||||
|
||||
|
50
init.lua
50
init.lua
@ -41,6 +41,30 @@ local function chopper_tool(digger)
|
||||
return false
|
||||
end
|
||||
|
||||
--
|
||||
-- Remove/add tree steps
|
||||
--
|
||||
local function remove_steps(pos)
|
||||
local pos1 = {x=pos.x-1, y=pos.y, z=pos.z-1}
|
||||
local pos2 = {x=pos.x+1, y=pos.y, z=pos.z+1}
|
||||
for _,pos in ipairs(minetest.find_nodes_in_area(pos1, pos2, "lumberjack:step")) do
|
||||
minetest.remove_node(pos)
|
||||
end
|
||||
end
|
||||
|
||||
local function add_steps(pos, digger)
|
||||
local facedir = minetest.dir_to_facedir(digger:get_look_dir(), false)
|
||||
local dir = minetest.facedir_to_dir((facedir + 2) % 4)
|
||||
local newpos = vector.add(pos, dir)
|
||||
minetest.add_node(newpos, {name="lumberjack:step", param2=facedir})
|
||||
end
|
||||
|
||||
local function on_punch(pos, node, puncher)
|
||||
if chopper_tool(puncher) then
|
||||
add_steps(pos, puncher)
|
||||
end
|
||||
end
|
||||
|
||||
--
|
||||
-- tool wearing
|
||||
--
|
||||
@ -64,6 +88,7 @@ local function remove_items(pos1, pos2, name)
|
||||
local cnt = 0
|
||||
for _,pos in ipairs(minetest.find_nodes_in_area(pos1, pos2, name)) do
|
||||
minetest.remove_node(pos)
|
||||
remove_steps(pos)
|
||||
cnt = cnt + 1
|
||||
end
|
||||
return cnt
|
||||
@ -81,31 +106,6 @@ local function is_top_tree_node(pos, name)
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Remove/add tree steps
|
||||
--
|
||||
local function remove_steps(pos)
|
||||
local pos1 = {x=pos.x-1, y=pos.y, z=pos.z-1}
|
||||
local pos2 = {x=pos.x+1, y=pos.y, z=pos.z+1}
|
||||
for _,pos in ipairs(minetest.find_nodes_in_area(pos1, pos2, "lumberjack:step")) do
|
||||
minetest.remove_node(pos)
|
||||
end
|
||||
end
|
||||
|
||||
local function add_steps(pos, digger)
|
||||
local facedir = minetest.dir_to_facedir(digger:get_look_dir(), false)
|
||||
local dir = minetest.facedir_to_dir((facedir + 2) % 4)
|
||||
local newpos = vector.add(pos, dir)
|
||||
minetest.add_node(newpos, {name="lumberjack:step", param2=facedir})
|
||||
end
|
||||
|
||||
local function on_punch(pos, node, puncher)
|
||||
if chopper_tool(puncher) then
|
||||
add_steps(pos, puncher)
|
||||
end
|
||||
end
|
||||
|
||||
--
|
||||
-- Check for the necessary number of points and grant lumberjack privs if level is reached
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user