--------------------------------------------------------------------
         USS Frontier’s GravityFX v1.0
                                  by Fernando Aluani aka USS Frontier	 
--------------------------------------------------------------------
     
                  FOR MODDERS

--------------------------------------------------------------------

-----------------
General Info
-----------------
-	GravityFX creates the gravity well for planets/suns on a per set basis. That means that every time the players a new set, all gravity wells are deleted, and new ones are created. That also means that by changing sets the lifetime of grav well plugins and torpedo gravity effects are reseted.
-	Grav Well Plugins are created automatically for a ship when she enters the set, and they are deleted when that ship leaves the set (by warping out, or being destroyed or whatever), if the ship has a gravity generator. The gravity well will also be automatically “turned off” if the generators of a ship are either offline, disabled or destroyed.
-	Torpedo Gravity Effects are created automatically for an torpedo when it hits an target, and it will only be deleted when his lifetime, if he has one, ends, or if the player leaves that set.
-	Stations, for GravityFX, are ships with their genus set to 2 OR the stationary property set to yes.
-	Asteroids, for GravityFX, are ships with their genus set to 3.
-	Gravity wells will only affect ships, stations will only be affected if the option to affect them is enabled in the configuration menu. But in BC any ship with the STATIONARY status CAN’T move, so they won’t be affected by gravity.  Anti-gravity wells, affects the same things than normal gravity well, PLUS they affect torpedoes as well. The only exception to this is blackhole grav well plugins (more info on them on the “Gravity Generator” topic).
-	The radius of a gravity well, a thing mentioned/used a lot on GravityFX is the distance to the center of the gravity well that the gravity force is equal to 1m/s. If you are between it and the center of the gravity well you’ll be affected, if you’re further away than the radius, you won’t be affected.
-	The gravity damage radius is the radius from the center of the gravity well, which if you’re in it, or closer to the center, you’ll begin to receive damage by gravity.

And any problems/ideas/comments/request/etc that you might have, please do so in the GravityFX board at the BCS forums (link at the Full Readme Contact Me part)

------------------------
App.py Info
------------------------
This mod adds some methods to some of the App classes, and a variable to it.
They are:
-	App.Planet.GetMass(): this function returns the mass of the planet. I had to create this because in BC planets doesn’t have mass.
-	App.Planet.SetDensity(value): set’s the planet’s density value. The density of the planet is used in the calculation of it’s mass. Value should be in g/cm^3 (Earth’s density is 5.515 g/cm^3)
-	App.Planet.GetDensity(): gets the density value of the planet.
-	App.Planet.IsAtmosphereObj(): return 1 if the planet is one of those planets that AtmosphereFX (a part of NanoFX that creates the atmosphere effects) creates. It checks that by the planet’s name, AtmosphereFX creates them with the same name of the original planet, but it adds a last word to the name, else returns None.
-	App.Planet.GetClass(): returns the class of the planet/sun, using EarthFX (Planet Classification Script), if for some reason the class of it isn’t found, it’ll return DEFAULT. To this work, the mutator Planet Classification Script must be on.
-	App.PoweredSubsystem.IsSystemOnline(): returns 1 if the system is online (turned on, not disabled), else returns 0.
-	App.g_kGravityManager: this is an variable GravityFX adds to App. It’s the GravityManager object (yes, it’s an instance of an class called GravityManager that I made) that handles everything related to gravity: creating the gravity wells, creating and deleting gravity well plugins and torpedo gravity effects, setting up the ET_WEAPON_HIT handler, keeping track of the gravity well that currently exists, and more.
-	App.g_kGravityManager.PrintStats(): this function deserves to be noted as well because it prints to the console the status of the gravity manager. It’s good to use her to see if it is working properly. It prints the ID of the grav manager, the grav well list, the grav ship list (it’s a list of the ships in the set which can be affected by gravity) and the names of the planets/suns in the set.

-------------------
Density Ranges
-------------------
If the option “Set Stock Planets Random Density” is enabled, GravityFX will set a random density for the planets and suns in the systems that came in stock BC when the player enters the set, based on the class of those planets. The value set is a random float between an minimum and an maximum value, these minimum/maximum values are set for each planet class on the DensityDict script, and if anything goes wrong on the process of acquiring these values, GravityFX will use the default range of 1.0 to 10.0 to choose a random value from.
Using the function “DensityDict.AddPlanetClass(stringClassName, floatMinimumDensity, floatMaximumDensity)” you can add a new class with her density range to the DensityDict on-the-fly, in any script.
Also note that for the classification of planets to work, you must have NanoFX v2 installed (It contains AtmosphereFX, I don’t know if v1 contains it) and running, and EarthFX installed (this is included with GravityFX) and it’s mutator “Planet Classification Script” on.

----------------
Plugins Info
----------------
Here’s the details about the types of plugins:
-	NotToBeAffected plugins: plugins for ships as well, but these make an ship “invulnerable” to gravity, this exists because some ships in game if were affected by gravity would ruin the game experience (ever imagined your Probes or Firepoints falling on planets? Isn’t nice), these plugins aren’t created by the Plugin Tool anymore because of their simplicity, and because now the plugin tool can add/remove ships to the not-to-be-affected ship list, which has the same effect of creating a not-to-be-affected plugin for it.
-	GravTorpedo/AntiGravTorpedo plugins: plugin for torpedoes, this will make an torpedo, upon impact, create an gravity well on that spot. These gravity wells also creates an glow on that same spot, to graphically represent that gravity well, they may as well play an specific sound for grav well or anti-grav wells on an regular interval basis.
-	AllAround plugin: a GravTorpedo OR AntiGravTorpedo plugin with the name “AllAround”, it will make ALL projectiles create an gravity well upon impact, tho it that torpedo has an specific plugin for it, the information of that plugin will be used to create the gravity well.

