diff options
Diffstat (limited to 'init.lua')
-rw-r--r-- | init.lua | 42 |
1 files changed, 28 insertions, 14 deletions
@@ -2,8 +2,8 @@ local function eject_item(pos,dir,item,speed) if not speed then speed = 3 end local spawnpos = vector.add(pos,vector.multiply(dir,-0.6)) local velocity = vector.multiply(dir,speed*-1) - local item = minetest.add_item(spawnpos,item) - item:set_velocity(velocity) + local eref = minetest.add_item(spawnpos,item) + eref:set_velocity(velocity) end minetest.register_craftitem("printer:document",{ @@ -50,7 +50,14 @@ minetest.register_node("printer:printer",{ on_construct = function(pos) local meta = minetest.get_meta(pos) meta:get_inventory():set_size("paper",1) - meta:set_string("formspec","size[8,6]label[1,0;Paper Tray]list[context;paper;1,0.5;1,1]list[current_player;main;0,2;8,4]listring[]field[3,0.75;2,1;channel;Channel;${channel}]button_exit[5,0.5;2,1;set;Set]") + meta:set_string("formspec","size[8,6]".. + "label[1,0;Paper Tray]".. + "list[context;paper;1,0.5;1,1]".. + "list[current_player;main;0,2;8,4]".. + "listring[]".. + "field[3,0.75;2,1;channel;Channel;${channel}]".. + "button_exit[5,0.5;2,1;set;Set]" + ) end, can_dig = function(pos,player) local name = player:get_player_name() @@ -110,18 +117,18 @@ minetest.register_node("printer:printer",{ local facedir = minetest.facedir_to_dir(node.param2) if msg.command == "get_status" then if paperstack:get_count() > 0 then - digiline:receptor_send(pos,digiline.rules.default,channel,{status = "OK",paper_left = paperstack:get_count(),}) + digilines.receptor_send(pos,digilines.rules.default,channel,{status = "OK",paper_left = paperstack:get_count(),}) else - digiline:receptor_send(pos,digiline.rules.default,channel,{status = "no_paper",paper_left = paperstack:get_count(),}) + digilines.receptor_send(pos,digilines.rules.default,channel,{status = "no_paper",paper_left = paperstack:get_count(),}) end elseif msg.command == "formfeed" then if paperstack:get_count() > 0 then eject_item(pos,facedir,ItemStack("default:paper")) paperstack:take_item(1) minetest.sound_play("printer_feed",{pos=pos}) - digiline:receptor_send(pos,digiline.rules.default,channel,{status = "OK",paper_left = paperstack:get_count(),}) + digilines.receptor_send(pos,digilines.rules.default,channel,{status = "OK",paper_left = paperstack:get_count(),}) else - digiline:receptor_send(pos,digiline.rules.default,channel,{status = "no_paper",paper_left = paperstack:get_count(),}) + digilines.receptor_send(pos,digilines.rules.default,channel,{status = "no_paper",paper_left = paperstack:get_count(),}) end elseif msg.command == "print" then if paperstack:get_count() > 0 then @@ -134,9 +141,9 @@ minetest.register_node("printer:printer",{ eject_item(pos,facedir,document) paperstack:take_item(1) minetest.sound_play("printer_print",{pos=pos}) - digiline:receptor_send(pos,digiline.rules.default,channel,{status = "OK",paper_left = paperstack:get_count(),}) + digilines.receptor_send(pos,digilines.rules.default,channel,{status = "OK",paper_left = paperstack:get_count(),}) else - digiline:receptor_send(pos,digiline.rules.default,channel,{status = "no_paper",paper_left = paperstack:get_count(),}) + digilines.receptor_send(pos,digilines.rules.default,channel,{status = "no_paper",paper_left = paperstack:get_count(),}) end end meta:get_inventory():set_stack("paper",1,paperstack) @@ -198,7 +205,14 @@ minetest.register_node("printer:receipt_printer",{ on_construct = function(pos) local meta = minetest.get_meta(pos) meta:get_inventory():set_size("paper",1) - meta:set_string("formspec","size[8,6]label[1,0;Paper Compartment]list[context;paper;1,0.5;1,1]list[current_player;main;0,2;8,4]listring[]field[3,0.75;2,1;channel;Channel;${channel}]button_exit[5,0.5;2,1;set;Set]") + meta:set_string("formspec","size[8,6]".. + "label[1,0;Paper Compartment]".. + "list[context;paper;1,0.5;1,1]".. + "list[current_player;main;0,2;8,4]".. + "listring[]".. + "field[3,0.75;2,1;channel;Channel;${channel}]".. + "button_exit[5,0.5;2,1;set;Set]" + ) end, can_dig = function(pos,player) local name = player:get_player_name() @@ -258,9 +272,9 @@ minetest.register_node("printer:receipt_printer",{ local facedir = minetest.facedir_to_dir(node.param2) if msg.command == "get_status" then if paperstack:get_count() > 0 and paperstack:get_name() == "printer:receiptpaper_roll" then - digiline:receptor_send(pos,digiline.rules.default,channel,{status = "OK",paper_left = 65535-paperstack:get_wear(),}) + digilines.receptor_send(pos,digilines.rules.default,channel,{status = "OK",paper_left = 65535-paperstack:get_wear(),}) else - digiline:receptor_send(pos,digiline.rules.default,channel,{status = "no_paper",paper_left = 0,}) + digilines.receptor_send(pos,digilines.rules.default,channel,{status = "no_paper",paper_left = 0,}) end elseif msg.command == "print" then if paperstack:get_count() > 0 and paperstack:get_name() == "printer:receiptpaper_roll" then @@ -279,9 +293,9 @@ minetest.register_node("printer:receipt_printer",{ paperstack:set_wear(newwear) end meta:get_inventory():set_stack("paper",1,paperstack) - digiline:receptor_send(pos,digiline.rules.default,channel,{status = "OK",paper_left = math.max(0,65535-newwear),}) + digilines.receptor_send(pos,digilines.rules.default,channel,{status = "OK",paper_left = math.max(0,65535-newwear),}) else - digiline:receptor_send(pos,digiline.rules.default,channel,{status = "no_paper",paper_left = 0,}) + digilines.receptor_send(pos,digilines.rules.default,channel,{status = "no_paper",paper_left = 0,}) end end end, |