Tuesday, November 22, 2011

| Wiring! Room 1 (spoilers)

Dunno if all you guys have had a chance to poke around with the little mini-dungeon I set up (I think everyone but Rude saw the first and the functionally complete second area?). If you haven't, check it out, it takes like five minutes to go through the whole thing. Anyway I thought I'd put down a few notes on how it works since I know most of you haven't played with redstone too much and maybe you can get inspired to do way cooler (certainly cooler looking) stuff than I've done. Also it's fun for me to think through this stuff myself and how I did certain things in ways that turned out to be stupid and inefficient or (accidentally) sort of clever. Today I'll do the doorbell itself.



I thought about a few ways to make the doorbell ring and then dump the user into the basement. I spent a bunch of time wiring up a completely different method based on regular pistons and then realized that sticky pistons would be a lot easier. I could stick wood to the pistons, extend them, then retract them when the user pushes the button. It also took me a while to figure out the exact best way to wire the pistons. Especially in Beta 1.8 pistons were/are a little wonky and the positioning of the wiring takes a little experimentation.



This picture is directly behind the entry. The wire runs out from near the doorbell, then runs through a series of note blocks with repeaters in between them. The repeaters are important for three reasons. First, current will only travel so far (15 blocks or something) and you need a repeater in there to extend the range. Secondly they let you introduce a delay so that you can space out the notes. (I still think the notes don't sound quite right -- it's the Pirate LeChuck's theme from Monkey Island -- but eh, good enough.) Third, current can only move in one direction (from the back of the repeater to the front).

So the current travels through the seven note blocks/repeaters. Then it hits the sticky pistons. The pistons have wood blocks attached to them (which they push/pull with them).



In their normal state, the pistons are extended, so that the attached blocks are under the entryway, because they are connected to a redstone torch. A redstone torch will power anything connected to it perpetually, unless it receives power from behind (also known as a NOT gate). A wire directly into a block then into a redstone torch is how you create a NOT gate in Minecraft.



The picture above shows what the pistons are like when extended. I chopped the central wood block out for the picture.

So this is the exact order of events:

1. User stands in the entry, which means they are on the wood blocks that are connected to the extended sticky pistons.
2. User pushes button.
3. Current passes sequentially through note blocks, with the notes spaced out because they are separated by repeaters.
4. Current hits the NOT gate which de-powers the redstone torch and all the sticky pistons attached to it.
5. The sticky pistons retract, pulling the wood blocks out from under the user, dumping them into the basement.

I hope I've done Grimtooth proud!