How to change an industry from producing an item, to consuming only an item.

TORANA

Aprilia Racing Fan
Hello Everyone,

Been a very Long time for me here. Back into building my layout I started in TRS2004, now enjoying it in TS12 sp1.

Anyone know how I can change an industry that produces items into one that Consumes only?

It has me a bit puzzled, I'm try ing to get the Feedlot to consume Cattle instead of producing them.

I want to use the Feedlot as a holding pen that consumes Livestock (cattle, Pigs, Sheep etc ) to
use as a drop off point for export at the seaport.

I have tried changing the process in the config. with no luck, here's what I have done
but it still is producing instead of consuming.

processes
{
multi_consumer_producer
{
start-enabled 1
duration 60

inputs
{
0
{
amount 1
queue "cattle_q"
}
}

outputs
{
}
}
}

For some reason when I paste the above process it does not space it out properly, but it is in config file.

Any help greatly appreciated.


Cheers,
Torana.
 
The meatworks process in the config is basically what I have written above.

I've tried that process. I even copied the processes & pasted it in the feedlot config to try.

It still produces, not consume goods. I don't know how it does that.

Thanks anyway.
 
I had this trouble when I tried to setup a car storage yard using a car factory industry. In the end I stripped the script out and removed the tracks and placed a MIN in front. I left the cars there by setting the initial. Just scenery but I got the effect of a lot of cars being there, easier than placing a couple of hundred by hand. I also changed the cars so I had a yard full of the same brand. I also tried what you are diong but could never get it to work.
cheers,
Mike
 
Here's a quick fix I've used. Lay a MIN track next to the industry's track and get them exactly parallel. Set up the MIN to consume cattle, hook it up to the line, then carefully drag it on top of the industry's track. It probably won't produce the effect you're after, but at least it works...

-Vic
 
In addition to modifying the config.txt, you have to modify the script. The original script is for producing cattle, and loading a train. The new script has to unload a train, and consume cattle.

Peter
 
Hi Peter,
I worked that out and even had a go at adapting other script but it wouldn't work. I wouldn't mind finding out more about script as I did a bit of coding in the early days.

John,
I have used PLs a lot, I customize them for my routes all the time as they give a more realistic operation. But it is the showing of product that interests me. The best one I have come across for doing this is the PTS Track that trans load a product from one vehical to another, like from a SG to a NG or back. I have used it in an intermodal setup where a train pulls into a yard, then trucks pull alongside and the containers move to the trucks physically. You can then cart containers back to the train and reload it.
It would be really great if somebody could code a track like the one used in the old Auran Seaport where containers move from the train to the ship. even better if you could then get it to go back the other way. one can only hope.
Cheers,
Mike
 
Vic- Thanks for that mate. Already doing that to keep the wheels of industry turning. Good ol' M.I.N.

John- I'm willing to look at that thanks.

Peter- In the back of my head I was hoping it wasn't a script issue, but somehow knew it was.
10yrs on Trainz & still haven't got into that side of Trainz. Bit too much for me if feel.

Mike- I know I haven't been here for awhile, but wouldn't etiquette suggest that you at least give me a chance
to reply to these people first before you add more, because I'm just wondering,
if you knew it was obviously a script issue as you told Peter "I worked that out and even had a go at adapting other script but it wouldn't work.
I wouldn't mind finding out more about script as I did a bit of coding in the early days."

Why didn't you just say that in the first place?

This is just my thoughts, and not intended as an insult to anyone in any manner.

Should I ask the moderators to move this thread to Scenario Scripting & Scriptlets perhaps?

:)
 
I only tried the script thing earlier today so I have told you as soon as I found out in a roundabout way,
It is called a discussion forum and I think we have been discussing a problem that others are interested in.
cheers,
Mike
 
Last edited:
I have modified the script of 'cattle feedlot' (kuid2:50567:10027:2) to receive cattle instead of exporting.
Code:
include "GenericIndustry.gs"

//
// MultipleIndustry industry
//
class MultipleIndustry isclass GenericIndustry
{

    ProductQueue cattleQueue;
    Asset cattleAsset;

    bool animating = false;
    bool processing = false;
    bool scriptletEnabled = true;

    // Track if they only supply some of the logs that were requested in the waybill.
    int cattleWBRemain = 0;

    thread void ViewDetails(void)
    {
    if (!info)
    {
        info = Constructors.NewBrowser();
        info.LoadHTMLString(HTMLWindow.GetCompleteIndustryViewDetailsHTMLCode(me, scriptletEnabled));
        info.SetWindowRect(100, 80, 500, 545);
    }
    }

