TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ AutoloadConfig()

void Terraria.ModLoader.Mod.AutoloadConfig ( )
inlinepackageinherited

Definition at line 130 of file Mod.cs.

131 {
132 if (Code == null)
133 {
134 return;
135 }
136 foreach (Type type2 in from type in AssemblyManager.GetLoadableTypes(Code)
137 orderby type.FullName
138 select type)
139 {
140 if (!type2.IsAbstract && type2.IsSubclassOf(typeof(ModConfig)))
141 {
142 ModConfig mc = (ModConfig)Activator.CreateInstance(type2, nonPublic: true);
143 if (mc.Mode == ConfigScope.ServerSide && (Side == ModSide.Client || Side == ModSide.NoSync))
144 {
145 throw new Exception("The ModConfig " + mc.Name + " can't be loaded because the config is ServerSide but this Mods ModSide isn't Both or Server");
146 }
147 if (mc.Mode == ConfigScope.ClientSide && Side == ModSide.Server)
148 {
149 throw new Exception("The ModConfig " + mc.Name + " can't be loaded because the config is ClientSide but this Mods ModSide is Server");
150 }
151 mc.Mod = this;
152 string name = type2.Name;
153 if (mc.Autoload(ref name))
154 {
155 AddConfig(name, mc);
156 }
157 }
158 }
159 }
ModConfig provides a way for mods to be configurable. ModConfigs can either be Client specific or Ser...
Definition ModConfig.cs:16
static Type[] GetLoadableTypes(Assembly assembly)
void AddConfig(string name, ModConfig mc)
Definition Mod.cs:161
ModSide Side
The ModSide that controls how this mod is synced between client and server.
Definition Mod.cs:107
Assembly Code
The assembly code this is loaded when tModLoader loads this mod. Do NOT call M:System....
Definition Mod.cs:56
ConfigScope
Each ModConfig class has a different scope. Failure to use the correct mode will lead to bugs.
Definition ConfigScope.cs:7

References Terraria.ModLoader.Mod.AddConfig(), Terraria.ModLoader.Mod.Code, Terraria.ModLoader.Core.AssemblyManager.GetLoadableTypes(), and Terraria.ModLoader.Mod.Side.

Referenced by Terraria.ModLoader.ModContent.Load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: