nestharus / JASS

MIT License
31 stars 8 forks source link

Re: i'd take a look at this for unit indexing #18

Closed ghost closed 10 years ago

ghost commented 10 years ago

That requires quite a lot of libraries and stuff :/

Is it any better than PUI?

nestharus commented 10 years ago

Open the map and take a look at the demos/tutorials and make your own call : )

ghost commented 10 years ago

I can see it has a lot of functionality to it, but I only need the indexing/deindexing of unit.

is there any "light" version of it?

nestharus commented 10 years ago

The thing is rather light. The cool thing is that it's only as heavy as you make it.

This thing is all about local events. This means that if you don't declare a deindex event, it doesn't exist, meaning nothing gets run. If you only need the indexing, that's fine ^)^. It still needs the deindexing so that it can recycle the indexes, even if you don't need it. It just won't run anything but itself on deindexing.

It uses a brilliant system called Trigger to achieve this ^)^.

So it's up to you. If you use the module and only make an onIndex method, there will be no onDeindex running in the background : ).

In conclusion, it will only be as heavy as you make it. If you utilize all of the functionality, that'll all exist. If you don't, then it won't. Most of the code is split up between static ifs, meaning that only a small select amount of code is actually put into the map, the rest gets chopped out.

In this way, no matter what you are looking for (deindexing, indexing, both, or a combination of them spread across structs), this system provides only exactly what you want and nothing more ^)^.

edit oh, my bad, a hidden onDeindex will still exist to clear out the isIndexed flag for the struct, heh. If it doesn't do this, behavior breaks.

I suppose I can do a third module called UnitIndexG. This would use global indexing events, meaning that the method would not return a boolean ^)^.