From 70a27b441404634336770a37a1ee6cc54112e4ee Mon Sep 17 00:00:00 2001 From: Entoarox Date: Thu, 28 Mar 2019 14:14:47 +0100 Subject: [PATCH] [EM] 1.8.2-beta.0 --- ExtendedMinecart/ModEntry.cs | 265 ++++++++++++++++-------------- ExtendedMinecart/RELEASE-NOTES.md | 13 ++ ExtendedMinecart/manifest.json | 2 +- 3 files changed, 153 insertions(+), 127 deletions(-) diff --git a/ExtendedMinecart/ModEntry.cs b/ExtendedMinecart/ModEntry.cs index 6b7c83c..0402522 100644 --- a/ExtendedMinecart/ModEntry.cs +++ b/ExtendedMinecart/ModEntry.cs @@ -48,7 +48,7 @@ public override void Entry(IModHelper helper) { this.Config = helper.ReadConfig(); - helper.Events.GameLoop.UpdateTicked += this.OnUpdateTicked; + helper.Events.GameLoop.DayStarted += this.OnDayStarted; helper.Events.Display.MenuChanged += this.OnMenuChanged; } @@ -56,17 +56,10 @@ public override void Entry(IModHelper helper) /********* ** Protected methods *********/ - /// Raised after the game state is updated (≈60 times per second). - /// The event sender. - /// The event arguments. - private void OnUpdateTicked(object sender, EventArgs e) + private void OnDayStarted(object s, EventArgs e) { - if (!Context.IsWorldReady) - return; if (Context.IsMultiplayer) this.Monitor.Log("Multiplayer game detected, you are using Extended Minecarts at your own risk!", LogLevel.Warn); - - this.Helper.Events.GameLoop.UpdateTicked -= this.OnUpdateTicked; ModEntry.Destinations = new Dictionary(); foreach (KeyValuePair item in ModEntry.DestinationData) { @@ -107,55 +100,59 @@ private void OnUpdateTicked(object sender, EventArgs e) try { GameLocation farm = Game1.getFarm(); - if (this.Config.AlternateFarmMinecart) + if (!farm.map.Properties.ContainsKey("Entoarox.ExtendedMinecarts.Patched")) { - farm.SetTile(18, 5, "Front", 483, "untitled tile sheet"); - farm.SetTile(19, 5, "Front", 484, "untitled tile sheet"); - farm.SetTile(19, 5, "Buildings", 217, "untitled tile sheet"); - farm.SetTile(20, 5, "Front", 485, "untitled tile sheet"); + if (this.Config.AlternateFarmMinecart) + { + farm.SetTile(18, 5, "Front", 483, "untitled tile sheet"); + farm.SetTile(19, 5, "Front", 484, "untitled tile sheet"); + farm.SetTile(19, 5, "Buildings", 217, "untitled tile sheet"); + farm.SetTile(20, 5, "Front", 485, "untitled tile sheet"); - farm.SetTile(18, 6, "Buildings", 508, "untitled tile sheet"); - farm.SetTile(19, 6, "Back", 509, "untitled tile sheet"); - farm.SetTile(20, 6, "Buildings", 510, "untitled tile sheet"); + farm.SetTile(18, 6, "Buildings", 508, "untitled tile sheet"); + farm.SetTile(19, 6, "Back", 509, "untitled tile sheet"); + farm.SetTile(20, 6, "Buildings", 510, "untitled tile sheet"); - farm.SetTile(18, 7, "Buildings", 533, "untitled tile sheet"); - farm.SetTile(19, 7, "Back", 534, "untitled tile sheet"); - farm.SetTile(20, 7, "Buildings", 535, "untitled tile sheet"); + farm.SetTile(18, 7, "Buildings", 533, "untitled tile sheet"); + farm.SetTile(19, 7, "Back", 534, "untitled tile sheet"); + farm.SetTile(20, 7, "Buildings", 535, "untitled tile sheet"); - farm.SetTile(19, 6, "Buildings", 933, "untitled tile sheet"); - farm.SetTile(19, 7, "Buildings", 958, "untitled tile sheet"); - farm.SetTileProperty(19, 7, "Buildings", "Action", "MinecartTransport"); - } - else - { - // Clear annoying flower - farm.removeTile(79, 12, "Buildings"); - // Cut dark short - farm.SetTile(77, 11, "Back", 375, "untitled tile sheet"); - farm.SetTile(78, 11, "Back", 376, "untitled tile sheet"); - farm.SetTile(79, 11, "Back", 376, "untitled tile sheet"); - // Lay tracks - farm.SetTile(78, 12, "Back", 729, "untitled tile sheet"); - farm.SetTile(78, 13, "Back", 754, "untitled tile sheet"); - farm.SetTile(78, 14, "Back", 755, "untitled tile sheet"); - farm.SetTile(79, 12, "Back", 730, "untitled tile sheet"); - // Trim grass - farm.SetTile(77, 13, "Back", 175, "untitled tile sheet"); - farm.SetTile(77, 14, "Back", 175, "untitled tile sheet"); - farm.SetTile(77, 15, "Back", 175, "untitled tile sheet"); - farm.SetTile(78, 15, "Back", 175, "untitled tile sheet"); - farm.SetTile(79, 13, "Back", 175, "untitled tile sheet"); - farm.SetTile(79, 14, "Back", 175, "untitled tile sheet"); - farm.SetTile(79, 15, "Back", 175, "untitled tile sheet"); - // Clean up fence - farm.SetTile(78, 11, "Buildings", 436, "untitled tile sheet"); - farm.removeTile(78, 14, "Buildings"); - // Plop down minecart - farm.SetTile(78, 12, "Buildings", 933, "untitled tile sheet"); - farm.SetTile(78, 13, "Buildings", 958, "untitled tile sheet"); - farm.SetTileProperty(78, 13, "Buildings", "Action", "MinecartTransport"); - // Keep exit clear - farm.setTileProperty(78, 14, "Back", "NoFurniture", "T"); + farm.SetTile(19, 6, "Buildings", 933, "untitled tile sheet"); + farm.SetTile(19, 7, "Buildings", 958, "untitled tile sheet"); + farm.SetTileProperty(19, 7, "Buildings", "Action", "MinecartTransport"); + } + else + { + // Clear annoying flower + farm.removeTile(79, 12, "Buildings"); + // Cut dark short + farm.SetTile(77, 11, "Back", 375, "untitled tile sheet"); + farm.SetTile(78, 11, "Back", 376, "untitled tile sheet"); + farm.SetTile(79, 11, "Back", 376, "untitled tile sheet"); + // Lay tracks + farm.SetTile(78, 12, "Back", 729, "untitled tile sheet"); + farm.SetTile(78, 13, "Back", 754, "untitled tile sheet"); + farm.SetTile(78, 14, "Back", 755, "untitled tile sheet"); + farm.SetTile(79, 12, "Back", 730, "untitled tile sheet"); + // Trim grass + farm.SetTile(77, 13, "Back", 175, "untitled tile sheet"); + farm.SetTile(77, 14, "Back", 175, "untitled tile sheet"); + farm.SetTile(77, 15, "Back", 175, "untitled tile sheet"); + farm.SetTile(78, 15, "Back", 175, "untitled tile sheet"); + farm.SetTile(79, 13, "Back", 175, "untitled tile sheet"); + farm.SetTile(79, 14, "Back", 175, "untitled tile sheet"); + farm.SetTile(79, 15, "Back", 175, "untitled tile sheet"); + // Clean up fence + farm.SetTile(78, 11, "Buildings", 436, "untitled tile sheet"); + farm.removeTile(78, 14, "Buildings"); + // Plop down minecart + farm.SetTile(78, 12, "Buildings", 933, "untitled tile sheet"); + farm.SetTile(78, 13, "Buildings", 958, "untitled tile sheet"); + farm.SetTileProperty(78, 13, "Buildings", "Action", "MinecartTransport"); + // Keep exit clear + farm.setTileProperty(78, 14, "Back", "NoFurniture", "T"); + } + farm.map.Properties.Add("Entoarox.ExtendedMinecarts.Patched", true); } } catch (Exception err) @@ -169,57 +166,61 @@ private void OnUpdateTicked(object sender, EventArgs e) { // # Desert GameLocation desert = Game1.getLocationFromName("Desert"); - TileSheet parent = Game1.getLocationFromName("Mountain").map.GetTileSheet("outdoors"); - desert.map.AddTileSheet(new TileSheet("z_path_objects_custom_sheet", desert.map, parent.ImageSource, parent.SheetSize, parent.TileSize)); - desert.map.DisposeTileSheets(Game1.mapDisplayDevice); - desert.map.LoadTileSheets(Game1.mapDisplayDevice); - if (this.Config.AlternateDesertMinecart) + if (!desert.map.Properties.ContainsKey("Entoarox.ExtendedMinecarts.Patched")) { - // Backdrop - desert.SetTile(33, 1, "Front", 221, "desert-new"); - desert.SetTile(34, 1, "Front", 222, "desert-new"); - desert.SetTile(35, 1, "Front", 223, "desert-new"); + TileSheet parent = Game1.getLocationFromName("Mountain").map.GetTileSheet("outdoors"); + desert.map.AddTileSheet(new TileSheet("z_path_objects_custom_sheet", desert.map, parent.ImageSource, parent.SheetSize, parent.TileSize)); + desert.map.DisposeTileSheets(Game1.mapDisplayDevice); + desert.map.LoadTileSheets(Game1.mapDisplayDevice); + if (this.Config.AlternateDesertMinecart) + { + // Backdrop + desert.SetTile(33, 1, "Front", 221, "desert-new"); + desert.SetTile(34, 1, "Front", 222, "desert-new"); + desert.SetTile(35, 1, "Front", 223, "desert-new"); - desert.SetTile(33, 2, "Front", 237, "desert-new"); - desert.SetTile(34, 2, "Buildings", 254, "desert-new"); - desert.SetTile(34, 2, "Front", 238, "desert-new"); - desert.SetTile(35, 2, "Front", 239, "desert-new"); + desert.SetTile(33, 2, "Front", 237, "desert-new"); + desert.SetTile(34, 2, "Buildings", 254, "desert-new"); + desert.SetTile(34, 2, "Front", 238, "desert-new"); + desert.SetTile(35, 2, "Front", 239, "desert-new"); - desert.SetTile(33, 3, "Buildings", 253, "desert-new"); - desert.SetTile(34, 3, "Buildings", 254, "desert-new"); - desert.SetTile(35, 3, "Buildings", 255, "desert-new"); + desert.SetTile(33, 3, "Buildings", 253, "desert-new"); + desert.SetTile(34, 3, "Buildings", 254, "desert-new"); + desert.SetTile(35, 3, "Buildings", 255, "desert-new"); - desert.SetTile(33, 4, "Buildings", 269, "desert-new"); - desert.SetTile(34, 4, "Back", 270, "desert-new"); - desert.SetTile(35, 4, "Buildings", 271, "desert-new"); - // Cart - desert.SetTile(34, 3, "Front", 933, "z_path_objects_custom_sheet"); - desert.SetTile(34, 4, "Buildings", 958, "z_path_objects_custom_sheet"); - desert.SetTileProperty(34, 4, "Buildings", "Action", "MinecartTransport"); - } - else - { - // Backdrop - desert.SetTile(33, 39, "Front", 221, "desert-new"); - desert.SetTile(34, 39, "Front", 222, "desert-new"); - desert.SetTile(35, 39, "Front", 223, "desert-new"); + desert.SetTile(33, 4, "Buildings", 269, "desert-new"); + desert.SetTile(34, 4, "Back", 270, "desert-new"); + desert.SetTile(35, 4, "Buildings", 271, "desert-new"); + // Cart + desert.SetTile(34, 3, "Front", 933, "z_path_objects_custom_sheet"); + desert.SetTile(34, 4, "Buildings", 958, "z_path_objects_custom_sheet"); + desert.SetTileProperty(34, 4, "Buildings", "Action", "MinecartTransport"); + } + else + { + // Backdrop + desert.SetTile(33, 39, "Front", 221, "desert-new"); + desert.SetTile(34, 39, "Front", 222, "desert-new"); + desert.SetTile(35, 39, "Front", 223, "desert-new"); - desert.SetTile(33, 40, "Front", 237, "desert-new"); - desert.SetTile(34, 40, "Buildings", 254, "desert-new"); - desert.SetTile(34, 40, "Front", 238, "desert-new"); - desert.SetTile(35, 40, "Front", 239, "desert-new"); + desert.SetTile(33, 40, "Front", 237, "desert-new"); + desert.SetTile(34, 40, "Buildings", 254, "desert-new"); + desert.SetTile(34, 40, "Front", 238, "desert-new"); + desert.SetTile(35, 40, "Front", 239, "desert-new"); - desert.SetTile(33, 41, "Buildings", 253, "desert-new"); - desert.SetTile(34, 41, "Buildings", 254, "desert-new"); - desert.SetTile(35, 41, "Buildings", 255, "desert-new"); + desert.SetTile(33, 41, "Buildings", 253, "desert-new"); + desert.SetTile(34, 41, "Buildings", 254, "desert-new"); + desert.SetTile(35, 41, "Buildings", 255, "desert-new"); - desert.SetTile(33, 42, "Buildings", 269, "desert-new"); - desert.SetTile(34, 42, "Back", 270, "desert-new"); - desert.SetTile(35, 42, "Buildings", 271, "desert-new"); - // Cart - desert.SetTile(34, 41, "Front", 933, "z_path_objects_custom_sheet"); - desert.SetTile(34, 42, "Buildings", 958, "z_path_objects_custom_sheet"); - desert.SetTileProperty(34, 42, "Buildings", "Action", "MinecartTransport"); + desert.SetTile(33, 42, "Buildings", 269, "desert-new"); + desert.SetTile(34, 42, "Back", 270, "desert-new"); + desert.SetTile(35, 42, "Buildings", 271, "desert-new"); + // Cart + desert.SetTile(34, 41, "Front", 933, "z_path_objects_custom_sheet"); + desert.SetTile(34, 42, "Buildings", 958, "z_path_objects_custom_sheet"); + desert.SetTileProperty(34, 42, "Buildings", "Action", "MinecartTransport"); + } + desert.map.Properties.Add("Entoarox.ExtendedMinecarts.Patched", true); } } catch (Exception err) @@ -233,9 +234,13 @@ private void OnUpdateTicked(object sender, EventArgs e) { // # Woods GameLocation woods = Game1.getLocationFromName("Woods"); - woods.SetTile(46, 3, "Front", 933, "untitled tile sheet"); - woods.SetTile(46, 4, "Buildings", 958, "untitled tile sheet"); - woods.SetTileProperty(46, 4, "Buildings", "Action", "MinecartTransport"); + if (!woods.map.Properties.ContainsKey("Entoarox.ExtendedMinecarts.Patched")) + { + woods.SetTile(46, 3, "Front", 933, "untitled tile sheet"); + woods.SetTile(46, 4, "Buildings", 958, "untitled tile sheet"); + woods.SetTileProperty(46, 4, "Buildings", "Action", "MinecartTransport"); + woods.map.Properties.Add("Entoarox.ExtendedMinecarts.Patched", true); + } } catch (Exception err) { @@ -248,21 +253,25 @@ private void OnUpdateTicked(object sender, EventArgs e) { // # Wizard GameLocation forest = Game1.getLocationFromName("Forest"); - forest.SetTile(13, 37, "Front", 483, "outdoors"); - forest.SetTile(14, 37, "Front", 484, "outdoors"); - forest.SetTile(14, 37, "Buildings", 217, "outdoors"); - forest.SetTile(15, 37, "Front", 485, "outdoors"); + if (!forest.map.Properties.ContainsKey("Entoarox.ExtendedMinecarts.Patched")) + { + forest.SetTile(13, 37, "Front", 483, "outdoors"); + forest.SetTile(14, 37, "Front", 484, "outdoors"); + forest.SetTile(14, 37, "Buildings", 217, "outdoors"); + forest.SetTile(15, 37, "Front", 485, "outdoors"); - forest.SetTile(13, 38, "Buildings", 508, "outdoors"); - forest.SetTile(14, 38, "Back", 509, "outdoors"); - forest.SetTile(15, 38, "Buildings", 510, "outdoors"); + forest.SetTile(13, 38, "Buildings", 508, "outdoors"); + forest.SetTile(14, 38, "Back", 509, "outdoors"); + forest.SetTile(15, 38, "Buildings", 510, "outdoors"); - forest.SetTile(13, 39, "Buildings", 533, "outdoors"); - forest.SetTile(15, 39, "Buildings", 535, "outdoors"); + forest.SetTile(13, 39, "Buildings", 533, "outdoors"); + forest.SetTile(15, 39, "Buildings", 535, "outdoors"); - forest.SetTile(14, 38, "Buildings", 933, "outdoors"); - forest.SetTile(14, 39, "Buildings", 958, "outdoors"); - forest.SetTileProperty(14, 39, "Buildings", "Action", "MinecartTransport"); + forest.SetTile(14, 38, "Buildings", 933, "outdoors"); + forest.SetTile(14, 39, "Buildings", 958, "outdoors"); + forest.SetTileProperty(14, 39, "Buildings", "Action", "MinecartTransport"); + forest.map.Properties.Add("Entoarox.ExtendedMinecarts.Patched", true); + } } catch (Exception err) { @@ -275,16 +284,20 @@ private void OnUpdateTicked(object sender, EventArgs e) { // # Beach GameLocation beach = Game1.getLocationFromName("Beach"); - TileSheet parent = Game1.getLocationFromName("Mountain").map.GetTileSheet("outdoors"); - beach.map.AddTileSheet(new TileSheet("z_path_objects_custom_sheet", beach.map, parent.ImageSource, parent.SheetSize, parent.TileSize)); - beach.map.DisposeTileSheets(Game1.mapDisplayDevice); - beach.map.LoadTileSheets(Game1.mapDisplayDevice); - beach.RemoveTile(67, 2, "Buildings"); - beach.RemoveTile(67, 5, "Buildings"); - beach.RemoveTile(67, 4, "Buildings"); - beach.SetTile(67, 2, "Buildings", 933, "z_path_objects_custom_sheet"); - beach.SetTile(67, 3, "Buildings", 958, "z_path_objects_custom_sheet"); - beach.SetTileProperty(67, 3, "Buildings", "Action", "MinecartTransport"); + if (!beach.map.Properties.ContainsKey("Entoarox.ExtendedMinecarts.Patched")) + { + TileSheet parent = Game1.getLocationFromName("Mountain").map.GetTileSheet("outdoors"); + beach.map.AddTileSheet(new TileSheet("z_path_objects_custom_sheet", beach.map, parent.ImageSource, parent.SheetSize, parent.TileSize)); + beach.map.DisposeTileSheets(Game1.mapDisplayDevice); + beach.map.LoadTileSheets(Game1.mapDisplayDevice); + beach.RemoveTile(67, 2, "Buildings"); + beach.RemoveTile(67, 5, "Buildings"); + beach.RemoveTile(67, 4, "Buildings"); + beach.SetTile(67, 2, "Buildings", 933, "z_path_objects_custom_sheet"); + beach.SetTile(67, 3, "Buildings", 958, "z_path_objects_custom_sheet"); + beach.SetTileProperty(67, 3, "Buildings", "Action", "MinecartTransport"); + beach.map.Properties.Add("Entoarox.ExtendedMinecarts.Patched", true); + } } catch (Exception err) { @@ -330,11 +343,11 @@ private void OnMenuChanged(object sender, MenuChangedEventArgs e) foreach (KeyValuePair item in ModEntry.Destinations) item.Value.Disabled = item.Key.Equals(Game1.currentLocation.Name) || Game1.isFestival() && item.Key.Equals(Game1.whereIsTodaysFest); - if (!Game1.player.mailReceived.Contains("ccCraftsRoom")) + if (!Game1.MasterPlayer.mailReceived.Contains("ccCraftsRoom")) ModEntry.Destinations["Mountain"].Disabled = true; - if (this.Config.DesertDestinationEnabled && !Game1.player.mailReceived.Contains("ccVault")) + if (this.Config.DesertDestinationEnabled && !Game1.MasterPlayer.mailReceived.Contains("ccVault")) ModEntry.Destinations["Desert"].Disabled = true; - if (this.Config.WoodsDestinationEnabled && !Game1.player.mailReceived.Contains("beenToWoods")) + if (this.Config.WoodsDestinationEnabled && !Game1.MasterPlayer.mailReceived.Contains("beenToWoods")) ModEntry.Destinations["Woods"].Disabled = true; if (this.Config.BeachDestinationEnabled && (!(Game1.getLocationFromName("Beach") as Beach).bridgeFixed.Value || (Game1.currentSeason.Equals("winter") && Game1.dayOfMonth >= 15 && Game1.dayOfMonth <= 17))) ModEntry.Destinations["Beach"].Disabled = true; diff --git a/ExtendedMinecart/RELEASE-NOTES.md b/ExtendedMinecart/RELEASE-NOTES.md index 3efc202..5d3863f 100644 --- a/ExtendedMinecart/RELEASE-NOTES.md +++ b/ExtendedMinecart/RELEASE-NOTES.md @@ -1,4 +1,17 @@ ## Release notes +##1.8.1 +Released 20 March 2019. + +* Fixed minecart destinations disappearing in some situations. +* Fixed certain destinations not unlocking for FarmHands. + +## 1.8.1 +Released 06 March 2019. + +* Fixed the beach being a valid destination during the Night Market festival. +* Made patching logic more robust. +* Added warning for multiplayer, due to full support not yet being available. + ## 1.8.0 Released 28 December 2018. (Thanks to Pathoschild!) diff --git a/ExtendedMinecart/manifest.json b/ExtendedMinecart/manifest.json index 040cc9d..06de8ad 100644 --- a/ExtendedMinecart/manifest.json +++ b/ExtendedMinecart/manifest.json @@ -1,7 +1,7 @@ { "Name": "Extended Minecart", "Author": "Entoarox", - "Version": "1.8.1", + "Version": "1.8.2-beta.0", "Description": "More destinations for your minecart needs!", "UniqueID": "Entoarox.ExtendedMinecart", "EntryDll": "ExtendedMinecart.dll",