License
-------

This work is licensed under the Creative Commons Attribution-Share Alike 4.0 Unported License.
To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. 

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

Version History
---------------
v2.1.1 (by Lone_Wolf)
* fix breakage when SEC is not present

v2.1 (by Dybal)

* Fixes bug parsing the missionVariable when it holds an empty string.
* Defines scriptInfo.towbar_max_salvage_price for Shield Cycler and Shield Cycler Manual Configurator Standard and Advanced.

v2.0 (by Dybal)

* Adds functions for other OXPs to award and remove Shield Cycler equipments to NPC ships.
* Higher level function to be used by other OXPs to adjust shields through Shield Cycler.
* Feeds Shield Capacitors energy into the shields before adjusting if they are installed and charged for both player's ship and NPCs.
* Most functions for other OXPs are NPC-ready and should be called with the ship's script as context for NPCs.
* EQ_SC_SHIELD_CYCLER_INTERNAL and EQ_SC_MANUAL_CONFIGURATOR_INTERNAL are not used anymore (but kept for backwards compatibility), the ship keeps the versioned EQ_SHIELD_CYCLER_<version> and EQ_SC_MANUAL_CONFIGURATOR_<version> equipments that are sold at Ship Outfitting (F3).
* The installed equipments are the "source of truth" and the settings object will be adjusted to reflect them; for player's ship, that happens at every launch, for NPCs only when the _sc_award_equipment, _se_equipment_setup or _sc_retrieve_devices are called.
* Doesn't refund the Shield Cycler equipment value when the player buys a new ship: if the old ship was part of the payment, the equipment value (EQ_SC_SHIELD_CYCLER_<version> and EQ_SC_MANUAL_CONFIGURATOR_<version> keep their acquisition price, while EQ_SC_<equipment>_INTERNAL had 1Cr for price) was factored in the old ship's resale value; if not part of the payment, the ship was stored in Hyperspace Hangar with the Shield Cycler equipment installed.
* Energy cost is now proportional to the energy actually transferred between shields instead of a flat-fee for energy transfer range (that was prohibitive for the small transfers that occur after a little while in combat).
* _sc_store_devices (used by Ship Storage Helper OXP) doesn't remove the Shield Cycler devices from the ship.
* _sc_retrieve_devices (used by Ship Storage Helper OXP) is now functional, the bugs have been squashed.
* Major code re-factoring and many small bug fixes.
* Should still be backwards compatible, i.e., a savefile of a player ship with Shield Cycler v2.0 should still work with Shield Cycler Next 1.12.
* Changes from OXPConfig to Library, drops use of Cabal Common Library.
* Can be promoted from development to production version.

v1.12.1
- upon repair, equipment wasn't removed which made consecutive repairs impossible
- transfer needed in aft & forward setting was calulated wrong, this could sometimes result in unwanted free shield strength out of nowhere.
- With capacitors and shieldcycler both active, there were some weird effects.
  Although codewise they don't clash, i've changed the code so that SC will only cycle AFTER relevant capacitors are emptied.

v 1.12
new stable version
small fixes

v 1.11.3 :
Upon buying a new ship, shield cycler devices were not removed anymore, corrected.
small fixes

v1.11.2
Cabal Common Library and OxpConfig are now required dependencies
new external methods _sc_store_devices & _sc_retrieve_devices : allows Ship Storage Helper to store/retrieve ships with SC devices installed correctly

v1.11.1
    bugfix in shipLaunchedEscapePod
    implemented 1.82 functionality
    Minimum Oolite version is now 1.81

v1.11

    switch from unbreakable equipment to loss of functionality when damaged
    used schema :
    every direct hit will reduce functionality by 10% , but it won't go below 40% functionality
    since the presence / absence of shield booster and mil shields already influences SC performance, there is no additonal functionality loss when they are damaged
    new repair option when docked (F3 screen) 
    repair price  :
    calculate total price of all installed SC devices
    multiply by .5
    multiply with (100 -functionality)/100

v1.10.2
    oxpcSettings : switched from Notify to DynamicNotify
    conflicts with ShieldCycler 1.0 oxz
    released as oxz

v1.10.1
    small bugfixes

v1.10.

    Major rewrite
    code split over many (currently 9) script files instead of 2 to improve maintainability / flexibility.
    objects are used to share information between scripts where possible 
    oxp disables itself if savegame to old or to new.
    start/stop functionality changed
    new option through oxpconfig to disable entire oxp
      (the options for pilots to disable Shield Cycler were limited and dependant on having certain equipment).
    use JSON for missionvariables
    add functionality for npc ships to use shield cycler
      (npc ships wanting to use this will need a custom ship script to give them shield functionality, an alternative would be to adjust customshields oxp to use this new functionality)
    display device versions & damage level on F5+F5 screen
      (damage level won't change until 1.11.0 )
    power loss for changing configuration was 2 * (nr_of_energybanks + 1) , this led to a ship with 8 banks loosing almost an entire bank of energy after just 3 changes.
      new formula : nr_of_energybanks + 5
    added shipLaunchedEscapePod event

1.0
- added code to test for savegames created with 1.10+ (JSON)
- minor fix in equipment.plist
- license changed to CC-by-SA 4
- released as oxz & oxp


0.31
- new function : b-key sets shieldcycler back to whatever the launch setting is
- optimizied & simplified code
- updated CCL / OxpConfig requirements
- added manifest.plist to oxp
- requires Oolite 1.80


0.30.3
- adjusted to work with CCL 1.6 & OxpConfig 2.0.12

0.30.2
- small fixes
- updated to check for recent cabal_common & oxpconfig versions
- auto-sell cycler devices when player buys a new ship

0.30.1
- bugfixes
- encountered problems related to different JS execution contexts for equipment event handlers, shipscript event handlers and worldscript event handlers
  rewrite has as side-benefit that the code no longer uses global vars ( except missionvars) .
- added sc_stop & sc-start functions so other oxps can stop/start cycler functionality
- more in-script documentation

0.21.2
- added configurable options
  requires Cabal Common Library 1.4.1 (or later) and OxpConfig2 2.03 (or later)
- If CCL / OxpConfig2 are not present or to old, everything works but there will be no configure options
- cleaned up/ optimised code

0.20.1
- cycling to forward when forward shield was at full strength used energy, corrected.

0.20
- brought back disabled setting (was removed in 0.14 )
- shipLaunchedFromStation didn't check if player has a shield cycler, fixed
- Equipment names changed to EQ_SC_AAAAAA scheme
- variables now all start with sc_
- both automatic and manual versions are now available, see above for details
- halved power needed for switching configuration, as old number meant 4 switches would drain a complete energybank
- preparations to use OxpConfig for changing settings in later version

0.14
-	Basic Shield cycler made incompatible with Shield Booster and Mil. Shields
	Standard Shield cycler incompatible with Mil. Shields
-	cycling the configuration now subtracts 4 * # of energy banks from ship energy. 
-	adjusting also uses shield energy, but the amount is now fixed and related to the transferred amount of shield energy.

0.13
-	created basic, standard & advanced version incl. sell option.
-	cycling / adjusting uses ship energy
-	added EQ_Shield_Equalizer as incompatible equipment
-	clean / optimize code

0.12 
-	first public version with 1 device
