internal static void Initialize(IModHelper helper) { Helper = helper; CP = Helper.ModRegistry.GetApi <IContentPatcherApi>("Pathoschild.ContentPatcher"); if (CP is null) { Log.Alert("Content Patcher is not installed - RSV requires CP to run. Please install CP and restart your game."); return; } JA = Helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets"); if (JA == null) { Log.Warn("Json Assets API not found. This could lead to issues."); } MR = Helper.ModRegistry.GetApi <IWearMoreRingsApi>("bcmpinc.WearMoreRings"); if (MR == null) { Log.Trace("Wear More Rings API not found. Using base game ring slots only."); } SC = Helper.ModRegistry.GetApi <ISpaceCoreApi>("spacechase0.SpaceCore"); if (SC == null) { Log.Warn("SpaceCore API not found. This could lead to issues."); } QF = Helper.ModRegistry.GetApi <IQuestFrameworkApi>("purrplingcat.QuestFramework"); if (QF == null) { Log.Warn("Quest Framework API not found. This could lead to issues."); } }
public static void Initialize() { cp = Mod.instance.Helper.ModRegistry.GetApi <IContentPatcherApi>("Pathoschild.ContentPatcher"); ja = Mod.instance.Helper.ModRegistry.GetApi <IApi>("spacechase0.JsonAssets"); if (cp == null) { return; } ja.IdsAssigned += (s, e) => idsAssigned = true; ja.IdsAssigned += (s, e) => idsAssignedGen++; Mod.instance.Helper.Events.GameLoop.ReturnedToTitle += (s, e) => idsAssigned = false; tokens = new List <IdToken>(); tokens.Add(new IdToken("Object", ja.GetAllObjectIds)); tokens.Add(new IdToken("BigCraftable", ja.GetAllBigCraftableIds)); tokens.Add(new IdToken("Crop", ja.GetAllCropIds)); tokens.Add(new IdToken("FruitTree", ja.GetAllFruitTreeIds)); tokens.Add(new IdToken("Hat", ja.GetAllHatIds)); tokens.Add(new IdToken("Weapon", ja.GetAllWeaponIds)); foreach (var token in tokens) { cp.RegisterToken(Mod.instance.ModManifest, token.TokenName, token.UpdateContext, token.IsReady, token.GetValue, true, true); } }
public static void Initialize() { ContentPatcherIntegration.Cp = Mod.instance.Helper.ModRegistry.GetApi <IContentPatcherApi>("Pathoschild.ContentPatcher"); ContentPatcherIntegration.Ja = Mod.instance.Helper.ModRegistry.GetApi <IApi>("spacechase0.JsonAssets"); if (ContentPatcherIntegration.Cp == null) { return; } ContentPatcherIntegration.Ja.IdsAssigned += (s, e) => ContentPatcherIntegration.IdsAssigned = true; ContentPatcherIntegration.Ja.IdsAssigned += (s, e) => ContentPatcherIntegration.IdsAssignedGen++; Mod.instance.Helper.Events.GameLoop.ReturnedToTitle += (s, e) => ContentPatcherIntegration.IdsAssigned = false; ContentPatcherIntegration.Tokens = new List <BaseToken> { new IdToken("Object", Mod.StartingObjectId, ContentPatcherIntegration.Ja.GetAllObjectIds), new IdToken("Crop", Mod.StartingCropId, ContentPatcherIntegration.Ja.GetAllCropIds), new IdToken("FruitTree", Mod.StartingFruitTreeId, ContentPatcherIntegration.Ja.GetAllFruitTreeIds), new IdToken("BigCraftable", Mod.StartingBigCraftableId, ContentPatcherIntegration.Ja.GetAllBigCraftableIds), new IdToken("Hat", Mod.StartingHatId, ContentPatcherIntegration.Ja.GetAllHatIds), new IdToken("Weapon", Mod.StartingWeaponId, ContentPatcherIntegration.Ja.GetAllWeaponIds), new IdToken("Clothing", Mod.StartingClothingId, ContentPatcherIntegration.Ja.GetAllClothingIds), new SpriteTilesheetToken("Object", () => Mod.instance.Objects.ToList <DataNeedsIdWithTexture>()), new SpriteCoordinateToken("Object", true, () => Mod.instance.Objects.ToList <DataNeedsIdWithTexture>()), new SpriteCoordinateToken("Object", false, () => Mod.instance.Objects.ToList <DataNeedsIdWithTexture>()), new SpriteTilesheetToken("Crop", () => Mod.instance.Crops.ToList <DataNeedsIdWithTexture>()), new SpriteCoordinateToken("Crop", true, () => Mod.instance.Crops.ToList <DataNeedsIdWithTexture>()), new SpriteCoordinateToken("Crop", false, () => Mod.instance.Crops.ToList <DataNeedsIdWithTexture>()), new SpriteTilesheetToken("FruitTree", () => Mod.instance.FruitTrees.ToList <DataNeedsIdWithTexture>()), new SpriteCoordinateToken("FruitTree", true, () => Mod.instance.FruitTrees.ToList <DataNeedsIdWithTexture>()), new SpriteCoordinateToken("FruitTree", false, () => Mod.instance.FruitTrees.ToList <DataNeedsIdWithTexture>()), new SpriteTilesheetToken("BigCraftable", () => Mod.instance.BigCraftables.ToList <DataNeedsIdWithTexture>()), new SpriteCoordinateToken("BigCraftable", true, () => Mod.instance.BigCraftables.ToList <DataNeedsIdWithTexture>()), new SpriteCoordinateToken("BigCraftable", false, () => Mod.instance.BigCraftables.ToList <DataNeedsIdWithTexture>()), new SpriteTilesheetToken("Hat", () => Mod.instance.Hats.ToList <DataNeedsIdWithTexture>()), new SpriteCoordinateToken("Hat", true, () => Mod.instance.Hats.ToList <DataNeedsIdWithTexture>()), new SpriteCoordinateToken("Hat", false, () => Mod.instance.Hats.ToList <DataNeedsIdWithTexture>()), new SpriteTilesheetToken("Weapon", () => Mod.instance.Weapons.ToList <DataNeedsIdWithTexture>()), new SpriteCoordinateToken("Weapon", true, () => Mod.instance.Weapons.ToList <DataNeedsIdWithTexture>()), new SpriteCoordinateToken("Weapon", false, () => Mod.instance.Weapons.ToList <DataNeedsIdWithTexture>()) }; // TODO: Shirt tilesheet // TODO: Shirt x // TODO: Shirt y // TODO: Pants tilesheet // TODO: Pants x // TODO: Pants y foreach (var token in ContentPatcherIntegration.Tokens) { //cp.RegisterToken(Mod.instance.ModManifest, token.TokenName, token.UpdateContext, token.IsReady, token.GetValue, true, true); ContentPatcherIntegration.Cp.RegisterToken(Mod.instance.ModManifest, token.TokenName, token); } }
internal bool HookIntoContentPatcher(IModHelper helper) { _contentPatcherApi = helper.ModRegistry.GetApi <IContentPatcherApi>("Pathoschild.ContentPatcher"); if (_contentPatcherApi is null) { _monitor.Log("Failed to hook into Pathoschild.ContentPatcher.", LogLevel.Error); return(false); } _monitor.Log("Successfully hooked into Pathoschild.ContentPatcher.", LogLevel.Debug); return(true); }