summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFaceDeer <derksenmobile@gmail.com>2017-10-15 12:54:48 -0600
committerFaceDeer <derksenmobile@gmail.com>2017-10-15 12:54:48 -0600
commitd480b9bf2ff9f37a5eb0ba2af772a2aa46c84299 (patch)
tree4e008e0f705b05aaa248d0d71e2cf2f9a7274e98
parentfec29263b0302ee9efc747e6e50aa9847d5c88f3 (diff)
mark_diggable needed a player reference to dig steel doors without crashing
-rw-r--r--nodes/node_diggers.lua28
-rw-r--r--util.lua2
-rw-r--r--util_execute_cycle.lua4
3 files changed, 17 insertions, 17 deletions
diff --git a/nodes/node_diggers.lua b/nodes/node_diggers.lua
index 7d884ec..5b6874d 100644
--- a/nodes/node_diggers.lua
+++ b/nodes/node_diggers.lua
@@ -106,7 +106,7 @@ minetest.register_node("digtron:digger", {
},
-- returns fuel_cost, item_produced
- execute_dig = function(pos, protected_nodes, nodes_dug, controlling_coordinate, lateral_dig)
+ execute_dig = function(pos, protected_nodes, nodes_dug, controlling_coordinate, lateral_dig, player)
local facing = minetest.get_node(pos).param2
local digpos = digtron.find_new_pos(pos, facing)
@@ -114,7 +114,7 @@ minetest.register_node("digtron:digger", {
return 0, {}
end
- return digtron.mark_diggable(digpos, nodes_dug)
+ return digtron.mark_diggable(digpos, nodes_dug, player)
end,
damage_creatures = function(player, pos, controlling_coordinate)
@@ -164,7 +164,7 @@ minetest.register_node("digtron:intermittent_digger", {
on_receive_fields = intermittent_on_receive_fields,
-- returns fuel_cost, item_produced
- execute_dig = function(pos, protected_nodes, nodes_dug, controlling_coordinate, lateral_dig)
+ execute_dig = function(pos, protected_nodes, nodes_dug, controlling_coordinate, lateral_dig, player)
if lateral_dig == true then
return 0, {}
end
@@ -181,7 +181,7 @@ minetest.register_node("digtron:intermittent_digger", {
return 0, {}
end
- return digtron.mark_diggable(digpos, nodes_dug)
+ return digtron.mark_diggable(digpos, nodes_dug, player)
end,
damage_creatures = function(player, pos, controlling_coordinate)
@@ -229,7 +229,7 @@ minetest.register_node("digtron:soft_digger", {
"digtron_plate.png^digtron_motor.png^[colorize:" .. digtron.soft_digger_colorize,
},
- execute_dig = function(pos, protected_nodes, nodes_dug, controlling_coordinate, lateral_dig)
+ execute_dig = function(pos, protected_nodes, nodes_dug, controlling_coordinate, lateral_dig, player)
local facing = minetest.get_node(pos).param2
local digpos = digtron.find_new_pos(pos, facing)
@@ -238,7 +238,7 @@ minetest.register_node("digtron:soft_digger", {
end
if digtron.is_soft_material(digpos) then
- return digtron.mark_diggable(digpos, nodes_dug)
+ return digtron.mark_diggable(digpos, nodes_dug, player)
end
return 0, {}
@@ -289,7 +289,7 @@ minetest.register_node("digtron:intermittent_soft_digger", {
on_receive_fields = intermittent_on_receive_fields,
- execute_dig = function(pos, protected_nodes, nodes_dug, controlling_coordinate, lateral_dig)
+ execute_dig = function(pos, protected_nodes, nodes_dug, controlling_coordinate, lateral_dig, player)
if lateral_dig == true then
return 0, {}
end
@@ -307,7 +307,7 @@ minetest.register_node("digtron:intermittent_soft_digger", {
end
if digtron.is_soft_material(digpos) then
- return digtron.mark_diggable(digpos, nodes_dug)
+ return digtron.mark_diggable(digpos, nodes_dug, player)
end
return 0, {}
@@ -367,7 +367,7 @@ minetest.register_node("digtron:dual_digger", {
},
-- returns fuel_cost, items_produced
- execute_dig = function(pos, protected_nodes, nodes_dug, controlling_coordinate, lateral_dig)
+ execute_dig = function(pos, protected_nodes, nodes_dug, controlling_coordinate, lateral_dig, player)
local facing = minetest.get_node(pos).param2
local digpos = digtron.find_new_pos(pos, facing)
local digdown = digtron.find_new_pos_downward(pos, facing)
@@ -376,14 +376,14 @@ minetest.register_node("digtron:dual_digger", {
local cost = 0
if protected_nodes:get(digpos.x, digpos.y, digpos.z) ~= true then
- local forward_cost, forward_items = digtron.mark_diggable(digpos, nodes_dug)
+ local forward_cost, forward_items = digtron.mark_diggable(digpos, nodes_dug, player)
for _, item in pairs(forward_items) do
table.insert(items, item)
end
cost = cost + forward_cost
end
if protected_nodes:get(digdown.x, digdown.y, digdown.z) ~= true then
- local down_cost, down_items = digtron.mark_diggable(digdown, nodes_dug)
+ local down_cost, down_items = digtron.mark_diggable(digdown, nodes_dug, player)
for _, item in pairs(down_items) do
table.insert(items, item)
end
@@ -444,7 +444,7 @@ minetest.register_node("digtron:dual_soft_digger", {
},
-- returns fuel_cost, items_produced
- execute_dig = function(pos, protected_nodes, nodes_dug, controlling_coordinate, lateral_dig)
+ execute_dig = function(pos, protected_nodes, nodes_dug, controlling_coordinate, lateral_dig, player)
local facing = minetest.get_node(pos).param2
local digpos = digtron.find_new_pos(pos, facing)
local digdown = digtron.find_new_pos_downward(pos, facing)
@@ -453,14 +453,14 @@ minetest.register_node("digtron:dual_soft_digger", {
local cost = 0
if protected_nodes:get(digpos.x, digpos.y, digpos.z) ~= true and digtron.is_soft_material(digpos) then
- local forward_cost, forward_items = digtron.mark_diggable(digpos, nodes_dug)
+ local forward_cost, forward_items = digtron.mark_diggable(digpos, nodes_dug, player)
for _, item in pairs(forward_items) do
table.insert(items, item)
end
cost = cost + forward_cost
end
if protected_nodes:get(digdown.x, digdown.y, digdown.z) ~= true and digtron.is_soft_material(digdown) then
- local down_cost, down_items = digtron.mark_diggable(digdown, nodes_dug)
+ local down_cost, down_items = digtron.mark_diggable(digdown, nodes_dug, player)
for _, item in pairs(down_items) do
table.insert(items, item)
end
diff --git a/util.lua b/util.lua
index 05c6c79..4357353 100644
--- a/util.lua
+++ b/util.lua
@@ -31,7 +31,7 @@ digtron.find_new_pos_downward = function(pos, facing)
return vector.add(pos, digtron.facedir_to_down_dir(facing))
end
-digtron.mark_diggable = function(pos, nodes_dug)
+digtron.mark_diggable = function(pos, nodes_dug, player)
-- mark the node as dug, if the player provided would have been able to dig it.
-- Don't *actually* dig the node yet, though, because if we dig a node with sand over it the sand will start falling
-- and then destroy whatever node we place there subsequently (either by a builder head or by moving a digtron node)
diff --git a/util_execute_cycle.lua b/util_execute_cycle.lua
index 9b0bf97..de0ad1a 100644
--- a/util_execute_cycle.lua
+++ b/util_execute_cycle.lua
@@ -133,7 +133,7 @@ digtron.execute_dig_cycle = function(pos, clicker)
local target = minetest.get_node(location.pos)
local targetdef = minetest.registered_nodes[target.name]
if targetdef.execute_dig ~= nil then
- local fuel_cost, dropped = targetdef.execute_dig(location.pos, layout.protected, layout.nodes_dug, controlling_coordinate)
+ local fuel_cost, dropped = targetdef.execute_dig(location.pos, layout.protected, layout.nodes_dug, controlling_coordinate, false, clicker)
if table.getn(dropped) > 0 then
for _, itemname in pairs(dropped) do
table.insert(items_dropped, itemname)
@@ -449,7 +449,7 @@ digtron.execute_downward_dig_cycle = function(pos, clicker)
local target = minetest.get_node(location.pos)
local targetdef = minetest.registered_nodes[target.name]
if targetdef.execute_dig ~= nil then
- local fuel_cost, dropped = targetdef.execute_dig(location.pos, layout.protected, layout.nodes_dug, controlling_coordinate, true)
+ local fuel_cost, dropped = targetdef.execute_dig(location.pos, layout.protected, layout.nodes_dug, controlling_coordinate, true, clicker)
if table.getn(dropped) > 0 then
for _, itemname in pairs(dropped) do
table.insert(items_dropped, itemname)