I am trying to figure out how to determine (in Lua script) whether the currently running scenario has set all possible optional values for the currently running Freeciv software version in use ( to detect if new features exist which should be disabled for a scenario generated on an older version of Freeciv. )
I moved my Freeciv client rc file, ran 2.6.4 server and "/show all", getting all default values. Repeated that for 2.6.11, and there are no differences in default values between 2.6.4 and 2.6.11. Not surprising.
But, Lua script in Freeciv apparently has no way to know
what other (new) features are in the currently running version of the software, so I can't even begin to disable them to ensure that the scenario behaves the same on a newer version as it does on an older version. Is there a feature in Freeciv 3 that would allow listing all possible options that could be in a Freeciv 3 scenario file? To be able to determine within a Lua script that new options exist and should be disabled for the duration of the scenario.
I gathered the "field" or var name entries from the default values list of v2.6.11:
Code: Select all
option_names={ "aifill", "airliftingstyle", "allowtake", "alltemperate", "animals", "aqueductloss", "autoattack", "autosaves", "autotoggle", "barbarians", "borders", "citymindist", "citynames", "civilwarsize", "compress", "compresstype", "conquercost", "contactturns", "demography", "diplbulbcost", "diplchance", "diplgoldcost", "diplomacy", "disasters", "dispersion", "ec_chat", "ec_info", "ec_max_size", "ec_turns", "endspaceship", "endturn", "first_timeout", "fixedlength", "flatpoles", "foggedborders", "fogofwar", "foodbox", "freecost", "fulltradesize", "gameseed", "generator", "globalwarming", "gold", "happyborders", "homecaughtunits", "huts", "kicktime", "killcitizen", "killstack", "killunhomed", "landmass", "mapseed", "mapsize", "maxconnectionsperhost", "maxplayers", "mgr_distance", "mgr_foodneeded", "mgr_nationchance", "mgr_turninterval", "mgr_worldchance", "migration", "minplayers", "nationset", "naturalcitynames", "nettimeout", "netwait", "notradesize", "nuclearwinter", "occupychance", "onsetbarbs", "persistentready", "phasemode", "pingtime", "pingtimeout", "plrcolormode", "rapturedelay", "razechance", "restrictinfra", "revealmap", "revolen", "revolentype", "savefrequency", "savename", "savepalace", "saveturns", "sciencebox", "scorefile", "scorelog", "scoreloglevel", "separatepoles", "shieldbox", "singlepole", "size", "specials", "startcity", "startpos", "startunits", "steepness", "team_pooled_research", "teamplacement", "techlevel", "techlossforgiveness", "techlossrestore", "techlost_donor", "techlost_recv", "techpenalty", "temperature", "tilesperplayer", "timeaddenemymove", "timeout", "tinyisles", "topology", "trademindist", "trading_city", "trading_gold", "trading_tech", "traitdistribution", "turnblock", "unitwaittime", "unreachableprotects", "victories", "wetness", "xsize", "ysize" }
Then this to get the current values of those via Lua script:
Code: Select all
for i = 1, #option_names, 1 do
log.error("%s",option_names[ i ] .. string.rep( " ", ( 21 - string.len( option_names[ i ] ) ) ) .. "\t=\t" .. server.setting.get( option_names[ i ] ) )
end
BUT, I am already stumped as to how a Lua script could determine whether the currently running Freeciv client has
additional,
new features and parameters ( since server.setting.get( name ) relies upon the scenario already knowing the name of the feature/option ) ?
If v3 had a new feature "alienencounters" how could a Lua script know that the new feature exists on the running version of the software?
Ideally the script would be able to /show all and get the full list of optional values from the current running version. Any entry that is not "known" is therefor a new feature.
Or perhaps a "settings_iterator()" that loops through all [settings] for the running version of Freeciv?
Then the next hurdle will be whether or not the values for the new features can be disabled or otherwise changed just before gamestart. Would require knowing what constitutes "disabled" -- if the new feature's [settings] entry uses numeric values, then presumably 0. If it uses a quoted string, then possibly "DISABLED"?
EDIT3orso: Found some real-world examples of newer features by looking at Fc3 and 3.1 sav files that have been attached to posts here. These [settings] entries aren't found in prior version 2.6.11, and might alter a scenario's behavior / "feel" when the scenario is loaded in v3 or 3.1.
Freeciv 3.0
"caravan_bonus_style","CLASSIC","CLASSIC"
"multiresearch",FALSE,FALSE
"nuclearwinter_percent",100,100
"techleak",100,100
"trade_revenue_style","CLASSIC","CLASSIC"
"tradeworldrelpct",50,50
Freeciv 3.1
"caravan_bonus_style","CLASSIC","CLASSIC","Changed"
"incite_gold_capt_chance",0,0,"Internal"
"incite_gold_loss_chance",0,0,"Internal"
"multiresearch",FALSE,FALSE,"Changed"
"nuclearwinter_percent",100,100,"Changed"
"techleak",100,100,"Changed"
"tradeworldrelpct",50,50,"Changed"
Those examples are the sort of 'new settings' I would like to set to "DISABLED" or 0 via Lua script just before gamestart (in a version of FC > the version that created the scenario ) so that the scenario behavior in the newer Fc version would be as close as possible to the version of Fc on which the scenario was created.