Logistics Pipes

Logistics Pipes

13M Downloads

Request-Pipe "force craft"

Flow86 opened this issue · 12 comments

commented

Hi,

is there an easy way to get a request pipe to force the crafting of the items?

I want to check via ComputerCraft if I have "enough" of a specific item, if not, request crafting it. if I simply request the item, i get it from my chests. (And no - I dont want to request "all" of them to get it crafting "some"

commented

hmm, nice feature request...

atm active requests are satisfied by providers if possible, then crafting otherwise.

2 features which might help you : iron pipes do not block requests - they are one-way, and behave as expected, and no pipe will request from the inventory it is attached to.

you may need a second computer, or some other way of reading the inventory out are using as a buffer.

commented

but that won't work, since the crafting pipes need access to the inventories (and my setup is kind of compact "large library"). thats why I meant a simple "option" at the request pipe would be the best, like "request only", "craft only", "request/craft"

commented

the reason i said it is a feature request is that active requests are hard coded to check providers before crafting.
https://github.com/RS485/LogisticsPipes-Dev/blob/Dev/common/logisticspipes/request/RequestTreeNode.java#L56

RequestTree.request would need to take an extra parameter, pass it through to the RequstTree, and RequestTreeNode constructors.

commented

@Flow86 possibly resolved by #449 (ce41170)

would you be able to test?

commented

I will test it later or tomorrow. Thx sounds awesome

commented

Okay, it partly seem to work, but I get an exception:

"Took too long" on requesting 28 stacks of charcoal.

Code:

p = peripheral.wrap("back")

items = p.getAvailableItems()

for nr,item in ipairs(items) do
    name = p.getUnlocalizedName(item[1])

    if name == "Charcoal" then
        print("Char Coal: ", item[2])
        if item[2] < 64*64 then
            print("Missing: ", (64*64-item[2]))
            -- print(p.makeRequest(item[1], 64*64-item[2]), True)
            print(p.makeRequest(item[1], 64*28, True))
            return 0
        end
    end

    print(p.getItemID(item[1]), "#", p.getItemDamage(item[1]), "=", name, ": ", item[2])
end

got a stacktrace too:

2013-05-30 18:26:06 [INFO] [STDERR] java.lang.IllegalArgumentException: wrong number of arguments
2013-05-30 18:26:06 [INFO] [STDERR]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2013-05-30 18:26:06 [INFO] [STDERR]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
2013-05-30 18:26:06 [INFO] [STDERR]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2013-05-30 18:26:06 [INFO] [STDERR]     at java.lang.reflect.Method.invoke(Method.java:616)
2013-05-30 18:26:06 [INFO] [STDERR]     at logisticspipes.proxy.cc.LogisticsTileGenericPipe_CC$1.call(LogisticsTileGenericPipe_CC.java:320)
2013-05-30 18:26:06 [INFO] [STDERR]     at logisticspipes.ticks.QueuedTasks.tickEnd(QueuedTasks.java:40)
2013-05-30 18:26:06 [INFO] [STDERR]     at cpw.mods.fml.common.SingleIntervalHandler.tickEnd(SingleIntervalHandler.java:34)
2013-05-30 18:26:06 [INFO] [STDERR]     at cpw.mods.fml.common.FMLCommonHandler.tickEnd(FMLCommonHandler.java:141)
2013-05-30 18:26:06 [INFO] [STDERR]     at cpw.mods.fml.common.FMLCommonHandler.onPostWorldTick(FMLCommonHandler.java:282)
2013-05-30 18:26:06 [INFO] [STDERR]     at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:661)
2013-05-30 18:26:06 [INFO] [STDERR]     at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:275)
2013-05-30 18:26:06 [INFO] [STDERR]     at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:571)
2013-05-30 18:26:06 [INFO] [STDERR]     at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:469)
2013-05-30 18:26:06 [INFO] [STDERR]     at net.minecraft.server.ThreadMinecraftServer.run(SourceFile:573)
2013-05-30 18:26:08 [INFO] [STDERR] java.lang.Exception: Took too long (makeRequest,logisticspipes.pipes.PipeItemsRequestLogistics)
2013-05-30 18:26:08 [INFO] [STDERR]     at logisticspipes.proxy.cc.LogisticsTileGenericPipe_CC.callMethod(LogisticsTileGenericPipe_CC.java:344)
2013-05-30 18:26:08 [INFO] [STDERR]     at dan200.computer.core.apis.PeripheralAPI$PeripheralWrapper.call(PeripheralAPI.java:115)
2013-05-30 18:26:08 [INFO] [STDERR]     at dan200.computer.core.apis.PeripheralAPI.callMethod(PeripheralAPI.java:478)
2013-05-30 18:26:08 [INFO] [STDERR]     at dan200.computer.core.LuaJLuaMachine$2.invoke(LuaJLuaMachine.java:304)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.lib.VarArgFunction.onInvoke(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.TailcallVarargs.eval(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.LuaClosure.invoke(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.LuaClosure.execute(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.LuaClosure.onInvoke(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.LuaClosure.invoke(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.LuaClosure.execute(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.LuaClosure.onInvoke(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.LuaClosure.invoke(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.lib.BaseLib.pcall(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.lib.BaseLib$BaseLibV.invoke(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.LuaClosure.execute(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.LuaClosure.onInvoke(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.LuaClosure.invoke(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.LuaClosure.execute(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.LuaClosure.onInvoke(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.TailcallVarargs.eval(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.TailcallVarargs.arg1(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.LuaClosure.call(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.LuaClosure.execute(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.LuaClosure.onInvoke(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.LuaClosure.invoke(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.LuaClosure.execute(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.LuaClosure.onInvoke(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.LuaClosure.invoke(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.lib.BaseLib.pcall(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.lib.BaseLib$BaseLibV.invoke(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.LuaClosure.execute(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.LuaClosure.call(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.LuaClosure.execute(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.LuaClosure.onInvoke(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.LuaClosure.invoke(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at org.luaj.vm2.LuaThread$State.run(Unknown Source)
2013-05-30 18:26:08 [INFO] [STDERR]     at java.lang.Thread.run(Thread.java:679)
commented

aah another thing:

print(p.makeRequest(item[1], 64*28, False))

or

print(p.makeRequest(item[1], 64*28, 0))

still tries to craft, it seem to accept any parameter value as "true" (I even tried nil)
only if i remove the 3rd parameter, it uses the default behaviour.

commented

I will investigate tonight (8am in them morning here, i'm off to work)

On Fri, May 31, 2013 at 2:34 AM, Flow86 [email protected] wrote:

aah another thing:

print(p.makeRequest(item[1], 64*28, False))

or

print(p.makeRequest(item[1], 64*28, 0))

still tries to craft, it seem to accept any parameter value as "true" (I
even tried nil)


Reply to this email directly or view it on GitHubhttps://github.com//issues/83#issuecomment-18692241
.

“Getting information off the Internet is like taking a drink from a fire
hydrant.”
– Mitchell Kapor

commented

Ok i found the bug. At least inside the CC method mapping part. It was only checking if the Method arguments where matching the input arguments so it skipped the last boolean cause the first two double already matched the first makeRequest method.
Oh, and by the way you need to write false not False

commented

Should now work with dev.459

commented

Any news about that?

commented

sorry about the late response: yes it seem to work now