--[[ start civ1 hut enter callbacks ============================== ]] civ1_good_site = { Plains = 7; Grassland = 8; } civ1_hut = {} -- local profile functions function civ1_hut.technology (context) --[[ game.turn starts at 0 (will be replaced from 3.0 onwards) t250 = 1000 AD in Civ I ]] local turn = game.turn () if turn > 250 -- > 1000 AD -- or turn == 0 -- first turn (not needed in Freeciv) then return 50 else return context._MPF.technology end end function civ1_hut.barbarians (context) local MPF = context._MPF if context:_near_city () or context.unit.owner:num_cities () == 0 then return MPF.mercenary else return MPF.barbarians end end function civ1_hut.city (context) local MPF = context._MPF if context:_near_city () then return MPF.mercenary elseif civ1_good_site [context.unit.tile.terrain:rule_name ()] then return MPF.city else return 50 end end --[[ key tables and functions are not yet defined so this function is called when the default.lua script runs Also to allow for change of circumstances it is called each hut enter callback so one can use a dynamic setup i.e. mass points can be conditional - e.g. turn number In this example the top level MPFs are all in civ1_hut but one can use default.lua MPFs via context._MPF ]] function _deflua_hut_ruleset_context (self, unit) local context = self:reset (unit) context.consolation = 50 -- never actually needed for civ1 context.home_city = self.city_home_city context.city_radius_sq = 10 -- or 11 or 12 ~ <4 in civ I and II context:_set_point ( 50, 1) context:_set_point (civ1_hut.technology, 1) context:_set_point (civ1_hut.city, 1) context:_set_point (civ1_hut.barbarians, 1) return context end -- and we now rely on default.lua to do all the rest --[[ end civ1 hut enter callback functions ===================================== ]]