I nearly finished a LosCheckMgr, that can be instanced in Region Object (LoS check have no way to be across Regions...) and be used to throttle Los Check, store them in a cache, register Event Handler to an unfinished LoS Check (thus making One check available for multiple object wanting the results) and other tools...
This Manager can make Blocked Los Check (will wait for the response event before returning bool result), Non blocked Los Check that needs a IDOLEventHandler Object for returning results
Non Blocked Checks can get results from a previous Blocked query that will dispatch Notify message to registered IDOLEventHandler, cache can be enable or disable Timeouts can be default const (will be made serverproperties) or defined in the Method Call (Timeout for Blocked is the max waiting time, for Non-Blocked it's the cache validity)
Code parts like
- Code: Select all
Player.Out.SendCheckLos()
will need to be replaced by
- Code: Select all
Player.CurrentRegion.LosCheckManager.[Blocking]LosCheck(checker, source, target, [IDOLEventHandler])
The Blocking Checker are for testing purpose for now, they could be use in a Threaded Environment (If Mobs were to be lightly Threaded, this kind of scheduling won't be bothering the RegionTimer and will make it easier to take decision when Los Check is really made !)
I'm not posting files because it's not tested, If it's not wished to have this kind of manager in DOLCore I'll need to fork my Code for future Commits.