Updated Signals (markdown)

Florian Nücke 2013-12-12 12:46:24 -08:00
parent c125550da7
commit 414625d889

@ -28,6 +28,8 @@ Screen
**Important**: this signal is *checked*, i.e. it is only queued on a computer if the player that caused it is [[registered as a user|ComputerUsers]] on the computer (or there are no users registered on the computer).
- `redstone_changed(address: string, side: number)`
This signal is queued by [[redstone components|Component/Redstone]] when an incoming signal changes. The address is either that of the [[Redstone I/O block|Blocks#redstone-io]] or that of the computer with the [[redstone card|Items#redstone-card]] that generated the signal. The side is one of the `[[sides|API/Sides]]` constants and indicates on which side the signal changed. This is relative to the container of the component, so for computers and robots this depends on which way they are facing. For Redstone I/O blocks this is always the absolute side.
- `modem_message(receiverAddress: string, senderAddress: string, port: number, distance: number, ...)`
This signal is queued by [[network cards|Items#network-card]] (including wireless ones) when they receive a message on an open port. The first address is the address of the network card that received the message, the second the address from where the message was sent. Note that the sender address may differ from the card that originally sent the message when it passed through one or more [[routers|Blocks#router]]. The port is the port on which the message was received. This distance is the distance only set when receiving *wireless* network messages, in which case it is the distance to the wireless network card that sent the message. For normal network cards the distance will always be zero. All further parameters are user defined and correspond to what the sender specified in `[[modem.send()|Component/Modem]]` or `modem.broadcast()` as the message's payload.
- `inventory_changed(slot: number)`
This signal is queued by robots when their inventory changes. Note that this only includes changes to the kind of item stored in a slot. For example, increasing or decreasing the size of an already present stack does not trigger this signal. However, swapping one item with another (say, torches with sticks) by hand will actually trigger *two* signals: one for the removal of the torches, one for putting the sticks into the temporarily empty slot. Swapping items using `[[robot.transferTo()|API/Robot]]` will even trigger *four* signals - the same thing, but for the two slots involved in the swap.
Also, this only fires for the actually addressable inventory of the robot, i.e. it does not trigger for changes in equipment (tool, card, upgrade).