[Mod] Advanced Trains [advtrains] [2.4.3]

electrodude512
Member
Posts: 39
Joined: Wed Sep 17, 2014 21:34
GitHub: electrodude
IRC: electrodude512
In-game: electrodude512
Location: USA

Re: [Mod] Advanced Trains [advtrains] [2.1.1]

by electrodude512 » Post

I saw all the Lua restrictions mentioned in the xATC proposal. Instead of trying to prevent DoS attacks by only supporting a severely limited subset of Lua, why don't you use the debug.sethook() trick used in mesecons_luacontroller? As a side effect, it disables JIT on those functions, but it seems to be a bullet-proof way of allowing all of Lua's features to be used in a safe way.

User avatar
Andrey01
Member
Posts: 2577
Joined: Wed Oct 19, 2016 15:18
GitHub: Andrey2470T
In-game: Andrey01
Location: Russia, Moscow

Re: [Mod] Advanced Trains [advtrains] [2.1.1]

by Andrey01 » Post

Orwell, can I ask from which github repos and which a version of the blitz3d exporter did you use for your tracks and trains models?

User avatar
BuckarooBanzay
Member
Posts: 437
Joined: Tue Apr 24, 2018 05:58
GitHub: BuckarooBanzay
IRC: BuckarooBanzai
In-game: BuckarooBanzai

Re: [Mod] Advanced Trains [advtrains] [2.1.1]

by BuckarooBanzay » Post

Andrey01 wrote:
Mon Jun 22, 2020 13:03
Orwell, can I ask from which github repos and which a version of the blitz3d exporter did you use for your tracks and trains models?
If it helps: i set up a mirror-repo on github:
https://github.com/minetest-mirrors/advtrains/
¯\_(ツ)_/¯ Not active here anymore, contact me on the minetest discord, irc, lemmy or github (for programming issues)

User avatar
Blockhead
Member
Posts: 1678
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.1.1]

by Blockhead » Post

BuckarooBanzay wrote:
Wed Jun 24, 2020 11:46
Andrey01 wrote:
Mon Jun 22, 2020 13:03
Orwell, can I ask from which github repos and which a version of the blitz3d exporter did you use for your tracks and trains models?
If it helps: i set up a mirror-repo on github:
https://github.com/minetest-mirrors/advtrains/
I don't think this is what Andrey is asking about at all, he's asking about where the get the Blitz3d export plugin for blender. As a side note about advtrains mirrors: the advtrains main repository is hosted on git.bananach.space, as linked in the first post in the thread, though this is a cgit instance that doesn't support shallow clones. For a version of advtrains with the assets folder (which weighs around 100MB + diffs) removed see my lite branch on GitHub, which can be shallow cloned and then if you want to develop for advtrains you can make unshallow (or submit patches to the bug tracker)

Andrey01: orwell is not the main author of the models for advtrains. Mostly it was done by mbb. (If I am wrong, please correct me). The most recently active asset creator for advtrains is rubberduck. I recommend you ask him which Blitz3d exporter he uses for moretrains (moretrains forum thread).
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

User avatar
Blockhead
Member
Posts: 1678
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.1.1]

by Blockhead » Post

Hmmmm....
Image

Update: Yeah, the b3d exporter plugin that I used (source unknown sorry) really doesn't seem to like n-gons. If you want to use b3d for the smaller file size compared to obj, then you should break all your faces into triangles before exporting. But OBJ seems to handle more cases of n-gons better.
Attachments
Diamond Crossing
Diamond Crossing
screenshot_20200704_021210.png (866.81 KiB) Viewed 1443 times
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

gpcf
Member
Posts: 382
Joined: Fri May 27, 2016 10:48
GitHub: gpcf
In-game: gabriel

Re: [Mod] Advanced Trains [advtrains] [2.1.1]

by gpcf » Post

Those crossings look really nice!

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: [Mod] Advanced Trains [advtrains] [2.1.1]

by orwell » Post

