Combinator Codify

by sparr

Allows editing combinator settings as code

Utilities
10 days ago
2.0
72
Circuit network

i Less programmer-like option

12 days ago

Suggest also a less programmer-like option (possibly switchable, for example, in the settings). Something like this:

AND [item=iron-plate] R > 100
AND [item=copper-plate] R < [item=iron-plate] G
OR [virtual-signal=signal-A] > 10
[item=iron-plate] = -1
[item=iron-plate] = [item=iron-plate] G

Description

12 days ago

We're discussing some alternate representations on Discord in #mod-dev-discussion, and I've made a thread to centralize that conversation at https://discord.com/channels/139677590393716737/1316018212198154332

12 days ago

We're discussing some alternate representations on Discord in #mod-dev-discussion, and I've made a thread to centralize that conversation at https://discord.com/channels/139677590393716737/1316018212198154332

If it's not too much trouble, consider my offer. Unfortunately, I can't participate in the discord - it's banned in our country.

12 days ago

Another suggestion from Discord looks like this:

passive-provider-chest > steel-chest++#r | spidertron#g = 1 & construction-robot# <= brick#g

I expect we'll end up somewhere between your idea and theirs once we nail down all the requirements (theirs needs something for virtual signals, yours needs something for quality, both need a way to represent output signals, etc)

12 days ago

AND [item=iron-plate] R > 100
AND [item=copper-plate,quality=rare] R < [item=iron-plate] G
OR [virtual-signal=signal-A] > 10
[item=iron-plate] -1
[item=copper-plate,quality=rare] RG

Screen: https://i.ibb.co/J5Mm5sJ/image.png
On pic:
И = AND
ИЛИ = OR

In the editor I wrote how it might look for the user in your editor. When copying to the buffer, what I gave just above will get.

12 days ago

Good idea to use the signal notation that the editor understands! I didn't realize that would work.

12 days ago

Once you type [item=iron-plate] and it gets converted to the icon, is there any way to change the quality of that signal without typing the whole thing again?

12 days ago

feature request to be able to turn icons back into text for editing: https://forums.factorio.com/viewtopic.php?f=6&t=124158

12 days ago

It seems in the editor - no.

You can use this button: https://i.ibb.co/zfWKK2p/image.png

Suggest also a less programmer-like option (possibly switchable, for example, in the settings). Something like this:

AND [item=iron-plate] R > 100
AND [item=copper-plate] R < [item=iron-plate] G
OR [virtual-signal=signal-A] > 10
[item=iron-plate] = -1
[item=iron-plate] = [item=iron-plate] G

Description

Wouldn't this be exactly what you do in the GUI? I think there is no need for another abstraction layer, as this mod basically lets you define the internal definition/representation of the combinator. Is there something that an abstracted syntax would allow that is not possible in the GUI?

12 days ago

Any text(like) syntax allows copying and pasting, search and replace (in editors that allow that, which this doesn't yet but will and others do), regex operations (ditto), etc.

Which text(like) syntax still matters, though. The lua representation will be familiar to some modders, and is the most useful one in terms of writing this mod. The json representation will be familiar to other modders. However, both of those representations are extremely verbose and repetitive. Switching to an abbreviated syntax minus all the punctuation and table keys will make it faster for humans to type the code, and to read and comprehend it. Including signal icons in that abbreviated syntax makes the reading easier still.

12 days ago

It is important to remember that mods are primarily made for the game, not for modders.
I literally got tired of making the same, but slightly different settings in several combinators the day before yesterday. Copy-pasta text would have helped me a lot.
And the moderators can also make a log() to see.

12 days ago

I was inspired to make this mod when I learned the trick to use a constant combinator to allow one decider combinator to apply arbitrarily many conditions with arbitrarily many distinct output signals. Setting those up takes forever. I started exporting blueprints to json and editing them in a text editor, then decided I could write a mod to speed that loop up. More features for programmatic generation will come later, but for now I just want to make it really easy to manually edit/copy/paste/search/replace/etc pieces of a combinator setup.

It is important to remember that mods are primarily made for the game, not for modders.
I literally got tired of making the same, but slightly different settings in several combinators the day before yesterday. Copy-pasta text would have helped me a lot.
And the moderators can also make a log() to see.

True, but knowing lua doesn't mean you are a modder. It's a easy language to learn and especially for engineers and programmers would not be a challenge. Missing syntax and punctuation also introduces more room for errors, just look at the horror that yaml or python is.
I think it would make more sense to add more functionality to the code editor itself than creating another abstraction layer, but only the mod author can really estimate what would be more effective in terms of time investment to ux benefit.

11 days ago

An abstraction layer has two distinct types of benefits:
- faster typing (could be somewhat offset by autocomplete for boilerplate), better visual compactness (partially subjective preference, but beyond a certain point UI size becomes a limiting factor) and (very subjectively) better intuitive comprehension
- allowing features that wouldn't be available otherwise

Some examples for the latter include:
- converting "natural" logic expressions into DNF ( (A or B) and (C or D) -> AC or AD or BC or CD )
- allowing simple regex to effectively operate on conditions (would be painful with json)
- defining "syntax" extensions, like "iron-plate*" for any quality iron plate

11 days ago

True, but knowing lua doesn't mean you are a modder. It's a easy language to learn and especially for engineers and programmers would not be a challenge. Missing syntax and punctuation also introduces more room for errors, just look at the horror that yaml or python is.
I think it would make more sense to add more functionality to the code editor itself than creating another abstraction layer, but only the mod author can really estimate what would be more effective in terms of time investment to ux benefit.

Well, you can't please everyone here. That's why I think the best option is to give a choice. Maybe not even 2 options, but many.

11 days ago

Anyway, I was so inspired by the idea of ​​this mod that if my or a similar version is not made, I might make my own mod with blackjack and whores)

New response