Node breaker fixup for ones lacking pick slot

This has been seen on Vanessa's server, and caused the wielding code
to crash.
This commit is contained in:
Zefram 2014-08-09 15:51:18 +01:00 committed by Vanessa Ezekowitz
parent 487007f2a4
commit a9866aa5d5
1 changed files with 12 additions and 8 deletions

View File

@ -269,14 +269,18 @@ if pipeworks.enable_node_breaker then
local inv = meta:get_inventory() local inv = meta:get_inventory()
-- Node breakers predating the visible pick slot -- Node breakers predating the visible pick slot
-- may have been partially updated. This code -- may have been partially updated. This code
-- fully updates them. Originally, they had a -- fully updates them. Some have been observed
-- ghost pick in a "pick" inventory, no other -- to have no pick slot at all; first add one.
-- inventory, and no form. The partial update of if inv:get_size("pick") ~= 1 then
-- early with-form node breaker code gives them inv:set_size("pick", 1)
-- "ghost_pick" and "main" inventories, but leaves end
-- the old ghost pick in the "pick" inventory, -- Originally, they had a ghost pick in a "pick"
-- and doesn't add a form. First perform that -- inventory, no other inventory, and no form.
-- partial update. -- The partial update of early with-form node
-- breaker code gives them "ghost_pick" and "main"
-- inventories, but leaves the old ghost pick in
-- the "pick" inventory, and doesn't add a form.
-- First perform that partial update.
if inv:get_size("ghost_pick") ~= 1 then if inv:get_size("ghost_pick") ~= 1 then
inv:set_size("ghost_pick", 1) inv:set_size("ghost_pick", 1)
inv:set_size("main", 100) inv:set_size("main", 100)