Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Commit

Permalink
Fix overheating in protected areas
Browse files Browse the repository at this point in the history
Merge pull request GH#11 from Lejo1/protect_drop

Destroy modules with `remove_node` instead of `dig_node` that doesn’t work in protected areas.
  • Loading branch information
numberZero authored Jun 1, 2020
2 parents 5de15c5 + 1c38a8d commit 6d20b4a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion diode.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ end
local function diode_action(pos, node, channel, msg)
if digiline_routing.overheat.heat(pos) > OVERLOAD_THRESHOLD then
digiline_routing.overheat.forget(pos)
minetest.dig_node(pos)
minetest.remove_node(pos)
minetest.add_item(pos, node.name)
return
end
Expand Down
9 changes: 5 additions & 4 deletions filter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,18 @@ local function filter_cleanup(pos, node)
digiline_routing.multiblock.dig2(pos, node)
end

local function filter_test(master, channel)
local function filter_test(master, channel, node)
if digiline_routing.overheat.heat(master) > OVERLOAD_THRESHOLD then
minetest.dig_node(master)
minetest.remove_node(master)
filter_cleanup(master, node)
minetest.add_item(master, "digiline_routing:filter")
return false
end
return channel == minetest.get_meta(master):get_string("channel")
end

local function filter_in_action(pos, node, channel, msg)
if filter_test(pos, channel) then
if filter_test(pos, channel, node) then
local off = minetest.facedir_to_dir(node.param2)
local slave = vector.add(pos, off)
digiline:receptor_send(slave, filter_rules_out(node), channel, msg)
Expand All @@ -66,7 +67,7 @@ end
local function filter_out_action(pos, node, channel, msg)
local off = minetest.facedir_to_dir(node.param2)
local master = vector.subtract(pos, off)
if filter_test(master, channel) then
if filter_test(master, channel, node) then
digiline:receptor_send(master, filter_rules_in(node), channel, msg)
end
end
Expand Down
6 changes: 4 additions & 2 deletions splitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ end

local function splitter_in_action(pos, node, channel, msg)
if digiline_routing.overheat.heat(pos) > OVERLOAD_THRESHOLD then
minetest.dig_node(pos)
minetest.remove_node(pos)
splitter_cleanup(pos, node)
minetest.add_item(pos, "digiline_routing:splitter")
return
end
Expand All @@ -40,7 +41,8 @@ local function splitter_out_action(pos, node, channel, msg)
local off = minetest.facedir_to_dir(node.param2)
local master = vector.subtract(pos, off)
if digiline_routing.overheat.heat(master) > OVERLOAD_THRESHOLD then
minetest.dig_node(master)
minetest.remove_node(master)
splitter_cleanup(master, node)
minetest.add_item(master, "digiline_routing:splitter")
return
end
Expand Down

0 comments on commit 6d20b4a

Please sign in to comment.