/**************************************************************************

template_terrain.tgi
Copyright © 2002-2003 TimeGate Studios

	TODO: this is not finalized or being used

DESCRIPTION: templates used to define everything related to the terrain.

REVISION HISTORY:
drp110402 - created

USAGE:

	[Terrain template=Terrain]
	This node goes at the root level to define a terrain type available for biomes to
	use.  Each terrain has one or more variations.

	[Biome template=Biome]
	This node goes at the root level to define a biome available in the game.
	
NOTE:

	Define Terrains before Biomes
	
	jkm031503 - 
	Some cloud fields are currently inactive. I will add these as soon as
	I get some polish time. 

**************************************************************************/

;; TerrainGroup: every terrain is assigned to one. Use for mechanics and by the FX system for filters.
[template TerrainGroup]
{
	string		IDS
	localized	name
}

[template TransitionSet]
{
	string 		IDS
	localized	name
	string		path_prefix
}

[template CloudInfo]
{
	;; cloud_texture: set "null" for none
	string	cloud_texture 
	
	;; What size should the cloud texture be, in meters?
	point2	cloud_scale = 50.0, 50.0
	
	;; which direction should the clouds move along the terrain?
	;; Note: The unit is meters/sec
	point2	cloud_movement_direction = -1, -0.5
	
	;; how many degrees is the cloud aloud to wiggle along the direction 
	;; axis?
	;; NOTE: Currently ignored
	float	cloud_max_wiggle = 0.0
	
	;; This value dictates how rapidly the clouds are allowed to change
	;; the direction. (Usually should be pretty low.)
	;; NOTE: Currently ignored
	float	cloud_max_delta_wiggle_per_sec = 0.0
	
	;; What is the minimum velocity (meters/sec) for clouds?
	float	cloud_min_velocity = 0.5
	
	;; What is the maximum velocity (meters/sec) for clouds?
	float	cloud_max_velocity = 0.5
	
	;; This value dictates how rapidly the clouds are allowed to change
	;; their forward velocity. (Usually should be pretty low)
	float	cloud_max_delta_velocity_per_sec = 0.0
}

[template NoiseData]
{	
	int 	terrain_noise_num_blobs_min		= 90	;; min num blobs
	int 	terrain_noise_num_blobs_max		= 120	;; max num blobs
	fixed	terrain_noise_blob_size_min		= 40	;; min blob radius (meters)
	fixed	terrain_noise_blob_size_max		= 60	;; max blob radius (meters)
	fixed	terrain_noise_offset_magnitude_min	= 5	;; magnitude of min vertical noise offset (in meters)
	fixed	terrain_noise_offset_magnitude_max	= 7	;; magnitude of max vertical noise offset (in meters)
	fixed	terrain_noise_up_frequency		= 0.3	;; frequency of blobs add positive vertical noise (zero-one)
	fixed	terrain_noise_reference_size		= 128	;; the reference map size which the other params apply to (in meters)
	fixed	terrain_noise_area_factor		= 0.5	;; percent of blobs to actually apply (0-1)
}

;; associate a color/alpha with a depth (for water terrains)
[template DepthInfo]
{
	float 	depth	;; (positive meters)
	point3	color	;; RGB
	float	alpha	;; alpha
}

;; additional water info specified for a biome's water terrains
[template WaterInfo]
{
	;; the IDS of the water terrain
	string terrain_ids

	;; specify how the color changes with the depth
	[list DepthInfo Template=DepthInfo]
}

[template Biome]
{
	string	IDS
	localized	name

	string texture_subfolder_name = null
	
	;; detail_texture: set "null" for none
	string	detail_texture = null
	float	detail_repetition = 4

	;; macro_texture: set "null" for none
	string	macro_texture = null
	float	macro_repetition = 80

	[CloudInfo template=CloudInfo]

	[NoiseData template=NoiseData]

	[list Terrain]
	string	terrain_IDS 

	[list TransitionSet]
	string	set_IDS
	
	;; legal transitions between terrain types.  If no legal transition is
	;; specified then any is allowed.  
	;; E.g.: "grass, desert, grass_medium" means that grass_medium must be present between grass and desert tiles
	[list Transition]
	string	terrain1_IDS
	string	terrain2_IDS
	string	variation_IDS

	;; optional list of water infos
	[list WaterInfo Template=WaterInfo]
}

[template TerrainVariation]
{
	string		IDS
	localized	name
	string		texture
	float		texture_width
	float		texture_height
	KF32		weight = 1.0
	flag		random_variation = false
	point3		terrain_color = -1, -1, -1 
}

[template TerrainSpeedModifier template=AddModifier]
{
	attribute = TERRAIN_SPEED_CAP
	amount	
}

;; terrain types are listed at the root level in priority order
[template Terrain]
{
	string		IDS
	localized	name
	string 		type = LAND
	flag		random_selection = true	;; true to have variation cycle on each click when painting
	point3		terrain_color = 0.5, 0.5, 0.5 ;; What color should this terrain be in the minimap
	
	;; TODO: this should be a required field and no IDS should be hard-coded in the template.
	;;  Every game should set up its own terrain templates.
	string	terrain_group = null
	
	;; base_priority: this is used to set the priority of each variation (for rendering
	;;  purposes). All variations must have a unique priority, and therefore each
	;;  terrain should have a unique priority.  It is suggested to use numbers in	
	;;  increments of 10 - i.e. 10,20,30,40...
	int	base_priority

	;; doodad seeding
	;; - doodad_frequency = 0..1 probability of a tile having a doodad 
	;; - primary_doodad_frequency = 0..1 probability of that doodad being a "primary" doodad
	fixed	doodad_frequency	
	fixed	primary_doodad_frequency = 0

	/* property list
	;; TERRAIN_SPEED_CAP: define one of these modifier effects - they only work on the TerrainProperties
	[Modifier template=TerrainSpeedModifier]
	amount = 3
	*/
	[list Property]
	{
		string property_ids
	}

	/* REMOVED: drp061804 - now supposed to use TerrainSpeedModifier and the Property list
	;; DEPRECATED: property (optional) to be given to actors on this terrain
	;; TODO: remove use of this field
	string	property_ids = NULL
	
	;; DEPRECATED: speed_max: this is used if a "TerrainSpeedModifier" is not specified.  
	;; TODO: remove use of this field, because it won't display the information to the user in the tooltip
	fixed	speed_max = 0
	*/

	;; blocking
	bool	land = true
	bool	water = false

	;; list variations in priority order
	[list Variation template=TerrainVariation]
}

[template MountainTerrain inherit=Terrain]
{
	type = MOUNTAIN

	;; blocking
	land = false
	water = false

	;; paint_slope: controls how fast the mountain goes up from a single click
	fixed paint_slope = 0.25
	fixed max_slope = 1.25
	fixed paint_max_step = 10.0
	fixed noise_min = 1.0
	fixed noise_max = 2.0

	;; NOTE: code forces mountain speed_max to 0.0001
}

[template WaterTerrain inherit=Terrain]
{
	type = WATER
	
	;; blocking
	land = false
	water = true

	;; water-specific fields
	fixed paint_slope = 0.2
	fixed max_slope = 0.2
	fixed paint_max_step = 2.0
	fixed max_depth = 3.0
	string anim_textures_path_prefix
	fixed anim_fps = 30
	point3 color = 0,0,1

	;; water doodad
	string 	water_doodad_IDS = null
	fixed	water_doodad_offset_perpendicular = 1.0
	fixed	water_doodad_offset_parallel = 1.0
}