public static void Write(object msg) { string text = $"{nameof(KeybindLib)}: {msg}"; Stdout.WriteLine(text); SRMLOut.Log(text); }
public static EconomyDirector.ValueMap GetValueMap(Identifiable.Id id) { EconomyDirector.ValueMap[] valueMaps = SRSingleton <SceneContext> .Instance.EconomyDirector.baseValueMap; //Everything that can be sold foreach (EconomyDirector.ValueMap valueMap in valueMaps) { Console.Log("GetValueMap: " + valueMap.accept.id); if (SRSingleton <GameContext> .Instance.SlimeDefinitions.GetSlimeByIdentifiableId(id).Diet.Produces[0] == valueMap.accept.id) { return(valueMap); } } return(null); }
// Runs the population code for the mod, // registering all objects and populating // them internal static void PopulateMod() { // Register extra modules for registration foreach (Assembly ass in AppDomain.CurrentDomain.GetAssemblies()) { if (ass.GetName().Name.StartsWith("VikDisk.")) { RegistryUtils.extraModules.Add(ass); } } // Registers the all game content Others.RegisterAll(); Identifiables.RegisterAll(); SpawnResources.RegisterAll(); Gadgets.RegisterAll(); Upgrades.RegisterAll(); UIs.RegisterAll(); Plots.RegisterAll(); //GordoRegistry.Setup(); // Adds new commands to the game Console.RegisterCommand(new DumperCommand()); Console.RegisterCommand(new UnlockAllCommand()); Console.RegisterCommand(new TPCommand()); Console.RegisterCommand(new DebugModeCommand()); if (TESTING) { Console.RegisterCommand(new TestModeCommand()); } // Registers the remaining callback CallbackHandler.LateSetup(); // Runs fixing methods GameFixer.FixAtGameLoad(); // Run Injectors foreach (Injector inject in injectors) { inject.PopulateMod(); } }
public override void Load() { Console.Log("Loading SlimesAndMarket"); try //Try the code there, if some error arises then it calls the "catch" function { foreach (Identifiable.Id slime in ExtraSlimes.VANILLA_SLIMES) //For each slime int he slime class { Console.Log("Printing Slime: " + slime.ToString()); EconomyDirector.ValueMap valueMap = Extension.GetValueMap(slime); //If the slime is a puddle/fire/quicksilver slime then add the plort id, else just add the id of the slime (true/false argumeter tells the programm if it's a puddle/fire/quicksilver slime or regular slimes, except tarrs and lucky slimes) //We are getting the informations of the plort of the correct slime (to make normal prices) //But if we find nothing then return null Console.Log(" valueMap not found..."); if (valueMap == null) { continue; } Console.Log(" ...or maybe yes? Now registering slimes"); PlortRegistry.RegisterPlort(slime, valueMap.value * 4, valueMap.fullSaturation); //Else, if the slime is a regular slime, then register the slime (make so that you can sell it) for 4 times the original price more. DroneRegistry.RegisterBasicTarget(slime); //And make so that the drones can grab slimes Console.Log("Slime: " + slime + " registred perfectly"); } } catch (Exception e) //But if an error was found { Console.Log("Slimes and Market mod error (Vanilla): " + e.Message); //Then log the error into the SRML.log file } ExtraSlimes.RegisterSaberSlimes(); ExtraSlimes.RegisterGoldSlimes(); ExtraSlimes.RegisterFireSlimes(); ExtraSlimes.RegisterPuddleSlimes(); ExtraSlimes.RegisterQuicksilverSlimes(); ExtraSlimes.RegisterLuckySlimes(); }
public static void Append(string text) { Stdout.Write(text); SRMLOut.Log(text); }