Project Red - Exploration

Project Red - Exploration

27M Downloads

Clarifcation on requests.scala

octylFractal opened this issue ยท 2 comments

commented

I need something clarified about lines 43-50 of requests.scala:

    {
        def doRequest()
        {
            if (opt.contains(RequestFlags.PULL) && doPullReq()) return
            if (opt.contains(RequestFlags.CRAFT) && doExcessReq()) return
            if (opt.contains(RequestFlags.CRAFT) && doCraftReq()) return
        }
        doRequest()
    }

Is the if supposed to use CRAFT for both doExcessReq and doCraftReq?

commented

This is rather complex code, so let me tell you what it does.

the method doRequest() starts the entire request chain. First it tries to get all the requested item directly if it is sitting in a chest somewhere, which is what doPullReq() does. Then, it tries to craft from excess items. These excess items are items that are left over from another craft (like if you request 2 pickaxes, it crafts 4 sticks, and 2 of them get used for first pickaxe, and the other two are registered as excess, and doExcessReq() picks them up for the second pickaxe.

Both excess and normal crafting check to see if the crafting flag is set. They work together to craft the end result.

commented

Okay, thanks.