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

    Skyve

    First I'd like to thank you for making such a robust minecart mod which is a worthy successor to MM.

    Is there any possibility of expanding on automated block types? I'm particularly interested in vanilla MM blocks that worked without signs - booster rail (unpowered), cart spawner and remover, player grab blocks. This would make transition from MM way easier for my server.
     
  3. Offline

    bergerkiller

    Skyve I will expand that yes, but only after the main deal has been updated. For the case of player grab blocks, I decided to add a new sign for it first:
    5 = radius to let things enter
    P = load players
    M = load mobs
    I = load items (storage minecarts, sort of like the pick-up behaviour)

    But I still need to add cart removal and spawning blocks, though spawning is a bit confusing. (what should it spawn???)

    Killburner Newpoman I did fix a detector bug between single and multiple minecarts now, though I couldn't find a directional issue (so far). I'll test further until I find out what's wrong.

    Fixed the path finding bugs (was related to previous fixes in the track iterator to 'follow curves'). Fixes all those weird toggling described in earlier comments and screenshots. :)

    Now looking at the station misbehaviour.

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

    sntc06

    Hi, I'm running a server with few people using Bukkit 1.2.5-R1.0.
    I want to let all the players have the permission to craft signs, eg. [Train] spawner,
    but permission defaults to OP.

    I tried to add the nodes into GroupManager, but it doesn't help.
    How should I do to let everyone have the permission to craft signs?

    Thanks in advance.
     
  5. Offline

    bergerkiller

    sntc06 No experience with Group Manager, but I do know that the nodes are read and used when building the sign. Can I see the startup log of your server? I may be wrong, but if GroupManager loads before BKCommonLib and the permission is 'forced overridden' it might clear it? Seems odd, but you never know.
     
  6. Offline

    sntc06

    hi, here is my server log. http://pastebin.com/S2gPFMUN
    I tried to edit the PermissionDefaults.yml ( set default: true ), but every reboot it got reverted back to op.
     
  7. Offline

    bergerkiller

    sntc06 oh the default permissions are broken because of a CraftBukkit bug. The latest CB build should resolve that problem.

    <snip>

    Uploaded v1.65 on GitHub now. Fixes some of the reported issues in 1.64, of which the station/detector sign, path finding and other bugs here and there. Blocker sign now supports a fourth argument, setting what to do when the sign loses power.
     
  8. Offline

    CommanderGizmo

    May I ask, what was the station launch bug cause? Just curious.
     
  9. Offline

    bergerkiller

    CommanderGizmo when the train entered, it calculated the station 'length'. (the value after station). Without other rails on one side, it would end up with length 0 to launch at, which caused this bugged directional launching.
     
  10. Offline

    CommanderGizmo

    Oh I see. Thanks for the fixes. Does the launch distance only refer to the acceleration curve? As in, does the train always reach the same speed by the last block of the distance?
     
  11. Offline

    andrewpo

    [​IMG]
     
    bergerkiller likes this.
  12. Offline

    bergerkiller

    andrewpo Tnx :)

    CommanderGizmo Yep it always reaches the maximum launch velocity at the final block. (or stops, depends) The final velocity can be set in the configuration. The curve is linear.
     
  13. Offline

    CommanderGizmo

    Hey bergerkiller, thanks for the fast updates!

    Unfortunately, I'm having some issues with the furnace loading. I'm running TC 1.65 and CB 1.2.5R1.0 (2149)

    I have a wall of furnaces, one stack after the other with a train running behind it:

    Code:
      FFFFFFFF
    TTFFFFFFFFTT
      FFFFFFFF
      FFFFFFFF

    On the signs behind each column of furnaces are the following (facing away from the tracks):
    Code:
    [!train]
    deposit f
    16 smelts
    mostfuel
     
    [!train]
    collect f
    allsmelted
    When the train goes by with 4 stacks of stone and 12 stacks of charcoal, it puts 64 stone in each of the furnaces in the first column, but no fuel anywhere. It does this on the first pass and then nothing happens on secondary passes. If I add fuel manually, it does pick up the result and add more raw material.

    Here's my shortcust list in config.yml. I just can't seem to get the fuel part to work reliably. And I can't seem to get it to limit the amount of material placed reliably. It should put 16 in each furnace it gets on each pass. It can either make that a limit on the amount in there or the amount added, but it needs to be consistent.

    Code:
    itemShortcuts:
      # Item Aliases
      dye: ink_sack
      lapis: ink_sack:4
      coco: ink_sack:3
      coco_bean: coco
      steak: cooked_beef;
      raw_porkchop: pork
      cooked_pork: grilled_pork
      cobble: cobblestone
      charcoal: coal:1
     
      # Item Groups
      mushroom_stew: mushroom_soup
      mushroom: brown_mushroom;red_mushroom;huge_mushroom_1;huge_mushroom_2
      apples: apple;golden_apple
      metal: gold_ingot;gold_block;iron_ingot;iron_block
      redstuff: redstone;redstone_torch_off;redstone_torch_on;diode_block_off;diode_block_on;redstone_lamp_off;redstone_lamp_on
     
      # Tools and Weapons
      shovel: spade
      spade: wood_spade;stone_spade;iron_spade;diamond_spade;gold_spade
      axe: wood_axe;stone_axe;iron_axe;diamond_axe;gold_axe
      pickaxe: wood_pickaxe;stone_pickaxe;iron_pickaxe;diamond_pickaxe;gold_pickaxe
      sword: wood_sword;stone_sword;iron_sword;diamond_sword;gold_sword
      tools: spade;axe;pickaxe
      weapons: sword;bow;arrow
     
      # Armor
      hat: helmet
      shirt: chestplate
      breastplate: chestplate
      pants: leggings
      shoes: boots
      helmet: leather_helmet;chainmail_helmet;iron_helmet;diamond_helmet;gold_helmet
      chestplate: leather_chestplate;chainmail_chestplate;iron_chestplate;diamond_chestplate;gold_chestplate
      leggings: leather_leggings;chainmail_leggings;iron_leggings;diamond_leggings;gold_leggings
      boots: leather_boots;chainmail_boots;iron_boots;diamond_boots;gold_boots
      armor: helmet;chestplate;leggings;boots
      larmor: leather_helmet;leather_chestplate;leather_leggings;leather:boots
      carmor: chainmail_helmet;chainmail_chestplate;chainmail_leggings;chainmail:boots
      iarmor: iron_helmet;iron_chestplate;iron_leggings;iron:boots
      darmor: diamond_helmet;diamond_chestplate;diamond_leggings;diamond:boots
      garmor: gold_helmet;gold_chestplate;gold_leggings;gold:boots
     
      # Smelting
      ores: gold_ore;iron_ore;coal_ore;lapis_ore;diamond_ore;redstone_ore
      ored: gold_ingot;iron_ingot;lapis;diamond;redstone
      extraored: gold_block;iron_block;lapis_block;diamond_block
      refines: cobblestone;clay_ball;sand;log;cactus
      refined: stone;clay_brick;glass;ink_sack:2
      extrarefined: smooth_brick;brick;thin_glass;
      cooks: pork;raw_beef;raw_chicken;raw_fish
      cooked: grilled_pork;cooked_beef;cooked_chicken;cooked_fish
      smelts: ores;refines;cooks
      smelted: ored;refined;cooked
      extrasmelted: extraored;extrarefined
      allsmelted: smelted;extrasmelted
      basicfuel: wood;coal;stick
      mostfuel: wood;coal;stick;sappling;fence;wood_stairs;trap_door;workbench;bookshelf;chest;jukebox;note_block;huge_mushroom_1;huge_mushroom_2;blaze_rod;lava_bucket
      allfuel: log;wood;coal;stick;sappling;fence;wood_stairs;trap_door;workbench;bookshelf;chest;jukebox;note_block;huge_mushroom_1;huge_mushroom_2;blaze_rod;lava_bucket
     
      # Smelted Result Groups
      miscrefined: lapis;lapis_block;diamond;redstone;ink_sack:2
      metal_blocks: iron_block;gold_block
     
      # special alias for putting item in furnaces as fuel.
      fuel: mostfuel
     
      # Cooking and Eating
      meat: cooks;cooked
      rawfood: cooks;wheat;egg;sugar;milk;brown_mushroom;red_mushroom;melon_block
      edible: cooked;bread;cake;cookie;mushroom_soup;melon;apple;golden_apple;
      food: rawfood;edible
      allseeds: seeds;pumpkin_seeds;melon_seeds;
      farmable: seeds;sapling;sugar_cane
     
      # Default Config Aliases
      heatable: cobblestone;clay_ball;raw_fish;sand;redstone_ore;gold_ore;pork;iron_ore;log;coal_ore;lapis_ore;cactus;raw_chicken;diamond_ore;raw_beef
    I'm afraid this has shut down my entire refining facility. Any ideas? I need the fuel to go in on it's own.
     
  14. Offline

    Skyve

    Thanks for having it in the works. Especially the unpowered booster rail option would be quite welcome, since there are literally thousands of them in our system and it would take quite some time to fix that.


    Well, this one is easy - since the users want blocks to be consistent with MM, the default should be "spawn a single empty minecart (spawner)" / "remove any minecart or train (remover)". Bonus points for using default blocks same as MM (diamond spawner and diamond ore remover).

    EDIT: Destroy sign issue solved.
     

    Attached Files:

  15. Offline

    bergerkiller

    Skyve you need to power the destroy signs, or invert redstone power.
     
    Skyve likes this.
  16. Offline

    Skyve

    Do I have a knack for missing the obvious! Thanks.

    But maybe it would be more logical if by default the sign just did what it says? And redstone input cancelled the effect.
     
  17. Offline

    bergerkiller

    Skyve can't do that, it's simply how all of it works together. If you want to destroy carts of certain properties, you want to use a switcher sign with it, and not think in the reverse. Power the sign is performing the command...makes most sense. :)
     
  18. Offline

    CommanderGizmo

    Any news on my bug report above?
     
  19. Offline

    bergerkiller

    CommanderGizmo Amazed that it even managed to handle that large amount of item shortcuts (inside shortcuts), so yeah...
    It does work if you use 'coal' on the third or fourth line, instead of 'smelts'?
     
  20. Offline

    CommanderGizmo

    Ok, I keep editing and adding more questions, so lets break this down:

    Response:
    Yea, I'm afraid we've hit the industrial age. It does work with only coal listed, though smelts is not the fuel. If I change mostfuel to coal it works fine. However, I don't have room for 50 blocks under my refinery for one rail line. Maybe I should post the blueprints. It has two levels of trains, one is the internal line that runs the refinery. The other is the supply/demand line that feeds the machine and takes the output to be sorted in the warehouse. Thus, I need to be able to put shorter lists on my signs to accomplish what is needed.

    The shortcuts I am using seem pretty necessary for our purpose. I can shortcut references from the config.yml and see if that fixes it, though it seems like shouldn't be that difficult to detect and prevent a circular reference and implement the shortcuts since they are preloaded.

    At any rate, the fuel shortcut I am using does not contain an 'inside shortcut' and only contains the valid fuel items minus logs. Any idea why that doesn't work?

    Code:
    mostfuel: wood;coal;stick;sappling;fence;wood_stairs;trap_door;workbench;bookshelf;chest;jukebox;note_block;huge_mushroom_1;huge_mushroom_2;blaze_rod;lava_bucket
    Why should that cause it to fill all the furnaces with cobble and no fuel?

    After testing it with the original fuel lineup, it works fine. If I add just about anything to the fuel list the broken behavior occurs.

    Questions:
    1. Also, I guess I don't understand the pathing bit. Once a train reaches it's destination, does it clear the train's set destination if there is nothing on the fourth line of the destination sign? How can I use a sign to clear a train's destination data?
    2. How do you set a switch to just send the mine carts straight, or always north/east/south/west? For example, you have a siding which you want to be ignored unless the sign is disabled. From either direction it should go straight, but that requires two signs, one on each side since left and right are then inverted.
    3. How do you set a switcher sign to send all carts in a particular direction? I don't see an "everything" option in the wiki. I tried using asterisk (*), but that only works if there is a tag.
    4. Do trains automatically go a certain direction (or straight ahead) when encountering a plain switcher sign (no statements) or a sign at which they match no conditions? How do I know what the default direction is if a train comes that meets no conditions on the switcher sign (or there aren't any on the sign)?

    Bug Report:
    1. The refinery works pretty well if only the original fuel list is used. However, it is leaving a quantity of a single item that resulted from the smelting (in this case smooth stone) in the some furnaces. No matter how many times the train passes, it is not getting the last block out. The train has nothing in it, so it isn't over filled.
    I can send you our world to look at if you like. You can have a look at the building in question for testing.
     
  21. Offline

    bergerkiller

    CommanderGizmo First of all, I'll be testing the transfer signs a bit more today. I'll reply back if I found something. (been busy yesterday implementing explosions for Spout Vanilla)

    1.) To clear the destination, add a property sign which does this:
    With the destination empty. Destination signs don't set a destination if it is empty. Of course, setting it to a non-existent destination will do too. (Just add 'none' on the sign, none is not a destination it can reach, so nothing happens)

    2. and 3.) I need to add it I guess, right now you need to do difficult...I'll add a 'false' and 'true' statements, which will evaluate like that all the time. Then you can set line 3/4 to false and it will always go straight forward, or true/false to go left. You then need 3 signs to handle all directions though, but no problem: you can attach all of them to the same block. :)

    4.) If the sign contains no statements, it will do nothing. It will only do something then if the train has a destination set (it is basically a blank switcher). If you don't want to evaluate things but only want destinations to operate, keep them empty. (note that if a statement evaluates true it will override destinations)

    I only see one problem now: there are only left/right statements. If you want to force the train to go straight ahead, destinations can override it. Wish signs had 5 lines.... :/

    I'll have to change the format slightly:
    • Line 3 & 4 empty: Destinations handle the track switching
    • One line empty: If the other line evaluates false, destinations handle track switching
    • Neither lines empty: Destinations never handle track switching
     
  22. Offline

    CommanderGizmo

    bergerkiller

    Why not follow the pattern of the transfer signs? You could use letters to allow us to designate how we want the sign handled.

    Code:
    d = override destination routing
    s = default to straight ahead if no statement matches
    l = default to left
    r = default to right
    
    [train]
    switcher ds
    storage
    
    // Override destination routing and go straight unless a storage cart is found.
    
     
  23. Offline

    bergerkiller

    CommanderGizmo I can do that yes, but if it is just 'switcher' I will default it to 'switcher ds'.
     
  24. Offline

    CommanderGizmo

    So is an empty line on a switcher sign evaluated as true or false? And does both lines as true or both lines as false mean straight? What's the other option mean then?

    [EDIT]
    Also, can the track switch back to the default direction after a train has been routed? Right now, if a train goes through a switcher sign, any train coming after it that doesn't match a condition of the sign will be routed the same. This also applies if you disable the sign via redstone.

    I am having trouble setting up two signs for an intersection. If I place two signs facing the incoming track, one above the other, and disable the first sign via redstone, the second does not seem to be read. How then can I use directional signs and control them via a redstone circuit?
     
  25. Offline

    bergerkiller

    CommanderGizmo right now it is all a bit too confusing, empty lines evaluate as false yes. If one of the lines evaluate true, it goes left/right. If no destination is set, it otherwise goes straight ahead.
     
  26. Offline

    reeZZer

    Hello,

    very interesting Plugin , i already tested 2 other smiliar Plugins (MineCart Mania and Minecart Revolution) but no one has a "Iconomy" Support , yours neither.

    So what i would like to know is if you could add a support for Iconomy ?
    Like a Dedector Sign when a Player in a Minecart drives over this Sign , he will lose 30 Dollars.

    I would like to use that as a Train Station with Auto-Pay.

    Or is there already a way to do it ?

    Thank you in advance.

    Keep up the good work !

    greeTz,
    reeZZer
     
  27. Offline

    bergerkiller

    reeZZer I guess that is not too hard to do. All I have to do is add a property sign for it to remove, add or clear the money value for all carts or cart in the train. The switcher sign can then use this method. Train switcher with statement 'money >/</= amount' to evaluate it. Though I really need to figure out a way to properly handle these statements. Checking for one is quite easy right now (cart/train.hasTag), but the syntax 'space' for a sign is very low. Considering to allow you to 'extend' the amount of statements by placing a sign underneath the switcher sign, and have each direction handled with a tag in front. For example:
    Allowing all the following:
    It makes a whole lot more sense to be honest, plus you can then properly handle all directions again. I can define the default direction after 'switcher' as mentioned before. More directions? Just add another sign right under with more statements. Not sure if this is harder or easier to understand, but I guess it's not a problem to add more functionality.
     
  28. Offline

    reeZZer

    Yeah that sounds very very nice.

    I can't wait to test this once you added the feature !

    Thanks in advance !

    Keep up the good work :D

    greeTz,
    reeZZer
     
  29. Offline

    bergerkiller

    It's going great! I decided to just do what I did with most other features: Subclass it! I added a 'Statement' class, and all current 'switcher parsable' lines will get a matching class. Not only does this allow me to flexible add new statements (think of plugin support), it also allows me to get rid of all the elseif-text equals checks that were in before. Register the class, let the class check if it matches the statement and let it parse all of it.

    I will make the '@' a standard format for 'array', so after an '@' you can always use ; to delimit multiple options to check. One switcher sign will get infinite options to choose from, and it will take the first 'true' returning statement when switching. So, to simulate an 'and', you can do the following:
    Right now it will go right if the train has a passenger called berger, it has destination substation, one player inventory has at least 5 wood, a player is holding a diamond. If not, it goes left. Unfortunately I am kind of restricted by the 15-char count cap of signs, so checking player names is a bit impossible for long player names. I have no solution for that I'm afraid, maybe I can add an unique code based system for it at some point. (like, register a player name to a certain code or id)

    I am considering using the same text-replacement system I use for parsers right now. It will then convert constants automatically, so you can make a constant for bergerkiller and put that on the sign. I guess this is the very best solution. :)
     
  30. Offline

    CommanderGizmo

    bergerkiller

    Sounds good! Have you considered shortening the space needed for describing the sign's purpose? For example, instead of using two lines to tell the plugin it is a switcher, why not an abbreviation you can put on the first line:
    Code:
    [train sw] = switcher
    [cart col] = collect
    [!train dep cfd] = deposit
    ect
    
    This would allow more space for statements while decreasing the amount of typing to set up a sign. There should still be plenty of space for the syntax on the first line as is used right now.

    Can you have the switcher sign reset the track to a default specified after the 'switcher' such as: 'switcher s' for straight? The purpose in this is that after a train is switched, the next train to come along shouldn't be sent along the same route as the last one if the sign looses power or if the next train matches no conditions on the sign.
     
  31. Offline

    bergerkiller

    CommanderGizmo nope, the thing after train is preserved for remote control. (see WIKI)
    It got added in the latest update, which allows you to control trains by name remotely, through redstone.

    The idea is that it will default back by traversing all the statements. For example:
    Will send all trains with destination 'substation' to the left, and all others to the right. You can easily extend switcher signs by placing another sign underneath it, no need to give it the [train] switcher bit. It can hold an additional 4 of these statements.
     

Share This Page