Blockhead wrote:
Fri Jul 03, 2020 16:17
Hmmmm....
Image

Update: Yeah, the b3d exporter plugin that I used (source unknown sorry) really doesn't seem to like n-gons. If you want to use b3d for the smaller file size compared to obj, then you should break all your faces into triangles before exporting. But OBJ seems to handle more cases of n-gons better.
Also @Andrey01

It doesn't really seem to matter which B3d exporter you use. However, break faces into triangles (blender has Ctrl+F Triangulate for that). Best do that right before export and don't save it.
You can use both b3d and obj. However:
- b3d doesnt support multiple textures, but does support animations
- obj is the other way round.
For obj to use multiple textures, create multiple materials and assign them to the correct faces. make sure that in the export dialog "Material Groups" is checked.

Blockhead, are the crossings only decorational or are they integrated? If not and you want to code it, the at_conns table needs to have 4 entries, where 1-2 and 3-4 map to each other. Moving across this is already supported.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

User avatar
Blockhead
Member
Posts: 1678
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.1.1]

by Blockhead » Post

orwell wrote:
Fri Jul 03, 2020 23:49
Blockhead, are the crossings only decorational or are they integrated? If not and you want to code it, the at_conns table needs to have 4 entries, where 1-2 and 3-4 map to each other. Moving across this is already supported.
Oh yes, they are fully functional. I read the comment in advtrains/tracks.lua about how to do it. More crossing angles to come then I'll release them once the set is complete.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

User avatar
Blockhead
Member
Posts: 1678
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Crossing nodes

by Blockhead » Post

Hi orwell, I didn't want to put this on hemiptera as the patch is big and technically it describes itself as a bugtracker not a project mangement tool. Here is a PR with a set of diamond crossing nodes (perpendicular and 45/90).

Update: The nodes have had an initial merge, but I forgot to add crafting recipes! In the process of adding the recipes for crossing nodes, I noticed the dependencies around advtrains_train_track were badly arranged, so I re-arranged those. Pull Request. Now mods like linetrack (see my fork on GitHub) can depend on advtrains mods like luaautomation but without having any default tracks registered.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

User avatar
techniX
Member
Posts: 27
Joined: Sun Dec 08, 2019 20:55
GitHub: technix
In-game: techniX

Re: [Mod] Advanced Trains [advtrains] [2.1.1]

by techniX » Post

Proposal for advtrains.path_get_index_by_offset optimization:
https://github.com/minestead/minestead_ ... 00812cd424
On our server this patch made advtrains globalstep lower by 20%: from 92 ms to 76 ms average.

gpcf
Member
Posts: 382
Joined: Fri May 27, 2016 10:48
GitHub: gpcf
In-game: gabriel

Re: [Mod] Advanced Trains [advtrains] [2.1.1]

by gpcf » Post

Thanks, I just merged it into the master branch.

Emojiminetest
Member
Posts: 38
Joined: Sat Jun 06, 2020 00:21
GitHub: Emojigit

Re: [Mod] Advanced Trains [advtrains] [2.1.1]

by Emojiminetest » Post

I think this mod can add a Luacontrolled rail (with switch support)

Craft Way:
* = Blank
^ = Luacontroller (From Mesecons)
% = Rail

Code: Select all

----------------
%  %  %
*  ^  *
*  *  *
----------------

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: [Mod] Advanced Trains [advtrains] [2.1.1]

by orwell » Post

Emojiminetest wrote:
Wed Jul 15, 2020 10:05
I think this mod can add a Luacontrolled rail (with switch support)
The LuaAutomation ATC Rail is what you are looking for. More information on the wiki:
https://advtrains.de/wiki/doku.php?id=u ... c:latcrail
Unfortunately it doesn't have a crafting recipe yet. I might pick up your suggestion.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

Emojiminetest
Member
Posts: 38
Joined: Sat Jun 06, 2020 00:21
GitHub: Emojigit

Re: [Mod] Advanced Trains [advtrains] [2.1.1]

by Emojiminetest » Post

