Jump to content




CCTransport v2.1.2 (Redesign/Rewrite) - Not the mod we need, but the mod we deserve


52 replies to this topic

#1 ElvishJerricco

  • Members
  • 803 posts

Posted 26 September 2013 - 01:36 AM

CCTransport

CCTransport's old design has been totally retired in favor of a new one. It's a bit more useful this way.

GitHub - Download

There was a suggestion a while ago that CC should add the ability to serialize and deserialize items, a la Applied Energistics. The idea is generally not great in terms of balance and such, but it seems like such an obvious idea that it deserves to exist.

How to Use

It's a pretty simple to use mod. Place down the Serial Chest in the world, and attach it to your computer. The peripheral methods are as follows:
  • serialChest.serialize()
    Remove exactly one item from the inventory and serialize it.
    Return: token, itemDetailsOrError
    If the serialization fails, token will be false and itemDetailsOrError will be the error message.
    If the serialization succeeds, the token is an alphanumeric, randomly generated string. itemDetailsOrError is a table with the same format as the turtle.inspect() return format.
  • serialChest.deserialize(token)
    Deserialize a token into an item if possible.
    Parameter token: The alphanumeric token representing the item to deserialize.
    Return: success, errorMessage.
    Deserialization fails if the item currently in the serial chest isn't the same kind of item as the item being deserialized or if there isn't enough room left. If deserialization fails, the token is not invalidated.
    Deserialization succeeds if there is room for the item in the serial chest. The token is consumed and made invalid for reuse.
The serial_chest_update event

When a serial chest's contents are changed in any way, it emits a serial_chest_update event to all attached computers, where the event parameters are as follows:

local e, name, itemDetails = os.pullEvent("serial_chest_update")
  • Parameter name: The name of the peripheral that updated.
  • Parmaeter itemDetails: The details of the items in the chest.
Turtle Upgrade

Crafting a turtle with a serial chest makes a serial turtle, capable of using its peripheral just as an ordinary serial chest. It uses specifically the slot selected by turtle.select().

Changelog
Spoiler

Edited by ElvishJerricco, 08 April 2015 - 12:21 AM.


#2 Zudo

  • Members
  • 800 posts
  • LocationUK

Posted 26 September 2013 - 11:39 AM

Ooh, this looks nice :)

#3 ElvishJerricco

  • Members
  • 803 posts

Posted 26 September 2013 - 04:24 PM

View PostZudoHackz, on 26 September 2013 - 11:39 AM, said:

Ooh, this looks nice :)

Thanks! Simple but useful. That's the goal right now.

#4 electrodude512

  • Members
  • 167 posts
  • LocationEastern USA

Posted 28 September 2013 - 02:31 PM

Cool! How hard would it be to make it save over chunk reload?

#5 ElvishJerricco

  • Members
  • 803 posts

Posted 29 September 2013 - 10:41 AM

View Postelectrodude512, on 28 September 2013 - 02:31 PM, said:

Cool! How hard would it be to make it save over chunk reload?

Probably not too bad. But I don't really think it's a good idea to hold on to these item stacks in the computer. You could run into problems with different coroutines trying to use the buffer so it should be encouraged that people flush the buffer immediately after filling it, and i don't like the idea of people using the computer as some hackish, one-slot inventory.

#6 ElvishJerricco

  • Members
  • 803 posts

Posted 30 September 2013 - 04:51 PM

v1.0.0 is out. Added signs and sided inventories.

EDIT: Also the build script for the github repo is nicer.

#7 Nathan1852

  • Members
  • 30 posts

Posted 08 October 2013 - 12:17 PM

