Timer System.
The timer system should be a easy plug in play system when working with time related functions. (You tell it to wait 5 seconds, it waits 5 seconds of game-time.)
Timers.CreateTimer(Name,Length,Repeat,CallBack,Data)
Timers.DeleteTimer(Name)
Timers.TimeLeft(Name)
Timers.GetTimers()
Timers.CreateTimer(Name,Length,Repeat,CallBack,Data)
Code: Select all
Creates a new Timer Event.
-Name: The name of the timer event we are creating, this allows us to identify timers after they are created. If a timer of the name already exists, it is overwritten by the new one.
-Length: How long the timer event waits before it calls its function.
-Repeat: How many times a timer event runs before its removed. Numbers less then or equal to 0 cause the timer to run forever.
-CallBack: The function the timer calls every time it runs.
-Data: Extra Data that is passed to the function when the timer runs.
Code: Select all
Deletes The timer with the inputted name if it exists.
-Name: The Name of the timer we want to remove.
Code: Select all
Returns how long a timer has before it is called.
-Name: The Name of the timer we want to check.
Code: Select all
Returns all existing timers. (Could be limited to a per mod basis.)
Entity Subscriptions.
Entity subscriptions are essentially a addition to the current event system. The idea is instead of subscribing to all the events that can happen to a entity, you just subscribe to the entity itself. So when a event is called related to the subscribed entity it calls the function you defined. And when i say entity, I mean the entity type itself. Not a singular entity withen the game world.
SubscribeEntity(Ent,Name,Func)
UnSubscribeEntity(Ent,Name)
When a subscription is called it it sends both the effected entity, and the event that was triggered.
SubscribeEntity(Ent,Name,Func)
Code: Select all
Creates a Subscription to the inputted entity.
-Ent:The name of the entity we are subscribing to.
-Name: The name of the subscription. For later identification.
-Func: The function that is called for all the events relating to the subscribed entity.
Code: Select all
Removes a subscription to the inputted entity.
-Ent: The entity we are unsubscribing from.
-Name: The subscription id we are removing.
Code: Select all
function(Ent,Event)
-Ent: The entity that trigged the event.
-Event: The type of event that was triggered.