public override void Entry(IModHelper helper) { config = Helper.ReadConfig <Config>(); TMXLoaderMod.helper = Helper; monitor = Monitor; if (config.converter) { exportAllMaps(); convert(); } loadContentPacks(); setTileActions(); helper.Events.Player.Warped += OnWarped; PyLua.registerType(typeof(Map), false, true); PyLua.registerType(typeof(TMXActions), false, false); PyLua.addGlobal("TMX", new TMXActions()); new ConsoleCommand("loadmap", "Teleport to a map", (s, st) => { Game1.player.warpFarmer(new Warp(int.Parse(st[1]), int.Parse(st[2]), st[0], int.Parse(st[1]), int.Parse(st[2]), false)); }); fixCompatibilities(); harmonyFix(); helper.Events.GameLoop.UpdateTicked += (s, e) => { if (e.IsOneSecond && Context.IsWorldReady && Game1.IsMasterGame && Game1.IsMultiplayer && Game1.otherFarmers.Values.Where(f => f.isActive() && f != Game1.player && !syncedFarmers.Contains(f)) is IEnumerable <SFarmer> ef && ef.Count() is int i && i > 0) { syncMaps(ef); } }; }
public override void Entry(IModHelper helper) { Monitor.Log("Environment:" + PyUtils.getContentFolder()); exportAllMaps(); convert(); loadContentPacks(); setTileActions(); LocationEvents.CurrentLocationChanged += LocationEvents_CurrentLocationChanged; PyLua.registerType(typeof(Map), false, true); PyLua.registerType(typeof(TMXActions), false, false); PyLua.addGlobal("TMX", new TMXActions()); }
public override void Entry(IModHelper helper) { config = Helper.ReadConfig <Config>(); TMXLoaderMod.helper = Helper; monitor = Monitor; if (config.converter) { exportAllMaps(); convert(); } loadContentPacks(); setTileActions(); helper.Events.Player.Warped += OnWarped; PyLua.registerType(typeof(Map), false, true); PyLua.registerType(typeof(TMXActions), false, false); PyLua.addGlobal("TMX", new TMXActions()); new ConsoleCommand("loadmap", "Teleport to a map", (s, st) => { Game1.player.warpFarmer(new Warp(int.Parse(st[1]), int.Parse(st[2]), st[0], int.Parse(st[1]), int.Parse(st[2]), false)); }).register(); new ConsoleCommand("removeNPC", "Removes an NPC", (s, st) => { if (Game1.getCharacterFromName(st.Last()) == null) { Monitor.Log("Couldn't find NPC with that name!", LogLevel.Alert); } else { Game1.removeThisCharacterFromAllLocations(Game1.getCharacterFromName(st.Last())); if (Game1.player.friendshipData.ContainsKey(st.Last())) { Game1.player.friendshipData.Remove(st.Last()); } Monitor.Log(st.Last() + " was removed!", LogLevel.Info); } }).register(); fixCompatibilities(); harmonyFix(); helper.Events.GameLoop.UpdateTicked += (s, e) => { if (e.IsOneSecond && Context.IsWorldReady && Game1.IsMasterGame && Game1.IsMultiplayer && Game1.otherFarmers.Values.Where(f => f.isActive() && f != Game1.player && !syncedFarmers.Contains(f)) is IEnumerable <SFarmer> ef && ef.Count() is int i && i > 0) { syncMaps(ef); } }; }
public override void Entry(IModHelper helper) { TMXLoaderMod.helper = Helper; monitor = Monitor; Monitor.Log("Environment:" + PyUtils.getContentFolder()); exportAllMaps(); convert(); loadContentPacks(); setTileActions(); PlayerEvents.Warped += LocationEvents_CurrentLocationChanged; TimeEvents.AfterDayStarted += TimeEvents_AfterDayStarted; PyLua.registerType(typeof(Map), false, true); PyLua.registerType(typeof(TMXActions), false, false); PyLua.addGlobal("TMX", new TMXActions()); fixCompatibilities(); harmonyFix(); GameEvents.OneSecondTick += (s, e) => { if (Context.IsWorldReady && Game1.IsServer && Game1.IsMultiplayer) { if (Game1.otherFarmers.Values.Where(f => f.isActive() && !syncedFarmers.Contains(f)) is IEnumerable <SFarmer> ef && ef.Count() is int i && i > 0) { syncMaps(ef); } } }; TimeEvents.AfterDayStarted += (s, e) => { List <SFarmer> toRemove = new List <SFarmer>(); foreach (SFarmer farmer in syncedFarmers) { if (!Game1.otherFarmers.ContainsKey(farmer.UniqueMultiplayerID) || !Game1.otherFarmers[farmer.UniqueMultiplayerID].isActive()) { toRemove.Add(farmer); } } foreach (SFarmer remove in toRemove) { syncedFarmers.Remove(remove); } }; }
public override void Entry(IModHelper helper) { maplayers = new List <Map>(); TMXLoaderMod.helper = Helper; monitor = Monitor; Monitor.Log("Environment:" + PyUtils.getContentFolder()); exportAllMaps(); convert(); loadContentPacks(); setTileActions(); PlayerEvents.Warped += LocationEvents_CurrentLocationChanged; PyLua.registerType(typeof(Map), false, true); PyLua.registerType(typeof(TMXActions), false, false); PyLua.addGlobal("TMX", new TMXActions()); fixCompatibilities(); harmonyFix(); PlayerEvents.Warped += (s, e) => { if (e.NewLocation is GameLocation l && l.map is Map m) { addMoreMapLayers(m); } }; }
private void OnGameLaunched(object sender, GameLaunchedEventArgs e) { if (config.converter) { exportAllMaps(); convert(); } loadContentPacks(); setTileActions(); PyLua.registerType(typeof(Map), false, true); PyLua.registerType(typeof(TMXActions), false, false); PyLua.addGlobal("TMX", new TMXActions()); new ConsoleCommand("loadmap", "Teleport to a map", (s, st) => { Game1.player.warpFarmer(new Warp(int.Parse(st[1]), int.Parse(st[2]), st[0], int.Parse(st[1]), int.Parse(st[2]), false)); }).register(); new ConsoleCommand("removeNPC", "Removes an NPC", (s, st) => { if (Game1.getCharacterFromName(st.Last()) == null) { Monitor.Log("Couldn't find NPC with that name!", LogLevel.Alert); } else { Game1.removeThisCharacterFromAllLocations(Game1.getCharacterFromName(st.Last())); if (Game1.player.friendshipData.ContainsKey(st.Last())) { Game1.player.friendshipData.Remove(st.Last()); } Monitor.Log(st.Last() + " was removed!", LogLevel.Info); } }).register(); fixCompatibilities(); harmonyFix(); }