I'm building the new spawn station for our server, and the admin requested that I ensure that new players have to read the rules before they can enter the universe. So, I came up with a rail based door that requires the player to punch in a correct sequence on a keypad to open it, and put the combination in the rules list.
Thought I'd share that logic with everyone. This setup is designed to work for a three button keypad, where the combination is 2-1-3.
Now I didn't put in a whole lot of error checking, so this could technically be brute forced if you were fast enough, but for the purposes of being an effective combination lock, it works quite nicely.
Quick rundown on what it's doing.
First digit verification, you hit the 2 button and it goes to a flipflop that stores the "correct button pressed" state. Off to the side are 5 daisy chained delay blocks, with the last feeding back into the flipflop. This gives the player 2.5 seconds to correctly input the next digit before the delays reset it.
Second digit verification, assuming the flip flop from the first digit is active, link that flip flop into an AND along with the second correct digit. Repeat the delay blocks on this second stage state save so that it will also reset.
Third digit verifiction, same as second stage, AND the correct digit with the previous level's saved state, and feed it into a third saved state. At this point the user has correctly entered the code, feed the output of the third flipflop into your rail door activation toggle logic. For my door based on it's size, I put 20 delays on this stage to give the door enough time to open and for the user to walk through it before it closes again.
And thats it. The lock resets if the player doesn't enter the correct digit every 2.5 seconds and they have to start over. It is easily expandable to being as many digits in length as you want, you simply have to add another flipflop to save the state.
You now have a locked door that cannot be opened by anyone, even a faction member, that doesn't know the passcode. Great for spawn stations, but also great for private storage areas on faction bases, or for putting additional protection on large faction ships that you don't want a faction member running off with when you aren't looking.
Thought I'd share that logic with everyone. This setup is designed to work for a three button keypad, where the combination is 2-1-3.
Now I didn't put in a whole lot of error checking, so this could technically be brute forced if you were fast enough, but for the purposes of being an effective combination lock, it works quite nicely.
Quick rundown on what it's doing.
First digit verification, you hit the 2 button and it goes to a flipflop that stores the "correct button pressed" state. Off to the side are 5 daisy chained delay blocks, with the last feeding back into the flipflop. This gives the player 2.5 seconds to correctly input the next digit before the delays reset it.
Second digit verification, assuming the flip flop from the first digit is active, link that flip flop into an AND along with the second correct digit. Repeat the delay blocks on this second stage state save so that it will also reset.
Third digit verifiction, same as second stage, AND the correct digit with the previous level's saved state, and feed it into a third saved state. At this point the user has correctly entered the code, feed the output of the third flipflop into your rail door activation toggle logic. For my door based on it's size, I put 20 delays on this stage to give the door enough time to open and for the user to walk through it before it closes again.
And thats it. The lock resets if the player doesn't enter the correct digit every 2.5 seconds and they have to start over. It is easily expandable to being as many digits in length as you want, you simply have to add another flipflop to save the state.
You now have a locked door that cannot be opened by anyone, even a faction member, that doesn't know the passcode. Great for spawn stations, but also great for private storage areas on faction bases, or for putting additional protection on large faction ships that you don't want a faction member running off with when you aren't looking.
Last edited: