mirror of
https://github.com/joe7575/techpack.git
synced 2024-11-22 15:23:43 +01:00
fix some more crashes due to outdated nodes not having the right metadata
This commit is contained in:
parent
4b7ec0cda9
commit
666a2c6059
@ -297,7 +297,7 @@ end
|
||||
-- To be called after successful node action to raise the timer
|
||||
-- and keep the node in state RUNNING
|
||||
function NodeStates:keep_running(pos, meta, val, num_items)
|
||||
num_items = num_items or 1
|
||||
if not num_items or num_items < 1 then num_items = 1 end
|
||||
-- set to RUNNING if not already done
|
||||
self:start(pos, meta, true)
|
||||
meta:set_int("tubelib_countdown", val)
|
||||
@ -430,7 +430,8 @@ 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()})
|
||||
local cnt = oldmetadata.fields.tubelib_aging and tonumber(oldmetadata.fields.tubelib_aging) or 0
|
||||
local cnt = oldmetadata.fields.tubelib_aging and tonumber(oldmetadata.fields.tubelib_aging)
|
||||
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
|
||||
if self.node_name_defect and is_defect then
|
||||
inv:add_item("main", ItemStack(self.node_name_defect))
|
||||
|
Loading…
Reference in New Issue
Block a user