summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2014-08-09 15:51:18 +0100
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2014-08-09 10:57:43 -0400
commita9866aa5d5593b68f279724befa031833b360e44 (patch)
treed05bbe9cc05ee4e83c802faec8fe534676d980c4
parent487007f2a4f67612b339d3d0ceb8ddf23062a9ca (diff)
downloadpipeworks-a9866aa5d5593b68f279724befa031833b360e44.tar
pipeworks-a9866aa5d5593b68f279724befa031833b360e44.tar.gz
pipeworks-a9866aa5d5593b68f279724befa031833b360e44.tar.bz2
pipeworks-a9866aa5d5593b68f279724befa031833b360e44.tar.xz
pipeworks-a9866aa5d5593b68f279724befa031833b360e44.zip
Node breaker fixup for ones lacking pick slot
This has been seen on Vanessa's server, and caused the wielding code to crash.
-rw-r--r--wielder.lua20
1 files changed, 12 insertions, 8 deletions
diff --git a/wielder.lua b/wielder.lua
index 6d92a23..a57471f 100644
--- a/wielder.lua
+++ b/wielder.lua
@@ -269,14 +269,18 @@ if pipeworks.enable_node_breaker then
local inv = meta:get_inventory()
-- Node breakers predating the visible pick slot
-- may have been partially updated. This code
- -- fully updates them. Originally, they had a
- -- ghost pick in a "pick" inventory, no other
- -- inventory, and no form. 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.
+ -- fully updates them. Some have been observed
+ -- to have no pick slot at all; first add one.
+ if inv:get_size("pick") ~= 1 then
+ inv:set_size("pick", 1)
+ end
+ -- Originally, they had a ghost pick in a "pick"
+ -- inventory, no other inventory, and no form.
+ -- 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
inv:set_size("ghost_pick", 1)
inv:set_size("main", 100)