Wiki/Building/Components/Logic

*This article is a stub. You can help Stormworks: Build and Rescue Wiki by expanding it.*

< Back

 Wiki
 Building
 Components
 **Logic**

Add Comment

# Introduction to Logic

There are two key types of logic blocks with an extra section. The first is numeric, numeric logic blocks allow the user to manipulate numerical data, for example plus to input values together. The second is boolean, boolean logic allows for a true or false style of logic, for example opening/closing doors or on/off for lights.

Stormworks has two ways of impliment logic, either directly by placing them on a creation in the workshop, or by using them in a microcontroller.

# Numeric

Add

* Input 1 (Number)
* Input 2 (Number)
* Output 1 (Number)
* adds two numbers

Subtract

* Input 1 (Number)
* Input 2 (Number)
* Output 1 (Number)
* subtracts two numbers

Multiply

* Input 1 (Number)
* Input 2 (Number)
* Output 1 (Number)
* multiplies two numbers

Divide

* Input 1 (Number)
* Input 2 (Number)
* Output 1 (Number)
* divides two numbers

Abs

* Input 1 (Number)
* Output 1 (Number)
* the absolute value of a number

Clamp

* Input 1 (Number)
* Output 1 (Number)
* cuts off the input number at the given limits

Constant Number

* Output 1 (Number): the defined value

Exponent

* Input 1 (Number)
* Input 2 (Number)
* Output 1 (Number): the exponent of both inputs

Greater than

* Input 1 (Number)
* Input 2 (Number)
* Output 1 (On/Off)
* Outputs either true or false depending if Input 1 is greater than Input 2 or not.

Less than

* Input 1 (Number)
* Input 2 (Number)
* Output 1 (On/Off)
* Outputs either true or false depending if Input 1 is less than Input 2 or not.

Threshold Gate

* The output is "On" if the tested value is in the defined interval

Modulo

* Input 1 (Number)
* Input 2 (Number)
* Output 1 (Number)
* calculate the modulo of two numbers

Numerical Inverter

* Input 1 (Number)
* Output 1 (Number)
* inverts the input number: `f(-x)`

Trigonometry

* can output different functions such as sin, cos, tan

# Boolean (True/False)

And

* Input 1 (On/Off)
* Input 2 (On/Off)
* Output 1 (On/Off)
* if both inputs are on

Not

* Input 1 (On/Off)
* Output 1 (On/Off)
* inverts the input ("On"->"Off", "Off"->"On")

Constant On

* Output 1 (On/Off): always outputs "On"

JK Flip Flop

* Input 1 (On/Off): Set Flip Flop to "On"
* Input 2 (Number): Set Flip Flop to "Off"
* Output 1 (On/Off): state of the Flip Flop
* Output 2 (On/Off): opposite of the state of the Flip Flop

Or

* Input 1 (On/Off)
* Input 2 (On/Off)
* Output 1 (On/Off): outputs "On" if input 1 or input 2 or both are "On"

Push to toggle

* Input 1 (On/Off): change the state ("On"->"Off", "Off"->"On")
* Output 1 (On/Off): state of the toggle

SR Latch

Xor

* Input 1 (On/Off)
* Input 2 (On/Off)
* outputs "On" if only one of the two inputs is "On"

# Functions

Function (1 Input)

* Input 1 (Number)
* Output 1 (Number)
* applies a defined function onto a value

Function (3 Input)

* Input 1 (Number)
* Input 2 (Number)
* Input 3 (Number)
* Output 1 (Number)
* Same as Function with 1 input but you can use more different inputs in your function

Clamp: Sets both minimum and maximum values for a number. Although it states "clamp x within y and z" without specifying any order, it does require inputs in the order of (input, min, max).

# Other

Blinker

* Input 1 (On/Off): activate blinker
* Output 1 (On/Off)
* outputs "on" in a player defined rate

Capacitor

* Input 1 (On/Off)
* Output 1 (On/Off)
* can delay and/or extend the input signal

Delay

* Input 1 (On/Off)
* Output 1 (On/Off)
* delays the change of the input signal (it will extend and delay the "On" state)

Counter

* Input 1 (On/Off): is active
* Output 1 (Number): the current counter value
* after a defined time increases the counter value by 1

Counter (Ping Pong)

* Input 1 (On/Off): is active
* Output 1 (Number): the current counter value
* after a defined time increases the counter value by 1 until it reaches its upper limit. Then it will count -1 until it reaches its lower limit ... and again and again

Memory

* Input 1 (Number): the value to write to the memory
* Input 2 (On/Off): write value to memory now
* Input 3 (On/Off): reset memory to defined value (default: 0)
* Output 1 (Number): value in the memory
* can be used to store a value over time

Numerical Junction

* Input 1 (Number)
* Input 2 (On/Off): use output 2
* Output 1 (Number): outputs value of input 1 (if input 2 = "Off")
* Output 2 (Number): outputs value of input 1 (if input 2 = "On")

Numerical Switchbox

* Input 1 (Number)
* Input 2 (Number)
* Input 3 (On/Off): use input 2
* Output 1 (Number): outputs value of input 1 (if input 3 = "Off") and value of input 2 (if input 3 = "On")

Up/Down

* outputs 1 if "On" and -1 if "Off"

# Microcontroller

 Microcontroller

* This holds logic components and is used to organize groups of logic components and save space. It is the only way to read or write composite data.

Gyro

* Can be used to control a helicopter like vehicle

PID Controller

* Input 1 (Number): the target value
* Input 2 (Number): the current measured value
* Input 3 (On/Off): is active
* Output 1 (Number): the value used to control the measured value
* can be used to e.g. control the speed and throttle of a vehicle or engine