mirror of
https://github.com/joe7575/techpack.git
synced 2024-11-26 09:03:46 +01:00
Revert "fix some more crashes due to outdated nodes not having the right metadata"
This reverts commit 7a7784fc5ea41f104a3f12d58a0ae009cc61f761.
This commit is contained in:
parent
7a7784fc5e
commit
4b7ec0cda9
@ -297,7 +297,7 @@ end
|
|||||||
-- To be called after successful node action to raise the timer
|
-- To be called after successful node action to raise the timer
|
||||||
-- and keep the node in state RUNNING
|
-- and keep the node in state RUNNING
|
||||||
function NodeStates:keep_running(pos, meta, val, num_items)
|
function NodeStates:keep_running(pos, meta, val, num_items)
|
||||||
if not num_items or num_items < 1 then num_items = 1 end
|
num_items = num_items or 1
|
||||||
-- set to RUNNING if not already done
|
-- set to RUNNING if not already done
|
||||||
self:start(pos, meta, true)
|
self:start(pos, meta, true)
|
||||||
meta:set_int("tubelib_countdown", val)
|
meta:set_int("tubelib_countdown", val)
|
||||||
@ -430,8 +430,7 @@ end
|
|||||||
-- Return working or defect machine, depending on machine lifetime
|
-- Return working or defect machine, depending on machine lifetime
|
||||||
function NodeStates:after_dig_node(pos, oldnode, oldmetadata, digger)
|
function NodeStates:after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||||
local inv = minetest.get_inventory({type="player", name=digger:get_player_name()})
|
local inv = minetest.get_inventory({type="player", name=digger:get_player_name()})
|
||||||
local cnt = oldmetadata.fields.tubelib_aging and tonumber(oldmetadata.fields.tubelib_aging)
|
local cnt = oldmetadata.fields.tubelib_aging and tonumber(oldmetadata.fields.tubelib_aging) or 0
|
||||||
if not cnt or cnt < 1 then cnt = 1 end
|
|
||||||
local is_defect = cnt > self.aging_level1 and math.random(math.max(1, math.floor(self.aging_level2 / cnt))) == 1
|
local is_defect = cnt > self.aging_level1 and math.random(math.max(1, math.floor(self.aging_level2 / cnt))) == 1
|
||||||
if self.node_name_defect and is_defect then
|
if self.node_name_defect and is_defect then
|
||||||
inv:add_item("main", ItemStack(self.node_name_defect))
|
inv:add_item("main", ItemStack(self.node_name_defect))
|
||||||
|
Loading…
Reference in New Issue
Block a user