orwell wrote:
Wed Jul 15, 2020 19:00
Emojiminetest wrote:
Wed Jul 15, 2020 10:05
I think this mod can add a Luacontrolled rail (with switch support)
The LuaAutomation ATC Rail is what you are looking for. More information on the wiki:
https://advtrains.de/wiki/doku.php?id=u ... c:latcrail
Unfortunately it doesn't have a crafting recipe yet. I might pick up your suggestion.
I never see a LuaAutomation ATC Rail to be a switch!

User avatar
Blockhead
Member
Posts: 1678
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.1.1]

by Blockhead » Post

Emojiminetest wrote:
Thu Jul 16, 2020 07:46
orwell wrote:
Wed Jul 15, 2020 19:00
Emojiminetest wrote:
Wed Jul 15, 2020 10:05
I think this mod can add a Luacontrolled rail (with switch support)
The LuaAutomation ATC Rail is what you are looking for. More information on the wiki:
https://advtrains.de/wiki/doku.php?id=u ... c:latcrail
Unfortunately it doesn't have a crafting recipe yet. I might pick up your suggestion.
I never see a LuaAutomation ATC Rail to be a switch!
How to use a LuaAutomation ATC Rail to operate a switch:
  • Use the Passive Component Naming Tool to name the switch, e.g. "Switch1"
  • Place a LuaAutomation ATC Rail in the train's path
  • Put some code in the LuaAutomation ATC Rail that changes the state of the switch. States for switches are "cr" for curved and "st" for straight. Here is an example of some code to set the state of the switch based on which way the train is travelling, for example to make it follow Left/Right hand traffic:

    Code: Select all

    if atc_arrow then
        setstate("Switch1", "st")
    else
        setstate("Switch1", "cr")
    end
    
Here is a screenshot in case it is not clear:
Image
See advtrains/advtrains_luaautomation/README.txt for the full API. I know this is not something it is easy to figure out on your own.. I should make a video..
Attachments
screenshot_20200718_174837.png
screenshot_20200718_174837.png (169.86 KiB) Viewed 1443 times
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

Emojiminetest
Member
Posts: 38
Joined: Sat Jun 06, 2020 00:21
GitHub: Emojigit

Re: [Mod] Advanced Trains [advtrains] [2.1.1]

by Emojiminetest » Post

Blockhead wrote:
Sat Jul 18, 2020 07:41
Emojiminetest wrote:
Thu Jul 16, 2020 07:46
orwell wrote:
Wed Jul 15, 2020 19:00


The LuaAutomation ATC Rail is what you are looking for. More information on the wiki:
https://advtrains.de/wiki/doku.php?id=u ... c:latcrail
Unfortunately it doesn't have a crafting recipe yet. I might pick up your suggestion.
I never see a LuaAutomation ATC Rail to be a switch!
How to use a LuaAutomation ATC Rail to operate a switch:
  • Use the Passive Component Naming Tool to name the switch, e.g. "Switch1"
  • Place a LuaAutomation ATC Rail in the train's path
  • Put some code in the LuaAutomation ATC Rail that changes the state of the switch. States for switches are "cr" for curved and "st" for straight. Here is an example of some code to set the state of the switch based on which way the train is travelling, for example to make it follow Left/Right hand traffic:

    Code: Select all

    if atc_arrow then
        setstate("Switch1", "st")
    else
        setstate("Switch1", "cr")
    end
    
Here is a screenshot in case it is not clear:
Image
See advtrains/advtrains_luaautomation/README.txt for the full API. I know this is not something it is easy to figure out on your own.. I should make a video..
what is the value "atc_arrow" in your code?

User avatar
Blockhead
Member
Posts: 1678
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.1.1]

by Blockhead » Post

Emojiminetest wrote:
Sun Jul 19, 2020 00:07
snip

what is the value "atc_arrow" in your code?
As I said, the full LuaATC API is documented in your copy of advtrains. See the file inside your mods directory: advtrains/advtrains_luaautomation/README.txt.

