How to create a new combinator?

Place to get help with not working mods / modding interface.
Xeon257
Inserter
Inserter
Posts: 40
Joined: Wed Sep 24, 2025 6:25 pm
Contact:

How to create a new combinator?

Post by Xeon257 »

I want to create a combinator that represents sine and cosine functions.

Is there a better way to build a machine that performs this kind of circuit processing, other than using the tick event?

And to implement this, do I have to keep track of every combinator entity and run a loop on each tick?
I am not able to write in English myself, so I am using ChatGPT for help. Please excuse any awkward phrasing.
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3750
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: How to create a new combinator?

Post by DaveMcW »

Yes, you must use the on_tick event to get input from a circuit network.

Output must be a constant-combinator where you set your processed signals.
User avatar
Osmo
Fast Inserter
Fast Inserter
Posts: 193
Joined: Wed Oct 23, 2024 12:08 pm
Contact:

Re: How to create a new combinator?

Post by Osmo »

DaveMcW wrote: Sun Nov 09, 2025 9:24 pm Output must be a constant-combinator where you set your processed signals.
Must is a wrong word, constant combinators are a common option, but decider combinator can also be a good choice if your entity has input and output sides, since decider's outputs can also be freely manipulated.
eugenekay
Filter Inserter
Filter Inserter
Posts: 859
Joined: Tue May 15, 2018 2:14 am
Contact:

Re: How to create a new combinator?

Post by eugenekay »

The Sine function can be implemented using a Lookup table, with a Filter Combinator in "Select Input" mode:
11-11-2025, 16-02-01.png
11-11-2025, 16-02-01.png (57.99 KiB) Viewed 78 times


The values are normalized to three digits (1.000 = 1000), with an extra Arithmetic Combinator to account for 0-indexing. As-configured, this mechanism displays sin(30) = 500. With a bit more work this circuit could be extended to handle 91+ degree Input values using the Arithmetic Combinator's Modulo operator and some more Deciders.... but I got bored and stopped here.

I hope somebody finds this useful!
Post Reply

Return to “Modding help”