Logic gates and sensors are the building blocks of advanced automation in Rust. They allow you to create complex systems for defense, resource management, and even traps. By understanding how these components interact, you can transform your base from a simple shelter into an intelligent, automated fortress, reacting to threats and managing resources autonomously.
Logic Gates
Logic gates are fundamental components that perform Boolean operations. They take one or more inputs and produce a single output based on specific rules. The most common logic gates in Rust are:
- AND Gate: Output is ON only if ALL inputs are ON.
- OR Gate: Output is ON if ANY input is ON.
- NOT Gate: Output is the inverse of the input (ON becomes OFF, OFF becomes ON).
- XOR Gate: Output is ON if the inputs are DIFFERENT.
- Memory Cell: Stores a state (ON or OFF) and can be set or reset.
Sensors
Sensors detect specific environmental conditions or player actions and output a sal (ON or OFF) that can be fed into logic gates or directly control devices.
- Power Sensor: Detects if a power source is active.
- Pressure Plate: Activates when a player or entity steps on it.
- Item Collector: Detects when specific items are dropped into it.
- Car Sensor: Detects when a vehicle is within its range.
- Storage Sensor: Detects if a storage container is full or empty.
- HVAC Sensor: Detects temperature and humidity.
Connecting Components
Components are connected using Electrical Branches and Wire Tool. The Wire Tool allows you to draw connections between the output of one component and the input of another. Electrical Branches are used to split or combine power sals.
Example: Automated Door Lock
A simple example is an automated door lock that only opens when a specific item is placed in an Item Collector. This requires:
- An Item Collector.
- A Combiner (to combine the Item Collector's sal with a desired item).
- A Door Controller.
- A Power Source (e.g., a Small Generator).
- Wire Tool.
Connect the Combiner's output to the Door Controller's input. The Combiner is configured to output ON only when the specific item is present in the Item Collector. The Door Controller is then powered by the generator.
Advanced Applications
With these components, you can build:
- Automated defenses: Turrets that only activate when specific threats are detected.
- Resource management systems: Lights that turn on when storage is full.
- Trap systems: Doors that close and activate traps when unauthorized players enter.
- Complex base security: Multi-factor authentication for entry.
Experimentation is key. Use the Testmode command in a solo server to practice and refine your dess before implementing them on a live server.