pioneerspacesim/pioneer — pull request #1638 by skapusniak (2012-10-27 23:48:00+00:00)
Title: onConfigureStarSystem Lua event

So this adds a Lua event that gets fired when a new StarSystem is created and added to the StarSystem cache.

The event is passed a LuaStarSystem so you can make changes/read out info/whatever. Of course at the moment there isn't very much you *can* change.

To make doing something possible, I've added Setter functions for Name and FactionColour. I've put in a Lua Module called PopulationBrightness demonstrating usage which reads in the generated FactionColour and resets it's brightness based on system population.

To make all this work with the SectorView I had to make some changes there and within the embedded System class of Secctor (we have too many competing StarSystem classes! It all needs refactoring, but its *scary* in there). As an upshot I've removed the code that delayed full generation of systems that needed it until you had stopped scrolling the view. That's likely a bad idea, but changing Star Names only when you stopped moving looked really really weird.

My concerns with this code is mainly performance, and whether I'm leaking memory or stuffing Lua with too many objects that are going to just sit around because they're in the StarSystem cache.