🌐 Enable All Planet Mods

by Kryzeth

Simply has every currently available standalone planet mod on the mod portal as a forced requirement. Glorified shortcut to quickly enable all planets, moons, space locations, and exoplanetary systems (mainly used for compatibility testing). 🌐

Mod packs
20 days ago
2.0
2.46K

i [Implemented] New planet-moon Frozeta

a month ago
(updated a month ago)

Its my mod.
https://mods.factorio.com/mod/secretas

Secretas is a gas giant, a post Aquilo space location.
Frozeta is a planet size moon of Secretas, and can be visited.

Compatibility notes Secretas: data-updates. I go through all available science add them as to "science-pack-productivity" research. As both an ingredient and a modification to their recipe productivity.

Corrundum Compatibility - I implemented a data-final-fixes in Corrundum. After every mod adds their science to the lab, I set the pressure-lab's input list to be equal to the base laboratory input list. This means their changes should propagate to my new lab. I would appreciate a picture that shows all the new sciences as available inputs to this lab if you get the chance. Thanks!

a month ago

Cool, on both fronts!

I'll take a look into making an image for that compatibility bit, though I wonder about Cerys compatibility specifically, since (last I remember), that mod's resources and science packs were only intended to be used and consumed on Cerys (limiting its technologies to only those which can be crafted on Cerys), and not adding them to the wider technology pool. I'll see how it works though!

a month ago

Recently put an update to forbid autopopulation of science. This should fix Cerys compatibility.

a month ago

Latest version as of today? Because I'm still getting the same error Corrundum was getting before, "there is no lab that will accept all of the science packs", for science-pack-productivity, and lists the cerys-science-pack as one of the requirements (tested with just Secretas and Cerys, default settings)

a month ago

Well, there is a setting change that fixes this:

automatically-populate-science-pack-productivity-research

. Set this to false to fix the error. I also received a pull request that I just approved that fixes this. Will push the update out tonight.

Error relates to auto-populating something with all sciences, but some sciences are specific only to some lab.

a month ago
(updated a month ago)