To use the GravityFX Plugin Tool that comes in this pack (plugin tool v1.7.0) you’ll need the Microsoft .NET Framework 2.0, you can download it for free from Microsoft’s website. If for any reason you can’t use the Plugin Tool, contained in this mod pack is a file called “PluginExamples v1.7.0.rar” (that version number is there to tell that the example plugins contained in it are relative to the plugin tool v1.7.0), in it there are several plugin scripts to use as examples to create plugins manually.
It’s recommended to use the Plugin Tool to create plugins for GravityFX. The Plugin Tool is very easy to use, very fast, and has all the options to create a plugin, when creating the plugin it’ll search in the Windows Registry for folder path of Bridge Commander, and save the plugin in there (*BC Folder*/scripts/Custom/GravityFX/Plugins), and if the registry key isn’t found it will save the plugin on the folder where the plugin tool is located (*Plugin Tool folder*/scripts/Custom/GravityFX/Plugins), using the help button (the “?” button located at the left side of the “X” button on the title bar) and clicking on something on the tool will show an tooltip for the thing you clicked (be it a button, a text box or whatever) so if you’re having trouble discovering how the plugin tool works, use the help, they are very detailed.
Some of the attributes of the plugins which you create with the plugin tool are:
-	Mass: gravity is based on the mass of the object that is generating it, the bigger the mass, the stronger the gravity will be, and the bigger the radius of the grav well will be. Choosing “By Mass” in the Set Mass field will make the value entered to be treated as the mass value directly (kilograms), choosing “By Max Distance” will make the value entered to be treated as the max distance of the gravity well, which the plugin tool uses to calculate the mass of the gravity well when writing the plugin.
-	Lifetime: the time the gravity well will last. If 0, the gravity well will be endless, that is, will never end. If the lifetime is set to something bigger than 0, as the time passes, the gravity well will get weaker and weaker, until it will simply vanish when the gravity well reaches it’s lifetime. (set in seconds)
-	SoundDelay: the amount of time between each “grav sound” play. The grav sound is an sound – one for grav well, another for anti-grav wells – that’s played when an torpedo gravity effect exists, if set to 0 the sound will not be played at all. (set in seconds)
-	ColorRed, ColorBlue, ColorGreen, ColorAlpha: the RGBA components of the color you want the torpedo gravity effect glow to be. The torpedo gravity effect glow is an glow that appears on the set (on space) to graphically represent an gravity well, in this case, an torpedo gravity effect.
-	The name of the plugin should match the name of the TORPEDO MODULE (the script of a projectile on the folder scripts\Tactical\Projectiles) of the torpedo that you’re making the plugin for.

---------------
System Map Info
---------------
All the images (icons) used in the system map are contained in the folder *BC folder*/scripts/Custom/GravityFX/Icons, they all can be changed to your likings.

-------------------------
Gravity Generator Info
-------------------------
To give gravity wells to a ship, you give them “gravity generators”, which are hull-subsystems to them, in the hardpoint (by using MPE or manually). The name of these gravity generators can be anything, BUT THE NAME MUST CONTAIN ONE OF THE FOLLOWING: "Gravity Generator", "Grav Generator", "Grav Gen", “GravityGenerator", "GravGenerator", "GravGen", "Anti-Gravity Generator", "Anti-Grav Generator", "Anti-Grav Gen", "AntiGravityGenerator", "AntiGravGenerator", "AntiGravGen", "Blackhole Generator", "Blackhole Gen", "BlackholeGenerator" or "BlackholeGen".
For example, to make a ship have a single gravity generator, you give her 1 hull-subsystem called “Gravity Generator”, or for multiple generators you can name them “Grav Generator 1”, “Grav Generator 2”, etc.
The “Gravity” or “Grav” names will create normal gravity wells, while the “Anti” names will create anti-gravity wells, and the “blackhole” names will make an blackhole gravity well, which is a gravity well that also affects torpedoes and stations (even if the option to select if stations will be affected is turned off).
The more gravity generators the ship has, the stronger the gravity well of the ship will be, but the more power it’ll spend. You can have as many generators as you want on a ship.
The generators will drain power directly of the main battery, and if the main battery is depleted, they’ll drain the reserve battery.
The bigger the generator is (radius of the subsystem), and the more complex it is to repair it (the repair complexity of a subsystem), the stronger the gravity well will be.
And note that the generators only complement the mass of the ship, set in the ship property thing of the hardpoint, so the bigger the mass of the ship is, the stronger the gravity well will be, and the more difference the generators will make, because as I said, they only “modify” the ships mass.

In the Gravity Generator Options in engineering, setting the power bar of a generator to 0% will shut it down, setting it to 100% will leave it in normal condition, and setting to 1000% will give it 10 times more power.

-------------
Logger Info
-------------
The logs REALLY help in debugging the mod, and implementing the LogCreator on scripts is really easy: just create the LogCreator object, after that just use one of the logging methods to log data into it ;)
So what i’m trying to say is: if you, modder (most probably a scripter), has an script mod you’re making, and you want to use the Logger script to help you debug it, or maybe even releasing your mod with the Logger script, you’re free to do so, just make sure to credit me for it ;), now if you want to modify it in any way, then ask me for permission.
Also, the logs may get quite big sometimes right? I have an little program, that is working tho most of it’s features aren’t finished yet, that helps us with the task of reading them, telling us how many lines like that are on the log, giving the ability to remove some lines, and some other things… So if you are using the logger to debug your mod, and is tired of reading those big logs manually, just ask me about the program, I call it “BC – LoggerReader”.

The Logger uses the script TimeMeasurement in Autoload, to try to get the correct date/time of the day, because BC’s python TIME module is kinda buggy (it normally returns the same date/time several times).