逻辑门

来自Terraria Wiki
跳转至: 导航搜索
此页面的(部分)内容需要被翻译。
你可以帮助我们来翻译此页面
电脑版主机版移动版 电脑版/主机版/移动版独有内容:此的信息适用于电脑版主机版、和移动版泰拉瑞亚
逻辑门
  • 逻辑门的物品外观
自动使用
Stack digit 9.pngStack digit 9.pngStack digit 9.png
属性
类型
可放置是 (1 格宽 × 1 格高)
使用时间15(很快速度)
稀有度01*稀有度级别:1
买入2
卖出40
研究需要 5 份
逻辑门(与)的使用示范。

逻辑门是提供线路逻辑的机械。使用一个或多个逻辑门灯放在逻辑门上做为信号源。逻辑门的开关状态视其输入源而定,且每次改变状态时会发送一次信号。

逻辑门和逻辑门灯都以每个2的价格出售自蒸汽朋克人

行为[编辑 | 编辑源代码]

所有的逻辑门在初次放置时都会是关闭状态。每次加入、移除、或开关逻辑门灯,逻辑门会依以下规则行动:


逻辑门 规则
逻辑门(与)逻辑门(与)
内部物品 ID:3603
当所有的灯都激活时输出信号。
逻辑门(与非)逻辑门(与非)
内部物品 ID:3605
除非所有灯都激活,否则输出信号。
逻辑门(或)逻辑门(或)
内部物品 ID:3604
当至少有一盏灯激活时输出信号。
逻辑门(或非)逻辑门(或非)
内部物品 ID:3606
当没有灯激活时输出信号。
逻辑门(异或)逻辑门(异或)
内部物品 ID:3607
当只有一盏灯激活时输出信号。
逻辑门(同或)逻辑门(同或)
内部物品 ID:3608
当被激活的灯总数不是一盏时输出信号。

无论何时打开或关闭逻辑门,它都会发出一个信号。如果这个信号会导致一个逻辑门改变它自己的輸入,并在同一时刻发出两个信号,那么相反,在这个逻辑门上会显示一股烟雾,并且只发出一个信号。注意,虽然只发出一个信号,但逻辑门本身的状态仍会改变(逻辑门输出信号使逻辑门灯改变状态不满足逻辑门打开条件,逻辑门不会再次发出信号但是会关闭)。

故障逻辑门灯[编辑 | 编辑源代码]

在逻辑门上方放置故障灯会使其变蓝,并完全改变其逻辑行为。若逻辑门被信号触发,它会随机选择其下方的逻辑门灯,若选中的灯是亮的,逻辑门便会发出一次信号。所以假设其下有三个灯,两个暗的、一个亮的,则逻辑门收到信号时会有1/3的机会发出信号。放了故障灯后,逻辑门上的其它灯将无法影响逻辑门。

故障灯可以在同一个时刻被多次触发,导致逻辑门有更高的机率发出信号。但同时刻一样只能发出一次信号。比如:

A faulty lamp can be triggered multiple times in one tick, effectively giving the gate multiple chances to emit a signal. Multiple signals cannot be emitted on the same tick this way, however, the gate will have a chance to emit a signal for every time a faulty lamp receives a signal. For example, if you trigger a faulty gate with one out of two of its logic gate lamps on twice in the same tick, it will have an 3/4 chance of emitting a signal.

Faulty lamps continue to work if only one logic gate lamp is under it. In this case, the logic gate as a whole acts as an "if" statement, only passing a signal through if the single lamp is on. If no logic gate lamps are attached, the logic gate never sends signals when the faulty lamp is triggered. A very practical use of this is a one-way wire: when a logic gate receives a signal it does nothing, but triggering the faulty lamp above it does send a signal. The logic gate lamp under the faulty lamps needs to be on. Also, this wire can be turned off by sending a signal to the logic gate lamp. Making two of these lets the player control all four possible states of a wire: Off, on (A->B), on (A<-B), on (A<-->B).

Inverted Gates[编辑 | 编辑源代码]

Since gates emit a signal whenever they either turn on or off, the "inverted" versions of each gate (those with an "N" prefix) behave identically to their normal counterparts in most situations. The only difference is when the first lamp is added to a new gate. (For example, both the NAND and AND gates start off when first placed. However, upon adding an off gate, the AND gate would stay off and emit no signal while the NAND gate would turn on, thus emitting a signal.)

Useful Circuits[编辑 | 编辑源代码]

set/reset flip-flop (SR flip-flop)[编辑 | 编辑源代码]

A set/reset flip-flop is a device that has two inputs, and can be switched between the two. However, multiple activations on the same input will not change the state. It will output a pulse when the state changes. In the illustration, red and blue are the inputs, and green is the output.

备注[编辑 | 编辑源代码]

  • 泰拉瑞亚里没有NOT邏輯門,有的話理論上它會在每次輸入改變時都送出一次訊號。
  • 多個故障燈可以連接在一個邏輯門上,且都可用來控制邏輯門。不過只有邏輯門底下的燈才可以控制發射訊號的機率。

历史[编辑 | 编辑源代码]