Here is lines 179 and 180 of that file:

Code: Select all

atc_arrow
	Boolean, true when the train is driving in the direction of the arrows of the ATC rail. Nil if there is no train.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: [Mod] Advanced Trains [advtrains] [2.1.1]

by orwell » Post

Thanks Blockhead, this is pretty accurate.
The reason why you can't use mesecons for this is simply because mesecons don't work when the area is not loaded (no player is near). Trains however do.
Btw the Lua API is also on the wiki here: http://advtrains.de/wiki/doku.php?id=usage:atlatc:api
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

User avatar
Hume2
Member
Posts: 710
Joined: Tue Jun 19, 2018 08:24
GitHub: Hume2
In-game: Hume2
Location: Czech Republic

Re: [Mod] Advanced Trains [advtrains] [2.1.1]

by Hume2 » Post

I made the subway trains display up to two digits of the line. The colours are generated automagically. You can look here: https://gitlab.com/tunnelers-abyss/advt ... 0bbb96f53d

Image
Attachments
screenshot_20200720_134557.png
screenshot_20200720_134557.png (175.87 KiB) Viewed 1443 times
If you lack the reality, go on a trip or find a job.

gpcf
Member
Posts: 382
Joined: Fri May 27, 2016 10:48
GitHub: gpcf
In-game: gabriel

Re: [Mod] Advanced Trains [advtrains] [2.1.1]

by gpcf » Post

I will merge your PR, as soon as I fix the couple of bugs I found in it. It should happen today or tomorrow.

qawsedrftgzh
Member
Posts: 32
Joined: Sat Jul 25, 2020 08:36
GitHub: qawsedrftgzh
Location: Germany

Re: [Mod] Advanced Trains [advtrains] [2.1.1]

by qawsedrftgzh » Post

How can I create several lines with the interlocking system and where do i use the rwt in the advtrains lua block. I am to dumb to set up wirking lines. And please make manuals in German. Thanks to everyone, who can help me.
My English is not so good, because I am german

Emojiminetest
Member
Posts: 38
Joined: Sat Jun 06, 2020 00:21
GitHub: Emojigit

Re: [Mod] Advanced Trains [advtrains] [2.1.1]

by Emojiminetest » Post

When i try to use worldedit to edit rail's param2, it sometimes not work.
Is it an advtrain bug? Or a worldedit bug?

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: [Mod] Advanced Trains [advtrains] [2.1.1]

by orwell » Post

Emojiminetest wrote:
Sat Jul 25, 2020 23:31
When i try to use worldedit to edit rail's param2, it sometimes not work.
Is it an advtrain bug? Or a worldedit bug?
I said this multiple times in this thread, and I imagine it was also written in the manual. So here I say it again:
Do not use worldedit to edit advtrains nodes!
Reason: advtrains keeps a separate database of tracks and signals, known as the NDB (node database). It is used to look them up even if minetest has unloaded the mapblocks they're in. Due to reasons, advtrains always trusts the nodedb more than the minetest-managed world. Worldedit doesn't know about the nodedb, so it can't update it.
What works: you can use worldedit to construct rails using //stack and //copy, or delete rails. Whenever you delete rails using worldedit, run "/at_sync_ndb" afterwards. But NEVER touch signals, TCBs or that kind of stuff! Also, don't modify rails in place.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

qawsedrftgzh
Member
Posts: 32
Joined: Sat Jul 25, 2020 08:36
GitHub: qawsedrftgzh
Location: Germany

Re: [Mod] Advanced Trains [advtrains] [2.1.1]

by qawsedrftgzh » Post

I ask my Question again: Are there german manuals/Gibt es Anleitungen für Advtrains auf Deutsch?
My English is not so good, because I am german

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: [Mod] Advanced Trains [advtrains] [2.1.1]

by orwell » Post

Im Moment noch nicht. Ich kann mir ja mal vormerken sie auf deutsch zu übersetzen.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

Post Reply

Who is online

Users browsing this forum: No registered users and 31 guests