Hooks have been added to the plugin system for time of day based events. Additionaly, the python plugin was extended with those hooks. Now all thats left is making scripts that use it.
Allow map makers to utilize date and time for their maps.
Developper working on it: tchize
Implementation documentation: tod
Approximatively 90% work done on this. Still need to build a few script, like one to alter the destination of a map depending on hour and another to freeze/make alive all monster in map at a certain time. Note: some things below may only be working currently on developper's computer and may not yet have been commited
Example (verbose) python code using time based informations
import Crossfire import string Crossfire.Log(Crossfire.LogDebug, "Number of seasons for this server: %d" %Crossfire.Time.SEASONS_PER_YEAR) for x in range(Crossfire.Time.SEASONS_PER_YEAR): Crossfire.Log(Crossfire.LogDebug, "Season %d is %s" %(x,Crossfire.GetSeasonName(x))) Crossfire.Log(Crossfire.LogDebug, "Number of week days for this server: %d" %Crossfire.Time.DAYS_PER_WEEK) for x in range(Crossfire.Time.DAYS_PER_WEEK): Crossfire.Log(Crossfire.LogDebug, "weekday %d is %s" %(x,Crossfire.GetWeekdayName(x))) Crossfire.Log(Crossfire.LogDebug, "Number of months for this server: %d" %Crossfire.Time.MONTHS_PER_YEAR) for x in range(Crossfire.Time.MONTHS_PER_YEAR): Crossfire.Log(Crossfire.LogDebug, "Month %d is %s" %(x,Crossfire.GetMonthName(x))) now = Crossfire.GetTime() parameters = string.split(Crossfire.ScriptParameters(),",") current = [Crossfire.GetMonthName(now),Crossfire.GetWeekdayName(now),Crossfire.GetSeasonName(now)] Crossfire.SetReturnValue(1) if (set(parameters) & set(current)): Crossfire.SetReturnValue(0)
Prebuild scripts are available in /python/tod/sleep.py.