Editing Buildings

This page partially describes the contents of a ruleset collection. It is intended as developer reference and for people wanting to create/compile alternative rulesets for Freeciv.
==The anatomy of a buildings ruleset file==
The following table shows you all the attributes a building should provide to characterise it comprehesively. The first three columns of a table row form one single line inside the building ruleset file.
Attribute 	 	Example Content 	Explanation
name 	=	_("Airport") 	The name of the building as seen by the user.
genus 	=	"Improvement" 	one of: "GreatWonder", "SmallWonder", "Improvement", "Special".
reqs 	=	{"type", "name", "range""Tech", "Radio", "Player"}	Requirements to build the building (see Requirements for help).
graphic 	=	"b.airport" 	Icon of improvement (used in city dialog and tech tree).
graphic_alt 	=	"-" 	Alternate icon of improvement.
obsolete_by​​ Until 2.6	=	"None" 	Advance which makes building obsolete. Special value "None" means does not become obsolete.
obsolete_by​ ​New in 2.6	=	{"type", "name", "range""Tech", "Radio", "Player"}	Requirements to obsolete the building, any one true means the building is obsoleted.
build_cost 	=	120 	Production shields required to build.
upkeep 	=	3 	Monetary upkeep value. Can be set to 0 by an effect "Upkeep_Free" if it is equal or greater than this value; this effect may be building-specific.
sabotage 	=	100 	Percent chance of diplomat sabotage being successful.
flags 	=	"VisibleByOthers" 	Special flag strings. Others are "SaveSmallWonder" or "Gold".
helptext 	=	_("\Allows a city to produce veteran air units. Also, damaged air units\ which stay in town for one full turn without moving are completely\ restored.\
\n\n\
Two cities with Airports can airlift one unit per turn. \
Airlifting instantly transports the unit from one city to another\
and will use all of the unit's movement points. A unit must have\
some movement points left to be airlifted.\
")	The help text shown in the Freeciv help viewer.
sound 	=	"b_airport" 	
sound_alt 	=	"b_generic" 	
Buildings that are mentioned in a requirement of type "Builiding" in "SS_*" effect in effects.ruleset are space parts, other requirements of these effects are never tested; their genus should be "Special" as well as the genus of a "Gold"-flagged improvement (Mint). Special improvements are equivalent to normal buildings in terms of saving shields after production change.
"SaveSmallWonder" buildings will be rebuilt in a random city if a player loses one where it currently is and still has another city (server will moan if it is not a small wonder but probably won't fail). Starting buildings with this flag (global or nation-specific) will be also built for free if a player acquiring a city has previously lost all cities (on terms that game.server.savepalace is TRUE, note that just moving a palace is not controlled by this switch).
Building's graphics are optional in tilesets (but much recommended). Buildings automatically go to tech tree nodes and help pages of advances that are required to build them.
== Buildings obsoletion ==
Most gimmicks and quirks mentioned in this section already have HRM tickets about doing something to them.
As it has been mentioned, obsolete_by vector is tested with "OR" logical operation.
Buildings that are obsolete will result in false "Building" requirements even if they are not removed. A questionable logic behind obsoleting wonders is that a city that tested for this case is the target one of the requirement, not the wonder's one, thus you can't put an "on/off switch" improvement in the wonder city, and a wonder may be obsoleted for some cities and still active for another ones. Also, some players may benefit from a great wonder that is obsolete for the another.
Note that obsolete buildings up to v.2.6 are removed in all cities as soon as you research some tech (not necessary one obsoleting them), or when a city changes hands, and the improvements not removed still drain money on their upkeep.
Improvements that don't fulfil their building reqs but are not obsolete are generally not removed with just one exception: if the requirement type is either "Terrain" or "TerrainClass" and a tile adjacent to the city has its terrain changed so that this requirement stops being true (selling harbours in landlocked cities). In rulesets where harbours have "City"-ranged terrain requirements it may result in still having a harbour if the last transformed city tile was not adjacent to its center.
You may put a small wonder into its own negated building requirements to disallow moving it (or ever rebuilding, if "survives" flag is used), it will work but the automatic help may cover it in a wrong way.
== See also ==
Category:Editing rulesets