Krastorio Legacy deprecated


Caution!!! Krastorio 2 is now available! Therefore Krastorio Legacy is no longer supported! This mod expands the endgame, adds 30+ HR buildings, 60+ technologies, new ores, new items and rebalances almost all vanilla game content, making it harder.

Overhaul
4 years ago
0.17 - 0.18
160

i Support for Disco Science

4 years ago

Hey, would you consider making your mod support Disco Science? I've made an API to make it easy to register new ingredient colours, and modified versions of the base lab: https://mods.factorio.com/mod/DiscoScience/faq

Linver β˜†
4 years ago

I will try it in Krastorio 2, because I want reduce the support on Krastorio Legacy to spend more time on K2. Thank u for the notify.

Linver β˜†
4 years ago
(updated 4 years ago)

I don't have understand this API: "My mod adds labs that look like the vanilla labs, but aren't. How do I make them work with Disco Science?", this sentence confuse me, what mean with look like but isn't like?!.... In Krastorio 2 we have labs with different sprites than vanilla one, so doesn't look like vanilla one, instead in this case do u mean only with the same external sprite but the inside effect changed?

Linver β˜†
4 years ago

Implementing this in K2... Ur guide to implementation is incompleted or wrong. For science packs color, is not enough call that in on_configuration_changed (that in fact sound strange to me), but must be called in on_init too! Otherwise the remote call will never be reached until the player create a game and change the settings or mods.

Anyway I suggest u to change ur API, because global variable is save-persistent, and with a private access to mod to access it, u can register other mods calls in a table inside global. This mean that other modders (like me) have to do only one call in on_init callback (one time for game), instead redo it in every time is invoked a on_configuration_changed (and like is, will not be invoked on game created).

4 years ago

Hey Linver, thanks for taking a look into this. You're completely right that on_init is necessary for this to work with new worlds. However, on_configuration_changed is also required in order to properly handle dependencies. For instance, if Mod B optionally changes the colours of Mod B when it is present, and a user starts a game with only Mod B, then introducing Mod A later on will not have the same effect as if they were both present for on_init.

4 years ago

I've also clarified the FAQ heading, which I agree was confusing. The point is just that you can do this if your mod introduces labs which use the vanilla lab graphics.

Linver β˜†
4 years ago

I understand ur point about on_configuration_changed, I found difficult that someone will change science pack colors design in mod versions, but is a possible use case so ok.

4 years ago
(updated 4 years ago)

It's not so much mod versions as a user introducing a mod half-way through a game. But yeah, they're all slightly weird use cases.

Linver β˜†
4 years ago
(updated 4 years ago)

Is not necessary, from API documentation -> https://lua-api.factorio.com/latest/LuaBootstrap.html#LuaBootstrap.on_init:
on_init(f)
Register a callback to be run on mod init. This is called once when a new save game is created or once when a save file is loaded that previously didn't contain the mod. This is always called before other event handlers and is meant for setting up initial values that a mod will use for its lifetime.

4 years ago

Ok, then it's just required to handle dependencies properly.

New response