remove invalid-schedule error which can have false positives (e.g. when NPC is married to a player)
This commit is contained in:
parent
5518e4cf24
commit
8b1fd90c6e
|
@ -11,8 +11,9 @@
|
||||||
|
|
||||||
For modders:
|
For modders:
|
||||||
* Asset propagation for player sprites now affects other players' sprites, and updates recolor maps (e.g. sleeves).
|
* 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.
|
* The `/mods` web API endpoint now includes version mappings from the wiki.
|
||||||
|
|
||||||
## 3.1
|
## 3.1
|
||||||
|
|
|
@ -909,13 +909,10 @@ namespace StardewModdingAPI.Metadata
|
||||||
this.Reflection.GetField<bool>(villager, "_hasLoadedMasterScheduleData").SetValue(false);
|
this.Reflection.GetField<bool>(villager, "_hasLoadedMasterScheduleData").SetValue(false);
|
||||||
this.Reflection.GetField<Dictionary<string, string>>(villager, "_masterScheduleData").SetValue(null);
|
this.Reflection.GetField<Dictionary<string, string>>(villager, "_masterScheduleData").SetValue(null);
|
||||||
villager.Schedule = villager.getSchedule(Game1.dayOfMonth);
|
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
|
// switch to new schedule if needed
|
||||||
|
if (villager.Schedule != null)
|
||||||
|
{
|
||||||
int lastScheduleTime = villager.Schedule.Keys.Where(p => p <= Game1.timeOfDay).OrderByDescending(p => p).FirstOrDefault();
|
int lastScheduleTime = villager.Schedule.Keys.Where(p => p <= Game1.timeOfDay).OrderByDescending(p => p).FirstOrDefault();
|
||||||
if (lastScheduleTime != 0)
|
if (lastScheduleTime != 0)
|
||||||
{
|
{
|
||||||
|
@ -923,6 +920,7 @@ namespace StardewModdingAPI.Metadata
|
||||||
villager.checkSchedule(lastScheduleTime);
|
villager.checkSchedule(lastScheduleTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue