From 8b1fd90c6e72bff99d81a3b9614fdeaa6f67a950 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 12 Jan 2020 15:53:59 -0500 Subject: remove invalid-schedule error which can have false positives (e.g. when NPC is married to a player) --- docs/release-notes.md | 3 ++- src/SMAPI/Metadata/CoreAssetPropagator.cs | 16 +++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/docs/release-notes.md b/docs/release-notes.md index f5c49a88..bc30bed7 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -11,8 +11,9 @@ For modders: * Asset propagation for player sprites now affects other players' sprites, and updates recolor maps (e.g. sleeves). + * Removed invalid-schedule validation which had false positives. -* For SMAPI/tool developers: +For SMAPI/tool developers: * The `/mods` web API endpoint now includes version mappings from the wiki. ## 3.1 diff --git a/src/SMAPI/Metadata/CoreAssetPropagator.cs b/src/SMAPI/Metadata/CoreAssetPropagator.cs index abe28ce9..57e1d197 100644 --- a/src/SMAPI/Metadata/CoreAssetPropagator.cs +++ b/src/SMAPI/Metadata/CoreAssetPropagator.cs @@ -909,18 +909,16 @@ namespace StardewModdingAPI.Metadata this.Reflection.GetField(villager, "_hasLoadedMasterScheduleData").SetValue(false); this.Reflection.GetField>(villager, "_masterScheduleData").SetValue(null); villager.Schedule = villager.getSchedule(Game1.dayOfMonth); - if (villager.Schedule == null) - { - this.Monitor.Log($"A mod set an invalid schedule for {villager.Name ?? key}, so the NPC may not behave correctly.", LogLevel.Warn); - return true; - } // switch to new schedule if needed - int lastScheduleTime = villager.Schedule.Keys.Where(p => p <= Game1.timeOfDay).OrderByDescending(p => p).FirstOrDefault(); - if (lastScheduleTime != 0) + if (villager.Schedule != null) { - villager.scheduleTimeToTry = NPC.NO_TRY; // use time that's passed in to checkSchedule - villager.checkSchedule(lastScheduleTime); + int lastScheduleTime = villager.Schedule.Keys.Where(p => p <= Game1.timeOfDay).OrderByDescending(p => p).FirstOrDefault(); + if (lastScheduleTime != 0) + { + villager.scheduleTimeToTry = NPC.NO_TRY; // use time that's passed in to checkSchedule + villager.checkSchedule(lastScheduleTime); + } } } return true; -- cgit