Seems like pushFromComputer() doesn't work on most mod inventories. It didn't worked on all IC2 inventories and BC inventories for me... :(/>

After some testing, i found out that i can push Items from the Inventories into the computer, but i cannot push them into Inevntories from the Computer

Edited by Nathan1852, 08 October 2013 - 01:02 PM.


#8 ElvishJerricco

  • Members
  • 803 posts

Posted 08 October 2013 - 05:42 PM

View PostNathan1852, on 08 October 2013 - 12:17 PM, said:

Seems like pushFromComputer() doesn't work on most mod inventories. It didn't worked on all IC2 inventories and BC inventories for me... :( After some testing, i found out that i can push Items from the Inventories into the computer, but i cannot push them into Inevntories from the Computer

The function isn't pushFromComputer. It's pullFromComputer. It's worked for me in all my testing. Also, if the block is a sided inventory you can use pullFromComputerToSide instead of specifying a slot.

#9 Nathan1852

  • Members
  • 30 posts

Posted 09 October 2013 - 07:48 AM

View PostElvishJerricco, on 08 October 2013 - 05:42 PM, said:

View PostNathan1852, on 08 October 2013 - 12:17 PM, said:

Seems like pushFromComputer() doesn't work on most mod inventories. It didn't worked on all IC2 inventories and BC inventories for me... :(/>/> After some testing, i found out that i can push Items from the Inventories into the computer, but i cannot push them into Inevntories from the Computer

The function isn't pushFromComputer. It's pullFromComputer. It's worked for me in all my testing. Also, if the block is a sided inventory you can use pullFromComputerToSide instead of specifying a slot.

Yeah, i didn't remebered the function name correctly. But i used the right one.

I theory, this should work with this code: http://puu.sh/4LApB.png and this setup: http://puu.sh/4LAqZ.jpg , right?

#10 ElvishJerricco

  • Members
  • 803 posts

Posted 09 October 2013 - 11:00 AM

View PostNathan1852, on 09 October 2013 - 07:48 AM, said:

Yeah, i didn't remebered the function name correctly. But i used the right one.

I theory, this should work with this code: http://puu.sh/4LApB.png and this setup: http://puu.sh/4LAqZ.jpg , right?

I'm not sure. I was fairly sure OpenPeripheral used "up" and "down." Not "top" and "bottom"

If that's not the issue, either the item in the computer buffer isn't allowed to be piped into the top, or I used the IInventory API wrong, which I'm fairly sure isn't true.

#11 Nathan1852

  • Members
  • 30 posts

Posted 09 October 2013 - 02:31 PM

View PostElvishJerricco, on 09 October 2013 - 11:00 AM, said:

View PostNathan1852, on 09 October 2013 - 07:48 AM, said:

Yeah, i didn't remebered the function name correctly. But i used the right one.

I theory, this should work with this code: http://puu.sh/4LApB.png and this setup: http://puu.sh/4LAqZ.jpg , right?

I'm not sure. I was fairly sure OpenPeripheral used "up" and "down." Not "top" and "bottom"

If that's not the issue, either the item in the computer buffer isn't allowed to be piped into the top, or I used the IInventory API wrong, which I'm fairly sure isn't true.


Well, i just tested it with "up" and "down". It is still not working. And i am sure that Iron Ore can be piped into an electric furnace from the top...

#12 ElvishJerricco

  • Members
  • 803 posts

Posted 10 October 2013 - 01:06 PM

View PostNathan1852, on 09 October 2013 - 02:31 PM, said:

Well, i just tested it with "up" and "down". It is still not working. And i am sure that Iron Ore can be piped into an electric furnace from the top...

Fixed. Download v1.0.1

#13 LaughingLeader

  • Members
  • 9 posts

Posted 16 October 2013 - 06:16 PM

Thanks for making this mod! It goes really well with OpenPeripherals.

Now I can push items from my sort chest into the computer, and have another chest grab the items from there. Exactly what I needed for my system.

#14 Jyzarc

  • Members
  • 24 posts

Posted 14 November 2013 - 07:43 PM

What is your modpack policy?

#15 ElvishJerricco

  • Members
  • 803 posts

Posted 15 November 2013 - 02:40 AM

View PostJyzarc, on 14 November 2013 - 07:43 PM, said:

What is your modpack policy?

Don't claim it's not mine and you can use it for whatever you want.

#16 Jyzarc

  • Members
  • 24 posts

Posted 15 November 2013 - 05:17 PM

View PostElvishJerricco, on 15 November 2013 - 02:40 AM, said:

View PostJyzarc, on 14 November 2013 - 07:43 PM, said:

What is your modpack policy?

Don't claim it's not mine and you can use it for whatever you want.
Thank you, I will probably make a spotlight of this in a few days, but I dont really understand the getSlotsFromSide() and pullFromComputerToSide() methods, can you explain those?

#17 ElvishJerricco

  • Members
  • 803 posts

Posted 15 November 2013 - 09:59 PM

View PostJyzarc, on 15 November 2013 - 05:17 PM, said:

Thank you, I will probably make a spotlight of this in a few days, but I dont really understand the getSlotsFromSide() and pullFromComputerToSide() methods, can you explain those?

As you know, each inventory block has a set of slots representing each space you can put items in. OpenPeripheral gives you some level of access to these by letting you say "Move an item from slot a to slot b of the adjacent inventory." In a sided inventory, each side of the block corresponds to a certain few slots. getSlotsFromSide returns a table with all of those slots for a specified side.

With CCTransport, a computer has a small buffer inventory. It fits exactly one itemstack. You use pushToComputer(slot) to push an itemstack from the slot in the inventory to the buffer in the computer. To get it out, any inventory can then use pullFromComputer(slot) to pull the stack from the computer into the slot. In the case of sided inventories, pullFromComputerToSide(side) doesn't specify a slot. It specifies a side, and CCTransport tries its best to push the stack in, similar to piping an item in from that side with BuildCraft or something.

#18 Jyzarc

  • Members
  • 24 posts

Posted 15 November 2013 - 10:09 PM

View PostElvishJerricco, on 15 November 2013 - 09:59 PM, said:

View PostJyzarc, on 15 November 2013 - 05:17 PM, said:

Thank you, I will probably make a spotlight of this in a few days, but I dont really understand the getSlotsFromSide() and pullFromComputerToSide() methods, can you explain those?

As you know, each inventory block has a set of slots representing each space you can put items in. OpenPeripheral gives you some level of access to these by letting you say "Move an item from slot a to slot b of the adjacent inventory." In a sided inventory, each side of the block corresponds to a certain few slots. getSlotsFromSide returns a table with all of those slots for a specified side.

With CCTransport, a computer has a small buffer inventory. It fits exactly one itemstack. You use pushToComputer(slot) to push an itemstack from the slot in the inventory to the buffer in the computer. To get it out, any inventory can then use pullFromComputer(slot) to pull the stack from the computer into the slot. In the case of sided inventories, pullFromComputerToSide(side) doesn't specify a slot. It specifies a side, and CCTransport tries its best to push the stack in, similar to piping an item in from that side with BuildCraft or something.

Thank you, I will be doing a spotlight of this soon :D

#19 Jyzarc

  • Members
  • 24 posts

Posted 16 November 2013 - 12:12 PM

I cant get inv.pullFromComputerToSide(side) to work (I did wrap the peripheral of course). I assume the sides are the same you would use for something like the redstone api, so "left", "right", "back", etc. it just returns "lua:52: attempt to call nil" inv.getSlotsFromSide() to work either. All of the other methods work

#20 ElvishJerricco

  • Members
  • 803 posts

Posted 17 November 2013 - 09:46 PM

View PostJyzarc, on 16 November 2013 - 12:12 PM, said:

I cant get inv.pullFromComputerToSide(side) to work (I did wrap the peripheral of course). I assume the sides are the same you would use for something like the redstone api, so "left", "right", "back", etc. it just returns "lua:52: attempt to call nil" inv.getSlotsFromSide() to work either. All of the other methods work

The sided methods only work on ISidedInventories, not simple inventories like chests.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users