bergerhealer / TrainCarts

Minecarts redefined
MIT License
206 stars 63 forks source link

TrainCarts ticket system #150

Closed bergerkiller closed 6 years ago

bergerkiller commented 7 years ago

A map-based ticket system, where train destinations (or other such properties like tags) can be set. When a player enters a train that has a certain property set indicating a ticket is required ('token' or something?) it is checked whether the player possesses a ticket for the train. When the player possesses more than one ticket/token for the same train, one is chosen in the following order:

  1. Currently held item
  2. Quickbar
  3. Inventory

This item is removed from the inventory, its properties applied to the train. By using a switcher sign it can be checked when a player enters / destination is set, provoking the initial depart of the station.

BKCommonLib already has a versatile map API which can be used to easily render unique ticket logos. It is also possible to display live information or things like expire dates or what have you on there.

Requested is a way to 'skip' stations when 'express' tickets are used (add tag 'express' to the train), but I'm not sure how that can be used. Perhaps with complicated switcher systems stations can be bypassed (or disabled with redstone signals) when express tag is set, and the destination set for the train does not match the station. I'll leave that up to the users to figure out, since that's already possible.

See also a more detailed post by _frozen on SpigotMC: https://www.spigotmc.org/threads/traincarts.233672/page-7#post-2552624

frozenMC commented 7 years ago

Requested is a way to 'skip' stations when 'express' tickets are used (add tag 'express' to the train), but I'm not sure how that can be used. Perhaps with complicated switcher systems stations can be bypassed (or disabled with redstone signals) when express tag is set, and the destination set for the train does not match the station. I'll leave that up to the users to figure out, since that's already possible.<

I can confirm that there is a way to do this with the existing system (a bit complicated but it requires a unique track setup at every station that supports local/express. If anyone is interested i can post a rough setup on how to do this.

However, looking at the previous issue I see a potential workaround in the distant future-- Issue #61 -- that could simplify the system, but thats asking for more work.

Also: it doesnt have to be a map to achieve a ticket system. Leave the option for users to put in a specific item (emerald, iron ignots, etc) so it can be as customizable. If this is harder than the map approach, thats fine-- just a suggestion!

bergerkiller commented 7 years ago

Maps are really simple to implement. TrainCarts already has an undocumented WIP system for maps, you get the item with /train editor. You can click on signs or rails to 'edit' signs with it. BKCommonLib already has a very rich and powerful map API for doing this, and I don't see why it can't be used to display customizable / user-specific tickets ;)

I do have to think about ways to render the tickets though. I have been thinking of a sort of HTML meta language to display images and styled text, but also don't want to get too far ahead of myself...

bergerkiller commented 7 years ago

The following is planned:

Are there any other features requested for tickets?

frozenMC commented 7 years ago

Not that I can think of right now; youre spot on with all my feature requests so I m good with this!

bergerkiller commented 7 years ago

I will release a new TrainCarts version on Spigot. It supports the full use of tickets with trains. The use is somewhat complicated at first, but once you get used to it, it is really simple.

  1. Set up new tickets. Tickets are a global configuration. They define the name, properties to apply, and what the limitations are. You do this with /train ticket create [name]. With /train list tickets you can see all tickets that exist. To edit an existing one, use /train ticket edit [name].
  2. Configure the ticket to set destinations or tags. All properties are actually supported, but I've only added commands for /train ticket destination and /train ticket tags. Other properties can be changed by adding them to the tickets.yml manually under 'properties' key.
  3. Give the ticket to players, with /train ticket give [name] [player names]
  4. Set ticket restrictions on trains. This can be done with property signs, default train properties, or by using the command /train [set/add/rem]ticket [name]

Example of it in use on my test server: https://www.youtube.com/watch?v=fVA_MPxXVO0

More detail: https://www.spigotmc.org/resources/traincarts.39592/update?update=181448

frozenMC commented 7 years ago

GREAT! Glad to see it in use!

One odd thing (probably a minor bug related to syntax): My name starts with an underscore, so this may be the cause. Instead of assigning it to _frozen, it shows "4_frozenr" rather than _frozen.

"Maps will be used as tokens. On the maps will be rendered an image to your choice (png, jpg, put in plugin folder. I may add some way to download an image online and store it in a cache so you can use links)"

which folder would this be found?

bergerkiller commented 7 years ago

Current release does not have a path for the ticket image you can set. For now you can open the .jar in Winrar or other archive tool and edit the ticket background png to change it. Reason I didn't add any yet is because it needs a more advanced syntax for setting up the display. Such as positioning the labels.

It uses your player display name on the ticket, but for checking if you are the owner it always uses your player GUID. I think you may have styling effects in your display name, causing this. I'll have to strip those off.