    bool TriggerSupportsStoppedLoad(Vehicle vehicle, string triggerName)
    {
    bool vehicleToTrain = vehicle.GetFacingRelativeToTrain();
    int direction;
    direction = vehicle.GetRelationToTrack(me,"cattle-export");
    if (!vehicleToTrain) direction = -direction;
    // Are we up to the furthest trigger away from the side we entered for goods?
    if (direction == Vehicle.DIRECTION_BACKWARD and triggerName == "cattle-exporttrig1") return true;
    else if (direction == Vehicle.DIRECTION_FORWARD and triggerName == "cattle-exporttrig1") return true;
    // If the train has already stopped, then fall thru and allow this load as well
    if (triggerName == "cattle-exporttrig1")
    {
        if (vehicle.GetMyTrain().IsStopped()) return true;
    }
    return false;
    }

    void PerformStoppedLoad(Vehicle vehicle, string triggerName)
    {

    bool cattleWBModified = false;
    int cattlespaceAvailable;
    LoadingReport cattlereport;
    int cattledirection;

    if (triggerName == "cattle-exporttrig1" )
    {
        if (itc.IsTrainCommand(vehicle.GetMyTrain(), Industry.UNLOAD_COMMAND))
        {
        cattlespaceAvailable = cattleQueue.GetQueueSpace();
        cattlereport = CreateUnloadingReport(cattleQueue,cattlespaceAvailable);
        cattledirection = vehicle.GetRelationToTrack(me,"cattle-export");

        if (cattledirection == Vehicle.DIRECTION_FORWARD) cattlereport.sideFlags = LoadingReport.RIGHT_SIDE;
        else if (cattledirection == Vehicle.DIRECTION_BACKWARD) cattlereport.sideFlags = LoadingReport.LEFT_SIDE;

        vehicle.UnloadProduct(cattlereport);
        //Already done something to the queue? if so, set flag so that we don't unload it again.
        if (cattlereport.amount > 0)
        {
            cattleWBRemain = cattleWBRemain - cattlereport.amount;
            if (cattleWBRemain < 0) cattleWBRemain = 0;
            cattleWBModified = true;
        }
        }
    }
    }

    thread void MultipleMain(void)
    {
    Message msg;
    Vehicle vehicle;
    string triggerName;

    wait()
    {
        on "Scriptlet-Enabled", "1":
        {
        if (!scriptletEnabled)
        {
            scriptletEnabled = true;
            SetProcessEnabled("multi_consumer_producer", true);
        }
        continue;
        }

        on "Scriptlet-Enabled", "0":
        {
        if (scriptletEnabled)
        {
            scriptletEnabled = false;
            SetProcessEnabled("multi_consumer_producer", false);
        }
        continue;
        }
    }
    }

    // called by the game once when a process is ready to start (see Industry.gs)
    void NotifyProcessStarted(string processName)
    {
    if (PerformProcessInput(processName))
    {
        // we are making the assumption that there is only one process, "multi_consumer_producer"
        PerformProcessStarted(processName);
    }
    else PerformProcessCancelled(processName);
    }

    //
    // Called by the game once when a process is ready to stop (see Industry.gs)
    //
    void NotifyProcessFinished(string processName)
    {
    processing = false;

    if (!animating)
    {
        PerformProcessOutput(processName);
        PerformProcessFinished(processName);
    }
    }

    public void Init(void)
    {
    inherited();
    usePipeAnimation = false;
    // initialize queues
    cattleQueue = GetQueue("cattle_q");
    cattleAsset = GetAsset().FindAsset("cattle");
    AddAssetToIndustryProductInfo("cattle", "cattle_q", "multi_consumer_producer", true);
    MultipleMain();
    }

    public Requirement[] GetRequirements(void)
    {
    Requirement[] ret = new Requirement[0];
    if (cattleQueue.GetQueueSpace() > (cattleQueue.GetQueueSize() / 2) or cattleWBRemain > 0)
    {
        ResourceRequirement req = new ResourceRequirement();
        req.resource = cattleQueue.GetProductFilter().GetProducts()[0];
        req.amount = cattleQueue.GetQueueSpace();
        req.dst = me;
        req.dstQueue = cattleQueue;
        cattleWBRemain = req.amount;
        ret[ret.size()] = req;
    }
     return ret;
    }

    public void AppendDriverDestinations(string[] destNames,string[] destTracks)
    {
    destNames[destNames.size()] = "cattle-unloading";
    destTracks[destTracks.size()] = "cattle-export";
    }

};
Peter
 
Thank you very much Peter I think a lot of people will be pleased with that little beauty. Specially Torana. Be a lot less hair pulling now.
Cheers,
Mike
 
Wow, I think that's the nicest thing a stranger has ever done for me.

Thank you so much for your time & effort Peter, I'm overwhelmed with your kindness.
You are the pinnacle of what makes a great Trainz community Sir.

If you are ever in Brisbane, PM me, I would like to buy you a drink.

I wish you & your family all the very best for the future.

Cheers
 
Back
Top