[MOD] (Alpha 8) A2B: conveyor belts & co. [v0.8.0]

Started by noone, August 18, 2014, 10:42:04 PM

Previous topic - Next topic

TehJoE

Quote from: Rock5 on February 16, 2015, 09:46:41 AM
Currently the way a Splitter works, I believe, is to alternate sending items to each output. If an output is blocked it sends the item to the unblocked output. This is good but... if both outputs are blocked I think it assigns the item to one of the blocked outputs anyway. Then if an output becomes free and it's not the one the splitter chose to send the item then the splitter becomes stuck until the other output clears.

I didn't write the original splitter code, but I did alter the routing code of the splitter significantly in the 0.8.1 version. The bolded is certainly the way the splitter is meant to work. I haven't personally experienced them clogging in the way you describe in 0.8.0 or 0.8.1 (I didn't actually use the 2-way splitter much), but I wouldn't be surprised if that issue was inadvertently addressed by the changes I made. If you run into the same issue in 0.8.1, let me know and I'll see if I can find what causes it.
Do you remember, how many breads have you eaten in your lifetime?

Rock5

I don't have time to test it right now. I'll try to test it tomorrow.

I don't really know C# but I had a quick look at the code (). It looks like the Splitter GetDestinationForThing function always returns a destination regardless of whether all the outputs are full or not. So I think it would still have the same problem. For it to work properly it would have to skip trying to move the item if all the outputs are full and keep checking GetDestinationForThing until it returns a destination which should happen when an output is finally clear. But, like I said, I don't know C#, so I could be wrong.
Rock5 [B18] Mods
- Butchers Can Count Meat
- Sun Lamp Planner
- JTZoneButtons
- RimSearch
- JTExport

TehJoE

#182
Quote from: Rock5 on February 16, 2015, 12:26:28 PM
For it to work properly it would have to skip trying to move the item if all the outputs are full and keep checking GetDestinationForThing until it returns a destination which should happen when an output is finally clear.

As far as I know, that's what it does:

        public void Tick()
        {
            (...)

            foreach (var thing in Contents.Where(ShouldIncreaseCounter))
            {
                _thingCounter[thing]++;
            }
        }

        private bool ShouldIncreaseCounter([NotNull] Thing thing)
        {
            (...)
            var destination = _parentComponent.GetDestinationForThing(thing);

            var belt = destination.GetBeltComponent();

            // If no belt items, then move things only if this is an unloader
            if (belt == null)
            {
                if (_parentComponent.IsUnloader())
                {
                    // If this is an unloader always increment the counter
                    return destination.CanPlaceThing(thing);
                }

                return false;
            }

            // If there is a belt, only move things if it can accept them from us
            if (!belt.CanAcceptFrom(_parentComponent))
                return false;

            return belt.Empty;
        }


But then, I've made some changes to routing code since the 0.8.1 version so this may not represent what's actually released. (I'm still tweaking a few things here and there so the version I have running on my machine is a little different from the one currently released) I'll make a note to test the splitter for the clogging issue when I test other changes.

EDIT: Just tested for and fixed the clogging issue. It turns out the splitter was being re-checked for a good destination, but the splitter wouldn't consider any others until its item changed.
Do you remember, how many breads have you eaten in your lifetime?

noone

Just to add my two cents on the splitter clogging issue: I delayed fixing it because I saw it as a fun unintentional feature - it's a less advanced equipment than the selector, and so sometime it's not quite perfect. Also, I liked the idea of the users pesting against malfunctioning A2B software, having to draft a colonist to un-clog the belt ... :)

This being said, I won't complain the issue is gone. Thanks for all your input TehJoE ! It is genuinely much appreciated.

Rock5

Another one of your features Grrr. LoL.

Except in this case I don't "draft a colonist to un-clog the belt" but have to manually prioritize hauling from the clogged side of the splitter. The belts are supposed to automate things, not make us do thing manually.

TehJoe, glad to hear you fixed it.
Rock5 [B18] Mods
- Butchers Can Count Meat
- Sun Lamp Planner
- JTZoneButtons
- RimSearch
- JTExport

noone

A2B has evolved into a fully fledged corporation. The new thread is here:
https://ludeon.com/forums/index.php?topic=10644.0

With this change, we at A2B hope to secure a bright future for the mod while allowing easy contributions from the community.

This thread is now closed.