---------------------------------------------------------------------------------------------------
Version: 0.17.1
Date: 2019-09-07T01:43:00+02:00
  Info:
    - Initial release
    - Credits go to
      - aodgizmo:    for the original mod, "Gizmos Car Keys" (not updated to Factorio 0.17) -- I used the code (and changed or removed parts of it) and the car-key graphics in my mod;
      - Zahnfeechen: for "Gizmos Car Keys - Zahnfeechen Patch" (which updated aodgizmo's mod for Factorio 0.17) -- I happily played with this mod myself, but it removed all items from the vehicle grid when a vehicle was summoned and has not been updated for 5 months as of now, so I first patched it and then went to the source to make some more improvements.
    - This mod and "Gizmos Car Keys - Zahnfeechen Patch" are based on the same code, so it makes no sense to have both mods active at the same time. Rather, it might lead to unforeseeable results as both mods act on the same events! I therefore

  Locale:
    - English
    - German

  Major Features:
    - While the original mod moved vehicles by copy/pasting them between positions, this mod just teleports them to their new location. This saves some code and has the additional bonus that vehicles will be moved with everything that is in them: not only trunk, ammo, and fuel inventory, but also (if any of these are present) vehicle grid, driver, and passenger.
    - Vehicles can now only be moved where you could manually place them: i.e. not on buildings, trees, rocks, or cliffs; not on (deep) water if it is a car, tank, etc.; only on water if it is a boat.
    - Long reach (character_build_distance_bonus) will be disabled by default while a vehicle is summoned, so you can't get into a car and teleport to the other end of your base. (There is a start-up option to enable long reach again.)

  Release name:
    - "Smart grids won't stay behind"
      (Contents of vehicle grids will be moved with vehicles.)

---------------------------------------------------------------------------------------------------
Version: 0.17.2
Date: 2019-09-10T12:55:00+02:00
  Bugfixes:
    - Fixed that keys could be blueprinted. Thanks to Dragonling for finding this bug!

  Changes:
    - Added optional dependency on Schallfalke's "Transport Group" mod.

  Release name:
    - The "I've got blueprints and that ain't good" release
      (Released in response to the first bug report.)
---------------------------------------------------------------------------------------------------
Version: 0.17.3
Date: 2019-09-10T21:03:00+02:00
  Locale:
    - Russian

  Changes:
    - Added Russian localization. Thanks to Dragonling for the translation!

  Release name:
    - "From Russia with love"
      (Added Russian localization.)
---------------------------------------------------------------------------------------------------
Version: 0.17.4
Date: 2019-09-24T06:13:00+02:00

  Bugfixes:
    - Fixed that players could claim a vehicle owned by another player.
    - Fixed wrong dates of the previous two versions in the changelog. :-)

  Compatibility:
    - Cargo ships provides the technology "Ships" which unlocks the boat. Keys will now also be unlocked by researching this technology.

  Changes:
    - Added optional dependency on Cargo Ships.
    - Added migration script so that Keys are available even if this mod is loaded into a game where Automobilism/Ships have already been researched.
    - Added check whether the chunk at the new location of the vehicle has already been generated (vehicles will never be moved into an ungenerated chunk).
    - Added localization key for the mod description.
    - Multiplayer:
      - If a vehicle without an owner is occupied, the driver may claim it -- but only if it has no passenger.
      - If a vehicle owned by someone is mined by another player, or destroyed, a message can be shown on the location where the vehicle used to be. There is a global runtime option to turn off this feature; you can also adjust for how long the message will be displayed.
      - If a player enters an unlocked vehicle that belongs to somebody else, the player will be warned that the vehicle may be summoned somewhere by the owner and the owner will be informed that somebody is using it.
      - Players may enter a locked vehicle that belongs to somebody else -- but only as passenger, not as driver. If the vehicle already has a passenger, the player will be ejected.

  Release name:
    - The "R.I.P" release
      (Leave a message where your vehicle was before it died.)

---------------------------------------------------------------------------------------------------
Version: 0.17.5
Date: 2019-09-26T21:30:30+02:00
  Bugfixes:
    - Fixed a bug that was found with bobplates, but potentially affects even more mods (my debug function leaked into global space and overwrote the debug table).

  Release name:
    - "Think globally, act locally!"
      (Neglecting the scope of variables can cause serious bugs.)

