Beiträge von SoftwareSimian

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


    If you want to use the start year for new generated maps, look for "Init" in gamescript: Game Script

    I'm not sure how that helps me. Perhaps I'm not understanding.


    The current game year can be found from game.interface.getGameTime().date.year when the game is running, but from my testing during map generation game exists but game.interface does not.


    Could someone smarter than me show me a simple code sample that would detect a new map being generated (lack of game.interface may suffice for this) and output the year the game is starting in

    print("New game generating, starting year = " .. newMapStartYear)

    How does one access the settings the user used to create the map (in my current case I'm interested in the starting year, but other parameters may also be interesting)? For example to alter mod behavior during map generation based on starting year (or other parameter).


    These parameters are dumped nicely at the top of stdout.txt, these are the kind of data I'm looking for:

    OpenSource: thank you, that helps. But I'm still having problems with lua scoping issues.


    I'm currently trying to get the list of defined cargo types:

    Lua
    definedCargoTypes = {}
    addModifier("loadCargoType", function(fileName, data)
    	table.insert(definedCargoTypes, data)
    	return data
    end)
    -- definedCargoTypes is empty here

    And it does indeed loop through the cargo types, add them into definedCargoTypes (if I check the value inside the anonymous function the table gets one entry longer each time), but when I want to do something with it on the next line beyond the addModifier call, the table is empty. What am I doing wrong?

    Perhaps an example might help?


    Previously I was doing something like this:

    Code
    for i=1,#game.config.cargotypes do
    	if (game.config.cargotypes[i].id == "MIXED_FODDER") then
    		-- MIXED_FODDER cargo type has been defined, do something about it
    	end
    end

    Now how would I do a similar thing in TpF2?

    In TpF1 the game cargo types were defined in game.config.cargotypes but that is no longer present in TpF2. I see the cargo types are defined in \res\config\cargo_types\ but how do I enumerate them in my mod? Previously it was as simple as

    Code
    for i=1,#game.config.cargotypes do


    but I'm not sure what to do in TpF2?

    I think it's likely a conflict with another mod, but which one I'm not sure. You appear to have 492 mods loaded.
    The configuration report shows things like this:

    Which are values that are unexpected in the configuration dialog for Flexible Industries. My suspicion is that another mod is somehow adjusting the parameter settings, injecting the above configuration parameters, and removing the productionLevel key.

    How do you draw a road in a construction with the bus lane enabled?


    Adding a tram track with tramTrackType = "ELECTRIC" (or "TRAM") in result.edgeLists is well-documented, but I can't find any equivalent flag to turn on the bus lane. What am I missing?

    In creating my latest industry mod I have a complex setup (24 terminals in one construction) and every now and then I run into a fatal crash with the error message:

    Zitat

    src\game\ecs\railroadcrossingsystem.cpp:48: class ecs::Entity __cdecl `anonymous-namespace'::GetNextEdgeEntity(const class ecs::Engine *,const struct transport::PortId &): Assertion `endNode.ports[endPortId.port].transitions.count() <= 1' failed.

    After some experimenting I've discovered it's triggered when a train is going to cross the road in the centre of my industry, where one road crosses 5 tracks:
    https://i.imgur.com/4qWVTaM.jpg
    If I restrict trains to terminals only on one side of the road then no problem. Also if I remove the road (and leave everything else identical) then the trains can work fine at all terminals. But when the road is there and the train even thinks about crossing it the error is triggered every time.


    But I can't figure out what I've done wrong, or how to prevent this error from happening.
    Any suggestions, please?


    edit1: I'm now suspecting that the top crossing is too close to the road. If I remove that track, the problem goes away:
    https://i.imgur.com/ijCkZcU.jpg


    edit2: If I remove the road between the 1st and 2nd tracks to make it into two separate crossings the problem also goes away:
    https://i.imgur.com/6qk7T76.jpg

    I think the type has to remain as "INDUSTRY" for it to function as I need it to.


    edit: It seems that adding "skipCollision = true" to the main array returned in the .con does prevent sub-models from triggering collisions:
    type = "INDUSTRY",
    skipCollision = true,

    I'm trying to make a dock of sorts, something that's partly on land and partly over water. But I haven't quite figured out what I need to do to make some parts of the construction be required to be over land and some over water (right now I can place the whole thing on land).
    How do I force it to be at water level (not just whatever elevation the terrain is)?


    How do I avoid collisions with the water when placing assets in the water?
    edit: For example, suppose I want to put a building at the water's edge, and I don't want it to collide with the water:

    Code
    result.models[#result.models + 1] = { id = "building/era_c/ind_2_3x3_01_02.mdl", transf = transf.rotZYXTransl(transf.degToRad(  0.0, 0.0, 0.0), vec3.new(  50.0,   50.0, 1.0)) }

    I've tried making a modified building .mdl with "skipCollision = true" (not entirely sure where to put it), commenting out the boundingInfo, everything I could think of, but no luck so far.


    Any tips?

    I'm trying to figure a way to build back-to-back cargo and passenger train stations (like this) but have the passenger lanes connect across the two stations so passenger (and cargo) can still walk from one side to the other. I can set up the lanes where I want them fine, but the nodes from the two separate stations don't seem to connect (debug mode lane viewer shows the connecting node as correctly in the identical place between stations, but red (single-connection) not green (double-connected). Is there a magic trick to making lane nodes "snappable" to connect to a second construction?

    That's intriguing!


    As far as you know, is it possible to have both cargo + passenger on the exact same platform? Or not on the same platform segment but on the same track (e.g. people wait near the middle of the station and cargo waits at the end of the station). Or just on different platforms within the station?


    I'd love to see a combination station where express cargo (mail, milk) could be loaded on passenger trains. I don't know if it's possible to make cargo and passengers wait on the exact same platform so the train could be loaded in a single stop? I would also be perfectly happy with the equivalent of what's shown in my screenshot of a cargo station attached to (both) ends the passenger station.


    @Vitaro If making a combination cargo + passenger station is hard, is it relatively easier to adjust the track spacing of your Small Freight Station like my screenshot so we can just chain the stations together? Well, I know it's easy enough to adjust the track spacing since even I figured out how, I just didn't know how to adjust the platforms to keep the terminals connected.


    Eagerly awaiting what new miracles the mighty Vitaro can bring us! :)

    There's Vitaru's Small freight station which combines cargo train and cargo truck:
    [Blockierte Grafik: https://steamuserimages-a.akamaihd.net/ugc/871870337611082364/FF85F625D46025D63A4F613A66C191742D013A62/?interpolation=lanczos-none&output-format=jpeg&output-quality=95&fit=inside%7C637%3A358&composite-to=*,*%7C637%3A358&background-color=black]
    Small freight station
    http://steamcommunity.com/shar…iledetails/?id=1179341726
    http://transport-games.ru/file…kaya-gruzovaya-stantsiya/


    As for combining cargo + passenger at a train station I think it may not be possible at all with the game engine (but I would love someone to prove me wrong). The obvious workaround would be to attach a cargo and passenger train station end-to-end, but for whatever reason the developers decided to give them different track spacing (9m passenger, 14m cargo) to make that effectively impossible (left). What I've been trying to do (and failing, because I'm new to modding) for the last week or so is to modify one or the other to fit together (middle/right):
    [Blockierte Grafik: https://steamuserimages-a.akamaihd.net/ugc/865118265370267828/625447E541C39E983DEB252B9BE5E64A32D0DB17/]


    I even played with the Small Freight Station mod to adjust the track spacing to match the passenger stations:
    [Blockierte Grafik: https://steamuserimages-a.akamaihd.net/ugc/865118579584087878/9ECBDA8AEAA19059CD0FDA031C62077BCF397D6A/]


    While in both cases I could get the tracks in the right position to join together, I get "Terminals not connected" errors.


    I would be very grateful if someone who knows how to mod stations could help with either a combined station (if that's even possible, which it might not be), or at least getting two stations joined together.