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

    _frozen


    Hmm. Maybe at the worst, use a item to check all wiring information (this idea I noticed was used in Railcraft, a tekkit plugin similar to this). Like String and Worldguard (was it Worldguard? Im not sure.), you click the item on the tracks and it tells you which detector region it is covered under, destinations that is possible, things like that. I DO know that this might be unnecessary due to the upcoming API, and agree completely to hold off major development like that until further notice.
     
  3. Offline

    maro48m

    ok, i tried Your suggestions:
    ~~~~====================
    ====|==================|=======
    ST~~S1~D1~~~~~~~~~~D2~S2~~~~ST
    ~~~|...|~~~~~~~~~~|...|

    S1 and S2 are switchers facing STations with text:
    S1:
    [train]
    switcher
    l:true
    r:false

    S2:
    [train]
    switcher
    l:false
    r:true

    D1 and D2 are detectors fcing each others
    and switchers still work even without power.
    You can see it on my server:
    maro48m.dnsd.info:25565
     
  4. Offline

    dibujaron

    bergerkiller:

    yes I did. I set it up exactly the same way the videos did. so unless the videos did it wrong, I did it right. for 2 separate videos.
     
  5. Offline

    Sveken

    I am having the EXACT same issue lol, i tried Chunkenforcer to fix it but it didn't work.
    Will try and replicate your steps and hope it fixes it for me :D
     
  6. Offline

    bergerkiller

    dibujaron I tested it locally, and trains are not teleported..at all. So I'll be fixing this now, thanks for the heads-up.

    maro48m The problem I've seen is that, when unpowered, it will not do anything at all. This makes it a bit impossible to use switcher signs as a redstone-based switching station. The only solution I can give, is to have two switcher signs underneath one rail, and power either of them using an inverter:

    And power the above two signs using the same wire. Then the train will go right when powered, forward when not powered (not not = yes)
    I am considering a separate statement to read redstone power around the sign. Only problem is that the sign would activate/deactivate as well. So then you would have to put a torch below the sign and an additional wire to the sign, which you read. For example:
    Redstone coming from the left? Go right. Else go forward. Instead of the torch I could add another ID for 'always active', for example:
     
  7. Offline

    dibujaron

    @ bergerkiller

    great thanks a lot!
     
  8. Offline

    bergerkiller

    Alright I resolved the teleport problem, added a +train and +cart version for 'always powered' and am now going to add a directional redstone power check.
     
  9. Offline

    maro48m

    is it going to be next release of train carts?
    Or should i rebuild source myself?
     
  10. Offline

    bergerkiller

    maro48m will be the next release (1.69). Also, the redstone based statement now works really nicely! This on the sign:
    Left side powered, switches left, right side powered, switches right. It works amazingly well, but it did require me to pass in some more information to each statement. Hope it didn't break anything in the process. So I'll first be testing detector signs more thoroughly, then I'll publish it.

    [​IMG]

    But I just remember that I had to improve the spawn sign to allow a timer in it...

    maro48m Alright I did a full-out test complete with your set-up. I managed to make that extra line when the other line was crowded, and handle proper switching when coming from the other direction. This is how it looks like:
    [​IMG]

    I see no better way to do it, so for now, this will have to do. What this does, is basically:
    • All trains entering facing that sign, will go left when ahead is powered, otherwise forwards
    • Trains coming from the left or from the back of the sign (relative front) will go back (facing the sign)
    The detector signs also work as expected without problems. (did have to fix something...as well a huge rewrite to make that code less confusing...)

    Not sure how I am going to implement that spawner sign, because it requires permanent storage of spawner signs and a pulse now and then to trigger a spawn.

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

    dibujaron

    dang another problem. I have an automatic train system between 2 stations. the train occasionally gets stuck at the station when no players are around. I have your plugin and RollingMinecarts as a backup to keep the chunks loaded, and the config option "keep chunks loaded only when moving" is set to false. please help; I keep having to fly out to the far station and fix it. :(

    my stations signs are set up like this:
    [train]
    station 5
    10
    reverse

    the train is a storage minecart, 3 minecarts, and another storage

    edit to previous: it only happens when no one's on. and another question: do transfer signs only work
    if the sign is facing sideways? they don't seem to work if the sign is facing the same way as the track. generally with
    your plugin if the sign is sideways it works for both directions, but if it's facing one way it only works for that direction. however, this doesn't seem to be the case for transfer signs. Am i wrong? or am I going to have to redesign my system?

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

    _frozen

    Have the signs replicate a button press? Not sure how to approach it, but for every duration, it ends with a 5-tick power-up. As for the permanent storage, dont over-engineer it, and reuse the current "keepchunkloaded" attribute to any and all signs with the spawn line enabled? Not sure if this is possible via coding.
     
  13. Offline

    bergerkiller

    dibujaron I had to slightly alter that system. When the track above is not curved, it works both ways when the sign is sideways. When facing a certain side, then only that side. When the track above is curved, it only works to the direction facing that sign. To have custom directions to trigger the sign, say, you have a 4-direction switcher, you can do that on the first line:
    It will detect trains coming from the left and right, and switch those trains forwards. You can have multiple switcher signs underneath the same block (pillar) to handle all directions.

    _frozen To loop through all signs in all loaded chunks of all loaded world is incredibly slow. Right now, SignLink handles the updating these signs. That one, too, stores the signs that have variables on the signs. For spawner signs I could use a variable and ask SignLink for all the signs, but that is a workaround. I prefer storing the signs to pulse, combined with the interval, and update these signs one after the other. But the problem is that a crash could potentially erase all data, something I dislike.
     
  14. Offline

    maro48m

    @bergerkiller
    I don't know how plugins work internally, but maybe You can have some sort of signs array,
    Where you put all spawner signs taht have timer set. and later in some sort of main loop you check all signs from this array, and force spawn if their time has come.
    Looping through ALL signs every time will be complete waste of time - most of them will not be timed spawners.
     
  15. Offline

    bergerkiller

    maro48m Yup, but that requires me to store data in a flatfile for when the plugin/server disables. That is the offline part of it all...and if something goes wrong at that point or the file gets corrupted, you have to replace all spawner signs in the world...
     
  16. Offline

    maro48m

    isn't this a problem in all other signs as well?
    Oh, right - you don't keep other signs in files - train detects sign when is above one.
    But you keep trains in file, and that didn't stopped you;)
     
  17. Offline

    bergerkiller

    Mhh that is true yes, same for detector signs. Guess it isn't such a big deal.
     
  18. Offline

    maro48m

    You could always add some mechanism for backup files.
    When you save a file , do a copy before that.
    When for some reason save will fail and file will be dead - just replace a file, and user will be happy not to recreate all 20000 traincarts from scratch.
    It could even be done internally by plugin (with some message to server console)
     
  19. Offline

    dibujaron

    bergerkiller:

    let's see if I understood that. so on the first line you can put [train:lr] and it'll detect from left to right only?

    also, the links on both bukkitdev and this page that are supposed to go to the wiki are deleted. can you edit them to point towards the new minecraft forums pages?
     
  20. Offline

    bergerkiller

    dibujaron Yes, you can set the directions from where trains are coming from to detect. And I thought I updated the links to point to Minecraft WIKI....odd.
     
  21. Offline

    dibujaron

    bergerkiller oh m'bad this page's link works. bukkitdev's doesn't though...

    also the signlink wiki link doesn't work either on either page. I really need that one, as I have no idea how to create a variable, but it looks really cool.
     
  22. Offline

    bergerkiller

    dibujaron yeah the wiki admin seems to be too busy to not forget my e-mails about temporary restoring it...lol

    Anyway, maro48m I started development on a timer for the spawn sign. I rewrote most of the build logic to use a sign action event to get around the annoying overloads for all functions. Now all functions use one type, SignActionEvent, to send sign information over. Sign spawners get their own block map, and like detectors, their own save file. I already wrote how the intervals are handled, rules around loading and such. Now time to debug...the best time during development. :'(
     
  23. Offline

    maro48m

    My personal favourite is when i get idea how to solve some complicated problem. Right after that is debuging:)
     
  24. Offline

    bergerkiller

    Well it works really well, only for some reason it waits 50 seconds when the interval is 10. But it works... xd

    EDIT

    Had to divide ms with 50 instead of 20...explains. Now it is spot-on, I used a stopwatch to see if it was indeed 10 seconds. And it is. Uses a combination of 2 tasks (one for long time delay, the other repeats every 5 ticks) to spawn 100% accurately. Well, maybe 100 ms off or so. I guess I can go and publish it now.

    Spawns a train of 3 minecarts every 2 minutes 30 seconds at a velocity of 0.5 blocks/tick. It permanently stores the spawn sign in file, and when the server loads, it will automatically start all pending spawn signs. It loads a 7x7 chunk area around the sign before spawning the train, ensuring that all will go well. If you can test it, please do. :)

    Alright updated it to 1.69. (after 2 months...sigh...never knew I'd be this busy with other things for such a long time)

    Fixed:
    • NPE occurring when you put an invalid item name on a furnace/transfer sign
    • Data not getting saved when storage minecarts close (oldie...)
    • Cleanup of a lot of classes, which most likely fixed some unknown bugs as well
    • Teleporter sign was failing
    Added:
    • Location readout when performing /train info or /cart info commands
    • Spawn sign: interval in real-time
    • '+'-mode (always power on sign)
    • Redstone reading from certain directions of the sign (statement)
    I also rewrote most of the build logic, detector logic and added several new utility classes in TrainCarts, of which OfflineSign and ChangingSign. I hope this resolved pretty much everything so far reported. (though that random bouncing bug I couldn't trigger, and the station sign worked all right to me)

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

    CommanderGizmo

    bergerkiller Thanks for the update! It's nice to have you back in action man.

    I was wondering if you had a chance to fix the logs being used as fuel over smeltable and the issue with data values being reset when a train loads at plugin start? Maybe the save on close takes care of the last one?
     
  26. Offline

    bergerkiller

    CommanderGizmo Didn't look at that, sorry. The problem right now is that the item parser is very primitive and makes it pretty hard to, for example, include parsers inside parsers, because an Item Parser only supports one material...

    I would need to work around with multi-mat parsers to have the right results...
     
  27. Offline

    Snipes01

    bergerkiller

    Question...some of the links in the original post are out of date. Is there a place commands and permission nodes? I found most of it on the bukkit wiki, but not all of it.

    I had been waiting for this to be updated. Good job.
     
  28. Offline

    dibujaron

    hey I have a train that runs an automatic run between 2 stations. one station is in an area far away and so it's chunk usually isn't loaded. the train is supposed to keep the chunks it's going through loaded, but it seems to get stuck at the station often ( but not always). I have the config option "keep chunks loaded only when moving" set to FALSE. please help? I keep having to fly out there to fix it :p
     
  29. Offline

    bergerkiller

    Snipes01 see top of this main page, The minecraft WIKI now has everything and a lot more.

    dibujaron Just wondering, normal long distance routes (going towards this station) work fine? This could be a possible inconsistency in the keep chunks loaded feature when a station is guiding it.
     
  30. Offline

    Snipes01

    Well not exactly,

    This is all that I can see

    Which sort of helps, but not really.
     
  31. Offline

    bergerkiller

Share This Page