Giter Club home page Giter Club logo

Comments (16)

 avatar commented on May 28, 2024

You can use detector signs:
http://minecraft.gamepedia.com/Custom_servers/Bukkit/TrainCarts/Signs/Detector
They detect trains between two signs.

from traincarts.

harm27 avatar harm27 commented on May 28, 2024

Hey,

The problem is that the check system is triggert by some sort of region enter.
Let me explain that.
When a player enters a region the check system is triggert.
It needs to check if there is a train:

  • In the get out area
  • In the last scene before the get out area
  • In the spawn area
    If there is train in one of that areas, no train needs to be spawned.
    But if there is no train there, then a train needs to be spawned.

If i look at the detector sign, i think it will not give me the thing that i need.
Looking at what is explained about it, and what i know about the thing i need.

Harm

from traincarts.

 avatar commented on May 28, 2024

I don't understand what's the issue.
Detector signs can detect trains in a region:
Detector

from traincarts.

harm27 avatar harm27 commented on May 28, 2024

image
The track is like what displayed above.
When a player enters the station region, there will be checked if there is a train on the step out or last scene or rangeer system.
This will be some what with a command system, what triggers the redstone for the checks.
Since it is hangrail, i forgat to say that earlier, there is less space below.
And most of the time, no space.
This because of the scenery that is build arround the track.

Harm

from traincarts.

 avatar commented on May 28, 2024

I suggest having a look at this:
http://jd.mg-dev.eu/tc/com/bergerkiller/bukkit/tc/detector/DetectorRegion.html

TrackMap map = new TrackMap(startRail, direction);
map.generate(length);
DetectorRegion.create(map).register(your DetectorListener);

TrackMap: http://jd.mg-dev.eu/tc/com/bergerkiller/bukkit/tc/utils/TrackMap.html
DetectorListener: http://jd.mg-dev.eu/tc/com/bergerkiller/bukkit/tc/detector/DetectorListener.html

I'm not sure if this works, I didn't test it.

from traincarts.

harm27 avatar harm27 commented on May 28, 2024

Okey, i will try that. Looks what some part at what i am looking for.
Only problem is the length.
I do have the start and end Location.
But i will look for a solition for that.

from traincarts.

 avatar commented on May 28, 2024

Try this:

TrackMap map = new TrackMap(startRail, direction, maxDistance); # maxDistance = maximum distance between the two blocks
while (map.hasNext()) {
    Block next = map.next(); # get next block
    if (next != null && /* check location */)
        break; # exit while
}
DetectorRegion.create(map).register(your DetectorListener);

Don't use TrackMap#generate in this case.
I didn't test this but I'm 99% sure this works.

You should provide a maximum distance because otherwise it could loop forever.

from traincarts.

harm27 avatar harm27 commented on May 28, 2024

Okey, i think that will do that. Now coding it.
Thanks for the help.

from traincarts.

harm27 avatar harm27 commented on May 28, 2024

I have been looking into the detector code.
Maybe that is what i am looking for.
Only problem is now how to get tracked of the state of the detector. Is there a way to get the detectorregion name? So there can be a custom sign that tracks if that region is used and when not, spawn a train.

from traincarts.

 avatar commented on May 28, 2024

You can activate a Wireless Redstone channel in your DetectorListener.

from traincarts.

harm27 avatar harm27 commented on May 28, 2024

What function do i need to use for that. Since there are multiple functions, for train or seperate cart.
Do i need to check in that function bv. for any groups, if there is a group, set status to off?

And how do i know what detector region i need to check? Is there a way to get the name or UUID? If i have placed the detector signs?

from traincarts.

 avatar commented on May 28, 2024

You told me you didnt want to use detector signs 4 days ago...?

If you use detector signs you can just attach a lever to one of the signs and attach it to a wireless redstone transmitter.

from traincarts.

harm27 avatar harm27 commented on May 28, 2024

Then i didn't understand it far enough. The problem with the lever thing is that there is next to the rail no space. Since it is a hangrail and the builders don't want some levers hanging, there is that problem what i am facing now. When i can one someway track what detectorregion the detectors are, then i can build a plugin with a DetectorListener that can track the channels. And i can place a sign somewhere that i can place a redstone block next so i can use that info in redstone checks.

from traincarts.

 avatar commented on May 28, 2024

Try this:
Detector

from traincarts.

harm27 avatar harm27 commented on May 28, 2024

Thanks for the help. That was exactly what i was looking for.

from traincarts.

 avatar commented on May 28, 2024

No problem!

from traincarts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.