The problem with having this as a startup setting (particularly one that isn't enabled by default), is that you can't get to the Settings menu with both mods enabled to see this potential fix. But perhaps that update will fix things?

I think Cerys will always be a problem for other mods that try to do things like this; cerys science pack just has to be blacklisted from these automated processes.

Btw, I didn't realize that you might be a newbie modder? Just looked at this older discussion page from Corrundum, but there are many ways to detect the existence of other mods, with the simplest one being:

if mods["internal-name-of-mod"] then...

If you only need to check for a specific item/recipe/technology/etc, then you can use:

if data.raw["object-prototype"]["name-of-object"] then...

before attempting to modify that object. But if you don't want to delve too far into mod intercompatibility, then you could just relegate it to a third-party mod to fix. I've done that sort of thing as a standalone mod, and even in previous versions of this one, where I had to remove cerys science packs from techs that didn't need it.

a month ago

Yea, I am a bit of newbie modder. I know how to program, but I've really only been modding Factorio for 5-6 weeks. Anyway, I just pushed out a patch. 1.0.9 Should work fine with Cerys now. I only now consider science for that has already been added to the base laboratory. If that doesn't work, I will manually download the mod and hard-code against it.

I also added an option in Corrudum to brute force adding all the sciences to it. (everything in the science subgroup.)

Thanks for the advice

a month ago
(updated a month ago)

Ah, so new! I've only been at this for about.. 8 years, longer than I thought. I'm not even a real programmer; had to rebuild entire mods from scratch more than once. But I've gotten pretty good at the mod intercompatibility side, since I like all of my mods to be as accessible as possible!

That new update seems like a smart plan; if I remember correctly, Cerys only adds its science pack to the Cerys lab, so that should work out perfectly. I'll check the compatibility later tonight

a month ago
(updated a month ago)

UM, are you sure you are new to Factorio modding, or just new to programming in general? Or is lua just that different from other programming languages?

Because I just looked through some of the source code for Corrondum and this is.. pretty rough. Like, lack of basics rough... No offense. See below:

In this section specifically, at line 13, you don't need to write the whole thing out as:

if(handle_science_populate == true) then...

You can simply write:

if handle_science_populate then...

The handle_science_populate variable will evaluate to either true or false, depending on what happens in line 11, so you don't need to check it again.

Furthermore, on line 5, you map data.raw.lab to the local variable all_lab_types, but then... you only use it on line 14, under the condition that handle_science_populate is true. Why not just change line 14 to

for name, lab in pairs(data.raw.lab) do...

(renamed from "k,v" because k is the name of the lab, and v is the table that holds the rest of the table data for that specific lab)

Then on line 6, you ask why data.raw.tool['science-pack'] is nil, that's because there is no tool named "science-pack"

data.raw.tool is the table that contains all "tool" type items in the game, which includes science packs, for some complicated and historical reasons. If you want a list of all science packs, then you can just use another for loop, like:

for name, pack in pairs(data.raw.tool) do...

(where again, name is the name of the science pack, and pack is the table that holds the table data for that specific science pack)

And finally, on line 11, you have a check for

if mods["PlanetsLib"] ~= nil...

when you can shorten that to just

if not mods["PlanetsLib"]...

And then there's more of those if ... == true, which can be shortened in the same way as handle_science_populate.

a month ago

New to Lua. My stylistic choices come from C++, and not knowing all Lua syntax. Like in C++ I know you can if statement a variable to see if its true but I wasn't sure if you could do the same in Lua. I picked syntax that I know works.

Code has undergone a bunch a revisions. So needs to be cleaned up. Its functional and readable enough.

I check the value of handle_science_populate before going into the loop. Line 11 can change its value, and I only want to do that loop if and only if hand_science_populate is true.

I define the variable all_lab_types because I wasn't sure if there was a performance cost to keep reading from data.raw every iteration of the loop. I know this sometimes the case, so I tend to grab what I need before engaging in a loop. No idea if Lua would even keep reading from data.raw every iteration or it handles caching. Sure, I could have moved all_lab_types to the if statement, but putting it where it is avoids scope errors. Switch statements in C++ with Unreal have given me too many scope errors when I try to define variables with in them.

a month ago

I see, I'm sorry for implying that you were new to programming; there appear to be many more differences between lua and other programming languages than I thought (and you probably know a lot more about general programming than I do)

I'll admit that I only looked at that one section and stopped; maybe the rest looks better, but line 11 just seems excessively long, taking up 3 entire lines with word wrap enabled, and should probably be separated for readability? I personally don't like code hitting the wrap around limit (though I guess that's subject to monitor/window size...)

You still don't need to write out line 13 as if handle_science_populate == true though; when handle_science_populate is false, it evaluates to

if false then -- never enters the loop

The way line 13 is currently written basically evaluates to:

if true == true then -- superfluous

As for the performance cost thing; the way lua works is that table variables are references (like pointers, I think?) and most other variables are just copied directly. So when you have all_lab_types = data.raw.lab , then what you have is a reference to data.raw.lab every time you use all_lab_types

If you were to modify all_lab_types in some way, you would also be modifying data.raw.lab as well (that's how the for loop works, on line 14 for example, v is a reference to the table data contained in pairs(all_lab_types), so when you modify v, you modify a value in all_lab_types, and by extension, you modify values in data.raw.lab

For all other simple variables that just contain strings or numbers or bools, they copy directly, so for example

number = 1
new_number = number
new_number = new_number + 1

then number will still be 1, but new_number will be 2 (1+1). I guess that's probably weird, that tables work differently from other values, but that's just how it is in lua.

a month ago

No worries. Thanks for heads up. Yea wasn't sure whether tables are shallow or deep copied. The code I cobbled together was from testing and whatever documentation I could shove in my brain.

New response