Jump to content

Overriding another mod class?


Mythrell

Recommended Posts

Hey all,

 

just a quick question, is there a way to override another mods class to fix some mod compatibility issues?

 

I suppose you need to copy it's source code to your project to be able to compile against it, so you would need a permission at least.

 

Other thing which comes to mind is that you might be able to compile using the other mods compiled package as a some kind of library, but I don't know if there's a way to do that either.

 

So yeah, if anyone has a clue about this, let me know. :)

Link to comment
Share on other sites

You can place the source code of the mod into SrcOrig, and add

[UnrealEd.EditorEngine]
+EditPackages=Mod_To_Compile_Against

to your XComEngine.ini.

 

After that, you can simply reference their code in your mod. The compiled mod will neither have the source code nor the compiled package of Mod_To_Compile_Against included, so it will crash when reaching any code referenced unless the user has the Mod_To_Compile_Against installed. You can, however, just check before you execute any critcal code:

function DoStuff()
{
	// Do things
	//...

	// now hande mod specific workaround
	if (ModInstalled('SpecificMod'))
	{
		// Compatibility hack
		// if mod isn't installed, this section won't be reached
		// and can't crash the game
	}
}


function bool ModInstalled(name ModName)
{

	local XComOnlineEventMgr EventManager;
	local int i;

	EventManager = `ONLINEEVENTMGR;
	for(i = EventManager.GetNumDLC() - 1; i >= 0; i--)
	{
		if(EventManager.GetDLCNames(i) == ModName)
		{
			return true;
		}
	}
	return false;
}
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...