tModLoader

tModLoader

Not enough ratings
HolidayLib
   
Award
Favorite
Favorited
Unfavorite
Mod Features: Library
Mod Side: NoSync
tModLoader Version: 1.4.4
File Size
Posted
Updated
40.579 KB
17 Jul, 2023 @ 5:15am
5 Nov, 2023 @ 5:32pm
3 Change Notes ( view )

Subscribe to download
HolidayLib

Description
HolidayLib exists to let mods forcibly activate holiday events that the vanilla game does not feature, regardless of which mod adds them, this potential existed for April Fools' Day in 1.4.3 through detouring AprilFools.CheckAprilFools but since that's been removed I made this mod so all the holidays can be manipulated (provided the mods that use them use this mod)

all calls and names/aliases are case-insensitive and ignore spaces and underscores
Call documentation:
ADDHOLIDAY: adds a holiday or merges range/conditions into existing holiday, returns a reference to the added holiday, or an ArgumentException if the arguments are formatted incorrectly
ADDHOLIDAY <name: string> <day: DateTime (ignores year and time)>
ADDHOLIDAY <name: string> <start: DateTime (ignores year and time)> <end: DateTime (ignores year and time)>
ADDHOLIDAY <name: string> <start: DateTime (ignores year and time)> <duration: int (duration in days)>
ADDHOLIDAY <name: string> <dateRanges: params HolidayLib.DateRange[]>
ADDHOLIDAY <name: string> <conditions: params Func<int>[] (if the sum of the return value of all conditions is > 0 holiday is active regardless of date, if < 0 holiday is inactive regardless of date)>

ADDALIAS: adds one or more aliases to a holiday, returns null
ADDALIAS <name: string> <aliases: params string[]>
ADDALIASES <name: string> <aliases: params string[]>

ISACTIVE: returns whether or not a holiday is currently active
ISACTIVE <name: string>

GETACTIVELOOKUP: returns a function that returns whether or not a holiday is currently active
GETACTIVELOOKUP <name: string>

HOLIDAYFORCECHANGED: increments a counter to allow mods to check if the holiday has been changed, returns the new value, should be called whenever a holiday is forced to start or end, or when the state of a holiday which does not begin or end at the beginning of a new day changes
HOLIDAYFORCECHANGED <no arguments>

FORCEDHOLIDAYVERSION: returns the current value of the counter incremented by HOLIDAYFORCECHANGED
FORCEDHOLIDAYVERSION <no arguments>

GETFUNC: returns a Func<object[], object> to call the specified call directly
GETFUNC <callName: string>

HELP: returns the string "See description for documentation"
HELP <no arguments>
Originally posted by tModLoader:
Developed By Tyfyter
3 Comments
Moonlight Glint  [author] 14 Feb @ 5:19pm 
Any mod can add holidays, but the ones that are registered by default can be found here: https://github.com/Tyfyter/HolidayLib/blob/master/HolidayLib.cs#L32-L48
lutravurr 14 Feb @ 4:54pm 
what are the names for the holidays tho?
Animarchy 10 Oct, 2024 @ 4:04am 
cool mod vary us:steamhappy:efull