[Resolved] How to remove/hide technologies?

Place to get help with not working mods / modding interface.
Post Reply
User avatar
kirazy
Filter Inserter
Filter Inserter
Posts: 416
Joined: Tue Mar 06, 2018 12:18 am
Contact:

[Resolved] How to remove/hide technologies?

Post by kirazy »

I'm attempting setting-dependent integration of my loader mod and Loader Redux, and under one of the configurations I need to remove Loader Redux's technologies.

I found this thread: viewtopic.php?f=25&t=53111&p=310535&hil ... y.#p310535

But the code I wrote:

Code: Select all

	-- Check for and remove Loader Redux technologies.
	if data.raw.technology["loader"] then
		data.raw.technology["loader"].enabled = false
	end
	
	if data.raw.technology["fast-loader"] then
		data.raw.technology["fast-loader"].enabled = false
	end
	
	if data.raw.technology["express-loader"] then
		data.raw.technology["express-loader"].enabled = false
	end
	
	if data.raw.technology["purple-loader"] then
		data.raw.technology["purple-loader"].enabled = false
	end
	
	if data.raw.technology["green-loader"] then
		data.raw.technology["green-loader"].enabled = false
	end
Does not work. :[
Last edited by kirazy on Sat Jun 09, 2018 7:38 am, edited 1 time in total.

User avatar
kirazy
Filter Inserter
Filter Inserter
Posts: 416
Joined: Tue Mar 06, 2018 12:18 am
Contact:

Re: How to remove/hide technologies?

Post by kirazy »

Figured it out.

Code: Select all

if data.raw.technology["loader"] then
	data.raw.technology["loader"] = null
end

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [Resolved] How to remove/hide technologies?

Post by eradicator »

Deleting mod technologies will break compatibility for any other mod that relies on them. Why not just edit them to fit your needs?

User avatar
kirazy
Filter Inserter
Filter Inserter
Posts: 416
Joined: Tue Mar 06, 2018 12:18 am
Contact:

Re: [Resolved] How to remove/hide technologies?

Post by kirazy »

eradicator wrote:Deleting mod technologies will break compatibility for any other mod that relies on them. Why not just edit them to fit your needs?
In this instance the technologies do one thing, and one thing only: unlock the loader. But the way the integration operates is that it you can either use Loader Redux's research path, or mine. If I don't remove Loader Redux's, there are two technologies that do the same thing. Since merely removing the recipe does not remove the research (aka, the technology is empty, has no effects, but is still there) aesthetically it's terrible, so I remove it.

I think the odds are remote that there exists a mod that is dependent on loader research. If that becomes an issue, I can make adjustments. As it stands though I am happy with my solution.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [Resolved] How to remove/hide technologies?

Post by eradicator »

kirazy wrote:I think the odds are remote that there exists a mod that is dependent on loader research. If that becomes an issue, I can make adjustments. As it stands though I am happy with my solution.
The odds of you being notified of that are even more remote :P. I know xanders mod has integration with loaders redux (and does major changes to the tech tree), so high likelyhood that breaks with your mod.
I've just seen this incompatibility pattern of "delete some old thing because i want to name my own one" too often to ignore it.
kirazy wrote:But the way the integration operates is that it you can either use Loader Redux's research path, or mine. If I don't remove Loader Redux's, there are two technologies that do the same thing.
I'm guessing your saying that there's a mod option to either use yours xor LRs tech tree? In that case there's never a requirement to have two technologies at the same time, so you simply overwrite LRs tech (i.e. keep the name, change the requirements).

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2916
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [Resolved] How to remove/hide technologies?

Post by Optera »

I don't see a need to remove a technology.
Usually it's enough to make any mod(s) you want to change an optional dependancy and update preferences of whatever technology, item, asf you want.

It doesn't matter what a technology is called internally. All the player ever sees are the localized names.

User avatar
kirazy
Filter Inserter
Filter Inserter
Posts: 416
Joined: Tue Mar 06, 2018 12:18 am
Contact:

Re: [Resolved] How to remove/hide technologies?

Post by kirazy »

Optera wrote:I don't see a need to remove a technology.
Usually it's enough to make any mod(s) you want to change an optional dependancy and update preferences of whatever technology, item, asf you want.

It doesn't matter what a technology is called internally. All the player ever sees are the localized names.
I don't add technologies that unlock the loaders. The loader unlocks are attached to the Logistics technologies, which are vanilla technologies.

When Loader Redux is also installed, it adds new technologies that do the same thing, so the unlock is in two places.

I created settings so you could have either the native unlock pathways (Logistics technology) or the Loader Redux pathways (new, distinct technologies).

It's easy to support using Loader Redux's pathway, you just don't add the unlock effect to the Logistics technologies. But supporting the other method seems difficult without A) removing the technologies added by Loader Redux, or B) adopting Loader Redux's pathway period, or C) having redundant loader research that has no effects.

I can remove the unlock from the technologies so that they're still there should someone have them as a dependency, but to me that is a hideous result in that I have 5 technologies in the tech tree that do nothing.

I don't want to do B, and C offends my aesthetics.

I don't know. :\

Edit: Could add a warning message to the setting, and have the research setting default such that it prefers Loader Redux's research tree. Then you have to opt-in to break your game.

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2916
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [Resolved] How to remove/hide technologies?

Post by Optera »

Moving loader unlocks into the respective logistic tech makes sense.
I just got used to having my mods gated behind their own techs. It makes adapting them to changes in the tech tree simpler.

I doubt any mod actually depends on my loader techs.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [Resolved] How to remove/hide technologies?

Post by eradicator »

:oops:
I didn't realize your "alternative path" was reusing vanilla technologies. That ofc changes the situation completely and makes me sound pretty stupid. Sorry for that. That said...yea, there's no nice solution for that. I guess you could loop through data.raw.technology in data-final-fixes and check if anything requires any of the loader techs and print a meaningful warning to the log before deleting them (because if you just error you end up in a loop where the user can't change your mod setting back because your mod is disabled due to the error *sigh*). I looked at xanders mod's internals and at least that should be fine as long as the recipes are unlocked somewhere.

Post Reply

Return to “Modding help”