Inactive [MECH] TrainCarts v1.71.2 - Link minecarts of different types together to form trains [2222]

Discussion in 'Inactive/Unsupported Plugins' started by bergerkiller, Aug 3, 2011.

  1. Offline

    bergerkiller

    [​IMG]

    After a request from Marius A. Winsjansen I started to work on linked Minecarts. On the first day I already managed to make multiple carts move with the same speed, but a long list of bugs was to be expected. After fixing lots of bugs, adding lots of (complicated) Minecart handling functions and after hours of testing on my local server, this plugin is finally ready for a stable release! :D

    Also, special thanks go to @Shamebot for helping me out several times. :)

    Description:
    For a lot of information about TrainCarts see the WIKI page!

    Configuration and permissions

    All configuration nodes can be found in config.yml and contains a description with it. Permissions can be found in PermissionDefaults.yml, combined with a description.

    Media:

    Early development video (Photobucket)

    Video displaying version 0.6 of this plugin (YouTube)

    Video displaying version 1.0 of this plugin (YouTube)

    Video displaying version 1.1 of this plugin (YouTube)

    Video displaying version 1.2 of this plugin (holy...)


    A tutorial video in German explaining various sign-circuitry of TrainCarts


    PhotoBucket Sign system tutorial videos (also linked in the WIKI pages)
    Train spawner / Stations / Stations2 / Arrival signs / Train teleportation / Track switcher based on tags / Destinations / Blocker
    Video of how the switcher, station and destination signs work together

    Side information:

    It works best on straight lines with not too much elevation changes followed up by sharp corners. As long the cart gap can be adjusted, everything goes fine. It had some collision issues in the past, but I fixed all of that by manipulating the actual Minecraft server native code. I added links in the source where this was appropriate. Sharp 'U'-turns cause individual carts to lose perceptive of their direction. Keep at least one piece of track in between corner sections! Trains are stored on-disk when reloading and stopping the server, so expect trains to be there when you return.

    Important when updating: do one reload to save all trains, then replace traincarts.jar, and then do another reload. This next reload will probably cause a noClassDefFound exception (since the old jar got replaced), this is why a pre-reload is required. Replacing the jar without reloading is a very bad idea: it will cause a lot of runtime exceptions. Best is of course to stop the server and start again, but this is not always possible.

    This plugin is made compatible with Minecart Mania. If you notice a certain feature of Minecart Mania is not compatible with TrainCarts, notify me and I'll fix it. :)


    Known bugs:
    - None.

    TODO:
    - Train-sign message handling using SignLink (low priority)
    - Minecart use permissions (for individual carts?) such as Storage Minecarts

    Commenting

    If you encountered a bug, post exactly what you had done and in what order. Even a slight wobble can help fixing bugs. When posting (long) errors I recommend you to post everything, don't cut it off. I work with native methods, so in my case these lines are important. For comments on the media content see YouTube, it also contains a description with the music name when music is used.

    Bug reporting (extend)

    1. Post the Craftbukkit version you are using (the first info message in the console)
    2. Post the log from where the first plugin gets enabled to the 'done'.
    3. Post possible errors in this log too (don't cut them short)
    4. No error? Still post the log. Also explain how I can reproduce it, you can use screenshots
    5. Before reporting, remove ALL plugins other than TrainCarts and try again. If it works then, find out what plugin is interfering and post that here. I can add support.
    6. ALWAYS use the latest recommended Craftbukkit build with this, or my methods may just fail because of renamed functions.

    Important links:

    Request thread
    TrainCarts on BukkitDev for download and more
    TrainCarts source and more on GitHub
    TrainCartsBlocks add-on source and more on GitHub
    SignLink Bukkit page (required to use Arrival signs)
    MyWorlds Bukkit page (required to use Portal train teleportation)

    notice: try to keep SignLink/MyWorlds up-to-date to prevent compatibility issues.

    Installation for those that don't know how

    1. Download and install the latest craftbukkit version
    2. Download the latest TrainCarts version
    3. ^ Save the archive (zip file) to your computer
    4. ^ Open the archive you just downloaded
    5. In the folder your server sits in, create the plugins folder if it doesn't exist
    6. Open the plugins folder
    7. Move the TrainCarts.jar file found in the archive into the plugins folder
    8. Run your craftbukkit server and look in the console/log for possible errors, and/or if the plugin is enabled.

    Changelog

    Show your appreciation for my plugins by donating
    [​IMG]
     
  2. Offline

    MacGyver420

    @bergerkiller
    Testing the 1.6 Dev version...

    KeepChunksLoaded is working fine for me as an individual train property, i didnt test it as a default because thats never worked for me :p

    I am having an issue at stations where the first cart in the train will line up over the station, the wait time will pass, the train moves and the center will then line up over the station. Causing all the waits to be doubled basically.

    http://youtu.be/NDGa1Jviei4

    Thats a vid of it happening at a couple stations, with the last station causing a reversal in the train out of nowhere. On a side note, the areas of track where it would always cause the bounceback bug no longer bug out. And i was on my 5th complete loop around when this one decided to freak out.
     
  3. Offline

    bergerkiller

    @MacGyver420 Looks strangely similar to the bug mentioned by @robxu9
    I've seen it ONCE and thought there were ghost carts in front of the train, bugged out because of a reload. I now see it's more of a general issue...wish I could replicate it just 'like that'.

    I'll make a loop myself and see the results. If you have time, could you test out/find out at what stations this happens? (the orientation of the station is important; look at the sign text while standing right in front of it, press F3 and post the 'F:0-3' you get to see.

    EDIT

    Wow it happened...reaalllly strange. No idea what it is, but I'll resolve it, believe me :)

    EDIT

    I'm pretty sure it's caused by this function:
    Code:
        public static boolean isHeadingTo(Vector offset, Vector velocity) {
            double dbefore = offset.lengthSquared();
            if (dbefore < 0.01) return true;
            velocity = velocity.clone();
            setVectorLengthSquared(velocity, dbefore);
            double dafter = offset.clone().subtract(velocity).lengthSquared();
            return dafter < dbefore;
        }
    It must be failing.

    EDIT

    Yup that's the cause, when I return true all the time this doesn't happen anymore. Will fix that function.
     
  4. Offline

    MacGyver420

    @bergerkiller
    All F:0 when reversal occurs.
    At least the last offender, and the previous ones i can remember.

    Double stations stops is in every direction though
     
  5. Offline

    bergerkiller

    @MacGyver420 ok, althought it happens at all orientations as I've seen... :)
    But I'm fixing it...and it's fixable.
     
  6. Offline

    MacGyver420

    Good to hear, let me know when you need more testing done.
     
  7. Offline

    watar

    Having similar problems on my server with TrainCarts activated. Normal serverload is 5-10% CPU and 500-800Mb memory usage. All of a sudden it goes to 100% and 2.5Gb memory. After a restart I had 6601 trains with 10597 minecarts according to the console (normal 2 trains and 8-10carts). Did a /train removeall and the trains disappeared but the serverload stays the same...
     
  8. Offline

    MechanID

    1. i cant look at train info ingame because /train i /train info doesnt work but as i see in trainflags.yml it is disabled for trains, here is my defaultflags.yml maybe i have an error
    Code:
    default:
      allowMobsEnter: true
      allowPlayerEnter: true
      allowPlayerExit: true
      allowLinking: true
      requirePoweredMinecart: false
      trainCollision: true
      keepChunksLoaded: true
      speedLimit: 0.4
      slowDown: true
      destination: ''
      pushAway:
        mobs: false
        players: false
        misc: true
    admin:
      owners: *id001
      passengers: *id002
      allowMobsEnter: true
      allowPlayerEnter: true
      allowPlayerExit: true
      allowLinking: true
      requirePoweredMinecart: false
      trainCollision: true
      keepChunksLoaded: true
      tags: *id003
      speedLimit: 0.4
      slowDown: true
      destination: ''
      pushAway:
        mobs: false
        players: false
        misc: true
    station:
      allowMobsEnter: true
      allowPlayerEnter: true
      allowPlayerExit: true
      allowLinking: true
      requirePoweredMinecart: false
      trainCollision: true
      keepChunksLoaded: true
      speedLimit: 0.4
      slowDown: true
      destination: ''
      pushAway:
        mobs: true
        players: true
        misc: true
    2. its your decision, but maybe its not good that station give a huge boost that train can travel very far away without powercart or booster rails.

    3. if there is onw missing track train brokens into five trains(akkording to /train destroyall, some parts move forward and some move backward.
    Edit: also no trains saved when server stops disregarding keepChunksLoaded: true or false
     
  9. Offline

    bergerkiller

    @MechanID the boost is configurable in the configuration, default is 10000. Do note that the *flags files are no longer used, because they are PROPERTIES, flags was just an old mistake. Plus I needed to make sure that the new format was used at all times.

    And ok, not saved, that's possible...maybe
    Still working heavily on an improved physics system which uses the direction directly, reducing CPU usage. (only 8 sin/cos results)
     
  10. Offline

    robxu9

    if this was to me? o.o PM me for details

    EDIT: uh... let's see, if I add powered rail, it somehow manages to push it up all the way o3o
    EDIT2: Never mind. >>;;
     
  11. Offline

    dockter

    Yes, this is exactly what happened with ours as well, just less carts, only about 3000.
     
  12. Offline

    bergerkiller

    @watar @dockter Are you using the teleporter signs? Because this sounds almost the same as that bug a few versions back.

    Also, the '180-flip' bug at stations is now fixed, also made everything use up a lot less CPU. (it now uses the direction of the minecart for physics calculations, which completely rids the use of Math.sin and Math.cos.
     
    MacGyver420 likes this.
  13. Offline

    dockter

    I typically use the station signs, I honestly didnt know about the teleporter signs. I used my very first spawn sign last night on my dev server though.
     
  14. Offline

    watar

    No teleporter signs, single world server. I have a quite long track which didn't work correctly unless I placed a extra destination sign along the way.
     
  15. Offline

    bergerkiller

    Then it's a bug with train unloading...it has to be. Somewhere somehow it is replacing entity minecarts with minecart members non-stop, resulting in that large amount of trains.
     
  16. Offline

    MacGyver420

    @bergerkiller
    I randomly replicated this overspawning of trains by jumping off a ramp in my cart at 0.8 speed. The cart jumps up in the air to around the 146 height, becomes stuck and seems to start cloning itself. my single cart was replicated to 56 in the min it took me to realize i was stuck and delete all trains. Using a speed of 0.4 trains jump normally though.
     
  17. Offline

    bergerkiller

    Uploaded a new 1.6 beta version. I couldn't spot any weird mid-air freezes or similar, so it is possible that it is fixed (?)

    Also did some ramp tests, but it all went as it is supposed to, even at 2 blocks/tick.
     
  18. Offline

    MacGyver420

    Yeah i was running 1.54 when that was happening, but ill try it on the new 1.6 too
     
  19. Offline

    bergerkiller

    For those wondering: Why does it fall down so quickly at high speed?! Yeah, I changed that just now :)
     
  20. Offline

    robxu9

    success! this fixes the bug :)
     
  21. Offline

    bergerkiller

    @robxu9 yeah it ended up that the setLengthSquared function was multiplying in the power of 2, so had to add a square root in it. Simply put, it was setting things too far ahead, causing it to always think it was NOT heading towards a certain point.

    EDIT

    Now possible to stack minecarts dynamically, including the 'pop' sound when picking one up. (because adding one to the inventory just isn't nice enough)

    EDIT

    Lol caterpillar carts climbing up a hill 0.01 block at a time...let's fix this xd
     
    robxu9 likes this.
  22. Offline

    dockter

    /Train Info isn't working in beta 1.6, says "Unknown cart command"
     
  23. Offline

    bergerkiller

    @dockter mmh yup you're right, let me add it again.
     
  24. Offline

    dockter

    I thought it was kinda strange that even thought I have permisson in group manager set correctly, they dont read it under 1.6 version. I have the following set:

    Code:
    - train.*
        - train.build.station
        - train build.spawner
        - train.build.trigger
        - train.build.tagswitcher
        - train.build.destination
        - train.build.destructor
        - train.build.ejector
        - train.build.pushHandler
        - train.command.globalproperties
        - train.command.properties
        - train.command.remove
        - train.command.keepchunksloaded
        - train.command.playerexit
        - train.properties.admin
    But I had to set myself as an OP on the server to make it so I could create a spawner sign.
     
  25. Offline

    bergerkiller

    @dockter you missed a dot after train :)
    Also, tagswitcher is now called switcher.
     
  26. Offline

    dockter

    No, the top line says train (dot) (star)
     
  27. Offline

    robxu9

    @bergerkiller are there any new/changed configs that we need to mind?
     
  28. Offline

    bergerkiller

    @dockter oow under 1.6 version, so it works in 1.6 BETA? And yes, it's quite possible that some permissions were messed up. Do you get a confirmation message when building? (the build handling was 'rubbish' so to speak)

    @robxu9 The main changes to mind are that:
    And of course new features like /cart pickup true/false and /cart public/private true/false to make carts publicly accessible or locked to the owner.

    EDIT

    Uploaded version BETA 3. In this version I fixed an up-hill bug (cart doesn't fall down correctly) and it is now possible to stack minecarts to stacks of 64. (toggleable in configuration)
     
    MacGyver420 likes this.
  29. Offline

    robxu9

  30. Offline

    dockter

    Is it possible to change the speed of a train on the fly?

    Something like this on a sign?:
    [train]
    maxspeed 0.1

    Performed the following command under 1.6.3 (beta)
    /train removeall

    Received the following messages.
    3 (visible) trains have been destroyed!
    You haven't selected a train to edit yet!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 14, 2016
  31. Offline

    MacGyver420

    use a property sign
    [train]
    property
    speedlimit
    0.1
     

Share This Page