mirror of
https://github.com/joe7575/techpack.git
synced 2024-11-25 16:43:50 +01:00
fixing bug issue #50
This commit is contained in:
parent
a5c1fd6182
commit
0adb8dadff
@ -47,8 +47,8 @@ minetest.register_node(NODE_NAME, {
|
|||||||
can_dig = function(pos)
|
can_dig = function(pos)
|
||||||
return wh.can_dig(Box, pos)
|
return wh.can_dig(Box, pos)
|
||||||
end,
|
end,
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
on_dig = function(pos, node, player)
|
||||||
wh.after_dig_node(Box, pos, oldnode, oldmetadata, digger)
|
wh.on_dig_node(Box, pos, node, player)
|
||||||
end,
|
end,
|
||||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
return wh.allow_metadata_inventory_put(Box, pos, listname, index, stack, player)
|
return wh.allow_metadata_inventory_put(Box, pos, listname, index, stack, player)
|
||||||
@ -58,7 +58,6 @@ minetest.register_node(NODE_NAME, {
|
|||||||
allow_metadata_inventory_move = wh.allow_metadata_inventory_move,
|
allow_metadata_inventory_move = wh.allow_metadata_inventory_move,
|
||||||
|
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
drop = "",
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
|
@ -47,8 +47,8 @@ minetest.register_node(NODE_NAME, {
|
|||||||
can_dig = function(pos)
|
can_dig = function(pos)
|
||||||
return wh.can_dig(Box, pos)
|
return wh.can_dig(Box, pos)
|
||||||
end,
|
end,
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
on_dig = function(pos, node, player)
|
||||||
wh.after_dig_node(Box, pos, oldnode, oldmetadata, digger)
|
wh.on_dig_node(Box, pos, node, player)
|
||||||
end,
|
end,
|
||||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
return wh.allow_metadata_inventory_put(Box, pos, listname, index, stack, player)
|
return wh.allow_metadata_inventory_put(Box, pos, listname, index, stack, player)
|
||||||
@ -58,7 +58,6 @@ minetest.register_node(NODE_NAME, {
|
|||||||
allow_metadata_inventory_move = wh.allow_metadata_inventory_move,
|
allow_metadata_inventory_move = wh.allow_metadata_inventory_move,
|
||||||
|
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
drop = "",
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
|
@ -47,8 +47,8 @@ minetest.register_node(NODE_NAME, {
|
|||||||
can_dig = function(pos)
|
can_dig = function(pos)
|
||||||
return wh.can_dig(Box, pos)
|
return wh.can_dig(Box, pos)
|
||||||
end,
|
end,
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
on_dig = function(pos, node, player)
|
||||||
wh.after_dig_node(Box, pos, oldnode, oldmetadata, digger)
|
wh.on_dig_node(Box, pos, node, player)
|
||||||
end,
|
end,
|
||||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
return wh.allow_metadata_inventory_put(Box, pos, listname, index, stack, player)
|
return wh.allow_metadata_inventory_put(Box, pos, listname, index, stack, player)
|
||||||
@ -58,7 +58,6 @@ minetest.register_node(NODE_NAME, {
|
|||||||
allow_metadata_inventory_move = wh.allow_metadata_inventory_move,
|
allow_metadata_inventory_move = wh.allow_metadata_inventory_move,
|
||||||
|
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
drop = "",
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
|
@ -323,10 +323,10 @@ function techpack_warehouse.can_dig(self, pos)
|
|||||||
return inv:is_empty("main") and inv:is_empty("shift")
|
return inv:is_empty("main") and inv:is_empty("shift")
|
||||||
end
|
end
|
||||||
|
|
||||||
function techpack_warehouse.after_dig_node(self, pos, oldnode, oldmetadata, digger)
|
function techpack_warehouse.on_dig_node(self, pos, node, digger)
|
||||||
tubelib.remove_node(pos)
|
tubelib.remove_node(pos)
|
||||||
if oldnode.name == self.node_name then -- not for defect nodes
|
if node.name == self.node_name then -- not for defect nodes
|
||||||
self.State:after_dig_node(pos, oldnode, oldmetadata, digger)
|
self.State:on_dig_node(pos, node, digger)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ minetest.register_node("tubelib:defect_dummy", {
|
|||||||
"tubelib_front.png^tubelib_defect.png",
|
"tubelib_front.png^tubelib_defect.png",
|
||||||
"tubelib_front.png^tubelib_defect.png",
|
"tubelib_front.png^tubelib_defect.png",
|
||||||
},
|
},
|
||||||
drop = "",
|
|
||||||
groups = {cracky=3, crumbly=3, choppy=3, not_in_creative_inventory=1},
|
groups = {cracky=3, crumbly=3, choppy=3, not_in_creative_inventory=1},
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
})
|
})
|
||||||
|
@ -391,9 +391,9 @@ minetest.register_node("tubelib:distributor", {
|
|||||||
return inv:is_empty("src")
|
return inv:is_empty("src")
|
||||||
end,
|
end,
|
||||||
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
on_dig = function(pos, node, player)
|
||||||
tubelib.remove_node(pos) -- <<=== tubelib
|
State:on_dig_node(pos, node, player)
|
||||||
State:after_dig_node(pos, oldnode, oldmetadata, digger)
|
tubelib.remove_node(pos)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||||
@ -403,7 +403,6 @@ minetest.register_node("tubelib:distributor", {
|
|||||||
on_timer = keep_running,
|
on_timer = keep_running,
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
|
|
||||||
drop = "",
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
|
@ -302,6 +302,7 @@ function NodeStates:keep_running(pos, meta, val, num_items)
|
|||||||
self:start(pos, meta, true)
|
self:start(pos, meta, true)
|
||||||
meta:set_int("tubelib_countdown", val)
|
meta:set_int("tubelib_countdown", val)
|
||||||
meta:set_int("tubelib_item_meter", meta:get_int("tubelib_item_meter") + (num_items or 1))
|
meta:set_int("tubelib_item_meter", meta:get_int("tubelib_item_meter") + (num_items or 1))
|
||||||
|
|
||||||
if self.aging_level1 then
|
if self.aging_level1 then
|
||||||
local cnt = meta:get_int("tubelib_aging") + num_items
|
local cnt = meta:get_int("tubelib_aging") + num_items
|
||||||
meta:set_int("tubelib_aging", cnt)
|
meta:set_int("tubelib_aging", cnt)
|
||||||
@ -427,15 +428,39 @@ function NodeStates:on_node_repair(pos)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Return working or defect machine, depending on machine lifetime
|
|
||||||
function NodeStates:after_dig_node(pos, oldnode, oldmetadata, digger)
|
--[[
|
||||||
local inv = minetest.get_inventory({type="player", name=digger:get_player_name()})
|
Callback after digging a node but before removing the node.
|
||||||
local cnt = oldmetadata.fields.tubelib_aging and tonumber(oldmetadata.fields.tubelib_aging)
|
|
||||||
if not cnt or cnt < 1 then cnt = 1 end
|
The tubelib node becomes defect after digging it:
|
||||||
local is_defect = cnt > self.aging_level1 and math.random(math.max(1, math.floor(self.aging_level2 / cnt))) == 1
|
- always if the aging counter "tubelib_aging" is greater than self.aging_level2
|
||||||
if self.node_name_defect and is_defect then
|
- with a certain probability if the aging counter "tubelib_aging" is greater than self.aging_level1
|
||||||
inv:add_item("main", ItemStack(self.node_name_defect))
|
but smaller than self.aging_level2
|
||||||
else
|
|
||||||
inv:add_item("main", ItemStack(self.node_name_passive))
|
Info: If a tubelib machine has been running quite some time but is dropped as a non-defect machine and then placed back again, the
|
||||||
|
tubelib machine will be reset to new (digging will reset the aging counter). So this code tries to prevent this exploit
|
||||||
|
|
||||||
|
]]--
|
||||||
|
function NodeStates:on_dig_node(pos, node, player)
|
||||||
|
local meta = M(pos)
|
||||||
|
local cnt = tonumber(meta:get_string("tubelib_aging"))
|
||||||
|
if (not cnt or cnt < 1) then
|
||||||
|
cnt = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local is_defect = (cnt > self.aging_level1) and ( math.random(math.max(1, math.floor(self.aging_level2 / cnt))) == 1 )
|
||||||
|
|
||||||
|
if is_defect then
|
||||||
|
self:defect(pos, meta) -- replace node with defect one
|
||||||
|
node = minetest.get_node(pos)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
minetest.node_dig(pos, node, player) -- default behaviour (this function is called automatically if on_dig() callback isn't set)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,15 +99,14 @@ minetest.register_node("tubelib:pusher", {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
on_dig = function(pos, node, player)
|
||||||
tubelib.remove_node(pos) -- <<=== tubelib
|
State:on_dig_node(pos, node, player)
|
||||||
State:after_dig_node(pos, oldnode, oldmetadata, digger)
|
tubelib.remove_node(pos)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_timer = keep_running,
|
on_timer = keep_running,
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
|
|
||||||
drop = "",
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
|
@ -312,10 +312,10 @@ minetest.register_node("tubelib_addons1:autocrafter", {
|
|||||||
return inv:is_empty("dst") and inv:is_empty("src")
|
return inv:is_empty("dst") and inv:is_empty("src")
|
||||||
end,
|
end,
|
||||||
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
on_dig = function(pos, node, player)
|
||||||
autocrafterCache[minetest.hash_node_position(pos)] = nil
|
autocrafterCache[minetest.hash_node_position(pos)] = nil
|
||||||
|
State:on_dig_node(pos, node, player)
|
||||||
tubelib.remove_node(pos)
|
tubelib.remove_node(pos)
|
||||||
State:after_dig_node(pos, oldnode, oldmetadata, digger)
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
@ -326,7 +326,6 @@ minetest.register_node("tubelib_addons1:autocrafter", {
|
|||||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||||
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
||||||
|
|
||||||
drop = "",
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
|
@ -207,9 +207,9 @@ minetest.register_node("tubelib_addons1:fermenter", {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
on_dig = function(pos, node, player)
|
||||||
|
State:on_dig_node(pos, node, player)
|
||||||
tubelib.remove_node(pos)
|
tubelib.remove_node(pos)
|
||||||
State:after_dig_node(pos, oldnode, oldmetadata, digger)
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
@ -219,7 +219,6 @@ minetest.register_node("tubelib_addons1:fermenter", {
|
|||||||
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
||||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||||
|
|
||||||
drop = "",
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
|
@ -147,11 +147,12 @@ minetest.register_node("tubelib_addons1:grinder", {
|
|||||||
return inv:is_empty("dst") and inv:is_empty("src")
|
return inv:is_empty("dst") and inv:is_empty("src")
|
||||||
end,
|
end,
|
||||||
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
on_dig = function(pos, node, player)
|
||||||
State:after_dig_node(pos, oldnode, oldmetadata, digger)
|
State:on_dig_node(pos, node, player)
|
||||||
tubelib.remove_node(pos)
|
tubelib.remove_node(pos)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
on_timer = keep_running,
|
on_timer = keep_running,
|
||||||
on_receive_fields = on_receive_fields,
|
on_receive_fields = on_receive_fields,
|
||||||
@ -159,7 +160,6 @@ minetest.register_node("tubelib_addons1:grinder", {
|
|||||||
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
||||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||||
|
|
||||||
drop = "",
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
|
@ -336,8 +336,8 @@ minetest.register_node("tubelib_addons1:harvester_base", {
|
|||||||
return inv:is_empty("main")
|
return inv:is_empty("main")
|
||||||
end,
|
end,
|
||||||
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
on_dig = function(pos, node, player)
|
||||||
State:after_dig_node(pos, oldnode, oldmetadata, digger)
|
State:on_dig_node(pos, node, player)
|
||||||
tubelib.remove_node(pos)
|
tubelib.remove_node(pos)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
@ -347,7 +347,6 @@ minetest.register_node("tubelib_addons1:harvester_base", {
|
|||||||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||||
|
|
||||||
drop = "",
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
|
@ -159,8 +159,8 @@ minetest.register_node("tubelib_addons1:liquidsampler", {
|
|||||||
return inv:is_empty("dst") and inv:is_empty("src")
|
return inv:is_empty("dst") and inv:is_empty("src")
|
||||||
end,
|
end,
|
||||||
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
on_dig = function(pos, node, player)
|
||||||
State:after_dig_node(pos, oldnode, oldmetadata, digger)
|
State:on_dig_node(pos, node, player)
|
||||||
tubelib.remove_node(pos)
|
tubelib.remove_node(pos)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
@ -171,7 +171,6 @@ minetest.register_node("tubelib_addons1:liquidsampler", {
|
|||||||
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
||||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||||
|
|
||||||
drop = "",
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
|
@ -99,15 +99,14 @@ minetest.register_node("tubelib_addons1:pusher_fast", {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
on_dig = function(pos, node, player)
|
||||||
|
State:on_dig_node(pos, node, player)
|
||||||
tubelib.remove_node(pos)
|
tubelib.remove_node(pos)
|
||||||
State:after_dig_node(pos, oldnode, oldmetadata, digger)
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_timer = keep_running,
|
on_timer = keep_running,
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
|
|
||||||
drop = "",
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
|
@ -316,9 +316,9 @@ minetest.register_node("tubelib_addons1:quarry", {
|
|||||||
return inv:is_empty("main")
|
return inv:is_empty("main")
|
||||||
end,
|
end,
|
||||||
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
on_dig = function(pos, node, player)
|
||||||
|
State:on_dig_node(pos, node, player)
|
||||||
tubelib.remove_node(pos)
|
tubelib.remove_node(pos)
|
||||||
State:after_dig_node(pos, oldnode, oldmetadata, digger)
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
@ -327,7 +327,6 @@ minetest.register_node("tubelib_addons1:quarry", {
|
|||||||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||||
|
|
||||||
drop = "",
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
|
@ -203,9 +203,9 @@ minetest.register_node("tubelib_addons1:reformer", {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
on_dig = function(pos, node, player)
|
||||||
|
State:on_dig_node(pos, node, player)
|
||||||
tubelib.remove_node(pos)
|
tubelib.remove_node(pos)
|
||||||
State:after_dig_node(pos, oldnode, oldmetadata, digger)
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
@ -215,7 +215,6 @@ minetest.register_node("tubelib_addons1:reformer", {
|
|||||||
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
||||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||||
|
|
||||||
drop = "",
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
|
@ -360,8 +360,8 @@ minetest.register_node("tubelib_addons3:distributor", {
|
|||||||
return inv:is_empty("src")
|
return inv:is_empty("src")
|
||||||
end,
|
end,
|
||||||
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
on_dig = function(pos, node, player)
|
||||||
State:after_dig_node(pos, oldnode, oldmetadata, digger)
|
State:on_dig_node(pos, node, player)
|
||||||
tubelib.remove_node(pos)
|
tubelib.remove_node(pos)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
@ -372,7 +372,6 @@ minetest.register_node("tubelib_addons3:distributor", {
|
|||||||
on_timer = keep_running,
|
on_timer = keep_running,
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
|
|
||||||
drop = "",
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
|
@ -84,15 +84,14 @@ minetest.register_node("tubelib_addons3:pusher", {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
on_dig = function(pos, node, player)
|
||||||
|
State:on_dig_node(pos, node, player)
|
||||||
tubelib.remove_node(pos)
|
tubelib.remove_node(pos)
|
||||||
State:after_dig_node(pos, oldnode, oldmetadata, digger)
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_timer = keep_running,
|
on_timer = keep_running,
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
|
|
||||||
drop = "",
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
|
@ -75,16 +75,6 @@ local function aging(pos, meta)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function after_dig_node(pos, oldnode, oldmetadata, digger)
|
|
||||||
local inv = minetest.get_inventory({type="player", name=digger:get_player_name()})
|
|
||||||
local cnt = oldmetadata.fields.tubelib_aging and tonumber(oldmetadata.fields.tubelib_aging) or 0
|
|
||||||
local is_defect = cnt > AGING_LEVEL1 and math.random(AGING_LEVEL2 / cnt) == 1
|
|
||||||
if is_defect then
|
|
||||||
inv:add_item("main", ItemStack("tubelib_addons3:pushing_chest_defect"))
|
|
||||||
else
|
|
||||||
inv:add_item("main", ItemStack("tubelib_addons3:pushing_chest"))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function set_state(meta, state)
|
local function set_state(meta, state)
|
||||||
local number = meta:get_string("number")
|
local number = meta:get_string("number")
|
||||||
@ -200,8 +190,8 @@ minetest.register_node("tubelib_addons3:pushing_chest", {
|
|||||||
return inv:is_empty("main") and inv:is_empty("shift")
|
return inv:is_empty("main") and inv:is_empty("shift")
|
||||||
end,
|
end,
|
||||||
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
on_dig = function(pos, node, player)
|
||||||
after_dig_node(pos, oldnode, oldmetadata, digger)
|
State:on_dig_node(pos, node, player)
|
||||||
tubelib.remove_node(pos)
|
tubelib.remove_node(pos)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
@ -212,7 +202,6 @@ minetest.register_node("tubelib_addons3:pushing_chest", {
|
|||||||
on_timer = shift_items,
|
on_timer = shift_items,
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
|
|
||||||
drop = "",
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
|
Loading…
Reference in New Issue
Block a user