Scrap Mechanic

Scrap Mechanic

35 ratings
Analog Gates
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
45.022 MB
Jun 2, 2018 @ 10:58am
Sep 9, 2018 @ 4:03am
16 Change Notes ( view )

Subscribe to download
Analog Gates

Description
In short it can help you build complex mechanisms more compactly.

This mod add some scripted blocks which contain a value, and can recieve and send it to another scripted blocks.
This scripted blocks are called Analog gates.

Ok, how does it work?

Analog Gates recieve a value from inputs and contain it, and a value doesn't become zero when you disconnect all inputs. Some of Analog Gates can transmit a digital signal as well, they works like an OR Gate. AGs can contain only interger value.

Some of AGs depend of their inputs contecting order. I will talk about it below, but to make it clear: the 1st input - input which was connected firstly, the 2nd respectively.

A bit more about value.

To transmit a value I used power, it means you can control rotation speed and direction of engines. So some classic game parts contain a value too: logic gate, switcher and button contain 1 when it pressed(switched-on), and 0 when it not pressed(switched-off).

Analog Gates description:

Value Gate:
Have 2 inputs. If connected only one input then Value Gate recieve both value and digital signal from it. If connected two inputs VG recieve value from 1st input and digital signal from 2nd input.
The 2nd input should be painted in red (third from above in red column of paint tool).
It's main block, use it to transmit a value. The second input is needed if you use conditions.

Result Gate:
It is used if you want to transmit one of several input values. It recieve a value from first active input. It is usually used with Value Gates. Have 2 modes which define will it transmit a digital signal or not.

Gates to enter a value:

Binary to decimal coverter:
Use it to set a value. First of all you need to set a binary value by using any digital parts (switchers for example). Connect switchers from left to right the same as you would write a nuber: the switched-on = 1, the switched-off = 0. And then press E (interact with gate) to covert binary value to decimal value. Now work dynamically. Don't transmit a digital signal.

Counter:
Have 1 input. If input is active this gate add 1 to its value if input value is positive and -1 if input value is negative. Don't transmit a digital signal.

Gates to output a value:

Analog Line Chooser:
Connect it only to Analog Chooser cells. Have 2 modes. Recieve a value from input and turn on the line (Analog Chooser Cell) which number equal value - the first mode, turn on the line (Analog Chooser Cell) which number less or equal value - the second mode. Max quantity of outputs is 100.

Decimal To Binary Converter:
Connect it only to Analog Chooser cells, a connection order is same as of Binary To Decimal Converter (left to right). It recieve a decimal value from input and display it with Analog Chooser cells in the form of a binary number. Max quantity of outputs is 100.

Analog Chooser cell:
Contain a value like a logic gate. Transmit a digital signal. Connect Analog Line Chooser or Decimal To Binary Converter to it.

Gates for calculation:

Inversion gate:
Multiply an input value by -1. Transmit a digital signal.

Sum and multiplication gate:
Sum or multiply input values. Press E to change a calculating mode. Transmit a digital signal.

Difference and quotient gate:
Have 3 modes. Substraction, div (integer part of division) and mod (remainder of division). Press E to change a calculating mode. Transmit a digital signal.

Analog logic gates:

Comparator:
Compare 1st input with 2nd input, if condition is true it's turn on else it's turn off. Have 6 comparing mode. Press E to change a comparing mode. Don't transmit an analog value.

Bugs:
There is one bug which I can't fix now. When you reload a world some input connections can mix. Inputs connect in order they were created!
(TEMPORARILY NON-FIXED)

Write in comments about your ideas and bugs. And ... enjoy

34 Comments
dum_tard Dec 9, 2021 @ 8:00pm 
Basically Logic Gate's Brother
Zephyroku Nov 4, 2021 @ 9:17am 
I would love to see a BCD/7segment decoder!
VGStudios Oct 13, 2021 @ 4:44pm 
can you make a block that can incress the speed or power of the engine by a click of a button?
Riftmon Sep 22, 2020 @ 4:11pm 
if you can make a GUI that is the same as a logic gate, but let it output number values instead of digital, idk if one of the blocks can or can't because your wack english is making this alot harder than it needs to be
Scrap Discordian Apr 22, 2020 @ 9:42am 
Numbers?
i need number logic to speed up my engines
rollscanarley Oct 12, 2018 @ 8:42am 
could you explain a little more about "Bugs:
There is one bug which I can't fix now. When you reload a world some input connections can mix. Inputs connect in order they were created!
(TEMPORARILY NON-FIXED)" Please.

I understand there is a bug. We deal with bugs, no biggie. but if you know something about what causes it and or how it can be avoided it would be much appreciated if you would share.

Thanks!
Light-Rider Aug 23, 2018 @ 3:54am 
Decimal*
Light-Rider Aug 23, 2018 @ 3:54am 
Decimical input...? :D
Samurai (侍)  [author] Aug 23, 2018 @ 2:03am 
I hope you had already noticed it :)
Light-Rider Aug 21, 2018 @ 8:35am 
P.S. Will there be a binary output in the future instead of a decimal one?