private void Start() { newItem = ScriptableObject.CreateInstance <ModItem>().Create("WindTurbine", ItemType.Inventory); newItem.setInventorySettings("Wind Turbine", "A wind turbine which can be repurposed in several ways.", null, "Item/" + newItem.name, 5); RAPI.addItem(newItem); RConsole.Log("firstmod loaded!"); }
IEnumerator Start() { RNotification notification = FindObjectOfType <RNotify>().AddNotification(RNotify.NotificationType.spinning, "Loading MoreStorages..."); var bundleLoadRequest = AssetBundle.LoadFromFileAsync("mods\\ModData\\MoreStorages\\morestorages.assets"); yield return(bundleLoadRequest); assetbundle = bundleLoadRequest.assetBundle; if (assetbundle == null) { RConsole.LogError("Failed to load AssetBundle for MoreStorages!"); notification.Close(); yield return(null); } List <Item_Base> list = Traverse.Create(typeof(ItemManager)).Field("allAvailableItems").GetValue <List <Item_Base> >(); Item_Base Placeable_MoreStorages_MinecraftChest = (Item_Base)assetbundle.LoadAsset <ScriptableObject>("Placeable_MoreStorages_MinecraftChest"); Placeable_MoreStorages_MinecraftChest.Initialize(9845, "Placeable_MoreStorages_MinecraftChest", 1); list.Add(Placeable_MoreStorages_MinecraftChest); RegisterChest(Placeable_MoreStorages_MinecraftChest); Item_Base Placeable_MoreStorages_Barrel = (Item_Base)assetbundle.LoadAsset <ScriptableObject>("Placeable_MoreStorages_Barrel"); Placeable_MoreStorages_Barrel.Initialize(9846, "Placeable_MoreStorages_Barrel", 1); list.Add(Placeable_MoreStorages_Barrel); RegisterChest(Placeable_MoreStorages_Barrel); Item_Base Placeable_MoreStorages_Crate = (Item_Base)assetbundle.LoadAsset <ScriptableObject>("Placeable_MoreStorages_Crate"); Placeable_MoreStorages_Crate.Initialize(9847, "Placeable_MoreStorages_Crate", 1); list.Add(Placeable_MoreStorages_Crate); RegisterChest(Placeable_MoreStorages_Crate); Item_Base Placeable_MoreStorages_Luggage = (Item_Base)assetbundle.LoadAsset <ScriptableObject>("Placeable_MoreStorages_Luggage"); Placeable_MoreStorages_Luggage.Initialize(9848, "Placeable_MoreStorages_Luggage", 1); list.Add(Placeable_MoreStorages_Luggage); RegisterChest(Placeable_MoreStorages_Luggage); Item_Base Placeable_MoreStorages_MedievalChest = (Item_Base)assetbundle.LoadAsset <ScriptableObject>("Placeable_MoreStorages_MedievalChest"); Placeable_MoreStorages_MedievalChest.Initialize(9849, "Placeable_MoreStorages_MedievalChest", 1); list.Add(Placeable_MoreStorages_MedievalChest); RegisterChest(Placeable_MoreStorages_MedievalChest); Item_Base Placeable_MoreStorages_Package = (Item_Base)assetbundle.LoadAsset <ScriptableObject>("Placeable_MoreStorages_Package"); Placeable_MoreStorages_Package.Initialize(9850, "Placeable_MoreStorages_Package", 1); list.Add(Placeable_MoreStorages_Package); RegisterChest(Placeable_MoreStorages_Package); Traverse.Create(typeof(ItemManager)).Field("allAvailableItems").SetValue(list); notification.Close(); RConsole.Log("MoreStorages has been successfully loaded!"); }
// The Start() method is being called when your mod gets loaded. public void Start() { tick = 0; RConsole.Log("Mumble Link has been loaded!"); RConsole.Log("Starting connection to Mumble..."); GetMumble(); }
private void SetDaylength() { var args = RConsole.lcargs; if (args.Length != 2) { RConsole.Log(DayLengthArgumentsAreInvalid); return; } float length; if ((!float.TryParse(args[1], out length))) { RConsole.Log(DayLengthArgumentAreOutOfRange); return; } if (length < 1 || length > 90) { RConsole.Log(DayLengthArgumentAreOutOfRange); return; } m_dayLength = length; RConsole.Log(string.Format("{0}: Sucessfully set daylength to {1} minutes.", ModNamePrefix, m_dayLength)); }
IEnumerator LoadBundle() { // Load Bundle if (File.Exists(Path.Combine(Directory.GetCurrentDirectory(), "mods", "ModData", "earlsmod.assets"))) { menuBundle = AssetBundle.LoadFromFile(Path.Combine(Directory.GetCurrentDirectory(), "mods", "ModData", "earlsmod.assets")); RConsole.Log(modPrefix + "Loaded menu bundle from local file."); } else { UnityWebRequest uwr = UnityWebRequestAssetBundle.GetAssetBundle("https://github.com/earlbalai/earlsmod/blob/master/earlsmod.assets?raw=true"); yield return(uwr.SendWebRequest()); // Get an asset from the bundle and instantiate it. menuBundle = DownloadHandlerAssetBundle.GetContent(uwr); RConsole.Log(modPrefix + "Loaded menu bundle from remote repository."); } var loadAsset = menuBundle.LoadAssetAsync <GameObject>("EarlsMod_Canvas"); yield return(loadAsset.isDone); menu = (GameObject)Instantiate(loadAsset.asset, gameObject.transform); UISetup(); }
public void OnModUnload() { RConsole.Log(string.Format("{0} has been unloaded!", ModNamePrefix)); m_harmony.UnpatchAll(HarmonyId); Destroy(gameObject); }
public void Start() { if (instance != null) { throw new Exception("MoreSailsMoreSpeed singleton was already set"); } instance = this; harmony = HarmonyInstance.Create(harmonyID); harmony.PatchAll(Assembly.GetExecutingAssembly()); RConsole.registerCommand(typeof(MoreSailsMoreSpeed), "Lower all sails", "sailsOpen", SailsOpen); RConsole.registerCommand(typeof(MoreSailsMoreSpeed), "Raise all sails", "sailsClose", SailsClose); RConsole.registerCommand(typeof(MoreSailsMoreSpeed), "Rotate sails by a certain number", "sailsRotate", SailsRotate); RConsole.registerCommand(typeof(MoreSailsMoreSpeed), "Toggle all engines at once", "toggleEngines", ToggleAllEngines); RConsole.registerCommand(typeof(MoreSailsMoreSpeed), "Toggle all engines's direction at once", "toggleEnginesDir", ToggleAllEnginesDir); RConsole.registerCommand(typeof(MoreSailsMoreSpeed), "Tells you your current speed, 1.5 = default drift speed", "raftSpeed", PrintSpeed); if (SceneManager.GetActiveScene().isLoaded&& SceneManager.GetActiveScene().name == network.gameSceneName) { WorldEvent_WorldLoaded(); } RConsole.Log(modPrefix + "loaded!"); }
private void SetSpawnRate() { var args = RConsole.lcargs; if (args.Length != 2) { RConsole.Log(MoreAnimalsArgumentsAreInvalid); return; } int spawnRate; if ((!int.TryParse(args[1], out spawnRate))) { RConsole.Log(MoreAnimalsArgumentsAreInvalid); return; } if (spawnRate < 1 || spawnRate > 50) { RConsole.Log(MoreAnimalsArgumentAreOutOfRange); return; } ObjectSpawnerLandmarkEditPatch.DomesticSpawnFactor = spawnRate; RConsole.Log(string.Format("{0}: Animal factor set to {1} successfully.", ModNamePrefix, spawnRate)); }
// Token: 0x060000DD RID: 221 public static void GiveItem(Item_Base item, int amount, Player p = null) { if (p == null) { p = UnityEngine.Object.FindObjectOfType <Player>(); } FieldInfo field = Enumerable.FirstOrDefault <FieldInfo>(typeof(Player).GetFields((BindingFlags)36), (FieldInfo x) => x.Name == "playerInventory"); if (field == null) { RConsole.Log("Couldn't find playerInventory"); return; } PlayerInventory pi = (PlayerInventory)field.GetValue(p); if (pi == null) { RConsole.Log("Couldn't get playerInventory"); return; } try { pi.AddItem(item.name, 1); } catch (Exception ex) { RConsole.Log(ex.ToString()); } }
public IEnumerator Start() { var request = AssetBundle.LoadFromFileAsync("mods/ModData/MoreRareAnimals/llama_animator_fix.assets"); yield return(request); m_assetBundle = request.assetBundle; m_harmony = HarmonyInstance.Create(HarmonyId); m_harmony.PatchAll(Assembly.GetExecutingAssembly()); RConsole.registerCommand(typeof(MoreRareAnimals), "Gives you the ability to change the rare animal spanwn rate.", "morerareanimals", SetRareProbabilities); RConsole.registerCommand(typeof(MoreRareAnimals), "Gives you the ability to change the domestic animal spawn rate.", "moreanimals", SetSpawnRate); RConsole.registerCommand(typeof(MoreRareAnimals), "Gives you the ability to change the default animal scale factors.", "moreanimalscales", SetAnimalScales); RConsole.Log(string.Format("{0} has been loaded!", ModNamePrefix)); }
private void SetSpawnRate() { var args = RConsole.lcargs; if (args.Length != 2) { RConsole.Log(MoreAnimalsArgumentsAreInvalid); return; } int spawnRate; if ((!int.TryParse(args[1], out spawnRate))) { RConsole.Log(MoreAnimalsArgumentsAreInvalid); return; } if (spawnRate < 1 || spawnRate > 50) { RConsole.Log(MoreAnimalsArgumentAreOutOfRange); } ObjectSpawnerLandmarkEditPatch.DomesticSpawnFactor = spawnRate; }
private void Start() { path = Directory.GetCurrentDirectory() + path; RConsole.Log("ItemDataGenerator loaded!"); Generate(); RConsole.Log("ItemData Generated! at " + path); }
public MemoryMappedViewAccessor GetMumble() { if (mumble != null) { return(mumble); } if (tick % 600 != 0) { return(null); } try { mapped = MemoryMappedFile.OpenExisting("MumbleLink", MemoryMappedFileRights.FullControl); mumble = mapped.CreateViewAccessor(); RConsole.Log("Connected to Mumble."); return(mumble); } catch (System.IO.FileNotFoundException) { RConsole.Log("Mumble not found. Checking again in 10 seconds..."); } return(null); }
public void PrintSpeed() { Raft raft = FindObjectOfType <Raft>(); object value = Traverse.Create(raft).Field("currentMovementSpeed").GetValue() as object; RConsole.Log(value.ToString()); }
/// <summary> /// Mod initialization point. /// </summary> public void Start() { RConsole.Log("\"Utility Craft +\" starts loading."); INI.Open(); INI.SetConfigurationFromINI(); INI.Close(); RConsole.Log("UtilCraft+ has been loaded!"); }
static void Prefix(ref SeagullState newState) { if (newState == SeagullState.Peck) { newState = SeagullState.FlyAway; RConsole.Log("No More Peck: Seagull is flying off now"); } }
public void Start() { RConsole.Log(string.Format("{0} has been loaded!", ModNamePrefix)); RConsole.registerCommand(typeof(LongerDayNightCycles), "Gives you the ability to change the duration of a day.", "daylength", SetDaylength); }
public void OnModUnload() { RConsole.Log(modPrefix + "unloaded!"); PersonController_GroundControll_Patch.sprintByDefault = false; PersonController_GroundControll_Patch.crouchIsToggle = false; //menuBundle.Unload(true); harmony.UnpatchAll(harmonyID); Destroy(gameObject); }
public void OnSceneLoaded(Scene scene, LoadSceneMode mode) { if (scene.name == network.gameSceneName) { settings = LoadSettings(); StartCoroutine(ForceSettings()); RConsole.Log(modPrefix + "Scene " + scene.name + " loaded."); } }
public void OnModUnload() { if (GameModeValueManager.GetCurrentGameModeValue().gameMode != GameMode.Easy) { GameModeValueManager.GetCurrentGameModeValue().playerSpecificVariables.clearInventoryOnSurrender = true; } RConsole.Log("InvPersist has been unloaded!"); Destroy(gameObject); // Please do not remove that line! }
public void OnModUnload() { RConsole.Log(modPrefix + "unloaded!"); menuBundle.Unload(true); StopAllCoroutines(); SaveSettings(); harmony.UnpatchAll(harmonyID); Destroy(gameObject); }
public void Start() { ComponentManager <GlassHoneyUse> .Value = this; harmonyInstance = HarmonyInstance.Create(HARMONY_ID); harmonyInstance.PatchAll(Assembly.GetExecutingAssembly()); RConsole.Log(logPrefix + " loaded!"); }
private static void SyncFiltersWithPlayers() { RConsole.Log(string.Format("{0}: Sync was requested. Syncing filters with players...", ModNamePrefix)); var mappings = GetCurrentFilterMapping(); MessageHandler.SendMessage( new MessageSyncNetFilters( (Messages)MessageHandler.FilteredNetsMessages.SyncNetFilters, mappings)); }
private void Log(string text)//Just an easier function to call instead of RConsole.Log { try { RConsole.Log(text); } catch (Exception e) { RConsole.Log(e.ToString()); } }
public void SaveSettings() { try { string contents = JsonUtility.ToJson(settings); File.WriteAllText(settingsPath, contents); } catch { RConsole.Log(modPrefix + Utils.Colorize("Settings were unable to be saved to file" + settingsPath, "#FF0000")); } }
public void Start() { RConsole.Log("StackMod has been loaded!"); RConsole.registerCommand(typeof(StackMod), "", "stacksize", getCommand); lastSize = PlayerPrefs.GetInt("lastSize", 0); if (lastSize != 0) { Change(lastSize); } }
public void PrintItems() { string longString = ""; foreach (Item_Base item in items) { longString += " | " + item.UniqueName; } RConsole.Log(longString); RConsole.Log("This is a long list, but it is recomended to view it in your browser at https://pastebin.com/raw/VdtzyM0N"); }
public void OnModUnload() { if (marker) { Destroy(marker); } if (assets) { assets.Unload(true); } RConsole.Log("FindRaftCenter has been unloaded!"); Destroy(gameObject); }
public void ExportList() { RConsole.Log("Exporting list to " + Directory.GetCurrentDirectory() + @"\itemList.txt"); StreamWriter writer = new StreamWriter(Directory.GetCurrentDirectory() + @"\itemList.txt"); foreach (Item_Base item in items) { writer.WriteLine("UniqueName: " + item.UniqueName + " ID: " + item.UniqueIndex + " Display Name: " + item.name); } writer.Close(); RConsole.Log("Finished Exporting!"); }
private static void SetRareProbabilities() { var args = RConsole.lcargs; if (args.Length != 4) { RConsole.Log(MoreRareAnimalsArgumentsAreInvalid); return; } int defaultSkin; if ((!int.TryParse(args[1], out defaultSkin))) { RConsole.Log(MoreRareAnimalsArgumentsAreInvalid); return; } int rareSkin1; if ((!int.TryParse(args[2], out rareSkin1))) { RConsole.Log(MoreRareAnimalsArgumentsAreInvalid); return; } int rareSkin2; if ((!int.TryParse(args[3], out rareSkin2))) { RConsole.Log(MoreRareAnimalsArgumentsAreInvalid); return; } if (rareSkin1 < 0 || rareSkin2 < 0 || defaultSkin < 0) { RConsole.Log(MoreRareAnimalsSomeArgumentsAreNegative); return; } if (rareSkin1 + rareSkin2 + defaultSkin != 100) { RConsole.Log(MoreRareAnimalsArgumentsDoNotSumUpTo100); return; } RareMaterialEditPatch.DefaultSkinProbability = defaultSkin; RareMaterialEditPatch.RareSkin1Probability = rareSkin1; RareMaterialEditPatch.RareSkin2Probability = rareSkin2; RConsole.Log("Rare animal probabilities set successfully."); }