Per this feature request (http://www.byond.com/forum/?post=1863682), some discussion was had regarding the merit of the feature, and the necessity for hacks to do something like this. It's my feeling that the code snippet I showed off is a hack. Hacks are usually an indication of a missing feature.
So that said, I think we established a shortfall in the current slew of view-returning features, such as the ability to arbitrarily specify sight flags that would modify what the view/oview() function would return.
Optional arguments would include:
sight
see_in_dark
see_infrared
see_invisible
By adding these four optional arguments to view() and oview(), we'd be able to filter things out of the view() or oview()'s return list without actually changing the properties of the mob in question as well as using mob-related sight-flags on non-mobs.
ID:1868155
Jun 7 2015, 6:38 pm
|
|||||||
| |||||||
view() is definitely not fast. I think extra args are unlikely to impact that time negatively, so that's good.
On the other hand, Clusterfack, if you're calling view() from within those routines, I think it's very likely you're not going to see any significant improvement because that's the bottleneck. I've optimized our view() code quite a lot, although I daresay for luminosity it could use a little more work. (It's harder than it sounds.) The whole mess used to be O(N^3), which was horrible. |
It costs 1e-4 server seconds for us to call it, and we use it hundreds of thousands of times in a round for many various uses - included but not limited to lighting, cameras, saycode.
Just squeezing out that little bit of efficiency which I hope having it inbuilt would provide would be great.