---------------------------------------------------------------------------------------------------
Version: 0.17.6
Date: 2019-09-29T23:30:00+02:00
  Bugfixes:
    - Fixed another bug that crashed the game on loading. Thanks to eradicator for patiently explaining how I could improve my code, make it cleaner and safe to use! (Hope I didn't make a mess of it again …)

  Changes:
    - Updated Russian locale. Many thanks again to Dragonling for providing the translation of recently added and changed strings!

  Locale:
    - Updated Russian locale to work with versions >0.17.4 of this mod.

---------------------------------------------------------------------------------------------------
Version: 0.17.7
Date: 2019-09-30T19:50:00+02:00
  Bugfixes:
    - Fixed that debug output spammed the chat console even if the setting was turned off.

  Release name:
    - The "STFU!" release
      (Don't be so chatty, mod!)

---------------------------------------------------------------------------------------------------
Version: 0.17.8
Date: 2019-10-10T20:05:00+02:00
  Bugfixes:
    - Fixed desyncs caused by an error introduced in 0.17.6.
    - Fixed that list of vehicles owned/locked by a player persisted even if that player was permanently removed from game. Also made sure that all of this player's locked vehicles get unlocked again.

  Major Features:
    - Previously, if you locked a vehicle and gave it up for a new one, anybody with a key could claim it. Now, locked vehicles that don't have an owner can only be claimed by the player who locked them. This way, you can actually own various vehicles!
    - Previously, players couldn't use locked vehicles, but they could leave or enter them. That didn't seem right, so I introduced these changes:
      - If a vehicle is locked by its owner, everybody inside (including the owner) will be ejected.
      - Nobody can enter a locked vehicle. (Technically, one can -- no way to avoid that in the game. But if anybody enters a locked vehicle, they will be ejected again. Unfortunately, the color of the vehicle will be changed to that of the last player who tried for now. That problem is on my TODO list and will be addressed once Factorio 0.17.70 is released.)
      - If an unlocked vehicle is entered by its owner, the owner will always be the driver. If the vehicle already had a driver, the previous driver will be demoted to passenger status. (If the vehicle already had a driver and a passenger, the game won't allow anybody else to enter. But in such cases, the owner could always use the keys to lock the vehicle …)

  Minor Features:
    - Moved global runtime options (under "Modsettings --> Map") to user runtime settings (under "Modsettings --> Per player").
    - Added user runtime option to change colors of text messages rendered on the ground. (These messages can only be seen by one player, so messages for other players don't get into the way and you can use the color that suits you best).


  Changes:
    - Some more code clean-up.
    - Updated Russian locale again. Many thanks to Dragonling! (Some keys have been added in this version again, so you should install "Russian locale for some mods 2" by Dragonling for the latest translations.)
    - If a vehicle is summoned by the owner and somebody is inside it, passenger/driver will be notified.
    - If somebody enters or leaves a vehicle, the other occupant and the owner (if they exist) will be notified.
    - Added check whether vehicle is on the same surface as the player before trying to teleport it. Currently, Factorio allows only players to be teleported between surfaces.
    - Significantly reduced size of thumbnail, it was bloating the mod far too much.

  Release name:
    - "Dis be Susans turf!"
      (Credit for the name goes to eradicator, who suggested it as localization string.)

---------------------------------------------------------------------------------------------------
Version: 0.17.9
Date: 2019-10-13T09:41:00+02:00
  Bugfixes:
    - Fixed that entering or leaving a train would crash the game. (Unlike cars, locomotives/wagons may only have a driver, no passenger.)
    - Fixed that all players would lose their owned vehicles after update to 0.17.8. (Renamed a table that was stored in the savegame, but forgot to migrate it.)
    - Fixed bug on starting a new game or on loading a game that didn't contain this mod before. (Copy/paste error while editing events: tried to access event.player_index, which isn't available in on_init().)

  Changes:
    - Reformatted changelog. It may look better in the in-game changelog viewer with hard line breaks, but is almost unreadable on the mod portal. Let's see how it works with very long lines!
    - Added several new localization strings.

  Release name:
    - The "Buggy Cars" release
      (Fixes some annoying bugs introduced in 0.17.8.)

---------------------------------------------------------------------------------------------------
Version: 0.17.10
Date: 2019-10-29T04:57:00+02:00
  Major Features:
    - Players now also can summon vehicles that are on another surface. You may not like to be teleported to another surface, so I introduced a new per-user setting: You can opt to be ejected before the vehicle you're in is moved there.

  Minor Features:
    - A vehicle that has an owner will always have the color of its owner unless it is unlocked and used by somebody else. (If the owner is inside, he will be the driver. In this case, the vehicle color will also be the owner's color.)
    - A vehicle that has no owner and is unlocked will have the color of the driver, or of the passenger if it has no driver. Usually, the vehicle will keep the color of the last player who was in it. Now, the color of unlocked vehicles without an owner will be reset (r=g=b=a=0) when it is unoccupied again.
    - Messages rendered on the ground used to be displayed for a certain time only. Now, if a player leaves the game, the timer will be frozen and the message will be shown for the remaining time when the player joins again.
    - Added startup option to use the icon from "Zahnfeechen Patch" instead of "Gizmos Car Keys" for the keys. Thanks to Zahnfeechen for allowing me to include it! (This is just a change of the keys' appearance, not the way they work.)

  Compatibility:
    - Autodrive puts a dummy passenger into vehicles that have neither driver nor passenger so that it can open gates (if there is a Gate sensor in the vehicle) or shoot (if there is an Enemy sensor in the vehicle.) GCKI ejects driver and passenger when a vehicle gets locked or if anybody tries to enter a locked vehicle; thereby, it has been spamming the surface with dummy passenger characters. Now, these dummy passengers will be removed from the vehicle before they can be ejected.
    - If Autodrive is active and an Enemy sensor is installed in the vehicle, Autodrive will try to use the driver as gunner; if there is no driver, it will check for a passenger, and if there is no passenger, it will put the dummy passenger in and make him the gunner. Prior to Factorio 0.17.73, that only worked if "Weapons control" in the vehicle's menu was set to the same player that Autodrive considered to be the gunner. Now, this setting is automatically adapted whenever a player enters or leaves a vehicle. (Without Autodrive, weapons control is set to the passenger first so he doesn't get bored, and to the driver only if there's no passenger.)


  Changes:
    - Some more code optimizations.
    - Fix for a minor, but annoying issue with Autodrive.
    - Added optional dependency on Autodrive.
    - Removed dependency on OpteraLib. I thought I would use more of it, but all I did use was a very simple function to measure the distance between two map positions that was so basic that it doesn't justify a dependency on the complete library. :-)
    - Added migration script to remove accidentally spammed Autodrive passengers from all surfaces. It also removes some variables that have never been used for anything from saved games.
    - If other players enter or leave an unlocked vehicle that belongs to somebody else, the owner will only be informed if he is at least 30 tiles away from the vehicle (and possibly can't see what happens with it).
    - Changed dependency on base mod: version 0.17.73 is required now because this mod uses some features that have been introduced in the latest versions.
    - Had to distract myself from a particular problem for a while, so I tried to come up with some snappy release names for all versions. Completely useless, but the problem got fixed and I had some fun meanwhile. Perhaps you like them, too.  :-)

  Locale:
    - Updated the Russian localization with new translations courtesy of Dragonling.

  Release name:
    - "Fly me to the moon!"
      (Vehicles can now be teleported to other surfaces.)

---------------------------------------------------------------------------------------------------
Version: 0.17.11
Date: 2019-11-06T12:10:50+02:00
  Bugfixes:
    - This is a bug in Autodrive: When a vehicle controlled by Autodrive is killed, and if Autodrive has placed a dummy passenger inside it, a character that can't be controlled or killed appears in the game. This shouldn't happen, and it should be taken care of in Autodrive. For now, I've included a patch to remove dummy passengers; this will be removed once the bug gets fixed in Autodrive.

  Changes:
    - Use the event filtering mechanism introduced in Factorio 0.17.75. This should improve performance as the mod now ignores events it doesn't need to know about.
    - Bumped dependency on base mod to >=0.17.75.

---------------------------------------------------------------------------------------------------
Version: 0.17.12
Date: 2019-11-17T16:48:00+02:00
  Bugfixes:
    - Event filtering doesn't work if events are raised by scripts (see this thread on the forums: <https://forums.factorio.com/viewtopic.php?f=34&t=77550#p464525>), so I added a check to on_built_entity. This fixes a bug with the "Rocket-Silo Construction" were the construction site would be removed again as soon as the first stage was completed -- thanks to Dragonling for finding it!

---------------------------------------------------------------------------------------------------
Version: 0.17.13
Date: 2019-11-19T19:13:00+02:00
  Bugfixes:
    - Added checks to prevent crashes if a vehicle doesn't exist anymore because the mod that introduced it has been deactivated.
    - Make sure players are associated with a character before doing anything in event scripts for on_built_entity and on_player_driving_changed_state. This should prevent crashes occurring in editor and god mode -- thanks to Pankeko for reporting the bug!

  Changes:
    - Removed event filtering for now: Extra code for filtering events raised by scripts is still required, and event filtering doesn't work with the current stable version of Factorio (0.17.74).
    - Changed dependency on base mod to >= 0.17.74, to make this mod usable with the current stable version again.
    - Using the vehicle keys won't have any effect in god mode or editor mode. Also, entering/leaving a vehicle in these modes won't do anything special -- you'll need to play a normal single- or multiplayer game.

  Release name:
    - The "God ain't almighty" release
      (Vehicle keys can't be used in god or editor mode.)

---------------------------------------------------------------------------------------------------
Version: 0.17.14
Date: 2019-12-27T21:24:00+02:00
  Changes:
    - Disabled patches for Autodrive. The things they fixed (adjusting weapons control and removing dummy passengers) are now taken care of in Autodrive itself.

  Modding:
    - Added remote interface. Other mods can now check who has locked a vehicle or who is the owner of a vehicle. As I am now collaborator on Autodrive (>=0.1.18), I will use this myself to allow for better interaction between these mods.

      USAGE:
      remote.call("GCKI", "vehicle_locked_by", vehicle)
      remote.call("GCKI", "vehicle_owned_by", vehicle)

      In both cases, the argument 'vehicle' must be an entity of type "car". Both remote calls will return either a player entity or nil.

---------------------------------------------------------------------------------------------------
Version: 0.18.1
Date: 2020-01-21T19:49:00+02:00
  Info:
    - Updated the mod for Factorio 0.18 (no code changes)

---------------------------------------------------------------------------------------------------
Version: 0.18.2
Date: 2020-02-28T00:05:00+02:00
  Info:
    - All changes are also available for Factorio 0.17 (version 0.17.15 of this mod).

  Bugfixes:
    - Fixed crash with AAI Programmable vehicles. (https://mods.factorio.com/mod/GCKI/discussion/5e55cdf966994e000b327153)

  Changes:
    - Revived the old fix for Autodrive that used to remove characters of the "autodrive-passenger" dummy; it's more general now, so it will catch all dummy characters inserted by other mods into vehicles as driver or passenger.

  Modding:
    - Added another remote interface to find dummy characters inserted by mods like "Autodrive" or "AAI Programmable Vehicles".

      USAGE:
      remote.call("GCKI", "dummies_in_vehicle", vehicle)

      This will return nil if no dummy is inside, or a table of character entities:

          local dummy = remote.call("GCKI", "dummies_in_vehicle", vehicle)

          local driver = dummy["driver"]
          local passenger = dummy["passenger"]

---------------------------------------------------------------------------------------------------
Version: 0.18.3
Date: 2020-05-09T14:45:00+02:00
  Info:
    - WARNING: THIS VERSION OF GCKI MAY CRASH YOUR GAME!
      Vehicle data were previously stored in a way that makes it hard to take care of mods that replace vehicles (e.g. "AAI Programmable Vehicles"). I've restructured the data, but this means that I had to rework the parts of the code that use these data. Although I've tested the mod before uploading, it's still likely that I didn't catch everything -- so please be prepared for
      game crashes if you update this mod to 0.18.3!
      (I'd appreciate if you would test this and report any crashes you may get!)

  Bugfixes:

  Changes:
    - Added migration script to restructure vehicle data.
    - Adjusted code so it works with the new data structure.
    - If a "locked" vehicle is without an owner, it will now keep the color of the player who has locked it.
    - Removed conflict with "Gizmos Car Keys - Zahnfeechen Patch". It's not needed anymore because it has been deprecated some months ago and isn't available for Factorio 0.18.
    - Bumped dependency on "Autodrive" to version 0.2.0 -- it just doesn't make sense to depend on a version for Factorio 0.17.

  Compatibility:
    - Added compatibility with "AAI Programmable Vehicles".

  Modding:
    - Added remote interface for mods like "AAI Programmable Vehicles" that constantly replace vehicle entities.

      USAGE:
      remote.call("GCKI", "on_entity_replaced", event)

      This will return nothing. GCKI will add the new entity to its list, copy the data from the old new vehicle, and remove the old vehicle's entry.

      Arguments:
      event = {
        ["new_entity"] = entity,
        ["new_entity_unit_number"] = entity.unit_number,
        ["old_entity"] = entity,
        ["old_entity_unit_number"] = entity.unit_number,
      }

---------------------------------------------------------------------------------------------------
Version: 0.18.4
Date: 2020-05-13T14:20:00+02:00
  Bugfixes:
    - Fixed crash in migration script. (https://mods.factorio.com/mod/GCKI/discussion/5eae65a44470bd000bc8dada)

---------------------------------------------------------------------------------------------------
Version: 0.18.5
Date: 2020-05-13T22:20:00+02:00
  Bugfixes:
    - Fixed another crash. (https://mods.factorio.com/mod/GCKI/discussion/5ebc27d20f1be8000bdd6467)

---------------------------------------------------------------------------------------------------
Version: 0.18.6
Date: 2020-05-29T21:00:00+02:00
  Info:
    - All changes are also available for Factorio 0.17 (version 0.17.16 of this mod).

  Changes:
    - Added event filtering again, now that it works properly in Factorio 0.18.27. (Kept the old filtering code in the functions for now, so the code can be used for the 0.17 branch as well.)
    - Bumped dependency on Autodrive to 0.2.6.

  Compatibility:
    - Added compatibility with "Vehicle Wagons 2": If a player owned the vehicle before it was loaded, he will get it back when it is unloaded -- unless the player has claimed another vehicle in the meantime. Only the player who owns or who has locked a vehicle may load it onto a wagon and unload it again. Thanks to robot256 for cooperating on getting this done!
    - Added compatibility with "Uncle Shred's unminable vehicles": If that mod makes vehicles unminable, GCKI will respect this setting and keep vehicles unminable even if they are unlocked.

  Minor Features:
    - In ALT-mode, locked vehicles are now marked with an icon.

  Locale:
    - Fixed a typo in GCKI_messages.lock_vehicle_enter_owner (English).
    - Added some new keys.

  Modding:
    - Added remote interfaces for "Vehicle Wagons 2" and similar mods that may remove vehicles for a while and restore them later.

      USAGE:

      remote.call("GCKI", "get_vehicle_data", vehicle)

        This will return a table: { locker = player.index or nil, owner = player.index or nil}.

        vehicle: entity.unit_number or a valid (!) entity of type "car"

      remote.call("GCKI", "vehicle_removed", vehicle)

        This will return nothing. If a vehicle had been marked as "locked" or "owned" by GCKI, it will be removed from the list.

          vehicle_id: entity.unit_number or a valid entity of type "car"

---------------------------------------------------------------------------------------------------
Version: 0.18.7
Date: 2020-06-03T15:00:00+02:00
  Info:
    - All changes are also available for Factorio 0.17 (version 0.17.17 of this mod).

  Bugfixes:
    - Fixed crash on loading a saved game in Factorio <0.18.27 by including code to avoid calling script raised events with filtering. (https://mods.factorio.com/mod/GCKI/discussion/5ed1c8132b642b000d64e4e1)

---------------------------------------------------------------------------------------------------
Version: 0.18.8
Date: 2020-06-04T09:30:00+02:00
  Info:
    - All changes are also available for Factorio 0.17 (version 0.17.18 of this mod).

  Bugfixes:
    - Fixed crash when the last player was removed from the game. This could be triggered in single player mode by starting the scenario "Transport belt madness".

---------------------------------------------------------------------------------------------------
Version: 1.1.0
Date: 2020-12-04T05:10:00+02:00
  Info:
    - This is just a quick update for Factorio 1.1. I've just bumped the version number -- no code changes whatsoever. Also, I've only done minimal testing and it seems the mod will work, but I can't guarantee that it really is bug free!

---------------------------------------------------------------------------------------------------
Version: 1.1.1
Date: ?
  - Changes:
    - Added support for the "Lua API global Variable Viewer" (gvv). It allows to inspect the global table of other mods and is therefore a valuable tool during debugging.

  TODO:
    - If "AAI Programmable Vehicles" has been removed from the game, it may have left some dummy characters behind. Let GCKI look for and remove such dummies if it detects that AAI has been removed. (Implement once AAI gives a proper name to its dummies -- otherwise we could remove character entities not associated with a player that other mods created.)
    - Provide a GUI with a list of the owned/locked vehicles (per player). For multiplayer games, there also could be a special GUI for the admin that lists the owned/locked vehicles of all players. This should help to find vehicles that should be unlocked, e.g. if you want to remove GCKI from the game.
