Beiträge von doug

Willkommen in der Transport Fever Community

Wir begrüßen euch in der Fan-Community zu den Spielen Transport Fever und Train Fever, den Wirtschaftssimulatoren von Urban Games. Die Community steht euch kostenlos zur Verfügung damit ihr euch über das Spiel austauschen und informieren könnt. Wir pflegen hier einen freundlichen und sachlichen Umgang untereinander und unser Team steht euch in allen Fragen gerne beiseite.

 

Die Registrierung und Nutzung ist selbstverständlich kostenlos.

 

Wir wünschen euch viel Spaß und hoffen auf rege Beteiligung.

Das Team der Transport-Fever Community


    A Steam user with the handle mav12222 created a mod to implement mail as a cargo. He added the ability to carry mail to only a limited number of vehicles. This is how I added mail as a cargo type to anything that carrys goods. You could probably use it as a model to change capacities:

    The 'Start Paused' mod I posted a couple of days ago uses a game script file. There are actually two files needed - one in 'res/config/game_script' that loads the other, which is located in 'res/scripts'

    It is this second file that contains the actual functions that will be called on each update or event.

    Ok, nice to know.


    However, the problem with my mod is, that I'm calling that function in addModifier in runFn and in this mod thread game==false, so game.interface is not available.

    Maybe I need to combine that with the new GameScript, but dont know how yet.

    The 'game' variable is available in the runFn function of a mod. However, the modifier function, even if it is defined inline within runFn, does in fact run in a different thread - a thread where 'game.interface' is not available.

    The bogies were a separate mod. I don't recall who published it, but it shouldn't be too hard to track down. There were a number of TpF1 rail cars that used it.

    Claude,

    For mods located outside the Transport Fever 2 directory tree, the 'fileName' variable will be the fully qualified file name (i.e. everything including the drive letter.)

    You would probably be better served with:

    if string.find(fileName, "vehicle/train/loco1.mdl") ~= nil then

    Inline function definitions are allowed. I think you want:

    Edit: This is kind of OT for this thread. If this example doesn't work for you, start a new thread and we can look for solutions.

    I'm talking about if a player is using the Expanded Industry, the mod Freestyle industry would show expanded industry cargos. If the play is using just the mail mod FSI would also show just 16 vannila cargoes + mail as an option.

    You can include an addModifier function in the runFn of your mod:


    runFn = function(settings)

    addModifier( "loadCargoType", cargoHandler )

    end --runFn


    Also define the handler:


    local function cargoHandler(fileName, data)

    if string.find(fileName, 'res/config') ~= 1 then

    -- an addon has defined a cargo type, so do what needs doing

    end

    return data

    end

    Knowing what you're looking for, another possible solution comes to mind:

    On each update, call getVehicles()

    For each vehicle, add its current speed to an accumulator variable for its line.

    Increment a counter for the line.

    Dividing the accumulator by the counter should give you a pretty good indication of the overall speed of the line.

    Using a ton of mods, mostly vehicles. I don't think there are any that will directly affect the number of buildings - I'll have to check.

    As to the skyscrapers, I'm wondering if it would be possible to build a mod that will simply replace the stock period C buildings with copies of the period B ones. Just musing out loud here - don't know what affect that would have on town development...

    I take it you're looking for something more accurate than the straight line distance between stops.

    You could track the distance travelled by a unit as it covers the route.

    This would involve keeping track of its position and speed at each update, so that you could measure the distance travelled.

    I would start measuring when the vehicle first reached a station (any station.) Measure the distance travelled on each update until it next reaches that station.

    You would need to keep a table of information for each line that included the vehicle being tracked, last position, last time, accumulated distance, station at start, measurement status (not started, in progress, complete,) etc.

    A non-trivial exercise, for sure.

    I've never had issues with frame rates in this game. If I get close to one of Enzo's underground stations, or I leave a whole bunch of windows open on the screen, they'll drop down to 25 or so, but otherwise they're usually in the 50 - 60 range.

    Each person needs three buildings - home, shopping, work, so it does make sense that there are more town buildings than people.

    OK, thanks. Up until now, I had only tested it on one map. I have another in progress, which, conveniently enough, just crash, so I have to restart anyway...

    It doesn't look like you have any vehicles loaded that originate in the CargoTrams mod.

    The other is the blank one that precedes it in the modList. I'll have to look at suppressing that one.

    Based on what I'm seeing here, you should only be showing one mod loaded, with none in use.

    If you put one of the cargo trams into an active route, you should see it show up in the list of used mods.

    Scope is a terrible concept!

    In the mod.lua file, you will find the a function called modelName.

    It is defined as local. Remove the 'local' reference, so that it is global in scope.

    Alternatively, copy it into the vehicle_enumeration.lua file in the scripts folder.

    As an FYI, here is the list of entity types I got when calling game.interface.getEntity() without any type qualifier:

    entitiesSummary.ANIMAL; count; 4408; number

    entitiesSummary; ANIMAL; table: 000001BC9F1A6F70; table

    entitiesSummary.ASSET_GROUP; count; 61491; number

    entitiesSummary; ASSET_GROUP; table: 000001BC9F19EE10; table

    entitiesSummary.BASE_EDGE; count; 20286; number

    entitiesSummary; BASE_EDGE; table: 000001BB0A946810; table

    entitiesSummary.BASE_NODE; count; 18973; number

    entitiesSummary; BASE_NODE; table: 000001BB0A945E10; table

    entitiesSummary.CONSTRUCTION; count; 17203; number

    entitiesSummary; CONSTRUCTION; table: 000001BB0A953C40; table

    entitiesSummary.RAILROAD_CROSSING; count; 79; number

    entitiesSummary; RAILROAD_CROSSING; table: 000001BBE586C400; table

    entitiesSummary.SIGNAL; count; 550; number

    entitiesSummary; SIGNAL; table: 000001BB0A951D00; table

    entitiesSummary.SIM_BUILDING; count; 164; number

    entitiesSummary; SIM_BUILDING; table: 000001BB9AFFFE00; table

    entitiesSummary.SIM_CARGO; count; 3465; number

    entitiesSummary; SIM_CARGO; table: 000001BB903CD890; table

    entitiesSummary.SIM_PERSON; count; 9727; number

    entitiesSummary; SIM_PERSON; table: 000001BB0A947BC0; table

    entitiesSummary.STATION; count; 790; number

    entitiesSummary; STATION; table: 000001BB0A94D610; table

    entitiesSummary.STATION_GROUP; count; 505; number

    entitiesSummary; STATION_GROUP; table: 000001BB0A94D750; table

    entitiesSummary.TOWN; count; 16; number

    entitiesSummary; TOWN; table: 000001BBADDD5EF0; table

    entitiesSummary.TOWN_BUILDING; count; 16763; number

    entitiesSummary; TOWN_BUILDING; table: 000001BB9AFCB360; table

    entitiesSummary.VEHICLE; count; 1489; number

    entitiesSummary; VEHICLE; table: 000001BB0A951710; table

    entitiesSummary.VEHICLE_DEPOT; count; 84; number

    entitiesSummary; VEHICLE_DEPOT; table: 000001BB9AE91E60; table

    entitiesSummary.WORLD; count; 1; number

    entitiesSummary; WORLD; table: 000001BC9F1A6A20; table

    Permission question.


    I would like to include the line

    local mods = require 'commonapi2/mods'

    in my mod, so that I can later call

    local mod_table = mods.getById(modID)

    in order to retrieve the names of loaded mods.

    I am doing this in order to respond to this request:

    MOD Map Scan?

    I'm not proposing to distribute any of your files, rather just to load one of them if the user has it installed.


    Are you OK with this?


    Thank-you for your consideration.


    Doug Dawson