Giter Club home page Giter Club logo

ccfactorymanager's Introduction

CC's Factory Manager Build Status

Allows ComputerCraft to handle items, fluids and RF similar to Steve's Factory Manager but with the power of lua.

Though you can, please don't just pastebin code for this peripheral. It can be very over powered and you are meant to work for it by spending time on programming. This is also the reason why there is only a very basic quick-start guide and the peripheral documentation.

Tutorials, Spotlights and "how-to"-guides are very welcome - just don't post finished code.

Quick-Start

  1. Place a Factory Controller next to a Turtle
  2. Use a few Factory Cables to connect the controller to an empty chest or place a chest besides the controller.
  3. Right-click the Controller to open its GUI and name the turtle "hello" and the chest "world"
  4. Put a distinctive item in the turtles first slot, open a lua shell on the turtle and run:
factory = peripheral.wrap("front")
factory.transferItem("hello", 1, "world", 1, 0)
  1. It should say 1, because it transferred 1 item from the first slot of "hello" to the first-best slot (0) of the target "world", i.e.: transferItem(source, source-slot, target, quantity, target-slot)

Permissions

Feel free to use in any modpack. I won't answer messages/issues about this, please don't feel insulted.

Recipes

Factory Controller Factory Cable

Peripheral Documentation

Relative positions and Names

setName(x, y, z, name)

Sets the name of a position relative to the Factory Controller. This can also be done via the GUI of the Factory Controller block. Note that names are unique and setting a new name for a position might overwrite a old one. The name is used by other Factory methods to refer to the block in that position.

getName(x, y, z)

Returns the name of the position.

getTarget(name)

Returns the position a name is refering to.

resetNames()

Clears the name of all positions. Useful for lua programs which are naming their blocks themselves.

Targets and types

getTargets()

Returns a table containing details about all Blocks capable of handling items, fluids and/or energy, e.g. when connected to a single Casting Table:

{
  {
    Pos = { x = 5, y = 0, z = 1 },
    Types = { "item", "fluid" },
    Meta = 0,
    Block = "TConstruct:SearedBlock",
    Name = "Casting Table",
    Target = "IngotCast",
  },
}

getCapabilities(target-name), getCapabilitiesByPos(x, y, z)

Returns a table with the capabilities provided by the given target, e.g. for above Casting Table:

{
  item = true,
  fluid = true
}

Inventory Handling

transferItem(source-name, source-slot, target-name, quantity, target-slot)

Returns the number of transferred items. If target-slot is 0 the first matching/free slot will be used.

getInventorySize(source-name)

Returns the number of slots of the inventory at source-name.

getAllItems(source-name), getAllItemsByPos(x, y, z)

Returns a table containing all items stored in the inventory at that position. E.g.:

{
  {
    mod_id = "minecraft",
    raw_name = "tile.stone",
    max_size = 64,
    max_dmg = 0,
    qty = 32,
    dmg = 0,
    id = "minecraft:stone",
    ore_dict = { stone = true, },
    display_name = "Stone",
    name = "stone",
  },
  [ 11 ] = {
    display_name = "Enchanted Book",
    raw_name = "item.enchantedbook",
    max_size = 1,
    max_dmg = 0,
    qty = 1,
    dmg = 0,
    id = "minecraft:enchanted_book",
    nbt_id = "258bbd4a6be0fef5da627018fb8cc9b1",
    name = "enchanted_book",
    mod_id = "minecraft",
  },
}

Fluid Handling

transferFluid(source, source-side, source-tank-id, target, target-side, amount)

Side is specified as "north", "up", "down" etc. Tank-Id is the number of the tank stored in the block; this is usually 1 as most blocks only have one tank. Returns the amount of mB transferred.

getTankInfo(source, side), getTankInfoByPos(x, y, z, side)

Returns details about the tank accessible from the given side for the given block. If side is "" the details about all sides will be returned. E.g. for querying any specific side of an Extra-Utilities Drum filled with one bucket of Lava:

{
  {
    capacity = 256000,
    contents = {
      rawName = "Lava",
      amount = 1000,
      name = "lava",
      id = 2,
    },
  },
}

RF/Energy Handling

transferEnergy(source, source-side, target, target-side, amount)

Side is specified as "north", "up", "down" etc. Returns the amount of RF transferred.

getEnergyInfo(source, side), getEnergyInfoByPos(x, y, z, side)

Returns details about the RF stored at the given side of the given block.

{
  stored = 25200,
  capacity = 500000,
}

ccfactorymanager's People

Contributors

davenonymous avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.