#Interaction with logic gates

2 messages · Page 1 of 1 (latest)

scenic maple
#

Description

a way to interact with logic gates, in both ways.

Use Case

Can be used to make sensor communicate with the mods, to make the mods interact with blocks (for example moving hinges on a plane or car), but most importantly custom logic circuits (enabling to use sin, cos, ecc...). (this would become especially good if we get a ModBlock.GetColor() so we can differentiate between logic gates)

Implementation

ModBlock.GetInputs() return a table with the values of all inputs
ModBlock.SetOutput(value:float) overrides the output of the logic gate (if it's too difficoult to implement a SetInput(value:float) that adds an extra input given by the mod would also work)
ModBlock.GetOutput() returns the output of a lofic gate (useful tho avoid repetition of calculating the output using the inputs)

least important but could still be useful
ModBlock.GetInputBlocks() returns a table with the ModBlock of anything that connects to that gate
ModBlock.GetOutputBlocks() returns a table with the ModBlock of anything that receives an input from that gate
ModBlock.RegisterValueChange(functionName:String) makes so whenever the block's inputs change it calls a function

edgy ether
#

Would be a blessing if this was also extended for outputs from engines into wheels

+1 on ModBlock.GetInputBlocks(), ModBlock.GetOutputBlocks() and ModBlock.RegisterValueChange()—these would prove extremely useful for a variety of cases, such as tracing out connections

It could pair well with #1123958566093606953 message