邏輯門

出自Terraria Wiki
跳到: 導覽搜尋
此頁面的(部分)內容需要被翻譯。
你可以幫助我們來翻譯此頁面
電腦版主機版 電腦版/主機版獨有內容:此的信息適用於電腦版主機版泰拉瑞亞
邏輯門
  • 邏輯門的物品外觀
Stack digit 9.pngStack digit 9.pngStack digit 9.png
屬性
類型
可放置是 1 格寬 × 1 格高
使用時間14 很快速度
稀有度稀有度級別:1
買入20000*2 Gold Coin.png
賣出4000*40 Silver Coin.png
聲音
AND邏輯門的使用示範。

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

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

行為[編輯 | 編輯原始碼]

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

  • 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邏輯門,有的話理論上它會在每次輸入改變時都送出一次訊號。
  • 多個故障燈可以連接在一個邏輯門上,且都可用來控制邏輯門。不過只有邏輯門底下的燈才可以控制發射訊號的機率。

歷史[編輯 | 編輯原始碼]