/// <summary> Registers this instance's <see cref="Translations"/>, with either the Translation API or SRML. </summary> /// <remarks> Only registers english translations if the Translation API isn't available. </remarks> protected internal virtual void RegisterTranslations() { // TODO Translation API Support // For some reason unknown to me, the translation API isn't working as expected. // I've disabled it until I can get it working. Define the `TRSL_API` symbol to enable it. #if TRSL_API if (SRModLoader.IsModPresent("translationapi")) { foreach (KeyValuePair <Lang, string> translation in this.Translations) { this.RegisterTranslationWithAPI( language: translation.Key, value: translation.Value + Keybind.DEBUG_SUFFIX ); } } else { #endif if (this.Translations.TryGetValue(Lang.EN, out string value)) { this.RegisterTranslationWithSRML(value + Keybind.DEBUG_SUFFIX); } else if (this.Translations.Keys.Count >= 1) // In case there's no English translation. { this.RegisterTranslationWithSRML( this.Translations.Values.ToArray()[0] + Keybind.DEBUG_SUFFIX ); } #if TRSL_API } #endif }
public override void Load() { if (!SRModLoader.IsModPresent("quicksilver_rancher")) { GameObject prefab = SRSingleton <GameContext> .Instance.LookupDirector.GetPrefab(Identifiable.Id.QUICKSILVER_SLIME); AmmoRegistry.RegisterAmmoPrefab(PlayerState.AmmoMode.DEFAULT, SRSingleton <GameContext> .Instance.LookupDirector.GetPrefab(Identifiable.Id.QUICKSILVER_PLORT)); AmmoRegistry.RegisterAmmoPrefab(PlayerState.AmmoMode.DEFAULT, SRSingleton <GameContext> .Instance.LookupDirector.GetPrefab(Identifiable.Id.VALLEY_AMMO_1)); AmmoRegistry.RegisterAmmoPrefab(PlayerState.AmmoMode.DEFAULT, SRSingleton <GameContext> .Instance.LookupDirector.GetPrefab(Identifiable.Id.VALLEY_AMMO_3)); AmmoRegistry.RegisterAmmoPrefab(PlayerState.AmmoMode.DEFAULT, SRSingleton <GameContext> .Instance.LookupDirector.GetPrefab(Identifiable.Id.VALLEY_AMMO_2)); AmmoRegistry.RegisterAmmoPrefab(PlayerState.AmmoMode.DEFAULT, SRSingleton <GameContext> .Instance.LookupDirector.GetPrefab(Identifiable.Id.VALLEY_AMMO_4)); AmmoRegistry.RegisterAmmoPrefab(PlayerState.AmmoMode.DEFAULT, prefab); AmmoRegistry.RegisterRefineryResource(Identifiable.Id.QUICKSILVER_PLORT); //LookupRegistry.RegisterVacEntry(Identifiable.Id.QUICKSILVER_PLORT, Color.grey, SRSingleton<SceneContext>.Instance..entries.First((PediaDirector.IdEntry x) => x.id == PediaDirector.Id.QUICKSILVER_PLORT).icon); PlortRegistry.AddEconomyEntry(Identifiable.Id.QUICKSILVER_PLORT, 200f, 100f); PlortRegistry.AddPlortEntry(Identifiable.Id.QUICKSILVER_PLORT, new ProgressDirector.ProgressType[] { ProgressDirector.ProgressType.ENTER_ZONE_MOCHI_RANCH }); AmmoRegistry.RegisterSiloAmmo((SiloStorage.StorageType x) => x == SiloStorage.StorageType.NON_SLIMES || x == SiloStorage.StorageType.PLORT, Identifiable.Id.QUICKSILVER_PLORT); } else { throw new Exception("Quicksilver Rancher mod (the old and original) is there, please remove it if you consider using this mod"); } }
//+ CHECKS internal static bool IsModLoaded(string modid) { return(SRModLoader.IsModPresent(modid)); }