Beiträge von Enzojz

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


    It explains as follows:


    raw format:

    (p0, v0, w)

    (p1, v1, w)



    friendly format:

    (p0, p1, v0, v1)


    In Which


    p0:start Point

    p1:end point

    v0:start tangent Vector

    v1:end tangent vector

    W: lane width(optional)



    !!!! |v0| ==|v1| and |v0| = |v1| = length of the curve.


    snapNode: indices from 0 for raw foramt

    freeEdge: indices from 0 for raw format, both ends should be specified


    The offical documentation is here:


    Construction Basics [Transport Fever 2 Wiki]


    Hope that helps.

    Yes, I forgot that my function is only for straight edges.

    But is the length of tangent really important? Since it is only a tangent vector


    Code
    local function toArray(v)
        return {v.x, v.y, v.z}
    end

    That's the length that game takes to calculate the distance, so if you have a street with norminal tangent but actually 10m long, the cars will travel 10x faster. I forgot if it works the same for trains but for me better to follow this rule.

    An edge is in the following format:


    Code
    pt_start, tangent_start* length
    pt_end, tangent_end * length


    So first, the vanilla function is not adapted, since it works on a straight hypothesis, pt_end - pt_start result in a wrong tangent and a wrong length.
    You need to write the function of your own.

    I've tried it seems only ug is able to help you fix the map


    Even with vanilla api it doesn't work


    >> p = api.type.SimpleProposal.new()

    >> p.constructionsToRemove = {66248}

    >> c = api.cmd.make.buildProposal(p, nil, true)


    c:\build\tpf2_steam\src\lib\ecs\engine.h:275: int __cdecl ecs::Engine::GetComponentDataIndex(const class ecs::Entity &,int) const: Assertion `it != components.end()' failed.


    >

    Yeah, the problem is you need to bulldoze the construction and not the station or station group.
    However it seems there is no direct pointer from station to construction entity.


    So you have to traverse all construction you get by getEntites filtering with construction. Then look in the station key

    call this in the vanilla console he will get the construction id


    Code
    api.engine.system.streetConnectorSystem.getStation2ConstructionMap()[game.interface.getEntity(station_group_id_seen_from_ui).stations[1]]


    then if game.interface.bulldoze is callable, he can try to remove it


    the game api give the proposal constructor to remove a construction, but they forgot to give the command builder for that..

    Would you say, it's in general possible, to upgrade train stations or airports afterwards with other params?

    Yes, you have two sets of params, one is general for .con, another specific for template, the game will join them together when build the station.


    the vanilla game station puts all into the template, but you can leave them in the .con.

    It seems that it's not working for all types of Constructions (esp. Airports, Rail Stations).


    "it only workes when modular" - don't think so because the vienna bridge asset is not modular.

    Instead, I suspect upgrading only works, if the con is not modular.

    The modular station and non modular ones works essentially over the same fundemental.

    I don't know any other mod than my own mod using live text so I think it's not necessary to reintroduce it into tpf2, the built-in textlable is way better.

    I am thinking of a 3D one for tpf2, but yet got time to make it.

    The one I left on git in novembre works with tpf2 without problem as I have tested it, and I have readapted it to .net core 3.

    Well, I've been converting Enzojz to convert his "livetext" for a few days now. It is by far the most difficult MOD I convert to UnixRoot its Natural_Environment_Pro_1 mod. But I am very hopeful that I will get the "sometime" if the two of them don't get ahead of me.


    One thing has almost been done :thumbup:

    Well

    You should have asked me before...

    I have convert livetext generator during the beta testing of the game, just didn't release it since I see no use of it with introducing of textlables

    The updated generator generates mdl adaptes to tpf2.

    https://github.com/Enzojz/LivetextTool

    poEdit comes with decompiling tool msgunfmt.exe in it's bin folder

    However, if you want to put the correct in official release, you need to ask Tom for the po file, as what I have done with the Chinese translation (the original one comes with massive errors)

    Station from Tpf can be easily adapted to Tpf2, in fact the game accpet the old format and old mode (with minor modification on track nodes), but there are two reasons it's not widely done yet:

    1. The modification mode doesn't comes with a scrollbar, and most of the stations has many options... so you can see only top options there (Tom told me this would be fixed)

    2. We have better way to reduce the options by modular construction, but that need times to adopte, it's almost like to redesign a mod, as you see I spent almost two months to port the underground station


    I will port the Ultimate Station but it's more complicated with modular mode, I need some time to think out a good proposal.

    Lo2k, that name reminds me.

    Vous êtes Laurent de GP4Editor?


    mo is the compiled format of poEdit, so you can use poEdit to decompile it then edit it

    It's still working for TPF2 and improved for some feature in Tpf2, with support from UG

    From my understanding, in tpf2 the graphics and logical engine are run in async way that's why they are split.


    in general in a game_script you have guiEventHandler and eventHandler, the communication from guiEventHandler to eventHander via game.interface.sendScriptEvent, then load/save get datas from game engine back to graphcis engine.


    In general the two saves different states.


    I have uploaded my Underpass mod yesterday and there is what I discovered in the mod about this.


    I can create a floating window, put a button or text in it, run a script when clicking, open it and close it program also highlight it.


    You can't get data into the constructions, everything is top level down, the only injection that I find is calling the construction from eventHandler, but I have yet tried to access a game_script global from the construction, I don't know if it works


    But at least there's a way:


    in common api game_script : guiEventHander -> proposalPreview -> open track selection window -> (waiting for) -> proposalApply -> (if the mod is declared to support api) -> sendScriptEvent -> (in mod script) upgradeConstrdution with injection trackType -> (close track selection window) --> in general what you said above but so far there's a bug there is no event when modification is on the way/done, nothing reacts to the module.


    The states in params.module is saved, params will be clear each time.


    Modular station is not mandatory, old construction script is working too

    For every game_script there are two lua environement, graphics and game engine, the state data in game engine can be copied to graphics, from graphics event can be sent to game engine


    All datas can be saved and reload in gamesave automatically.


    We can have interface with text, image and button with text/image, a simple layout system.


    I don't know if data can be shared between game_scripts (except event system), if it's possible, common api as a public on call game_script is enough.


    What I suppose to do:


    With an event request, pop up a icon list of tracks, on clicking on the icon, broadcast an event with track.lua name, that's simple and elegant


    However I think UG should merge track upgrade function into station, that's much more simple.

    Still I did a lite convertor by myself, since I hope to convert my mods easily like executing an exe (I tried to adapte your convertor with Lua52.exe but failed since too complicated dependency)
    I will post it here later when it's working, it do only little work in general transfering materials from msh to mdl then adaptation of mdl, no animation work will be done since in my mods there's no animation..

    Ok, I'm here.


    Just have done a quick review of the script, it's good enough so I won't do my convertor.


    But I suggest to make it a standalone pack that so executed under the mod root to make the conversion