本站文本内容除另有声明外,转载时均必须注明出处,并遵守CC BY-NC-SA 3.0协议。(转载须知
本站是中文Terraria Wiki的镜像站,与Re-Logic、Gamepedia没有从属关系。(免责声明
由于镜像同步脚本的问题,本镜像站暂停更新。请前往中文Terraria Wiki源站访问最新信息。

全站通知:

逻辑门

阅读

    

2020-07-10更新

    

最新编辑:

阅读:

  

更新日期:2020-07-10

  

最新编辑:

来自Terraria Wiki
跳到导航 跳到搜索
此页面的(部分)内容需要被翻译。
你可以帮助我们来翻译此页面
电脑版主机版 电脑版/主机版独有内容:此的信息适用于电脑版主机版泰拉瑞亚
逻辑门
  • 逻辑门的物品外观
Stack digit 9.pngStack digit 9.pngStack digit 9.png
属性
类型
可放置是 (1 格宽 × 1 格高)
使用时间很快速度
稀有度稀有度级别:1
买入20000*2
卖出4000*40
声音
AND邏輯門的使用示範。

逻辑门是提供線路邏輯的机械。使用一個或多個逻辑门灯放在邏輯門上做為訊號源。邏輯門的開關狀態視其輸入源而定,且每次改變狀態時會發送一次訊號。

邏輯門每個20000*2,與邏輯門燈都出售自蒸汽朋克人

行为

所有的邏輯門在初次放置時都會是關閉狀態。每次加入、移除、或開關邏輯門燈,邏輯門會依以下規則行動:

  • Logic Gate (AND).png AND: 所有燈都亮時,輸出訊號。
  • Logic Gate (NAND).png NAND: 除非所有燈都亮,否則輸出訊號。
  • Logic Gate (OR).png OR: 至少一個燈亮時,輸出訊號。
  • Logic Gate (NOR).png NOR: 沒有燈亮時,輸出訊號。
  • Logic Gate (XOR).png XOR: 只有一個燈亮時,輸出訊號。
  • Logic Gate (XNOR).png XNOR: 不是正好一個燈亮時,輸出訊號。


無論何時邏輯門打開或關閉,它都會發出一個信號。如果這個信號會導致一個邏輯門改變它自己的輸入,並在同一時刻發出兩個信號,那麼相反,在這個邏輯門上會顯示一股煙霧,並且只發出一個信號。注意,雖然只發出一個信號,但邏輯門本身的狀態仍會改變(邏輯門輸出信號使逻辑门灯改变状态不满足逻辑门打开条件,邏輯門不會再次發出信號但是會关闭)。

故障邏輯門燈

在邏輯門上方放置故障燈會使其變藍,並完全改變其邏輯行為。若邏輯門被訊號觸發,它會隨機選擇其下方的邏輯燈,若選中的燈是亮的,邏輯門便會發出一次訊號。所以假設其下有三個燈,兩個暗的、一個亮的,則邏輯門收到訊號時會有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邏輯門,有的話理論上它會在每次輸入改變時都送出一次訊號。
  • 多個故障燈可以連接在一個邏輯門上,且都可用來控制邏輯門。不過只有邏輯門底下的燈才可以控制發射訊號的機率。

历史