Page 1 of 1

[0.11.22] Recipe Clipboard [WIP/First]

Posted: Mon Jun 22, 2015 1:49 pm
by leflings
Hi guys

This is my first attempt at a mod, so any criticism/advice on improvements are welcome :)

Project homepage: https://github.com/leflings/RecipeClipboard

The homepage contains a more detailed readme.

Recipe Clipboard adds the ability to

[*] Copy the ingredient list and count from any assembling machine (or anything with a recipe configured)
[*] Copy the product item from any assembling machine
[*] Paste ingredient list and count to logistic chest
[*] Paste recipe product item to any smart capable inserter

Re: [0.11.22] Recipe Clipboard [WIP/First]

Posted: Mon Jun 22, 2015 2:58 pm
by Xterminator
This is awesome! Wanted something like this for a long time. Keep up the good work, I will definitely be using this. :D

Re: [0.11.22] Recipe Clipboard [WIP/First]

Posted: Mon Jun 22, 2015 5:45 pm
by Takezu
Nice one, but how about including the zip for download ;)

Or i'm supposed do run over to git ;)

Re: [0.11.22] Recipe Clipboard [WIP/First]

Posted: Fri Jun 26, 2015 12:55 pm
by MagicLegend
Looks really cool! This is something that should be in the basegame! :D

~ML

Ps. I'll test this mod with Dytech for you :)

Re: [0.11.22] Recipe Clipboard [WIP/First]

Posted: Fri Jun 26, 2015 2:10 pm
by deepdriller
Wait... what'S the difference to Shift+LeftClick/Shift+RightcCick?

Re: [0.11.22] Recipe Clipboard [WIP/First]

Posted: Fri Jun 26, 2015 2:17 pm
by Takezu
Shift click works only if the entitys are the same, means from chest to hest or chem plant to chemplant, this works from assembler to requester chest and alike.

Re: [0.11.22] Recipe Clipboard [WIP/First]

Posted: Fri Jun 26, 2015 3:07 pm
by Blob
When loading saved MP game. What can I do?
sshot-1.png
sshot-1.png (20.94 KiB) Viewed 22275 times

Re: [0.11.22] Recipe Clipboard [WIP/First]

Posted: Fri Jun 26, 2015 4:27 pm
by jorgenRe
Blob wrote:When loading saved MP game. What can I do?
The attachment sshot-1.png is no longer available
THat is because this is a single player mod :/!
THOUGH it should be possible to make it multiplayer compatible at the very least (atleast so 1 player can use it) :)!
Putting up a fix for you:
Do note that the only thing i did was to change:
game.player. to --> game.players[1].
Now how to make it work with all the players in a multiplayer game you will need to make it check which player it was that did it! Hence the talk about the for loop down under:

Code: Select all

game.onevent(defines.events.ontick,
  function(e)
  --Now i havent read through the code but adding a for i = 1, numPlayers on do 
  --loop you should be able to make it possible to use this mod with more than just 1 player! Remember to change
  --the 1 with i as players[1] Just means player number 1 in a multiplayer game OR the player in singleplayer so it works even
  --In singleplayer!
    if game.players[1].opened then
      if pcall(function() return game.players[1].opened.recipe end) then
        if not getBtn('copyButton') then
          dbg('+ Copy button')
          createButton('Copy Build Requirements', 'copyButton')
        end
      elseif game.players[1].opened.name == 'logistic-chest-requester' then
        if not getBtn('pasteButton') then
          dbg(' + Paste Button')
           createButton('Paste Build Requirements', 'pasteButton')
        end
      elseif game.players[1].opened.type == 'inserter' then
        if not getBtn('pasteButton') then
          if string.find(game.players[1].opened.name, "smart") then
            createButton('Paste Build Requirements', 'pasteButton')
          end
        end
      end
    else
      if getBtn('copyButton') then
        dbg(' - Copy Button')
        getBtn('copyButton').destroy()
      end
      if getBtn('pasteButton')  then
        dbg(' - Paste Button')
          getBtn('pasteButton').destroy()
      end
    end
  end)

Re: [0.11.22] Recipe Clipboard [WIP/First]

Posted: Fri Jun 26, 2015 5:11 pm
by orzelek
If you want to make it compatible with multiplayer I think there is a player index in the event object. I know for sure that player created event carries it.

Re: [0.11.22] Recipe Clipboard [WIP/First]

Posted: Sat Jun 27, 2015 8:45 am
by leflings
Hey guys

Thanks for the kind words.

Yeah, in this initial release, I did nothing to enable multiplayer, because I have never tried it. From what I can tell, and others are writing, it would be a small deal to add in support for. Sadly, this releasing this mod, I've barely had time to play Factorio myself, much less do further development on the mod. And it will be another week before I'm back from vacation, to look at these things again.

Re: [0.11.22] Recipe Clipboard [WIP/First]

Posted: Sun Jun 28, 2015 12:51 pm
by jorgenRe
leflings wrote:Hey guys

Thanks for the kind words.

Yeah, in this initial release, I did nothing to enable multiplayer, because I have never tried it. From what I can tell, and others are writing, it would be a small deal to add in support for. Sadly, this releasing this mod, I've barely had time to play Factorio myself, much less do further development on the mod. And it will be another week before I'm back from vacation, to look at these things again.
I think when you save it it should be saved in a table like this: date = table[playerNumb][1]
Then when it pastes it reades, who clicked the button and put the player number in the table:
paste = table[player1][1]

Re: [0.11.22] Recipe Clipboard [WIP/First]

Posted: Wed Jul 08, 2015 8:04 pm
by Koub
[Moved to helper mods by Koub]