How to conditionally include space-age graphics

Place to get help with not working mods / modding interface.
half a cat
Inserter
Inserter
Posts: 41
Joined: Sun Jul 16, 2023 4:03 pm
Contact:

How to conditionally include space-age graphics

Post by half a cat »

I have a mod with an optional space-age feature that uses space-age graphics. As I understand, the rule is that space-age graphics may only be used in mods that depend on space-age, so this mod that does not require space-age may not include space-age graphics.

Is there a way to split my mod into a main mod and space-age-extension mod such that "main" depends on "space-age-extension" if and only if space-age is enabled? I can check the enabled mods in data.lua and raise an exception, but this requires users to read the error message, manually enable the mod, and restart. Is there a way that the built-in dependency checker will take care of?

I would appreciate suggestions for other ways to handle optional space age graphics.
eugenekay
Filter Inserter
Filter Inserter
Posts: 356
Joined: Tue May 15, 2018 2:14 am
Contact:

Re: How to conditionally include space-age graphics

Post by eugenekay »

It seems like you just need to set “space-age” as an Optional Dependency in your Mod. Within your Mod’s prototypes stage you can then use

Code: Select all

if mods[“space-age”] then
code blocks to gate the bits that use Space Age features/content.

Take a look at the Glass mod for a good example of conditional recipes.

Good Luck!
half a cat
Inserter
Inserter
Posts: 41
Joined: Sun Jul 16, 2023 4:03 pm
Contact:

Re: How to conditionally include space-age graphics

Post by half a cat »

It seems like you just need to set “space-age” as an Optional Dependency in your Mod.
This is against policy. If I do this, then users who did not install space-age would be able to use a mod that contains graphics from space-age. Although Factorio staff have declined to clarify the policy, it seems to be against policy even if the graphics are disabled via if statements in the mod's code. See the discussion here: viewtopic.php?t=116488
Nidan
Filter Inserter
Filter Inserter
Posts: 301
Joined: Sat Nov 21, 2015 1:40 am
Contact:

Re: How to conditionally include space-age graphics

Post by Nidan »

What kind of "use" are you talking about?
Are you only referencing the space age files and maybe do transformations within your mods code (e.g. applying tint)? Then a "if mods["space-age"]" test is fine. (Someone owning only base factorio won't have these graphics.)
Or have you edited the images and now distribute adaptations/copies within your mod? Then you need to depend on space age. viewtopic.php?p=634661#p634661
eugenekay
Filter Inserter
Filter Inserter
Posts: 356
Joined: Tue May 15, 2018 2:14 am
Contact:

Re: How to conditionally include space-age graphics

Post by eugenekay »

half a cat wrote: Sat Mar 08, 2025 8:50 pm
It seems like you just need to set “space-age” as an Optional Dependency in your Mod.
This is against policy. If I do this, then users who did not install space-age would be able to use a mod that contains graphics from space-age. Although Factorio staff have declined to clarify the policy, it seems to be against policy even if the graphics are disabled via if statements in the mod's code. See the discussion here: viewtopic.php?t=116488
If you are creating Space Age “compatible” mod (which includes only Original art itself) then it should be fine to use an Optional dependency to integrate, if the DLC is enabled. You can load and reference Space Age/Quality/Elevated Rails; you just can’t re-distribute the files… which the users should have anyway. This is the most user-friendly path to take as a Mod author.

If you are including Assets which are directly derived from the Space Age (editing PNG art files, for example) then you should have “space-age” as a Required Dependency to be compliant with the published Terms of Service. You can split your Mod into a “Base Game” and “Space Age Add-On” component, with an Optional Dependency for user discovery…. But, as you point out in your original post, this is not great.
half a cat
Inserter
Inserter
Posts: 41
Joined: Sun Jul 16, 2023 4:03 pm
Contact:

Re: How to conditionally include space-age graphics

Post by half a cat »

This mod has graphics files that are edited space-age graphics. I have converted it to two separate mods, which seems to be the best solution based on the replies.
Post Reply

Return to “Modding help”