Schall Circuit Group


Put circuit network subgroup into a separate new “Circuit” group tab, containing all vanilla and most modded circuit components. Designed for players who tried to find circuit components in the “Logistics” tab. (Locale: English, Deutsch, 正體中文, Português Brasileiro) To fellow modders: Please consider putting your modded circuit components in this group as well! Only minor modifications are needed. Instructions included in FAQ.

Utilities
3 years ago
0.17 - 1.1
10.6K
Circuit network

FAQ

Q: If my mod supports using this “Circuit” group tab, would it make players fail to load without it?
A: No, you can use conditional statements to set which subgroup the modded item belongs to. Schall Armoured Train is a perfect example, to my another group tab mod Schall Transport Group.

Q: I have tons of modded circuit components (say, new combinators) that wants to be put new subgroups, can I do that?
A: Yes, you may create new subgroups if you want to. Simply set it group = "transport" with a proper order then it will work. Schall Tank Platoon is an example on creating custom subgroups, to my another group tab mod Schall Transport Group.

Q: Why not this mod just set all the subgroups of all other circuit components mods?
A: It is because I feel it is not the best way to do that, and maybe a bit disrespectful to fellow modders. They may have their preferred way to handle things, like using further subgroups to show things nicely. Furthermore, setting subgroups of their items may actually disrupt and prevent fellow modders to work with this mod.
So I leave this mod purely as a common and basic framework for everyone. No code will be included to directly alter any modded items (not even those from my other circuit components mods!)
Still the best way is for fellow modders to add conditional assignments to their own items, who know their own mods the best.

Q: What does the new subgroup circuit-input do? It is not used by any items in the game!
A: It is designed for items that have a PRIMARY ROLE of producing circuit network signals (by measuring the environment, reading contents, or alike), thus as input to a circuit network.
In vanilla game, there are things like transport belts, storage tanks, chests, rail signals, etc, that could produce circuit signals when connected by circuit wires. However, this is rather SUPPLEMENTARY when compared to their main role, thus better to stay in their original group tabs.
Yet, many modded items do fit into this subgroup though, like various detectors ranging from measuring brightness, time, enemy counts. It does not too fitting to put these detectors into the current combinator subgroups, so this new subgroup is introduced.
The only vanilla item that may fit into this subgroup is the constant combinator, but probably too many players (including myself) are already too used to have the three vanilla combinators being put together. So I just leave it as is.

Instructions to Fellow Modders

Adding Optional Dependency

Your mod should work with or without this mod. So first of all, in "info.json" of your mod folder, please add an optional dependency "? SchallCircuitGroup", to make sure the load order is correct.

Here is an example:

"dependencies": ["base >= 0.18.0", "? SchallCircuitGroup"]

Putting into a Subgroup

This mod has already done most of the job for you. You simply need to set the subgroup where your item should belong to, like the following:

subgroup = "circuit-combinator"

Or pick the appropriate subgroup instead. The list of subgroups are as below:

  • circuit-network (the vanilla subgroup): Contains miscellanous items, e.g., wires, cables.
  • circuit-connection: Connection controls, e.g., vanilla power switch.
  • circuit-combinator: All combinators, e.g., vanilla arithmetic combinator, decider combinator, constant combinator.
  • circuit-input: Produces circuit signals (by measuring the environment or reading contents). (Not used by vanilla items, but reserved for various detectors from mods.)
  • circuit-visual: Outputs circuit signals as visual perception to players, e.g., lamps.
  • circuit-auditory: Outputs circuit signals as auditory perception to players, e.g, vanilla programmable speaker.

There are three extra subgroups for each of the vanilla combinator types. They can also be used at any time, but those vanilla combinators are moved in only if mod option "Individual combinator subgroups" is enabled.
- circuit-combinator-arithmetic
- circuit-combinator-decider
- circuit-combinator-constant

Advanced: Conditional assignment

You would want your mod to both work with and without “Schall Circuit Group” mod installed, right?
Then you would need conditional assignment of subgroups, based on whether “Schall Circuit Group” mod is present or not.

First declare a local variable that will temporarily store the subgroup name, which assigns to vanilla subgroup "circuit-network".

local subgroup_circom = "circuit-network"

Next, detect if “Schall Circuit Group” mod is present. If yes, set the variable to the desired subgroup name.

if mods["SchallCircuitGroup"] then
subgroup_circom = "circuit-combinator"
end

Then use the variable subgroup_circom in your item prototype definition, like:

subgroup = subgroup_circom

Creating New Subgroups

You may also create new subgroups if you want. An example as follows:

{
type = "item-subgroup",
name = "circuit-combinator-4",
group = "circuit",
order = "c-4",
},

Then you can assign subgroup = "circuit-combinator-4" to your custom combinator in prototype declarations.

So this mod does NOT limit you on what subgroups you should use, but merely provides a common framework for all circuit components modders to use! If you feel a new subgroup I have missed and should be included in this common framework, please state in the Discussion section!

Full List of New (or Changed) Items

Group

  • 1 group:
    • circuit
  • (1 changed, 8 new) subgroup:
    • circuit-network (was under "logistics" group, now under "circuit" group)
    • circuit-connection
    • circuit-combinator
    • circuit-combinator-arithmetic
    • circuit-combinator-decider
    • circuit-combinator-constant
    • circuit-input
    • circuit-visual
    • circuit-auditory

List of Subgroups Used by Compatible Mods

If your mod has any new subgroups created, you may write me the details in the Discussion section. I will keep updating this page, so trying to minimize "competition" over the order space between different mods!

Subgroup Order Created by Item types Examples / Remarks
circuit-network a Vanilla Anything not actually placed entities. Default for all items that were in vanilla circuit-network subgroup.
circuit-connection b This mod Connection controls. Power switch.
circuit-combinator c This mod Any combinators.
circuit-combinator-arithmetic c-1 This mod Arithmetic combinators. Arithmetic combinators.
circuit-combinator-decider c-2 This mod Decider combinators. Decider combinators.
circuit-combinator-constant c-3 This mod Constant combinators. Constant combinators.
circuit-input d This mod Produces circuit signals. Various detectors.
circuit-visual e This mod Visual perception to players. Lamps.
circuit-auditory f This mod Auditory perception to players. Programmable speaker.