Interface Connectable
- All Known Implementing Classes:
Connector,ConnectorBridge,ConnectorRelay,ConnectorSink,ConnectorSource
public interface Connectable
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classstatic final class -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidacceptSignalFrom(Connectable source, Types.IntVector2 pos, GameContext ctx, HashSet<Integer> seen) Called when thisConnectablereceives a signal from another.default Types.IntVector2[]By default, connectable items connect visually to 8 directions.Get the type of connector.booleanGet whether or not this Connectable is connected (active)voidpropagate(GameContext ctx, HashSet<Integer> seen) Potentially propagate the the connectors current siganlvoidsetActive(boolean connected, GameContext ctx) Set theConnectableto beconnectedThis may or may not propagate the signal
-
Field Details
-
defaultConnectionDirections
-
-
Method Details
-
propagate
Potentially propagate the the connectors current siganl- Parameters:
seen- is IDs of allConnectableitems which have already propagated
-
connectionDirections
By default, connectable items connect visually to 8 directions. ^ ^ ^ ^ me ^ ^ ^ ^ Override this method to change visual connection directions -
acceptSignalFrom
void acceptSignalFrom(Connectable source, Types.IntVector2 pos, GameContext ctx, HashSet<Integer> seen) Called when thisConnectablereceives a signal from another.- Parameters:
source- the Connectable sending the signalpos- the source's positionseen- A set of already visited IDs
-
setActive
Set theConnectableto beconnectedThis may or may not propagate the signal -
getConnectorType
Connector.ConnectorType getConnectorType()Get the type of connector. -
isConnected
boolean isConnected()Get whether or not this Connectable is connected (active)
-