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

template_aa_building.tgi
Copyright © 2002 TimeGate Studios

DESCRIPTION:  templates for AA buildings, which have common features such
 	as the destruct animation.

REVISION HISTORY:
drp120302 - created

USAGE:

	[Thing Template=AABuilding]
	This node goes at the root level and defines a building that can be 
	instantiated in the game.
	
**************************************************************************/
[Template AABuilding template=Building]
{
	[Placement]
	placement_group_IDS = ___ERROR_AA_buildings_should_set_placement_group_IDS___

	[BodyComponent]
	{
		defense = 0
		rot_time = 10
		sink_time = 5
		defense_icon = /Properties/AbilityIcons/IconAbilityDefense.png
		health_bar_vfx_IDS = health_bar_medium_vfx
	}
	
	[ConstructionComponent]
	{
		;; TODO: are construction nodes necessary?
		construction_node_name_prefix = Stage
		finished_node_name = Final
	}

	[DetectionComponent]
	{
		detection_range = 16.0
		remote_detection_range = 12.0
	}

	[EconomyComponent]

	[PropertiesComponent]
	{
		[Property]
		property_ids = building
	}

	[StructureComponent]
	
	[View]
	{
		shadow_texture = /effects/shadows/UnitShadow.dds
		shadow_type = STENCIL
		
		[TextureSearchPath]
		path = /Shared/SharedTextures
	}
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; --------------------- PACKABLE BUILDINGS --------------- ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

[Template AABuildingPackable template=AABuilding]
{	
	[BodyComponent]
	{
	  	[WhenHealth Template=FXC_CreateVFX]
	  	{
			VFX_IDS = rising_flame
			location = damage_point80
			health = 0.2
			health_trigger_type = ABSOLUTE_BELOW
	  	}
	  	
	 	[WhenHealth Template=FXC_CreateVFX]
	  	{
			VFX_IDS = rising_flame
			location = damage_point20
			health = 0.8
			health_trigger_type = ABSOLUTE_BELOW
	  	}
	  
	  	[WhenHealth Template=FXC_CreateVFX]
	  	{
			VFX_IDS = rising_flame
			location = damage_point40
			health = 0.6
			health_trigger_type = ABSOLUTE_BELOW
	  	}
	
		[WhenHealth template=FXC_CreateVFX]
		{
			vfx_ids = temperate_large_explosion_1
			location = explosion_point_disabled01
			health = 0.4
			health_trigger_type = ABSOLUTE_BELOW
			attached = false
		}
		
		[WhenHealth template=FXC_CreateVFX]
		{
			vfx_ids = temperate_large_explosion_1
			location = explosion_point_death01
			health = 0
			health_trigger_type = ABSOLUTE_BELOW
			attached = false
		}	
	}

	[ElementComponent]
	{
		morale_value = 99
		resupply_rate = 0
	}

	[Flags]
	{
		tributable = false
		flatten_terrain = true
	}

	[MobileDeploymentComponent]
	{
		packing_length = 7
		unpacking_length = 7
		
		pack_health_min = 0.5
	}
	
	[PropertiesComponent]
	{
		[Property]
		property_ids = mobile_building	
	}
	
	[Stance Template=StancePacking]
	
	[Stance Template=StanceUnpacking]

	;; smm121603 - death has higher priority than disabled
	[Stance Template=StanceDisabled]
	
	[Stance Template=StanceDeath]

	[View]
	{		
		icon = %sIcon.tga
		
		[AspectNormal]
		skin = %sBase.dds
		
		[Aspect Template=AAAspectPacking]

		[Aspect Template=AAAspectUnpacking]
		
		[Aspect Template=AAAspectDisabled]
	
		[Aspect Template=AAAspectDeath]
		
		[WhenDestroyed template=FXC_CreateVFX]
		{
			vfx_ids = building_destruction
			at = SOURCE_GROUND
			attached = false
		}
	}
	
	[WhenEnter Template=FXC_CreateVFX]
	{
		vfx_ids = building_pack
		actor_state = structure_packing
		location = base
		attached = true
	}
	
	[WhenEnter Template=FXC_CreateVFX]
	{
		vfx_ids = building_pack
		actor_state = structure_unpacking
		location = base
		attached = true
	}

} ; end [template AABuildingPackable]

[Template AABuildingPackableHQ Template=AABuildingPackable]
{
	show_faction_portrait = true

	[DetectionComponent]
	detection_range = 60
	remote_detection_range = 20

	[EconomyComponent]
	{
		supply_required = true	

		[Upkeep]
		building_limit_consumed = 1
	}
	
	[BodyComponent]
	{
	  	[WhenHealth Template=FXC_CreateVFX]
	  	{
			VFX_IDS = rising_flame
			location = damage_point60
			health = 0.4
			health_trigger_type = ABSOLUTE_BELOW
	  	}
	  	
		[WhenHealth template=FXC_CreateVFX]
		{
			vfx_ids = temperate_large_explosion_1
			location = explosion_point_disabled02
			health = 0.4
			health_trigger_type = ABSOLUTE_BELOW
			attached = false
		}
		
		[WhenHealth template=FXC_CreateVFX]
		{
			vfx_ids = temperate_large_explosion_1
			location = explosion_point_death02
			health = 0
			health_trigger_type = ABSOLUTE_BELOW
			attached = false
		}
	}

	[MobileDeploymentComponent]
	{
		packing_length = 8
		unpacking_length = 8
	}

	[WhenEnter Template=FXC_PlaySFX]
	{
		actor_state = structure_packing
		audio_ids = pack_8s_sfx
	}
	
	[WhenEnter Template=FXC_PlaySFX]
	{
		actor_state = structure_unpacking
		audio_ids = unpack_8s_sfx
	}
	
} ; end [template AABuildingPackableHQ]

[Template AABuildingPackableCorpHQ Template=AABuildingPackable]
{
	show_faction_portrait = true

	[DetectionComponent]
	detection_range = 60
	remote_detection_range = 20
	
	[MobileDeploymentComponent]
	{
		packing_length = 10
		unpacking_length = 10
	}

	[WhenEnter Template=FXC_PlaySFX]
	{
		actor_state = structure_packing
		audio_ids = pack_10s_sfx
	}
	
	[WhenEnter Template=FXC_PlaySFX]
	{
		actor_state = structure_unpacking
		audio_ids = unpack_10s_sfx
	}
	
	[View]
	{		
		[WhenSelected Template=FXC_PlayObjectAnimation]
		object_animation_IDS = talk1
	}

} ; end [template AABuildingPackableHQ]

[Template AABuildingPackableDepot Template=AABuildingPackable]
{
	[BodyComponent]
	{
		captureable = false
		
		[WhenHealth Template=FXC_CreateVFX]
	  	{
			VFX_IDS = smoke_oil
			location = damage_point60
			health = 0.4
			health_trigger_type = ABSOLUTE_BELOW
	  	}
	}

	[Flags]
	{
		tributable = true	
	}

	[DetectionComponent]
	detection_range = 55
	remote_detection_range = 20

	[SupplyComponent]
	{
		supply_range = 50
		is_relay = true
		stockpile_max = 60
	}

	[PropertiesComponent]
	{
		[Property]
		property_ids = depot
	}

	[EconomyComponent]
	supply_required = true
	
	[LairComponent]
	{
		reward = 25, 50	
	}
	
} ; end [template AABuildingPackableDepot]

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ------------------- CONSTRUCTED BUILDINGS --------------- ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

[Template AABuildingConstructed Inherit=AABuilding]
{
	[BodyComponent]
	{
	 	[WhenHealth Template=FXC_CreateVFX]
	  	{
			VFX_IDS = smoke_bunker
			location = damage_point20
			health = 0.8
			health_trigger_type = ABSOLUTE_BELOW
	  	}
	  
	  	[WhenHealth Template=FXC_CreateVFX]
	  	{
			VFX_IDS = smoke_bunker
			location = damage_point40
			health = 0.6
			health_trigger_type = ABSOLUTE_BELOW
	  	}		
	}

	[ConstructionComponent]
	{
		construction_node_name_prefix = Stage
		finished_node_name = Final
	}
	
	[Flags]
	tributable = true

	[PropertiesComponent]
	{
		[Property]
		property_IDS = bunker
	}
	
	[WhenEnter Template=FXC_CreateVFX]
	{
		actor_state = construction
		VFX_IDS = construction_raise_vfx
		location = BASE
	}

	[WhenEnter Template=FXC_CreateVFX]
	{
		actor_state = construction
		VFX_IDS = bunker_construction
	}

	[WhenLeave Template=FXC_CreateVFX]
	{
		actor_state = construction
		VFX_IDS = bunker_deconstruction
	}
	
	[WhenEnter Template=FXC_CreateVFX]
	{
		vfx_ids = building_pack
		actor_state = active_construction
		location = position
	}

	[View]
	{	
		icon = %sIcon.tga
		
		[AspectNormal]
		skin = %sBase.dds
		
		[WhenDestroyed template=FXC_CreateVFX]
		{
			vfx_ids = building_destruction_small
			at = SOURCE_GROUND
			attached = false
		}
	}
}


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ------------------- SPECIAL BUILDINGS ------------------- ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; ------------ CUTSCENE/HiRes BUILDINGS ----------- ;;

[Template AABuildingHiRes template=Building]
{
	[BodyComponent]
	{
		health = 1000
		defense = 0
	}

	[ConstructionComponent]
	{
		construction_node_name_prefix = Stage
		finished_node_name = Final
	}

	[Placement]
	placement_group_IDS = group_cutscene
	
	[View]
	{
		shadow_type = STENCIL
		shadow_texture = /effects/shadows/UnitShadow.dds
		
		[TextureSearchPath]
		path = /Shared/SharedTextures
		
		[WhenDestroyed template=FXC_CreateVFX]
		{
			vfx_ids = building_destruction
			
			at = SOURCE_GROUND
			attached = false
		}
	}
}

;; ----------------------------- RESOURCES --------------------- ;;


[Template AAResource Template=AABuilding]
{
	[BodyComponent]
	{
		captureable = true
		health = 500
		defense = 0
		
		[WhenHealth Template=FXC_CreateVFX]
	  	{
			VFX_IDS = rising_flame
			location = damage_point20
			health = 0.8
			health_trigger_type = ABSOLUTE_BELOW
	  	}
	  	
	  	[WhenHealth Template=FXC_CreateVFX]
	  	{
			VFX_IDS = smoke_oil
			location = damage_point40
			health = 0.6
			health_trigger_type = ABSOLUTE_BELOW
	  	}
	
		[WhenHealth template=FXC_CreateVFX]
		{
			vfx_ids = temperate_large_explosion_1
			location = explosion_point_disabled01
			health = 0.4
			health_trigger_type = ABSOLUTE_BELOW
			attached = false
		}
	}

	[DetectionComponent]
	{
		detection_range = 16.0
		remote_detection_range = 12.0
	}

	[EconomyComponent]

	[Placement]
	placement_group_IDS = group_resource

	[PropertiesComponent]
	{
		[Property]
		property_ids = building
	}
	
	[View]
	{
		shadow_type = STENCIL
		shadow_texture = /effects/shadows/UnitShadow.dds
		
		[TextureSearchPath]
		path = /Shared/SharedTextures
	}
} ; end [template AAResource]
