From b50ad6e748719d1b042c3fa0ff30fba9a76972b0 Mon Sep 17 00:00:00 2001 From: Novatux Date: Fri, 13 Feb 2015 09:41:08 +0100 Subject: [PATCH] Interaction with formspec: part II Ability to move items within inventory or with open formspecs, and to craft items. --- api.lua | 223 +++++++++++++++++++++++++++++++++++++++++++++-- cptr.lua | 1 + forth.fth | 3 + forth_floppy.lua | 2 +- t2.lua | 29 +++++- 5 files changed, 248 insertions(+), 10 deletions(-) diff --git a/api.lua b/api.lua index c28d00d..962c441 100644 --- a/api.lua +++ b/api.lua @@ -12,7 +12,7 @@ local function pointable(stack, node) return nodedef and def and (nodedef.pointable or (nodedef.liquidtype ~= "none" and def.liquid_pointable)) end -local function create_turtle_player(turtle_id, dir, only_player) +function turtles.create_turtle_player(turtle_id, dir, only_player) local info = turtles.get_turtle_info(turtle_id) local inv = turtles.get_turtle_inventory(turtle_id) local pitch @@ -187,7 +187,7 @@ end local function turtle_dig(turtle, cptr, dir) tl.close_form(turtle) - local player, pointed_thing = create_turtle_player(turtle, dir) + local player, pointed_thing = turtles.create_turtle_player(turtle, dir) if pointed_thing == nil then return end local info = turtles.get_turtle_info(turtle) local wieldstack = player:get_wielded_item() @@ -224,7 +224,7 @@ end local function turtle_place(turtle, cptr, dir) tl.close_form(turtle) - local player, pointed_thing = create_turtle_player(turtle, dir) + local player, pointed_thing = turtles.create_turtle_player(turtle, dir) if pointed_thing == nil then return end local formspec = minetest.get_meta(pointed_thing.under):get_string("formspec") if formspec ~= nil then @@ -306,13 +306,23 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) end end) +local function get_turtle_formspec_player(turtle) + local info = turtles.get_turtle_info(turtle) + local dir + if info.formspec_type and info.formspec_type.type == "node" then + dir = vector.normalize(vector.sub(info.formspec_type.pos, info.spos)) + else + dir = minetest.facedir_to_dir(info.dir) + end + return turtles.create_turtle_player(turtle, dir, true) +end + local function send_fields(turtle) local info = turtles.get_turtle_info(turtle) local fields = info.formspec_fields info.formspec_fields = {} + local player = get_turtle_formspec_player(turtle) if info.formspec_type.type == "show" then - local dir = minetest.facedir_to_dir(info.dir) - local player = create_turtle_player(turtle, dir, true) for _, func in ipairs(minetest.registered_on_receive_fields) do if func(player, info.formspec_type.formname, fields) then return @@ -322,8 +332,6 @@ local function send_fields(turtle) local pos = info.formspec_type.pos local nodedef = minetest.registered_nodes[minetest.get_node(pos).name] if nodedef and nodedef.on_receive_fields then - local dir = vector.normalize(vector.sub(pos, info.spos)) - local player = create_turtle_player(turtle, dir, true) nodedef.on_receive_fields(vector.new(pos), "", fields, player) end end @@ -507,6 +515,10 @@ local function get_element_by_id(formspec, elem_id) return formspec.lists[elem_id + 1] end +--------------- +-- Inventory -- +--------------- + local function get_inventory_from_location(turtle, location) if location == "current_player" then return turtles.get_turtle_inventory(turtle) @@ -537,7 +549,7 @@ function tl.get_stack(turtle, cptr, elem_id, slot, addr) local formspec = info.open_formspec local elem = get_element_by_id(formspec, elem_id) if elem and elem.location and - elem.start_index <= slot and slot <= elem.start_index + elem.size then + elem.start_index <= slot and slot < elem.start_index + elem.size then local inv = get_inventory_from_location(turtle, elem.location) if inv then stack = inv:get_stack(elem.listname, slot) @@ -546,3 +558,198 @@ function tl.get_stack(turtle, cptr, elem_id, slot, addr) end push_stack(cptr, addr, stack) end + +local function same_location(location1, location2) + if location1.type ~= location2.type then + return false + end + if location1.type == "node" then + return vector.equals(location1.pos, location2.pos) + else + return location1.name == location2.name + end +end + +local function get_callbacks(location) + if location.type == "node" then + local node = minetest.get_node(location.pos) + local nodedef = minetest.registered_nodes[node.name] or {} + return {allow_move = function(list1, index1, list2, index2, count, player) + return nodedef.allow_metadata_inventory_move and + nodedef.allow_metadata_inventory_move(location.pos, list1, index1, list2, index2, count, player) or + count + end, + allow_take = function(list, index, stack, player) + return nodedef.allow_metadata_inventory_take and + nodedef.allow_metadata_inventory_take(location.pos, list, index, stack, player) or + stack:get_count() + end, + allow_put = function(list, index, stack, player) + return nodedef.allow_metadata_inventory_put and + nodedef.allow_metadata_inventory_put(location.pos, list, index, stack, player) or + stack:get_count() + end, + on_move = function(list1, index1, list2, index2, count, player) + if nodedef.on_metadata_inventory_move then + nodedef.on_metadata_inventory_move(location.pos, list1, index1, list2, index2, count, player) + end + end, + on_take = function(list, index, stack, player) + if nodedef.on_metadata_inventory_take then + nodedef.on_metadata_inventory_take(location.pos, list, index, stack, player) + end + end, + on_put = function(list, index, stack, player) + if nodedef.on_metadata_inventory_put then + nodedef.on_metadata_inventory_put(location.pos, list, index, stack, player) + end + end, + } + elseif location.type == "detached" then + print("WARNING: not yet implemented") + return {allow_move = function(list1, index1, list2, index2, count, player) + return count + end, + allow_take = function(list, index, stack, player) + return stack:get_count() + end, + allow_put = function(list, index, stack, player) + return stack:get_count() + end, + on_move = function() end, + on_take = function() end, + on_put = function() end, + } + else + return {allow_move = function(list1, index1, list2, index2, count, player) + return count + end, + allow_take = function(list, index, stack, player) + return stack:get_count() + end, + allow_put = function(list, index, stack, player) + return stack:get_count() + end, + on_move = function() end, + on_take = function() end, + on_put = function() end, + } + end +end + +local function room_for_item(stack, stack2) + return stack:is_empty() or stack2:is_empty() or + (stack:get_name() == stack2:get_name() and stack:get_free_space() >= stack2:get_count()) +end + +local function move(inv1, list1, index1, inv2, list2, index2, player, count) + local location1 = inv1:get_location() + local location2 = inv2:get_location() + local callbacks1 = get_callbacks(location1) + local callbacks2 = get_callbacks(location2) + local stack = inv1:get_stack(list1, index1) + local stack_to = inv2:get_stack(list2, index2) + if stack_to:get_name() ~= stack:get_name() and stack_to:get_count() > 0 then -- Disallow move to different type of item + return + end + if list2 == "craftpreview" then return end -- Disallow moving items into craftpreview + if list1 ~= "craftpreview" then + count = math.min(stack:get_count(), count) + stack:set_count(count) + count = math.min(count, stack_to:get_free_space()) + else + local c = 0 + local crafted_stack = ItemStack("") + while c < count do + local st = minetest.craft_predict( + minetest.get_craft_result( + {method = "normal", + items = inv1:get_list("craft"), + width = inv1:get_width("craft")}).item, + player, + inv1:get_list("craft"), + inv1) + --if not stack_to:room_for_item(st) then + if not room_for_item(stack_to, st) then + break + end + local old_grid = inv1:get_list("craft") + local out, decr_input = minetest.get_craft_result( + {method = "normal", + items = inv1:get_list("craft"), + width = inv1:get_width("craft")}) + local item = out.item + inv1:set_list("craft", decr_input.items) + local crafted = minetest.on_craft(item, player, old_grid, inv1) + crafted_stack:add_item(crafted) + stack_to:add_item(crafted) + c = c + 1 + end + stack = crafted_stack + count = stack:get_count() + end + if count <= 0 then return end + local count1, count2 + if same_location(location1, location2) then + count1 = callbacks1.allow_move(list1, index1, list2, index2, count, player) + count2 = count1 + else + count1 = callbacks1.allow_take(list1, index1, stack, player) + count2 = callbacks2.allow_put(list2, index2, stack, player) + end + if count1 >= 0 then + count = math.min(count, count1) + end + if count2 >= 0 then + count = math.min(count, count2) + end + if count == 0 then return end + stack:set_count(count) + if count1 >= 0 then + local s = inv1:get_stack(list1, index1) + s:take_item(count) + inv1:set_stack(list1, index1, s) + end + if count2 >= 0 then + local s = inv2:get_stack(list2, index2) + s:add_item(stack) + inv2:set_stack(list2, index2, s) + end + if same_location(location1, location2) then + callbacks1.on_move(list1, index1, list2, index2, count, player) + else + callbacks1.on_take(list1, index1, stack, player) + callbacks2.on_put(list2, index2, stack, player) + end +end + +local function readC(cptr, addr) + return cptr[addr] +end +local function read(cptr, addr) + return cptr[addr] + 256 * cptr[u16(addr + 1)] +end + +function tl.move_item(turtle, cptr, addr) + local from_id = readC(cptr, addr) + local to_id = readC(cptr, u16(addr + 1)) + local from_index = read(cptr, u16(addr + 2)) + local to_index = read(cptr, u16(addr + 4)) + local count = read(cptr, u16(addr + 6)) + local info = turtles.get_turtle_info(turtle) + local player = get_turtle_formspec_player(turtle) + if info.open_formspec then + local formspec = info.open_formspec + local from_elem = get_element_by_id(formspec, from_id) + local to_elem = get_element_by_id(formspec, to_id) + if from_elem and from_elem.location and to_elem and to_elem.location and + from_elem.start_index <= from_index and from_index < from_elem.start_index + from_elem.size and + to_elem.start_index <= to_index and to_index < to_elem.start_index + to_elem.size then + local from_inv = get_inventory_from_location(turtle, from_elem.location) + local to_inv = get_inventory_from_location(turtle, to_elem.location) + if from_inv and to_inv then + move(from_inv, from_elem.listname, from_index, to_inv, to_elem.listname, to_index, player, count) + end + end + end +end diff --git a/cptr.lua b/cptr.lua index 6baba87..667966a 100644 --- a/cptr.lua +++ b/cptr.lua @@ -312,6 +312,7 @@ ITABLE_RAW = { [0x88] = "tl.open_inv(turtle, cptr)", [0x89] = "tl.get_formspec(turtle, cptr, cptr.X)", [0x8a] = "tl.get_stack(turtle, cptr, cptr.X, cptr.Y, cptr.Z)", + [0x8b] = "tl.move_item(turtle, cptr, cptr.X)", } ITABLE = {} diff --git a/forth.fth b/forth.fth index f259e68..a63d08a 100644 --- a/forth.fth +++ b/forth.fth @@ -108,6 +108,7 @@ ASSEMBLER : OPEN-INV 0x88 NXT ; : GET-FORMSPEC PLX 0x89 NXT ; : GET-STACK PLZ PLY PLX 0x8a NXT ; +: (move_item) PLX 0x8b NXT ; ENVIRONMENT 256 CONSTANT /COUNTED-STRING @@ -307,6 +308,8 @@ FORTH : GET-INV-ID >R S" current_player" S" main" R> GET-LIST-ID ; : GET-CRAFT-ID >R S" current_player" S" craft" R> GET-LIST-ID ; : GET-CRAFT-OUTPUT-ID >R S" current_player" S" craftpreview" R> GET-LIST-ID ; +\ from_id from_index to_id to_index count +: MOVE-ITEM 0xfffe ! 0xfffc ! 0xfff9 C! 0xfffa ! 0xfff8 C! 0xfff8 (move_item) ; : GET-CURRENT CW @ ; : SET-CURRENT LATEST @ CW @ ! DUP CW ! @ LATEST ! ; diff --git a/forth_floppy.lua b/forth_floppy.lua index 7f79447..061a654 100644 --- a/forth_floppy.lua +++ b/forth_floppy.lua @@ -1,3 +1,3 @@ function create_forth_floppy() - return ""..string.rep(string.char(0),264).."\010\000\000\000a#\000\000\000\000\148#"..string.rep(string.char(0),140).."\171\018\180\001\176\001\001"..string.rep(string.char(0),9).."a#\030\011"..string.rep(string.char(0),28).."\176\001"..string.rep(string.char(0),558).."M\000\002\024M\000\003\025Ma#\026\000EXIT\000\000\004()\000(lit)\020\004\005+!)\000(slit)\031\004\006+E\011!\034\012D\027)\000(dodoes),\004\008+!+\027)\000DUPA\004\0030!)\000SWAPM\004\00412!\034)\000ROTX\004\003123\034!#)\000-ROTd\004\004123!#\034)\000OVERs\004\00420\034!)\000PICK\130\004\0042D\012\008\013\007\034)\000DROP\143\004\0041)\0002DROP\159\004\00511)\0002DUP\170\004\00420\034!\034)\0002SWAP\181\004\005123\0033\034!#\019#)\0002OVER\196\004\0053\003320\034#\019#!\034)\000NIP\216\004\0031 )\000TUCK\235\004\00412!\034!)\000?DUP\246\004\00409\001\000)!)\000>R\004\005\0021\001)\000R>\017\005\002\017!)\000R@\026\005\002\016!)\000!#\005\00121&)\000C!+\005\002216)\000@5\005\0010\004 )\000C@>\005\0020\020 )\000ANDH\005\00320, )\000ORS\005\00220- )\000XOR^\005\00320. )\000INVERTj\005\0060/ )\000(branch)y\005\008+\027)\000(0branch)\137\005\0092+:\001\000\027)\000ROLL\153\005\0042AKD\012\008\013\005!1DJJ\007%IIEH;\245\255)\000+\168\005\00121\012\034)\000-\196\005\00121\013\034)\000+!\206\005\0022A\0071\012B%)\000*\217\005\00121\014\034)\000U<\230\005\00220\013 )\000U>\241\005\00212\013!)\000M*\252\005\00221\015\034!)\000UM*\007\006\00321\014\034!)\0000=\020\006\00209\003\000/ )M\000\000 )\0000<> \006\00309\001\000)M\255\255 )\0000<3\006\0022?!)\0000>C\006\0022:\002\000\034)?/!)\000<>M\006\00220\013:\002\000 )M\255\255 )\000=]\006\00120\013:\005\000M\255\255 )M\000\000 )\000EMPTYRo\006\006M\000\003\025)\000EMPTYS\137\006\006M\000\002\024)\000DEPTH\152\006\005\008N\000\002\013DN\001\000=!)\0002*\166\006\002N\001\0000> )\0002/\184\006\002N\001\0000= )\000RSHIFT\197\006\00620< )\000LSHIFT\214\006\00620> )\0002>R\229\006\00321\001\002)\0002R>\241\006\003\018\017!\034)\0002R@\253\006\003\018\016\002!\034)\0001+\009\007\0020I )\0001-\021\007\0020F )\000EXECUTE\031\007\0071\026\000*/MOD.\007\005321\015\031#\034)\000*/9\007\002321\015\031\034)\000/MODG\007\00432?\031#\034)\000/V\007\00132?\031\034)\000MODb\007\00332?\031#)\000UM/MODo\007\006312\030#\034)\000FM/MOD\127\007\006312\031#\034)\000O+\144\007\00221\012\034!)\000UDM/MOD\157\007\007312\030#\034!)\000<\174\007\0012?A2\034.E?/9\004\0002?!)1C\013!)\000>\187\007\00112!?A2\034.E?/9\004\0002?!)1C\013!)\000NEGATE\213\007\0060/I )\000(do)\246\007\004+\00123\003\002)\000(?do)\003\008\005+\00121\001\002\013:\004\000\018\018\017\027)\000I\019\008\001\016!)\000J'\008\001\019\018\034\018\016\0022\002\003!)\000UNLOOP/\008\006\018\018\018)\000(loop)D\008\006\018J\016\002\013+:\004\000\018\018\018)\027)\000(+loop)R\008\007\018A1\012\016F\002C@\013?!B\018\002\013?2.E+:\002\000\027)\018\018\018)\000WAITl\008\004\000)\000LEAVE\146\008\005\017\017\017\027)\000RECEIVE-AT\157\008\010320R )\000DELETE-MSG\176\008\01021S)\000SET-CHANNEL\196\008\01121U)\000SEND\215\008\00421T)\000FW\227\008\002`!)\000BW\237\008\002a!)\000UP\246\008\002b!)\000DN\255\008\002c!)\000TL\008\009\002d)\000TR\017\009\002e)\000DT\025\009\0021h!)\000DT-UP!\009\0051i!)\000DT-DN.\009\0051j!)\000DIG;\009\003p)\000DIG-UPF\009\006q)\000DIG-DNR\009\006r)\000PLACE^\009\005t)\000PLACE-UPi\009\008u)\000PLACE-DNw\009\008v)\000REFUEL\133\009\00621\128!)\000SELECT\145\009\0061\129)\000GET-ENERGY\160\009\010\130\034!)\000OPEN-INV\177\009\008\136)\000GET-FORMSPEC\193\009\0121\137)\000GET-STACK\211\009\009321\138)\000/COUNTED-STRING\000\000\015M\000\001!)\000/HOLD\251\009\005M\034\000!)\000/PAD\009\010\004MT\000!)\000ADRESS-UNIT-BITS\022\010\016M\008\000!)\000CORE/\010\004M\255\255!)\000CORE-EXT<\010\008M\255\255!)\000FLOOREDM\010\007M\255\255!)\000MAX-CHAR]\010\008M\255\000!)\000MAX-Nn\010\005M\255\127!)\000MAX-U|\010\005M\255\255!)\000RETURN-STACK-CELLS\138\010\018M\128\000!)\000STACK-CELLS\165\010\011M\128\000!)\000MAX-UD\185\010\006M\255\255!M\255\255!)\000MAX-D\200\010\005M\255\255!M\255\127!)\000SEARCH-ORDER\218\010\012M\255\255!)\000SEARCH-ORDER-EXT\243\010\016M\255\255!)\000WORDLISTS\012\011\009M\008\000!)\000BL\227\009\002M \000!)\000FALSE)\011\005M\000\000!)\000TRUE7\011\004M\255\255!)\000(source)D\011\008M\000\001!)\000>INU\011\003M\004\001!)\000SOURCE-IDa\011\009M\006\001!)\000BASEs\011\004M\008\001!)\000STATE\128\011\005M\010\001!)\000LATEST\142\011\006M\012\001!)\000SPAN\157\011\004M\016\001!)\000(here)\170\011\006M\018\001!)\000LT\185\011\002M\020\001!)\000#TIB\196\011\004M\022\001!)\000TIB\209\011\003M\024\001!)\000'NUMBER\221\011\007M\160\001!)\000NEW-WORDLIST\237\011\012M\162\001!)\000CW\002\012\002M\164\001!)\000NWORDER\013\012\007M\166\001!)\000WORDLISTS\029\012\009M\176\001!)\000FORTH-WORDLIST/\012\014M\176\001!)\000ENVDICOF\012\007M\178\001!)\000WORDERV\012\006M\208\001!)\000CHARSe\012\133*\020\004\000ALIGNs\012\133*\020\004\000ALIGNED\127\012\135*\020\004\000CELL+\141\012\005*\031\004\002\000\196\005\020\004\000CELL-\153\012\005*\031\004\002\000\206\005\020\004\000CHAR+\171\012\005*\021\007\020\004\000CELLS\189\012\005*\184\006\020\004\000EMIT\203\012\004*,\004\006\000screen\215\008\031\004\002\000+\005\031\004\002\000\031\004\001\000\227\008\020\004\000RECEIVE\216\012\007*\031\004\128\000\176\008\020\004\0002!\002\013\002*X\004\130\004+\005\153\012+\005\020\004\0002@\017\013\002*M\004\153\012>\005X\004>\005\020\004\000SOURCE$\013\006*U\011$\013\020\004\000S>D;\013\003*M\004C\006\020\004\000MAXI\013\003*\181\004\213\007\153\005f\013\159\004\137\005h\013\235\004\020\004\000MINW\013\003*\181\004\213\007\153\005\128\013\235\004\137\005\130\013\159\004\020\004\000D+q\013\002*d\004\196\005s\004\157\007d\004\196\005\020\004\000HEX\138\013\003*\031\004\016\000\128\011+\005\020\004\000DECIMAL\160\013\007*\031\004\010\000\128\011+\005\020\004\000TUCK\182\013\004*X\004\130\004\020\004\000ABS\201\013\003*M\004C\006\153\005\226\013\246\007\020\004\000(marker)\215\013\008*\157\011+\005\185\011+\005\020\004\000TYPE\240\013\004*M\004M\006\153\005$\014\130\004\196\005X\004\019\008 \014'\008H\005\216\012R\008\022\014\137\005&\014\170\004\020\004\000RSTR\003\014\004*\021\007M\004\031\004\002\000\196\005H\005\031\004\127\000S\005\201\013\206\005X\004\020\004\000CR0\014\002*\031\004\010\000\216\012\020\004\000SPACEQ\014\005*\031\004 \000\216\012\020\004\000SPACESc\014\006*M\004M\006\153\005\145\014\031\004\000\000\003\008\141\014c\014R\008\135\014\137\005\147\014\159\004\020\004\000STR=v\014\004*\031\004\000\000\003\008\200\014\130\004H\005\130\004H\005]\006\153\005\188\014D\008\170\0047\011\020\004X\004\021\007X\004\021\007R\008\166\014\170\004D\011\020\004\000IMMEDIATE\157\014\009*\157\011>\005\031\007M\004H\005\031\004\128\000^\005X\0045\005\020\004\000HERE\219\014\004*\185\011>\005\020\004\000[\250\014\129*7\011\142\011+\005\020\004\000]\006\015\001*D\011\142\011+\005\020\004\000ALLOT\020\015\005*\185\011\217\005\020\004\000,&\015\001*\250\014+\005\031\004\002\000&\015\020\004\000C,2\015\002*\250\0145\005\031\004\001\000&\015\020\004\000SKIP-WHITEE\015\010*M\004H\005\031\004!\000\187\007\153\005\127\015\021\007\181\004o\006\153\005{\015\020\004\137\005a\015\020\004\000EXIT-IF-END`\015\011*;\013\235\004a\011>\005o\006\153\005\171\015;\013\196\005\031\004\000\000\026\005\159\004\020\004\000PARSE-LIMITS\144\015\012*;\013\130\004\196\005X\004a\011>\005\196\005\020\004\000>IN-END\189\015\007*;\013\235\004a\011+\005\020\004\000COUNTED-STRING\217\015\014*M\004\250\0145\005\250\014\021\007s\004\130\004\196\005X\004\003\008\027\016'\008H\005\130\0045\005\021\007R\008\013\016\159\004\250\014\020\004\000PARSE-WORD\246\015\010*\144\015\189\015`\015\181\004o\006\153\005H\016\217\015\159\004\031\004\000\000\020\004M\004\017\005M\004H\005\031\004 \000\213\007\153\005v\016\021\007\181\004o\006\153\005r\016\217\015\159\004#\005\206\005\026\005X\004\020\004\137\005L\016\235\004M\004;\013\159\004\206\005\021\007a\011+\005#\005\206\005\026\005X\004\020\004\000PARSE/\016\005*;\013\235\004a\011>\005o\006\153\005\180\016\159\004;\013\196\005\031\004\000\000\020\004\189\015M\004\017\005d\004\017\005M\004H\005#\005]\006\153\005\234\016\021\007\181\004o\006\153\005\230\016\026\005\159\004\217\015\159\004#\005\206\005\026\005X\004\020\004\137\005\190\016\026\005\159\004\235\004M\004;\013\159\004\206\005\021\007a\011+\005#\005\206\005\026\005X\004\020\004\000WORD\153\016\004*;\013\235\004a\011>\005o\006\153\005-\017\159\004\031\004\000\000\250\0145\005\250\014\020\004\189\015M\004\017\005d\004\017\005M\004H\005#\005]\006\153\005c\017\021\007\181\004o\006\153\005_\017\026\005\159\004\217\015\159\004#\005\206\005\026\005X\004\020\004\137\0057\017\026\005\159\004\235\004M\004;\013\159\004\206\005\021\007a\011+\005#\005\206\005\026\005X\004\246\015\020\004\000HEADER\016\017\006*/\016\201\013\031\004\000\000E\015\130\004\196\005X\004\003\008\172\017'\008H\005E\015R\008\162\017\157\011>\0052\015E\015\020\004\000:\141\017\001*\141\017\250\014M\004\196\011+\005\031\004*\000E\015\020\015\020\004\000:CODE\187\017\005*\141\017\250\014M\004\196\011+\005\020\004\000UNUSED\217\017\006*\250\014\246\007\020\004\000NCHAR\240\017\005*M\004H\005M\004\031\004:\000\187\007\153\005\027\018\031\0040\000\206\005\137\0057\018M\004\031\004a\000\187\007\153\0051\018\031\0047\000\206\005\137\0057\018\031\004W\000\206\005\020\004\000>NUMBER\000\018\007*M\004\017\005\031\004\000\000\003\008\161\018\000\018M\004\128\011>\005\187\007\130\004C\006y\005S\005\153\005\143\018\196\004\128\011>\005\230\005\031\004\000\000X\004d\004\128\011>\005\020\006\138\013d\004\031\004\000\000\138\013d\004\021\007\137\005\157\018\159\004'\008D\008\026\005X\004\206\005\020\004R\008Q\018\026\005\159\004\031\004\000\000\020\004*\031\004\000\000\031\004\000\000\196\004\130\004H\005\031\004-\000o\006\153\005\222\018X\004\021\007X\004\031\007D\018\196\004\159\004\246\007\031\004\001\000\196\004\137\005\234\018D\018d\004\159\004\031\004\001\000s\004\020\004\000NUMBERD\018\006*\237\011>\005.\007\020\004\000SAVE-INPUT\246\018\010*a\011>\005\031\004\001\000\020\004\000RESTORE-INPUT\013\019\013*M\004\031\004\001\000o\006\153\005B\019\159\004a\011+\0057\011\137\005R\019\031\004\000\000\019\008P\019\159\004R\008J\019D\011\020\004\000COUNT)\019\005*M\004\021\007X\004H\005\020\004\000CHAR]\019\004*/\016\159\004H\005\020\004\000FILLp\019\004*s\004M\004M\006\153\005\164\019\130\004\196\005X\004\003\008\160\019M\004'\0085\005R\008\150\019\137\005\166\019\170\004\159\004\020\004\000ERASE\129\019\005*\031\004\000\000\129\019\020\004\000(\179\019\129*\031\004)\000\153\016\170\004\020\004\000.(\193\019\130*\031\004)\000\153\016\003\014\020\004\000\092\210\019\129*\031\004\010\000\153\016\170\004\020\004\000THEN\226\019\132*\250\014X\004+\005\020\004\000BEGIN\245\019\133*\250\014\020\004\000FIND-WORD-DICO\007\020\014*X\004\017\005M\004\031\004\004\000\206\0050\014#\005o\006\153\005O\020\031\004\002\000\143\004#\005\157\014\153\005K\020\235\004\026\005\159\004\020\004\137\005Q\020\159\004\031\004\003\000\206\005>\005M\004 \006\153\005#\020\235\004\026\005\159\004\020\004\000GET-WL-LATEST\030\020\013*M\004\013\012>\005o\006\153\005\145\020\159\004\157\011>\005\137\005\147\020>\005\020\004\000FIND-WORDz\020\009*e\012\029\012>\005\184\006\196\005e\012\003\008\205\020'\008>\005z\020\030\020\004\005\153\005\197\020D\008\020\004\031\004\002\000l\008\179\020\031\004\000\000\020\004\000'\162\020\001*/\016\162\020\020\004\000POSTPONE\216\020\136*\216\020M\004\031\007H\005\031\004\128\000S\005\153\005\004\0212\015\137\005\018\021\031\004\031\0042\0152\015\031\0042\0152\015\020\004\000LITERAL\235\020\135*\031\004\031\0042\0152\015\020\004\000NLITERAL\031\021\136*M\004\017\005\031\004\000\000\003\008S\021\031\004\031\0042\015\031\004\000\0002\015R\008C\021\026\005\031\004\000\000\003\008u\021\250\014\031\004\002\000\206\005'\008\031\004\004\000\230\005\206\005+\005R\008]\021\020\004\000DOES>6\021\005*\031\004A\004\157\011>\005\021\007+\005\026\005\157\011>\005\031\004\005\000\196\005+\005\020\004\000[']\128\021\131*\216\020\031\021\020\004\000[COMPILE]\164\021\137*\216\0202\015\020\004\000;\184\021\129*\031\004\020\0042\015\157\011+\005\006\015\020\004\000CODE;\196\021\005*\031\004)\000E\015\157\011+\005\020\004\000[CHAR]\220\021\134*p\019\031\021\020\004\000CREATE\243\021\006*\141\017\250\014\157\011+\005\031\004*\000E\015\250\014\031\004\006\000\196\005\031\021\031\004\020\0042\015\020\004\000VARIABLE\004\022\008*\004\022\031\004\002\000&\015\020\004\000CONSTANT1\022\008*\141\017\250\014\157\011+\005\031\004M\000E\0152\015\031\004!\000E\015\031\004)\000E\015\020\004\000MARKERH\022\006*\250\014\141\017\250\014X\004\031\004*\000E\015\031\021\157\011>\005\031\021\031\004\240\0132\015\031\004\020\0042\015\157\011+\005\020\004\000IFq\022\130*\031\004\153\0052\015\250\014\031\004\000\0002\015\020\004\000ELSE\160\022\132*\031\004\137\0052\015\250\014X\004\031\004\000\0002\015\250\014X\004+\005\020\004\000UNTIL\185\022\133*\031\004\153\0052\0152\015\020\004\000REPEAT\219\022\134*\031\004\137\0052\0152\015\250\014X\004+\005\020\004\000WHILE\240\022\133*\031\004\153\0052\015\250\014X\004\031\004\000\0002\015\020\004\000CASE\010\023\132*\031\004\000\000\020\004\000ENDCASE%\023\135*\031\004\159\0042\015M\0043\006\153\005P\023\250\014X\004+\005\137\005>\023\159\004\020\004\000OF7\023\130*\031\004\130\0042\015\031\004o\0062\015\031\004\153\0052\015\250\014\031\004\000\0002\015\031\004\159\0042\015\020\004\000ENDOFZ\023\133*\031\004\137\0052\015\250\014\031\004\000\0002\015\250\014d\004+\005\020\004\000SLITERAL\134\023\136*\031\004,\0042\015M\0042\015\130\004\196\005X\004\019\008\200\023'\008H\005E\015R\008\190\023\020\004\000S\034\169\023\130*\031\004\034\000\153\016\169\023\020\004\000PAD\208\023\003*\250\014\031\004$\000\196\005\020\004\000VALUE\226\023\005*\141\017\250\014\157\011+\005\031\004M\000E\0152\015\031\004!\000E\015\031\004)\000E\015\020\004\000TO\246\023\130*/\016\162\020\021\007\142\011>\005\153\0056\024\031\021\031\004+\0052\015\137\0058\024+\005\020\004\000COMPILE,\027\024\008*2\015\020\004\000AGAINF\024\133*\031\004\137\0052\0152\015\020\004\000ABORTT\024\005*\152\006q\029\020\004\000COMPILE-WORDh\024\012*\181\004\241\006\162\020\004\005\153\005\172\024\253\006\170\004M\004\031\007H\005\031\004\128\000S\005\153\005\166\024.\007\137\005\168\0242\015\137\005\224\024\009\007\246\018 \006\153\005\194\024\159\004\253\006\170\0046\021\137\005\224\024\159\004\031\004\000\000\019\008\210\024\159\004R\008\204\024\253\006\003\014c\014\031\004?\000\216\012h\024\020\004\000COUNT\127\024\005*M\004\021\007X\004H\005\020\004\000RECURSE\235\024\135*\196\011>\0052\015\020\004\000:NONAME\001\025\007*\250\014M\004\196\011+\005\031\004*\000E\015\157\011>\005\020\015\020\004\000>BODY\021\025\005*\031\004\007\000\196\005\020\004\000ENVIRONMENT?5\025\012*V\012>\005\030\020M\004\153\005_\025.\007D\011\020\004\000D0=N\025\003*^\005 \006\020\004\000HOLDh\025\004*\250\014>\005\031\007M\004\250\014+\0055\005\020\004\000#w\025\001*\128\011>\005\174\007d\004M\004\031\004\009\000\213\007\153\005\172\025\031\0047\000\196\005\137\005\178\025\031\0040\000\196\005w\025\020\004\000#S\141\025\002*\141\025\181\004h\025\153\005\189\025\020\004\000.\034\188\025\130*\208\023\031\004\003\0142\015\020\004\000C\034\207\025\130*\031\004\034\000\153\016\031\004\137\0052\015\250\014\031\004\000\0002\015s\004\250\014s\004M\004E\015\130\004\196\005X\004\019\008\019\026'\008H\005E\015R\008\009\026X\004\250\014X\004+\005\031\021\020\004\000<#\224\025\002*\226\023\250\014+\005\020\004\000#>%\026\002*\170\004\250\014>\005\226\023\130\004\206\005\020\004\000SIGN4\026\004*C\006\153\005X\026\031\004-\000w\025\020\004\000CONVERTK\026\007*\031\004\255\255D\018\159\004\020\004\000MOVEe\026\004*M\004 \006\153\005\135\026\159\004\170\004\020\004s\004\181\004\252\005\153\005\179\026d\004\031\004\000\000\003\008\175\026\130\004H\005\130\0045\005\021\007X\004\021\007X\004R\008\155\026\137\005\225\026\031\004\002\000\143\004\201\013\196\005s\004\196\005X\004d\004\031\004\000\000\003\008\225\026\031\007X\004\031\007X\004\130\004H\005\130\0045\005R\008\205\026\170\004\020\004\000.x\026\001*M\004\017\005\215\013\031\004\000\000%\026)\011w\025\188\025\026\005K\0264\026\003\014\020\004\000U.\234\026\002*\031\004\000\000%\026)\011w\025\188\0254\026\003\014\020\004\000.R\013\027\002*\017\005M\004\017\005\215\013\031\004\000\000%\026)\011w\025\188\025\026\005K\0264\026\026\005\130\004\206\005v\014\003\014\020\004\000U.R&\027\003*\017\005\031\004\000\000%\026)\011w\025\188\0254\026\026\005\130\004\206\005v\014\003\014\020\004\000WITHINT\027\006*\130\004\206\005\017\005\206\005\026\005\241\005\020\004\000DO{\027\130*\031\004\003\0082\015\250\014\031\004\000\0002\015\250\014\020\004\000?DO\144\027\131*\031\004\019\0082\015\250\014\031\004\000\0002\015\250\014\020\004\000LOOP\170\027\132*\031\004R\0082\0152\015\250\014X\004+\005\020\004\000+LOOP\197\027\133*\031\004l\0082\0152\015\250\014X\004+\005\020\004\000ACCEPT\223\027\006*,\004\006\000screen\196\008,\004\006\000screen\031\004\016\000\176\008M\004C\006\153\005'\028\159\004\146\008\137\005\007\028q\013\201\013\031\004\016\000s\004x\026\020\004\000EXPECT\250\027\006*\250\027\170\011+\005\020\004\000QUERY?\028\005*\031\004\000\000a\011+\005\031\004\000\000s\011+\005\221\011M\004\031\004P\000\250\027c\014U\011\017\013\020\004\000REFILLQ\028\006*s\011>\005\153\005\141\0287\011\137\005\167\028\031\004\000\000a\011+\005\221\011M\004\031\004P\000\250\027c\014U\011\017\013D\011\020\004\000INTERPRET-WORD~\028\014*\181\004\241\006\162\020\004\005\153\005\210\028\253\006\170\004.\007\137\005\004\029\009\007\246\018 \006\153\005\230\028\170\004\253\006\170\004\137\005\004\029\159\004\031\004\000\000\019\008\246\028\159\004R\008\240\028\253\006\003\014c\014\031\004?\000\216\012h\024\020\004\000EVALUATE\187\028\008*;\013\241\006a\011>\005\017\005s\011>\005\017\005\031\004\255\255s\011+\005\031\004\000\000a\011+\005U\011\017\013/\016\004\005\153\005S\029\142\011>\005\153\005M\029\127\024\137\005O\029\187\028\137\0057\029\159\004\026\005s\011+\005\026\005a\011+\005\253\006U\011\017\013\020\004\000QUIT\018\029\004*\137\006Q\014~\028\153\005\174\029/\016\004\005\153\005\152\029\142\011>\005\153\005\146\029\127\024\137\005\148\029\187\028\137\005|\029\159\004c\014\031\004O\000\216\012\031\004K\000\216\012Q\014\137\005v\029\020\004\000(abort\034)q\029\008*d\004\153\005\199\029\003\014h\024\170\004\020\004\000ABORT\034\188\029\134*\208\023\031\004\188\0292\015\020\004\000DABS\213\029\004*M\004C\006\153\005\007\030\130\004\246\007d\004\153\005\003\030X\004y\005\137\005\007\030X\004\246\007\020\004\000D.\232\029\002*M\004\017\005\232\029%\026)\011w\025\188\025\026\005K\0264\026\003\014\020\004\000SM/REM\015\030\006*\130\004\017\005\181\004j\005\017\005\215\013\017\005\232\029\026\005\127\007\026\005C\006\153\005Q\030\246\007X\004\026\005C\006\153\005]\030\246\007X\004\020\004\000ON2\030\002*\215\008,\004\002\000on\227\008\020\004\000OFFg\030\003*\215\008,\004\003\000off\227\008\020\004\000IO@{\030\003*\002\013\031\004\003\000\187\007\020\004\000LOADPKG\144\030\007*\031\004\000\000\031\004\030\0015\005/\016\031\004\026\001\017\013\031\004\026\001$\013\215\008\031\004\030\001\031\004\001\000\227\008\031\004\030\001H\005\021\007\031\004\030\0015\005\031\004\026\001$\013\031\004\016\000\176\008\031\004\016\000H\005\153\005\251\030\031\004\016\000X\004\018\029\137\005\185\030\159\004\020\004\000FORMSPEC-BUFFER\166\030\015M\000\240!)\000TAG-END\018\031\007M\000\000!)\000TAG-LIST\034\031\008M\001\000!)\000IS-ADDR-LIST3\031\012*M\004\017\005>\005\031\004\003\000\143\004o\006\153\005\179\031\031\004\003\000\143\004#\005\031\004\002\000\196\005#\005>\005\157\014\153\005\171\031#\005>\005\026\005\196\005\031\004\002\000\196\005M\004\017\005>\005\130\004o\006\153\005\163\031\130\004#\005\031\004\002\000\196\005#\005>\005\157\014\137\005\167\031\031\004\000\000\137\005\175\031\031\004\000\000\137\005\183\031\031\004\000\000\026\005\159\004\020\004\000GET-LIST-ADDRH\031\013*\017\005#\005H\005\153\005\029 #\005#\005\021\007>\005#\005H\005X\004\017\0053\031o\006\153\005\017 \031\004\004\000\196\005H\031\153\005\017 \026\005\159\004\159\004\159\004\159\004\159\004\026\005\031\004\255\255\020\004\026\005\026\005\159\004\017\005\137\005\209\031\026\005\159\004\159\004\159\004\159\004\159\004\031\004\000\000\020\004\000GET-ELEM-ID\206\031\011*\031\004\003\000\196\005H\005\020\004\000GET-LIST-ID> \011*\206\031\153\005e > \137\005i \031\004\255\255\020\004\000GET-INV-IDX \010*\017\005,\004\014\000current_player,\004\004\000main\026\005X \020\004\000GET-CRAFT-IDy \012*\017\005,\004\014\000current_player,\004\005\000craft\026\005X \020\004\000GET-CRAFT-OUTPUT-ID\172 \019*\017\005,\004\014\000current_player,\004\012\000craftpreview\026\005X \020\004\000GET-CURRENT\231 \011*\013\012>\005\020\004\000SET-CURRENT!!\011*\157\011>\005\013\012>\005+\005M\004\013\012+\005>\005\157\011+\005\020\004\000WORDLIST7!\008*\002\012>\005M\004\153\012\002\012+\005\020\004\000DEFINITIONS\092!\011*e\012>\0057!\020\004\000GET-ORDERz!\009*e\012\029\012>\005\031\007\184\006\196\005\019\008\173!'\008>\005\031\004\254\255l\008\161!\029\012>\005\020\004\000SET-ORDER\144!\009*M\004\029\012+\005e\012\031\004\000\000\019\008\219!\201\013+\005\153\012R\008\209!\159\004\020\004\000ALSO\192!\004*e\012M\004\153\012\029\012>\005\184\006x\026\029\012\031\004\002\000\217\005\020\004\000FORTH\231!\005*F\012e\012+\005\020\004\000ONLY\009\034\004*\009\034\031\004\001\000\029\012+\005\020\004\000ORDER\026\034\005*e\012\029\012>\005\184\006\196\005e\012\003\008O\034'\008>\005\234\026\031\004\002\000l\008A\034Q\014\013\012>\005\020\004\000PREVIOUS0\034\008*e\012\153\012e\012\029\012>\005\031\007\184\006x\026\029\012\031\004\254\255\217\005\020\004\000SEARCH-WORDLISTc\034\015*z\020\030\020M\004\153\005\184\034M\004\031\007H\005\031\004\128\000S\005\153\005\180\034\031\004\001\000\137\005\184\034\031\004\255\255\020\004\000FIND\145\034\004*M\004\235\024e\012\029\012>\005\184\006\196\005e\012\003\008\249\034\181\004'\008>\005\145\034\004\005\153\005\241\034\241\006\170\004\159\004\253\006D\008\020\004\031\004\002\000l\008\215\034\170\004\031\004\000\000\020\004\000DUMP\194\034\004*\215\008\031\004\000\001\031\004\000\000\003\008<#'\008\031\004@\000\230\005\226\023\021\007\031\004@\000x\026'\008\226\0235\005\226\023\031\004A\000\227\008R\008\024#\020\004\000SAVE-STATE\009#\010*,\004\004\000boot\009#\020\004\000COLDL#\004*,\004\019\000Computer is ready (\003\014\240\017\013\027,\004\011\000bytes free)\003\014q\029\020\004"..string.rep(string.char(0),7276).."" + return ""..string.rep(string.char(0),264).."\010\000\000\000\167#\000\000\000\000\218#"..string.rep(string.char(0),140).."\189\018\180\001\176\001\001"..string.rep(string.char(0),9).."\167#0\011"..string.rep(string.char(0),28).."\176\001"..string.rep(string.char(0),558).."M\000\002\024M\000\003\025M\167#\026\000EXIT\000\000\004()\000(lit)\020\004\005+!)\000(slit)\031\004\006+E\011!\034\012D\027)\000(dodoes),\004\008+!+\027)\000DUPA\004\0030!)\000SWAPM\004\00412!\034)\000ROTX\004\003123\034!#)\000-ROTd\004\004123!#\034)\000OVERs\004\00420\034!)\000PICK\130\004\0042D\012\008\013\007\034)\000DROP\143\004\0041)\0002DROP\159\004\00511)\0002DUP\170\004\00420\034!\034)\0002SWAP\181\004\005123\0033\034!#\019#)\0002OVER\196\004\0053\003320\034#\019#!\034)\000NIP\216\004\0031 )\000TUCK\235\004\00412!\034!)\000?DUP\246\004\00409\001\000)!)\000>R\004\005\0021\001)\000R>\017\005\002\017!)\000R@\026\005\002\016!)\000!#\005\00121&)\000C!+\005\002216)\000@5\005\0010\004 )\000C@>\005\0020\020 )\000ANDH\005\00320, )\000ORS\005\00220- )\000XOR^\005\00320. )\000INVERTj\005\0060/ )\000(branch)y\005\008+\027)\000(0branch)\137\005\0092+:\001\000\027)\000ROLL\153\005\0042AKD\012\008\013\005!1DJJ\007%IIEH;\245\255)\000+\168\005\00121\012\034)\000-\196\005\00121\013\034)\000+!\206\005\0022A\0071\012B%)\000*\217\005\00121\014\034)\000U<\230\005\00220\013 )\000U>\241\005\00212\013!)\000M*\252\005\00221\015\034!)\000UM*\007\006\00321\014\034!)\0000=\020\006\00209\003\000/ )M\000\000 )\0000<> \006\00309\001\000)M\255\255 )\0000<3\006\0022?!)\0000>C\006\0022:\002\000\034)?/!)\000<>M\006\00220\013:\002\000 )M\255\255 )\000=]\006\00120\013:\005\000M\255\255 )M\000\000 )\000EMPTYRo\006\006M\000\003\025)\000EMPTYS\137\006\006M\000\002\024)\000DEPTH\152\006\005\008N\000\002\013DN\001\000=!)\0002*\166\006\002N\001\0000> )\0002/\184\006\002N\001\0000= )\000RSHIFT\197\006\00620< )\000LSHIFT\214\006\00620> )\0002>R\229\006\00321\001\002)\0002R>\241\006\003\018\017!\034)\0002R@\253\006\003\018\016\002!\034)\0001+\009\007\0020I )\0001-\021\007\0020F )\000EXECUTE\031\007\0071\026\000*/MOD.\007\005321\015\031#\034)\000*/9\007\002321\015\031\034)\000/MODG\007\00432?\031#\034)\000/V\007\00132?\031\034)\000MODb\007\00332?\031#)\000UM/MODo\007\006312\030#\034)\000FM/MOD\127\007\006312\031#\034)\000O+\144\007\00221\012\034!)\000UDM/MOD\157\007\007312\030#\034!)\000<\174\007\0012?A2\034.E?/9\004\0002?!)1C\013!)\000>\187\007\00112!?A2\034.E?/9\004\0002?!)1C\013!)\000NEGATE\213\007\0060/I )\000(do)\246\007\004+\00123\003\002)\000(?do)\003\008\005+\00121\001\002\013:\004\000\018\018\017\027)\000I\019\008\001\016!)\000J'\008\001\019\018\034\018\016\0022\002\003!)\000UNLOOP/\008\006\018\018\018)\000(loop)D\008\006\018J\016\002\013+:\004\000\018\018\018)\027)\000(+loop)R\008\007\018A1\012\016F\002C@\013?!B\018\002\013?2.E+:\002\000\027)\018\018\018)\000WAITl\008\004\000)\000LEAVE\146\008\005\017\017\017\027)\000RECEIVE-AT\157\008\010320R )\000DELETE-MSG\176\008\01021S)\000SET-CHANNEL\196\008\01121U)\000SEND\215\008\00421T)\000FW\227\008\002`!)\000BW\237\008\002a!)\000UP\246\008\002b!)\000DN\255\008\002c!)\000TL\008\009\002d)\000TR\017\009\002e)\000DT\025\009\0021h!)\000DT-UP!\009\0051i!)\000DT-DN.\009\0051j!)\000DIG;\009\003p)\000DIG-UPF\009\006q)\000DIG-DNR\009\006r)\000PLACE^\009\005t)\000PLACE-UPi\009\008u)\000PLACE-DNw\009\008v)\000REFUEL\133\009\00621\128!)\000SELECT\145\009\0061\129)\000GET-ENERGY\160\009\010\130\034!)\000OPEN-INV\177\009\008\136)\000GET-FORMSPEC\193\009\0121\137)\000GET-STACK\211\009\009321\138)\000(move_item)\227\009\0111\139)\000/COUNTED-STRING\000\000\015M\000\001!)\000/HOLD\013\010\005M\034\000!)\000/PAD\027\010\004MT\000!)\000ADRESS-UNIT-BITS(\010\016M\008\000!)\000COREA\010\004M\255\255!)\000CORE-EXTN\010\008M\255\255!)\000FLOORED_\010\007M\255\255!)\000MAX-CHARo\010\008M\255\000!)\000MAX-N\128\010\005M\255\127!)\000MAX-U\142\010\005M\255\255!)\000RETURN-STACK-CELLS\156\010\018M\128\000!)\000STACK-CELLS\183\010\011M\128\000!)\000MAX-UD\203\010\006M\255\255!M\255\255!)\000MAX-D\218\010\005M\255\255!M\255\127!)\000SEARCH-ORDER\236\010\012M\255\255!)\000SEARCH-ORDER-EXT\005\011\016M\255\255!)\000WORDLISTS\030\011\009M\008\000!)\000BL\247\009\002M \000!)\000FALSE;\011\005M\000\000!)\000TRUEI\011\004M\255\255!)\000(source)V\011\008M\000\001!)\000>INg\011\003M\004\001!)\000SOURCE-IDs\011\009M\006\001!)\000BASE\133\011\004M\008\001!)\000STATE\146\011\005M\010\001!)\000LATEST\160\011\006M\012\001!)\000SPAN\175\011\004M\016\001!)\000(here)\188\011\006M\018\001!)\000LT\203\011\002M\020\001!)\000#TIB\214\011\004M\022\001!)\000TIB\227\011\003M\024\001!)\000'NUMBER\239\011\007M\160\001!)\000NEW-WORDLIST\255\011\012M\162\001!)\000CW\020\012\002M\164\001!)\000NWORDER\031\012\007M\166\001!)\000WORDLISTS/\012\009M\176\001!)\000FORTH-WORDLISTA\012\014M\176\001!)\000ENVDICOX\012\007M\178\001!)\000WORDERh\012\006M\208\001!)\000CHARSw\012\133*\020\004\000ALIGN\133\012\133*\020\004\000ALIGNED\145\012\135*\020\004\000CELL+\159\012\005*\031\004\002\000\196\005\020\004\000CELL-\171\012\005*\031\004\002\000\206\005\020\004\000CHAR+\189\012\005*\021\007\020\004\000CELLS\207\012\005*\184\006\020\004\000EMIT\221\012\004*,\004\006\000screen\215\008\031\004\002\000+\005\031\004\002\000\031\004\001\000\227\008\020\004\000RECEIVE\234\012\007*\031\004\128\000\176\008\020\004\0002!\020\013\002*X\004\130\004+\005\171\012+\005\020\004\0002@#\013\002*M\004\171\012>\005X\004>\005\020\004\000SOURCE6\013\006*g\0116\013\020\004\000S>DM\013\003*M\004C\006\020\004\000MAX[\013\003*\181\004\213\007\153\005x\013\159\004\137\005z\013\235\004\020\004\000MINi\013\003*\181\004\213\007\153\005\146\013\235\004\137\005\148\013\159\004\020\004\000D+\131\013\002*d\004\196\005s\004\157\007d\004\196\005\020\004\000HEX\156\013\003*\031\004\016\000\146\011+\005\020\004\000DECIMAL\178\013\007*\031\004\010\000\146\011+\005\020\004\000TUCK\200\013\004*X\004\130\004\020\004\000ABS\219\013\003*M\004C\006\153\005\244\013\246\007\020\004\000(marker)\233\013\008*\175\011+\005\203\011+\005\020\004\000TYPE\002\014\004*M\004M\006\153\0056\014\130\004\196\005X\004\019\0082\014'\008H\005\234\012R\008(\014\137\0058\014\170\004\020\004\000RSTR\021\014\004*\021\007M\004\031\004\002\000\196\005H\005\031\004\127\000S\005\219\013\206\005X\004\020\004\000CRB\014\002*\031\004\010\000\234\012\020\004\000SPACEc\014\005*\031\004 \000\234\012\020\004\000SPACESu\014\006*M\004M\006\153\005\163\014\031\004\000\000\003\008\159\014u\014R\008\153\014\137\005\165\014\159\004\020\004\000STR=\136\014\004*\031\004\000\000\003\008\218\014\130\004H\005\130\004H\005]\006\153\005\206\014D\008\170\004I\011\020\004X\004\021\007X\004\021\007R\008\184\014\170\004V\011\020\004\000IMMEDIATE\175\014\009*\175\011>\005\031\007M\004H\005\031\004\128\000^\005X\0045\005\020\004\000HERE\237\014\004*\203\011>\005\020\004\000[\012\015\129*I\011\160\011+\005\020\004\000]\024\015\001*V\011\160\011+\005\020\004\000ALLOT&\015\005*\203\011\217\005\020\004\000,8\015\001*\012\015+\005\031\004\002\0008\015\020\004\000C,D\015\002*\012\0155\005\031\004\001\0008\015\020\004\000SKIP-WHITEW\015\010*M\004H\005\031\004!\000\187\007\153\005\145\015\021\007\181\004o\006\153\005\141\015\020\004\137\005s\015\020\004\000EXIT-IF-ENDr\015\011*M\013\235\004s\011>\005o\006\153\005\189\015M\013\196\005\031\004\000\000\026\005\159\004\020\004\000PARSE-LIMITS\162\015\012*M\013\130\004\196\005X\004s\011>\005\196\005\020\004\000>IN-END\207\015\007*M\013\235\004s\011+\005\020\004\000COUNTED-STRING\235\015\014*M\004\012\0155\005\012\015\021\007s\004\130\004\196\005X\004\003\008-\016'\008H\005\130\0045\005\021\007R\008\031\016\159\004\012\015\020\004\000PARSE-WORD\008\016\010*\162\015\207\015r\015\181\004o\006\153\005Z\016\235\015\159\004\031\004\000\000\020\004M\004\017\005M\004H\005\031\004 \000\213\007\153\005\136\016\021\007\181\004o\006\153\005\132\016\235\015\159\004#\005\206\005\026\005X\004\020\004\137\005^\016\235\004M\004M\013\159\004\206\005\021\007s\011+\005#\005\206\005\026\005X\004\020\004\000PARSEA\016\005*M\013\235\004s\011>\005o\006\153\005\198\016\159\004M\013\196\005\031\004\000\000\020\004\207\015M\004\017\005d\004\017\005M\004H\005#\005]\006\153\005\252\016\021\007\181\004o\006\153\005\248\016\026\005\159\004\235\015\159\004#\005\206\005\026\005X\004\020\004\137\005\208\016\026\005\159\004\235\004M\004M\013\159\004\206\005\021\007s\011+\005#\005\206\005\026\005X\004\020\004\000WORD\171\016\004*M\013\235\004s\011>\005o\006\153\005?\017\159\004\031\004\000\000\012\0155\005\012\015\020\004\207\015M\004\017\005d\004\017\005M\004H\005#\005]\006\153\005u\017\021\007\181\004o\006\153\005q\017\026\005\159\004\235\015\159\004#\005\206\005\026\005X\004\020\004\137\005I\017\026\005\159\004\235\004M\004M\013\159\004\206\005\021\007s\011+\005#\005\206\005\026\005X\004\008\016\020\004\000HEADER\034\017\006*A\016\219\013\031\004\000\000W\015\130\004\196\005X\004\003\008\190\017'\008H\005W\015R\008\180\017\175\011>\005D\015W\015\020\004\000:\159\017\001*\159\017\012\015M\004\214\011+\005\031\004*\000W\015&\015\020\004\000:CODE\205\017\005*\159\017\012\015M\004\214\011+\005\020\004\000UNUSED\235\017\006*\012\015\246\007\020\004\000NCHAR\002\018\005*M\004H\005M\004\031\004:\000\187\007\153\005-\018\031\0040\000\206\005\137\005I\018M\004\031\004a\000\187\007\153\005C\018\031\0047\000\206\005\137\005I\018\031\004W\000\206\005\020\004\000>NUMBER\018\018\007*M\004\017\005\031\004\000\000\003\008\179\018\018\018M\004\146\011>\005\187\007\130\004C\006y\005S\005\153\005\161\018\196\004\146\011>\005\230\005\031\004\000\000X\004d\004\146\011>\005\020\006\156\013d\004\031\004\000\000\156\013d\004\021\007\137\005\175\018\159\004'\008D\008\026\005X\004\206\005\020\004R\008c\018\026\005\159\004\031\004\000\000\020\004*\031\004\000\000\031\004\000\000\196\004\130\004H\005\031\004-\000o\006\153\005\240\018X\004\021\007X\004\031\007V\018\196\004\159\004\246\007\031\004\001\000\196\004\137\005\252\018V\018d\004\159\004\031\004\001\000s\004\020\004\000NUMBERV\018\006*\255\011>\005.\007\020\004\000SAVE-INPUT\008\019\010*s\011>\005\031\004\001\000\020\004\000RESTORE-INPUT\031\019\013*M\004\031\004\001\000o\006\153\005T\019\159\004s\011+\005I\011\137\005d\019\031\004\000\000\019\008b\019\159\004R\008\092\019V\011\020\004\000COUNT;\019\005*M\004\021\007X\004H\005\020\004\000CHARo\019\004*A\016\159\004H\005\020\004\000FILL\130\019\004*s\004M\004M\006\153\005\182\019\130\004\196\005X\004\003\008\178\019M\004'\0085\005R\008\168\019\137\005\184\019\170\004\159\004\020\004\000ERASE\147\019\005*\031\004\000\000\147\019\020\004\000(\197\019\129*\031\004)\000\171\016\170\004\020\004\000.(\211\019\130*\031\004)\000\171\016\021\014\020\004\000\092\228\019\129*\031\004\010\000\171\016\170\004\020\004\000THEN\244\019\132*\012\015X\004+\005\020\004\000BEGIN\007\020\133*\012\015\020\004\000FIND-WORD-DICO\025\020\014*X\004\017\005M\004\031\004\004\000\206\005B\014#\005o\006\153\005a\020\031\004\002\000\143\004#\005\175\014\153\005]\020\235\004\026\005\159\004\020\004\137\005c\020\159\004\031\004\003\000\206\005>\005M\004 \006\153\0055\020\235\004\026\005\159\004\020\004\000GET-WL-LATEST0\020\013*M\004\031\012>\005o\006\153\005\163\020\159\004\175\011>\005\137\005\165\020>\005\020\004\000FIND-WORD\140\020\009*w\012/\012>\005\184\006\196\005w\012\003\008\223\020'\008>\005\140\0200\020\004\005\153\005\215\020D\008\020\004\031\004\002\000l\008\197\020\031\004\000\000\020\004\000'\180\020\001*A\016\180\020\020\004\000POSTPONE\234\020\136*\234\020M\004\031\007H\005\031\004\128\000S\005\153\005\022\021D\015\137\005$\021\031\004\031\004D\015D\015\031\004D\015D\015\020\004\000LITERAL\253\020\135*\031\004\031\004D\015D\015\020\004\000NLITERAL1\021\136*M\004\017\005\031\004\000\000\003\008e\021\031\004\031\004D\015\031\004\000\000D\015R\008U\021\026\005\031\004\000\000\003\008\135\021\012\015\031\004\002\000\206\005'\008\031\004\004\000\230\005\206\005+\005R\008o\021\020\004\000DOES>H\021\005*\031\004A\004\175\011>\005\021\007+\005\026\005\175\011>\005\031\004\005\000\196\005+\005\020\004\000[']\146\021\131*\234\0201\021\020\004\000[COMPILE]\182\021\137*\234\020D\015\020\004\000;\202\021\129*\031\004\020\004D\015\175\011+\005\024\015\020\004\000CODE;\214\021\005*\031\004)\000W\015\175\011+\005\020\004\000[CHAR]\238\021\134*\130\0191\021\020\004\000CREATE\005\022\006*\159\017\012\015\175\011+\005\031\004*\000W\015\012\015\031\004\006\000\196\0051\021\031\004\020\004D\015\020\004\000VARIABLE\022\022\008*\022\022\031\004\002\0008\015\020\004\000CONSTANTC\022\008*\159\017\012\015\175\011+\005\031\004M\000W\015D\015\031\004!\000W\015\031\004)\000W\015\020\004\000MARKERZ\022\006*\012\015\159\017\012\015X\004\031\004*\000W\0151\021\175\011>\0051\021\031\004\002\014D\015\031\004\020\004D\015\175\011+\005\020\004\000IF\131\022\130*\031\004\153\005D\015\012\015\031\004\000\000D\015\020\004\000ELSE\178\022\132*\031\004\137\005D\015\012\015X\004\031\004\000\000D\015\012\015X\004+\005\020\004\000UNTIL\203\022\133*\031\004\153\005D\015D\015\020\004\000REPEAT\237\022\134*\031\004\137\005D\015D\015\012\015X\004+\005\020\004\000WHILE\002\023\133*\031\004\153\005D\015\012\015X\004\031\004\000\000D\015\020\004\000CASE\028\023\132*\031\004\000\000\020\004\000ENDCASE7\023\135*\031\004\159\004D\015M\0043\006\153\005b\023\012\015X\004+\005\137\005P\023\159\004\020\004\000OFI\023\130*\031\004\130\004D\015\031\004o\006D\015\031\004\153\005D\015\012\015\031\004\000\000D\015\031\004\159\004D\015\020\004\000ENDOFl\023\133*\031\004\137\005D\015\012\015\031\004\000\000D\015\012\015d\004+\005\020\004\000SLITERAL\152\023\136*\031\004,\004D\015M\004D\015\130\004\196\005X\004\019\008\218\023'\008H\005W\015R\008\208\023\020\004\000S\034\187\023\130*\031\004\034\000\171\016\187\023\020\004\000PAD\226\023\003*\012\015\031\004$\000\196\005\020\004\000VALUE\244\023\005*\159\017\012\015\175\011+\005\031\004M\000W\015D\015\031\004!\000W\015\031\004)\000W\015\020\004\000TO\008\024\130*A\016\180\020\021\007\160\011>\005\153\005H\0241\021\031\004+\005D\015\137\005J\024+\005\020\004\000COMPILE,-\024\008*D\015\020\004\000AGAINX\024\133*\031\004\137\005D\015D\015\020\004\000ABORTf\024\005*\152\006\131\029\020\004\000COMPILE-WORDz\024\012*\181\004\241\006\180\020\004\005\153\005\190\024\253\006\170\004M\004\031\007H\005\031\004\128\000S\005\153\005\184\024.\007\137\005\186\024D\015\137\005\242\024\009\007\008\019 \006\153\005\212\024\159\004\253\006\170\004H\021\137\005\242\024\159\004\031\004\000\000\019\008\228\024\159\004R\008\222\024\253\006\021\014u\014\031\004?\000\234\012z\024\020\004\000COUNT\145\024\005*M\004\021\007X\004H\005\020\004\000RECURSE\253\024\135*\214\011>\005D\015\020\004\000:NONAME\019\025\007*\012\015M\004\214\011+\005\031\004*\000W\015\175\011>\005&\015\020\004\000>BODY'\025\005*\031\004\007\000\196\005\020\004\000ENVIRONMENT?G\025\012*h\012>\0050\020M\004\153\005q\025.\007V\011\020\004\000D0=`\025\003*^\005 \006\020\004\000HOLDz\025\004*\012\015>\005\031\007M\004\012\015+\0055\005\020\004\000#\137\025\001*\146\011>\005\174\007d\004M\004\031\004\009\000\213\007\153\005\190\025\031\0047\000\196\005\137\005\196\025\031\0040\000\196\005\137\025\020\004\000#S\159\025\002*\159\025\181\004z\025\153\005\207\025\020\004\000.\034\206\025\130*\226\023\031\004\021\014D\015\020\004\000C\034\225\025\130*\031\004\034\000\171\016\031\004\137\005D\015\012\015\031\004\000\000D\015s\004\012\015s\004M\004W\015\130\004\196\005X\004\019\008%\026'\008H\005W\015R\008\027\026X\004\012\015X\004+\0051\021\020\004\000<#\242\025\002*\244\023\012\015+\005\020\004\000#>7\026\002*\170\004\012\015>\005\244\023\130\004\206\005\020\004\000SIGNF\026\004*C\006\153\005j\026\031\004-\000\137\025\020\004\000CONVERT]\026\007*\031\004\255\255V\018\159\004\020\004\000MOVEw\026\004*M\004 \006\153\005\153\026\159\004\170\004\020\004s\004\181\004\252\005\153\005\197\026d\004\031\004\000\000\003\008\193\026\130\004H\005\130\0045\005\021\007X\004\021\007X\004R\008\173\026\137\005\243\026\031\004\002\000\143\004\219\013\196\005s\004\196\005X\004d\004\031\004\000\000\003\008\243\026\031\007X\004\031\007X\004\130\004H\005\130\0045\005R\008\223\026\170\004\020\004\000.\138\026\001*M\004\017\005\233\013\031\004\000\0007\026;\011\137\025\206\025\026\005]\026F\026\021\014\020\004\000U.\252\026\002*\031\004\000\0007\026;\011\137\025\206\025F\026\021\014\020\004\000.R\031\027\002*\017\005M\004\017\005\233\013\031\004\000\0007\026;\011\137\025\206\025\026\005]\026F\026\026\005\130\004\206\005\136\014\021\014\020\004\000U.R8\027\003*\017\005\031\004\000\0007\026;\011\137\025\206\025F\026\026\005\130\004\206\005\136\014\021\014\020\004\000WITHINf\027\006*\130\004\206\005\017\005\206\005\026\005\241\005\020\004\000DO\141\027\130*\031\004\003\008D\015\012\015\031\004\000\000D\015\012\015\020\004\000?DO\162\027\131*\031\004\019\008D\015\012\015\031\004\000\000D\015\012\015\020\004\000LOOP\188\027\132*\031\004R\008D\015D\015\012\015X\004+\005\020\004\000+LOOP\215\027\133*\031\004l\008D\015D\015\012\015X\004+\005\020\004\000ACCEPT\241\027\006*,\004\006\000screen\196\008,\004\006\000screen\031\004\016\000\176\008M\004C\006\153\0059\028\159\004\146\008\137\005\025\028\131\013\219\013\031\004\016\000s\004\138\026\020\004\000EXPECT\012\028\006*\012\028\188\011+\005\020\004\000QUERYQ\028\005*\031\004\000\000s\011+\005\031\004\000\000\133\011+\005\239\011M\004\031\004P\000\012\028u\014g\011#\013\020\004\000REFILLc\028\006*\133\011>\005\153\005\159\028I\011\137\005\185\028\031\004\000\000s\011+\005\239\011M\004\031\004P\000\012\028u\014g\011#\013V\011\020\004\000INTERPRET-WORD\144\028\014*\181\004\241\006\180\020\004\005\153\005\228\028\253\006\170\004.\007\137\005\022\029\009\007\008\019 \006\153\005\248\028\170\004\253\006\170\004\137\005\022\029\159\004\031\004\000\000\019\008\008\029\159\004R\008\002\029\253\006\021\014u\014\031\004?\000\234\012z\024\020\004\000EVALUATE\205\028\008*M\013\241\006s\011>\005\017\005\133\011>\005\017\005\031\004\255\255\133\011+\005\031\004\000\000s\011+\005g\011#\013A\016\004\005\153\005e\029\160\011>\005\153\005_\029\145\024\137\005a\029\205\028\137\005I\029\159\004\026\005\133\011+\005\026\005s\011+\005\253\006g\011#\013\020\004\000QUIT$\029\004*\137\006c\014\144\028\153\005\192\029A\016\004\005\153\005\170\029\160\011>\005\153\005\164\029\145\024\137\005\166\029\205\028\137\005\142\029\159\004u\014\031\004O\000\234\012\031\004K\000\234\012c\014\137\005\136\029\020\004\000(abort\034)\131\029\008*d\004\153\005\217\029\021\014z\024\170\004\020\004\000ABORT\034\206\029\134*\226\023\031\004\206\029D\015\020\004\000DABS\231\029\004*M\004C\006\153\005\025\030\130\004\246\007d\004\153\005\021\030X\004y\005\137\005\025\030X\004\246\007\020\004\000D.\250\029\002*M\004\017\005\250\0297\026;\011\137\025\206\025\026\005]\026F\026\021\014\020\004\000SM/REM!\030\006*\130\004\017\005\181\004j\005\017\005\233\013\017\005\250\029\026\005\127\007\026\005C\006\153\005c\030\246\007X\004\026\005C\006\153\005o\030\246\007X\004\020\004\000OND\030\002*\215\008,\004\002\000on\227\008\020\004\000OFFy\030\003*\215\008,\004\003\000off\227\008\020\004\000IO@\141\030\003*\020\013\031\004\003\000\187\007\020\004\000LOADPKG\162\030\007*\031\004\000\000\031\004\030\0015\005A\016\031\004\026\001#\013\031\004\026\0016\013\215\008\031\004\030\001\031\004\001\000\227\008\031\004\030\001H\005\021\007\031\004\030\0015\005\031\004\026\0016\013\031\004\016\000\176\008\031\004\016\000H\005\153\005\013\031\031\004\016\000X\004$\029\137\005\203\030\159\004\020\004\000FORMSPEC-BUFFER\184\030\015M\000\240!)\000TAG-END$\031\007M\000\000!)\000TAG-LIST4\031\008M\001\000!)\000IS-ADDR-LISTE\031\012*M\004\017\005>\005\031\004\003\000\143\004o\006\153\005\197\031\031\004\003\000\143\004#\005\031\004\002\000\196\005#\005>\005\175\014\153\005\189\031#\005>\005\026\005\196\005\031\004\002\000\196\005M\004\017\005>\005\130\004o\006\153\005\181\031\130\004#\005\031\004\002\000\196\005#\005>\005\175\014\137\005\185\031\031\004\000\000\137\005\193\031\031\004\000\000\137\005\201\031\031\004\000\000\026\005\159\004\020\004\000GET-LIST-ADDRZ\031\013*\017\005#\005H\005\153\005/ #\005#\005\021\007>\005#\005H\005X\004\017\005E\031o\006\153\005# \031\004\004\000\196\005Z\031\153\005# \026\005\159\004\159\004\159\004\159\004\159\004\026\005\031\004\255\255\020\004\026\005\026\005\159\004\017\005\137\005\227\031\026\005\159\004\159\004\159\004\159\004\159\004\031\004\000\000\020\004\000GET-ELEM-ID\224\031\011*\031\004\003\000\196\005H\005\020\004\000GET-LIST-IDP \011*\224\031\153\005w P \137\005{ \031\004\255\255\020\004\000GET-INV-IDj \010*\017\005,\004\014\000current_player,\004\004\000main\026\005j \020\004\000GET-CRAFT-ID\139 \012*\017\005,\004\014\000current_player,\004\005\000craft\026\005j \020\004\000GET-CRAFT-OUTPUT-ID\190 \019*\017\005,\004\014\000current_player,\004\012\000craftpreview\026\005j \020\004\000MOVE-ITEM\249 \009*\031\004\254\255+\005\031\004\252\255+\005\031\004\249\2555\005\031\004\250\255+\005\031\004\248\2555\005\031\004\248\255\247\009\020\004\000GET-CURRENT1!\011*\031\012>\005\020\004\000SET-CURRENTg!\011*\175\011>\005\031\012>\005+\005M\004\031\012+\005>\005\175\011+\005\020\004\000WORDLIST}!\008*\020\012>\005M\004\171\012\020\012+\005\020\004\000DEFINITIONS\162!\011*w\012>\005}!\020\004\000GET-ORDER\192!\009*w\012/\012>\005\031\007\184\006\196\005\019\008\243!'\008>\005\031\004\254\255l\008\231!/\012>\005\020\004\000SET-ORDER\214!\009*M\004/\012+\005w\012\031\004\000\000\019\008!\034\219\013+\005\171\012R\008\023\034\159\004\020\004\000ALSO\006\034\004*w\012M\004\171\012/\012>\005\184\006\138\026/\012\031\004\002\000\217\005\020\004\000FORTH-\034\005*X\012w\012+\005\020\004\000ONLYO\034\004*O\034\031\004\001\000/\012+\005\020\004\000ORDER`\034\005*w\012/\012>\005\184\006\196\005w\012\003\008\149\034'\008>\005\252\026\031\004\002\000l\008\135\034c\014\031\012>\005\020\004\000PREVIOUSv\034\008*w\012\171\012w\012/\012>\005\031\007\184\006\138\026/\012\031\004\254\255\217\005\020\004\000SEARCH-WORDLIST\169\034\015*\140\0200\020M\004\153\005\254\034M\004\031\007H\005\031\004\128\000S\005\153\005\250\034\031\004\001\000\137\005\254\034\031\004\255\255\020\004\000FIND\215\034\004*M\004\253\024w\012/\012>\005\184\006\196\005w\012\003\008?#\181\004'\008>\005\215\034\004\005\153\0057#\241\006\170\004\159\004\253\006D\008\020\004\031\004\002\000l\008\029#\170\004\031\004\000\000\020\004\000DUMP\008#\004*\215\008\031\004\000\001\031\004\000\000\003\008\130#'\008\031\004@\000\230\005\244\023\021\007\031\004@\000\138\026'\008\244\0235\005\244\023\031\004A\000\227\008R\008^#\020\004\000SAVE-STATEO#\010*,\004\004\000bootO#\020\004\000COLD\146#\004*,\004\019\000Computer is ready (\021\014\002\018\031\027,\004\011\000bytes free)\021\014\131\029\020\004"..string.rep(string.char(0),7206).."" end \ No newline at end of file diff --git a/t2.lua b/t2.lua index cd4e31b..1fb0551 100644 --- a/t2.lua +++ b/t2.lua @@ -198,6 +198,19 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) return true end) +local function update_craftpreview(turtle) + local inv = turtles.get_turtle_inventory(turtle) + local info = turtles.get_turtle_info(turtle) + local dir = minetest.facedir_to_dir(info.dir) + local player = turtles.create_turtle_player(turtle, dir, true) + inv:set_stack("craftpreview", 1, + minetest.craft_predict( + minetest.get_craft_result({method = "normal", items = inv:get_list("craft"), width = inv:get_width("craft")}).item, + player, + inv:get_list("craft"), + inv)) +end + minetest.register_node("turtle:turtle", { description = "Turtle", drawtype = "airlike", @@ -211,7 +224,9 @@ minetest.register_node("turtle:turtle", { inv:set_size("floppy", 1) inv:set_size("main", 8 * 4) inv:set_size("craft", 3 * 3) - inv:set_size("craft_output", 1) + inv:set_width("craft", 3) + inv:set_size("craftpreview", 1) + inv:set_size("craftresult", 1) local id = turtles.create_turtle_id() meta:set_int("turtle_id", id) local info = turtles.get_turtle_info(id) @@ -227,6 +242,15 @@ minetest.register_node("turtle:turtle", { info.turtle = le le.turtle_id = id end, + on_metadata_inventory_move = function(pos) + update_craftpreview(minetest.get_meta(pos):get_int("turtle_id")) + end, + on_metadata_inventory_take = function(pos) + update_craftpreview(minetest.get_meta(pos):get_int("turtle_id")) + end, + on_metadata_inventory_put = function(pos) + update_craftpreview(minetest.get_meta(pos):get_int("turtle_id")) + end, on_rightclick = function(pos, node, clicker) local turtle_id = minetest.get_meta(pos):get_int("turtle_id") local info = turtles.get_turtle_info(turtle_id) @@ -327,12 +351,14 @@ minetest.register_entity("turtle:turtle", { end end, on_rightclick = function(self, clicker) + if self.turtle_id == nil then return end local info = turtles.get_turtle_info(self.turtle_id) local name = clicker:get_player_name() info.playernames[name] = true minetest.show_formspec(name, "turtle:" .. tostring(self.turtle_id), info.formspec) end, on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir) + if self.turtle_id == nil then return end self.object:remove() local info = turtles.get_turtle_info(self.turtle_id) local pos = info.spos @@ -352,6 +378,7 @@ minetest.register_entity("turtle:turtle", { turtle_infos[self.turtle_id] = nil end, get_staticdata = function(self) + if self.turtle_id == nil then return "" end return tostring(self.turtle_id) end, })