Pressure-Activated Safe Alarm
From GMod Wiki
Wiremod/Tutorials: Pressure-Activated Safe Alarm |
Description: | An alarm that uses a few chips to measure a hydraulic/pressure and activate if changed. You can also turn the alarm on/off |
Original Author: | Susuman |
Contributors: | None |
Created: | 4/18/2010 |
Instructions
First off, you'll need a safe into where you'll put your goodies, it needs to face up since it's going to be pressure activated. Here's an example, it's sideways for now so you can see clearly.
Next, spawn a control panel of you choice and make another prop that's going to be your pressure pad. Make a wired (Fixed) Hydraulic in the center of you pressure pad and put the controller on your panel. Then add a constant value of the height that you want the pad to be at when it's at the top of your safe and wire Hydraulic Length to the CV. In this case it's 45. Your pad might sag a bit downward so change the weight to about 10 and you might have to mess around a bit with the CV to get it right. Then you'll want to put on a Round chip for smoother wiring. Wire the Round to the Hydraulic. This is what you should have so far
Add on a Greater Than or Equal chip from the Comparison section and another Constant Value of the height of your Hydraulic when the treasure or item is removed. You can test this by putting on an item and your Hydraulic should drop about 1 measurement. Wire the A of the chip to the Round and the B to the CV. Add on an alarm from the Sound Emitter and wire it to the Greater Chip and you should have a working alarm.
Now for the toggle on/off switch. Pop on a If Then Else chip from Selection and a button that turns your alarm on/off. Wire the A of the If Then Else to the button, B to Sound Emitter and C to Greater Than. Another nice addition would be to add on a HUD Indicator or some kind of light to show you if it's safe to remove you item.
This is by-passable by putting on an object and then taking the other off, like in Indiana Jones. If you want an even more "safe" safe than add on a Less Than chip. Wire A to the Round chip and B to another Constant Value of the height of the Hydraulic if it's less than the weight of the item that it on it. So maybe 1 measurement below the height of when the item is on it.
Explanation
The Greater Than or Equal chip checks if the the height of the Hydraulic is greater than or equal to the 2nd Constant Value and send out a one to the sound emitter if it is. With the If Then Else chip it checks if the button is on and if it is than the output is 0, so the alarm doesn't turn on. If the button is not on than the If Then Else chip goes to the Greater Than chip and does the same thing as stated in the 1st sentence. Then Less Than chip does the same as the Greater Than but checks if the Hydraulic if Less than the height of when the item is on the pad.