Jump to content

[Help] Fabricator and Piped Dispenser small issue


Recommended Posts

So I found myself in a pickle, once again. I have been using Nightlib with success with some of my mods, with no issue at all. Recently I tried to add the optional exhaust option to a building that uses the fabricator as means to produce an element. The code I'm posting bellow works perfectly for element converters, but for some reason it does not with the fabricator. I tried many things, but I guess my knowledge with c# still very shallow, so I decided to ask here for some help with it.

Spoiler

            BuildingTemplates.CreateComplexFabricatorStorage(go, fabricator);
            fabricator.outStorage.capacityKg = 2000f;
            fabricator.storeProduced = true;
            fabricator.inStorage.SetDefaultStoredItemModifiers(FoundryStoredItemModifiers);
            fabricator.buildStorage.SetDefaultStoredItemModifiers(FoundryStoredItemModifiers);
            fabricator.outStorage.SetDefaultStoredItemModifiers(FoundryStoredItemModifiers);
            fabricator.outputOffset = new Vector3(1f, 0.5f);

            PipedDispenser dispenser = go.AddComponent<PipedDispenser>();
            dispenser.storage = fabricator.outStorage;
            dispenser.elementFilter = new SimHashes[] { SimHashes.MoltenGlass };
            dispenser.AssignPort(GlassOutputPort);
            dispenser.alwaysDispense = true;
            dispenser.SkipSetOperational = true;

            PipedOptionalExhaust exhaust = go.AddComponent<PipedOptionalExhaust>();
            exhaust.dispenser = dispenser;
            exhaust.elementHash = SimHashes.MoltenGlass;
            exhaust.elementTag = SimHashes.MoltenGlass.CreateTag();
            exhaust.capacity = 500f;
            this.AttachPort(go);

 

 

You see, if I use this building to fabricate the Glass, based on the recipe, it stores the molten glass, but does not outputs it. Am I using the wrong method to access the fabricator.outstorage, or perhaps something else? I tried to contact Nightlib on his Github page to try to solve this, but it will not cost anything to ask help here too. If anyone would help me figure out this, I will be very grateful.

Link to comment
Share on other sites

On 2/10/2021 at 2:07 PM, Ronivan said:

            PipedOptionalExhaust exhaust = go.AddComponent<PipedOptionalExhaust>(???);
            exhaust.dispenser = dispenser;
            exhaust.elementHash = SimHashes.MoltenGlass;
            exhaust.elementTag = SimHashes.MoltenGlass.CreateTag();
            exhaust.capacity = 500f;
            this.AttachPort(go);

I think there might be something wrong with that bold line.

I'm no virtuoso with modding, but have you tried troubleshooting the operation with a bottle emptier set to liquid glass nearby? can you retireve the glass manually?

This PipedOptionalExhaust is optional yes? Like where there's a mod made to have optional exhausts that work if they're connected and don't if they aren't - is that what this is? Maybe try working with standard port, and go from there?

Seems like it's not giving you a valid port at all - have you tired moving the port? I assume it's defined by the vector.

Quote

dispenser.AssignPort(GlassOutputPort);

this also seems redundant or atleast contradictory. MoltenGlassOutputPort maybe?? I don't know, there's a lot of references I can't check, hope for the best, let us know how is goes.

Link to comment
Share on other sites

Sorry, I should not have made this topic, since it relays on a Lib that is not part of Klei code. I will wait for the author of the said lib to answer me when its possible.

Anyway its seems I cannot access the fabricator storage by that method, even if said method works with the elemental converter. Perhaps the fabricator stores the data in a different hierarchy so I could no access that simple.

Link to comment
Share on other sites

Well I solved the issue today. Here is a sample on how the building will work:

ScreenShot033.thumb.png.3b8d58ca37675c76ffbf997fd1363d87.png

Its releasing all content directly in the floor bellow. Any product fabricated by it, as long it is liquid, will be released like that. I need to further clean the code so it won't cause any issues later on, but it worked the way I wanted. So far so good.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...