Skip to content
This repository has been archived by the owner on Dec 14, 2019. It is now read-only.

Commit

Permalink
Fix droping (again)
Browse files Browse the repository at this point in the history
  • Loading branch information
BlockMen committed Apr 5, 2014
1 parent 646089e commit 4cd14d9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
6 changes: 5 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Minetest mod "Torches"
=======================
version: 1.3
version: 1.3.1

License of source code and textures: WTFPL
-----------------------------------------
Expand Down Expand Up @@ -31,3 +31,7 @@ Changelog:
1.3:
- Torches only show flames when player is near (13 blocks)
- Old torches are converted to new, ceiling torches are dropped

1.3.1:
- fix dropping torches when digging a block next to it
- all torches attached to a block get droped when dug
25 changes: 21 additions & 4 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ minetest.register_node("torches:floor", {
after_dig_node = function(pos, oldnode, oldmetadata, digger)
if not digger:is_player() then minetest.add_item(pos, {name="default:torch"}) end
end,
update = function(pos,node, pos2)
if pos2.y < pos.y then
minetest.dig_node(pos)
end
end,
})

local wall_ndbx = {
Expand Down Expand Up @@ -204,15 +209,27 @@ minetest.register_node("torches:wand", {
after_dig_node = function(pos, oldnode, oldmetadata, digger)
if not digger:is_player() then minetest.add_item(pos, {name="default:torch"}) end
end,
update = function(pos,node)
if not check_attached_node_fdir(pos, node) then
minetest.dig_node(pos)
end
end,


})

minetest.register_on_dignode(function(pos, oldnode, digger)
local p = minetest.find_node_near(pos, 1, {"group:torch"})
if p and p ~= nil then
if not check_attached_node_fdir(p, minetest.get_node(p)) then
minetest.dig_node(p)
for ix=-1,1 do
for iz=-1,1 do
for iy=0,1 do
if ix ~=0 and iz ~= 0 then iy=0 end
local p = {x=pos.x+ix,y=pos.y+iy,z=pos.z+iz}
local n = minetest.get_node_or_nil(p)
local fd = minetest.registered_nodes[n.name].update or nil
if fd ~= nil then
fd(p, n, pos)
end
end
end
end
end)

0 comments on commit 4cd14d9

Please sign in to comment.