@@ -51,11 +51,6 @@ internal record TypeMapping(Type type, bool shouldCreateCache = true);
5151 /// </summary>
5252 internal static List < GameModeButtonsInformation > gamemodes = new ( ) ;
5353
54- /// <summary>
55- /// A dictionary of skin types of tribes, which can flood tiles, keyed by custom flood tile effect.
56- /// </summary>
57- internal static Dictionary < TileData . EffectType , SkinType > customFloodingSkins = new ( ) ;
58-
5954 /// <summary>
6055 /// Handlers for processing specific data types during mod loading.
6156 /// </summary>
@@ -105,7 +100,7 @@ out TribeAbility.Type tribeAbilityType
105100 string tileEffectId = skinId . ToLowerInvariant ( ) + "_flood" ;
106101 EnumCache < TileData . EffectType > . AddMapping ( tileEffectId , ( TileData . EffectType ) Registry . autoidx ) ;
107102 EnumCache < TileData . EffectType > . AddMapping ( tileEffectId , ( TileData . EffectType ) Registry . autoidx ) ;
108- customFloodingSkins . Add ( ( TileData . EffectType ) Registry . autoidx , skinValue ) ;
103+ Visual . customFloodingSkins . Add ( ( TileData . EffectType ) Registry . autoidx , skinValue ) ;
109104 Plugin . logger . LogInfo ( "Created mapping for tileEffect with id " + tileEffectId + " and index " + Registry . autoidx ) ;
110105 Registry . autoidx ++ ;
111106 }
@@ -407,6 +402,17 @@ internal static void LoadMods(Dictionary<string, Mod> mods, out bool dependencyC
407402 {
408403 LoadSpriteInfoFile ( mod , file ) ;
409404 }
405+ Match languageMatch = Regex . Match ( Path . GetFileName ( file . name ) , @"^language(?:_(.*))?\.json$" ) ;
406+ if ( languageMatch . Success )
407+ {
408+ string languageName = languageMatch . Groups [ 1 ] . Value ;
409+ LoadLanguageFile (
410+ mod ,
411+ file ,
412+ languageName
413+ ) ;
414+ continue ;
415+ }
410416 }
411417 if ( ! mod . client && id != "polytopia" )
412418 {
@@ -589,6 +595,23 @@ public static void LoadLocalizationFile(Mod mod, Mod.File file)
589595 }
590596 }
591597
598+ public static void LoadLanguageFile ( Mod mod , Mod . File file , string languageName )
599+ {
600+ try
601+ {
602+ var dict = JsonSerializer . Deserialize < Dictionary < string , string > > ( file . bytes ) ;
603+ if ( dict != null )
604+ {
605+ Loc . languagesToAdd . Add ( languageName , dict ) ;
606+ Plugin . logger . LogInfo ( $ "Registered language from { mod . id } mod") ;
607+ }
608+ }
609+ catch ( Exception e )
610+ {
611+ Plugin . logger . LogError ( $ "Error on loading language file from { mod . id } mod: { e . StackTrace } ") ;
612+ }
613+ }
614+
592615 /// <summary>
593616 /// Loads a sprite file from a mod.
594617 /// </summary>
0 commit comments