Stardew Valley
0 of 0

File information

Last updated

Original upload

Created by

drbirbdev

Uploaded by

drbirbdev

Virus scan

Safe to use

About this mod

Adds Content Patcher tokens and an API for creating holiday/real-time based events.

Requirements
Permissions and credits
Changelogs
This mod is a framework which doesn't do anything on its own.  Additional mods need to add actual holiday changes.

To find mods using this framework, check the requirements drop-down above.

Using Realtime Framework (as a Modder)

The simplest way to use the framework is with Content Patcher.  Realtime Framework provides several tokens which can be used to get current holidays.

For example:

{
"Foramt": "1.29.0",
"Changes": {
{
"Action": "EditImage",
"Target": "Portraits/Abigail",
"FromFile": "assets/pumpkin_hair_ornament.png",
"PatchMode": "Overlay",
"When": {
"drbirbdev.RealtimeFramework/CurrentHolidays": "halloween"
}
}
]
}

could add a pumpkin hair ornament to Abigail's portrait on Halloween.

Available tokens all start with "drbirbdev.RealtimeFramework/" and include

  • ComingHolidays - get a list of upcoming holidays
  • CurrentHolidays - get a list of current holidays (happening today)
  • PassingHolidays - get a list of holidays which have just passed
  • ComingHolidaysLocal - get a list of upcoming holidays using localized names
  • CurrentHolidaysLocal - get a list of current holidays using localized names
  • PassingHolidaysLocal - get a list of passing holidays using localized names
  • Hour - get the current hour
  • DayOfMonth - get the day of the month (eg 31)
  • DayOfWeek -get the day of the week (eg 6)
  • DayOfYear - get the day of the year (eg 278)
  • Month - get the month (eg 10)
  • Year - get the year (eg 2023)
  • WeekdayLocal - get the day of the week localized (eg Monday)
  • MonthLocal - get the month localized (eg October)

There's also an API.  Check github for the interface and code.  It include methods for Coming, Current, and Passing holidays, as well as getting a localized name of a holiday.  It does not include anything for current Hour, Day, Year, etc. since modders should just use time libraries.  It would be advisable to check for holidays at (in-game) day start, and cache the value, since that is how Content Patcher mods would likely work, but this is up to the modder.

Adding Holidays with Content Patcher

The prefered way to add a holiday is directly.  Please submit a pull request on github, or just write a message.  Note that people will still have to make content for that holiday, just adding it here won't do anything by itself.

This is because of the Content Patcher lifecycle, patches to this mod will take the first frame, and therefore patches using your added holiday will not be able to happen on frame one.  This means the title screen might not be patch-able for the holiday you are adding, unless it's added via a pull request.  I have only included a few holidays to start with, and they are all USA-centric.  If there is demand, I can add more holidays myself, or create alternate json files for prioritizing other nationalities holidays.  Please let me know.

If you'd still like to patch in holidays yourself, then see below.

If you would like to add a new holiday, see holidays.json for the format.  Holidays can be added with Content Patcher.

{
"Action": "EditData",
"Target": "Mods/drbirbdev.RealtimeFramework/Holidays",
"Entries": {
"<holiday>": {
"Date": [ <month>, <day> ],
"ComingDays": <days>,
"PassingDays": <days>,
"StartDelayHours": <hours>,
"EndDelayHours": <hours>,
"VaryingDates": {
"<year>": [ <month>, <day> ],
"<year>": [ <month>, <day> ],
"<year>": [ <month>, <day> ]
}
}
}
}

all values between <> should be replaced as appropriate.  <holiday> is the unique key for a holiday. <month>, <day>, <days>, <hours> are all integers.  "<year>" is an integer, but must be between quotes, eg "2023".

Date and VaryingDates


Date OR VaryingDates must be provided.  Date can be used if the holiday happens on the same day every year, like Valentines day or Halloween.  VaryingDates can be used if the holiday changes date, like Easter, or Thanksgiving.  VaryingDates must specify the date of the holiday for every year, so try to provide 10 or so years of dates ahead of the current year.


ComingDays and PassingDays

These can help with holiday events, allowing buildup to a coming holiday, or post-holiday events. For instance, consider Easter in Animal Crossing, which has a week or two of egg collecting, with an additional couple of items unlocked the day of.  By specifying these in the Realtime Framework, all mods adding holiday event changes can be roughly coordinated, and not start at random different times leading up to the holiday.


StartDelayHours and EndDelayHours

These settings can adjust the exact start and end times of holidays.  This can be useful if a holiday is usually celebrated at night, and therefore might overlap with the following day, such as Halloween or New Years Eve.  This can also help support holidays which don't start at midnight, like Hanukkah, by pushing the start time.