Skip to content

A Public Outwards Modding API to help alleviate some of the issues with modding the game and make things easier

License

Notifications You must be signed in to change notification settings

skully250/Outward-Mods-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Outward-Mods-API

User Installation

Download the API from the Nexus or Github Releases, unzip the file and place the .dll file into your mod location directory. For Partiality this is "Outward\Mods", for BepInEx this is "Outward/BepInEx/plugins". Mods will now be able to use functions provided.

Developer Installation

Download the API from the Nexus or Github Releases, unzip the file and place it somewhere. Then add a Reference to it in Visual Studio. Add using OModAPI to the files you want to use the API in.

ConfigHelper Example

public void Initialize()
{
	// Read config file
	ConfigHelper configHelper = new ConfigHelper(ConfigHelper.ConfigModes.CreateIfMissing, "FileNameHere.xml");
	configHelper.XMLDefaultConfig = "<config><baseSneakSpeed>0.7</baseSneakSpeed><stealthTrainingBonus>1.3</stealthTrainingBonus></config>";

	Debug.Log("Trying to load " + configHelper.FullPath);

	float baseSneakSpeed = configHelper.ReadFloat("/config/baseSneakSpeed");
	float stealthTrainingBonus = configHelper.ReadFloat("/config/stealthTrainingBonus");

	configHelper.WriteValue("/config/test", "write value 1");

	for(int i = 0; i < 10; ++i)
		configHelper.WriteValue("/config/loopValues/val_" + i, i.ToString());
}

XMLDefaultConfig is optional, if it and ConfigModes.CreateIfMissing is set then the API will automatically create the config file in "Outward\Config<Filename>" and populate it with whatever string you provide.

ReflectionTools Example

// These can be run once, for example in Initialize(), since their values don't change
// Variable
FieldInfo m_autoRun = ReflectionTools.GetField(typeof(LocalCharacterControl), "m_autoRun");
// Method
MethodInfo StopAutoRun = ReflectionTools.GetMethod(typeof(LocalCharacterControl), "StopAutoRun");

// Using the reflected values has to be done in a method where an instance to the class exists (in this example, self)
public void detectMovementInputs(On.LocalCharacterControl.orig_DetectMovementInputs orig, LocalCharacterControl self)
{
	// Reading variable
	if ((bool)m_autoRun.GetValue(self))

	// Setting variable
	m_autoRun.SetValue(self, false);

	// Calling a method with no parameters
	StopAutoRun.Invoke(self, null);

	// Calling a method with parameters
	StopAutoRun.Invoke(self, new object[] { param1, param2 ...});
}

OLogger Example

Check the Logger folder for documentation

About

A Public Outwards Modding API to help alleviate some of the issues with modding the game and make things easier

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages