This document describes how to convert freeciv 2.5 compatible lua script to 2.6 compatible ones. Please check these carefully to avoid your script mis-behaving, maybe in some rarely reached special case. These are changes to scripting API requiring special attention. Additions to the API that do not affect old scripts are not listed.
The Lua engine has been updated from 5.2 to 5.3. It's possible that scripts will need changing for this. See the upstream list of changes and incompatibilities.
Signal disaster has been deprecated. Connect to new disaster_occurred signal instead. The new signal has one more parameter than the old signal. This new parameter, had_internal_effect, tells if the disaster caused any of the effects handled internally by the freeciv engine. Default default.lua has a handler that informs user that disaster was harmless if that parameter is true. If you are using default default.lua, and want to avoid it from giving out the message, for example if the disaster actually had some consequences in your own script.lua, simply prevent default.lua handler from firing by returning true from your own handler.
City Transferred signalEdit
Signal city_lost has been deprecated. Connect to new city_transferred signal instead and check reason parameter as needed; "conquest" is the one that's equivalent to old city_lost signal.
City Size Change signalEdit
Signal city_growth has been deprecated. Connect to new city_size_change signal instead and check reason parameter as needed; "growth" is the one that's equivalent to old city_growth signal, but "migration_from" might be also relevant.
Cost of Given TechnologyEdit
edit.give_technology() / Player:give_technology() have been deprecated in favor of give_tech() that has additional parameter cost. Value -1 ("apply freecost") results in similar behavior than give_technology() has hardcoded.
Notifying players about techsEdit
Since the shared research system has been revamped, you may want to update the way you send notifications about techs the script gives to someone. You can either request that server sends all the necessary notifications by setting notify parameter of give_tech(), or make custom notification messages. In the latter case you typically want to send three notifications; one for the player getting the tech (notify.event(...E.TECH_GAIN...)), one for ones sharing the research (notify.research(...E.TECH_GAIN...)), and one for the embassies (notify.embassies(...E.TECH_EMBASSY...)). You may leave the first one out, and set selfmsg to true in the second one if you don't want different message for the player getting the tech.
Creating Roads and BasesEdit
As Bases and Roads are now just subtypes of Extras, Tile:create_base() and Tile:create_road() have been deprecated in favor of generic Tile:create_extra()
|tileset||1.14 to 2.0||2.0 to 2.1||2.1 to 2.2||2.2 to 2.3||2.3 to 2.4||2.4 to 2.5||2.5 to 2.6||2.6 to 3.0||3.0 to 3.1|
|ruleset||n/a||n/a||n/a||2.2 to 2.3||2.3 to 2.4||2.4 to 2.5||2.5 to 2.6||2.6 to 3.0||3.0 to 3.1|
|script.lua||n/a||n/a||n/a||n/a||n/a||n/a||2.5 to 2.6||2.6 to 3.0||3.0 to 3.1|